2017-09-06 06:28:31 -05:00
/**
* Marlin 3 D Printer Firmware
2020-02-03 08:00:57 -06:00
* Copyright ( c ) 2020 MarlinFirmware [ https : //github.com/MarlinFirmware/Marlin]
2017-09-06 06:28:31 -05:00
*
* Based on Sprinter and grbl .
2019-06-27 23:57:50 -05:00
* Copyright ( c ) 2011 Camiel Gubbels / Erik van der Zalm
2017-09-06 06:28:31 -05:00
*
* This program is free software : you can redistribute it and / or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation , either version 3 of the License , or
* ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
2020-07-23 05:20:14 +02:00
* along with this program . If not , see < https : //www.gnu.org/licenses/>.
2017-09-06 06:28:31 -05:00
*
*/
2017-09-17 00:38:39 -05:00
# include "../gcode.h"
# include "../../inc/MarlinConfig.h"
2021-03-30 04:36:01 +02:00
# include "../queue.h" // for getting the command port
2020-05-06 10:04:04 +05:30
# if ENABLED(M115_GEOMETRY_REPORT)
# include "../../module/motion.h"
# endif
2020-10-22 22:31:48 -05:00
# if ENABLED(CASE_LIGHT_ENABLE)
# include "../../feature/caselight.h"
# endif
2021-12-14 07:22:06 +01:00
//#define MINIMAL_CAP_LINES // Don't even mention the disabled capabilities
2017-12-19 20:08:24 -06:00
# if ENABLED(EXTENDED_CAPABILITIES_REPORT)
2021-12-14 07:22:06 +01:00
# if ENABLED(MINIMAL_CAP_LINES)
# define cap_line(S,C) if (C) _cap_line(S)
static void _cap_line ( FSTR_P const name ) {
SERIAL_ECHOPGM ( " Cap: " ) ;
SERIAL_ECHOF ( name ) ;
SERIAL_ECHOLNPGM ( " :1 " ) ;
}
# else
# define cap_line(V...) _cap_line(V)
static void _cap_line ( FSTR_P const name , bool ena = false ) {
SERIAL_ECHOPGM ( " Cap: " ) ;
SERIAL_ECHOF ( name ) ;
SERIAL_CHAR ( ' : ' , ' 0 ' + ena ) ;
SERIAL_EOL ( ) ;
}
# endif
2017-12-19 20:08:24 -06:00
# endif
2017-09-06 06:28:31 -05:00
/**
2020-02-10 14:52:15 -06:00
* M115 : Capabilities string and extended capabilities report
* If a capability is not reported , hosts should assume
* the capability is not present .
2017-09-06 06:28:31 -05:00
*/
2017-09-17 00:38:39 -05:00
void GcodeSuite : : M115 ( ) {
2020-09-10 22:02:18 -05:00
SERIAL_ECHOLNPGM (
" FIRMWARE_NAME:Marlin " DETAILED_BUILD_VERSION " ( " __DATE__ " " __TIME__ " ) "
" SOURCE_CODE_URL: " SOURCE_CODE_URL " "
" PROTOCOL_VERSION: " PROTOCOL_VERSION " "
" MACHINE_TYPE: " MACHINE_NAME " "
" EXTRUDER_COUNT: " STRINGIFY ( EXTRUDERS ) " "
2021-07-15 18:59:52 -07:00
# if LINEAR_AXES != XYZ
" AXIS_COUNT: " STRINGIFY ( LINEAR_AXES ) " "
# endif
2020-09-10 22:02:18 -05:00
# ifdef MACHINE_UUID
" UUID: " MACHINE_UUID
# endif
) ;
2017-09-06 06:28:31 -05:00
# if ENABLED(EXTENDED_CAPABILITIES_REPORT)
2021-03-30 04:36:01 +02:00
// The port that sent M115
serial_index_t port = queue . ring_buffer . command_port ( ) ;
2020-02-10 14:52:15 -06:00
// PAREN_COMMENTS
2021-09-27 13:46:42 -05:00
TERN_ ( PAREN_COMMENTS , cap_line ( F ( " PAREN_COMMENTS " ) , true ) ) ;
2020-02-10 14:52:15 -06:00
// QUOTED_STRINGS
2021-09-27 13:46:42 -05:00
TERN_ ( GCODE_QUOTED_STRINGS , cap_line ( F ( " QUOTED_STRINGS " ) , true ) ) ;
2020-02-10 14:52:15 -06:00
2017-12-02 21:07:21 -08:00
// SERIAL_XON_XOFF
2021-09-27 13:46:42 -05:00
cap_line ( F ( " SERIAL_XON_XOFF " ) , ENABLED ( SERIAL_XON_XOFF ) ) ;
2017-12-02 21:07:21 -08:00
2019-02-28 01:57:48 +00:00
// BINARY_FILE_TRANSFER (M28 B1)
2021-09-27 13:46:42 -05:00
cap_line ( F ( " BINARY_FILE_TRANSFER " ) , ENABLED ( BINARY_FILE_TRANSFER ) ) ; // TODO: Use SERIAL_IMPL.has_feature(port, SerialFeature::BinaryFileTransfer) once implemented
2019-02-28 01:57:48 +00:00
2017-09-06 06:28:31 -05:00
// EEPROM (M500, M501)
2021-09-27 13:46:42 -05:00
cap_line ( F ( " EEPROM " ) , ENABLED ( EEPROM_SETTINGS ) ) ;
2017-12-19 20:08:24 -06:00
// Volumetric Extrusion (M200)
2021-09-27 13:46:42 -05:00
cap_line ( F ( " VOLUMETRIC " ) , DISABLED ( NO_VOLUMETRICS ) ) ;
2017-09-06 06:28:31 -05:00
2021-05-15 15:02:20 -05:00
// AUTOREPORT_POS (M154)
2021-09-27 13:46:42 -05:00
cap_line ( F ( " AUTOREPORT_POS " ) , ENABLED ( AUTO_REPORT_POSITION ) ) ;
2021-05-15 15:02:20 -05:00
2017-09-06 06:28:31 -05:00
// AUTOREPORT_TEMP (M155)
2021-09-27 13:46:42 -05:00
cap_line ( F ( " AUTOREPORT_TEMP " ) , ENABLED ( AUTO_REPORT_TEMPERATURES ) ) ;
2017-09-06 06:28:31 -05:00
// PROGRESS (M530 S L, M531 <file>, M532 X L)
2021-09-27 13:46:42 -05:00
cap_line ( F ( " PROGRESS " ) ) ;
2017-09-06 06:28:31 -05:00
// Print Job timer M75, M76, M77
2021-09-27 13:46:42 -05:00
cap_line ( F ( " PRINT_JOB " ) , true ) ;
2017-09-06 06:28:31 -05:00
// AUTOLEVEL (G29)
2021-09-27 13:46:42 -05:00
cap_line ( F ( " AUTOLEVEL " ) , ENABLED ( HAS_AUTOLEVEL ) ) ;
2017-09-06 06:28:31 -05:00
2020-07-08 06:33:30 -05:00
// RUNOUT (M412, M600)
2021-09-27 13:46:42 -05:00
cap_line ( F ( " RUNOUT " ) , ENABLED ( FILAMENT_RUNOUT_SENSOR ) ) ;
2020-07-08 06:33:30 -05:00
2017-09-06 06:28:31 -05:00
// Z_PROBE (G30)
2021-09-27 13:46:42 -05:00
cap_line ( F ( " Z_PROBE " ) , ENABLED ( HAS_BED_PROBE ) ) ;
2017-09-06 06:28:31 -05:00
// MESH_REPORT (M420 V)
2021-09-27 13:46:42 -05:00
cap_line ( F ( " LEVELING_DATA " ) , ENABLED ( HAS_LEVELING ) ) ;
2017-09-06 06:28:31 -05:00
2017-10-15 02:15:19 -05:00
// BUILD_PERCENT (M73)
2021-09-27 13:46:42 -05:00
cap_line ( F ( " BUILD_PERCENT " ) , ENABLED ( LCD_SET_PROGRESS_MANUALLY ) ) ;
2017-10-15 02:15:19 -05:00
2017-09-06 06:28:31 -05:00
// SOFTWARE_POWER (M80, M81)
2021-09-27 13:46:42 -05:00
cap_line ( F ( " SOFTWARE_POWER " ) , ENABLED ( PSU_CONTROL ) ) ;
2017-09-06 06:28:31 -05:00
2020-07-08 06:33:30 -05:00
// TOGGLE_LIGHTS (M355)
2021-09-27 13:46:42 -05:00
cap_line ( F ( " TOGGLE_LIGHTS " ) , ENABLED ( CASE_LIGHT_ENABLE ) ) ;
cap_line ( F ( " CASE_LIGHT_BRIGHTNESS " ) , TERN0 ( CASE_LIGHT_ENABLE , caselight . has_brightness ( ) ) ) ;
2017-09-06 06:28:31 -05:00
2019-02-12 16:55:47 -05:00
// EMERGENCY_PARSER (M108, M112, M410, M876)
2021-09-27 13:46:42 -05:00
cap_line ( F ( " EMERGENCY_PARSER " ) , ENABLED ( EMERGENCY_PARSER ) ) ;
2017-09-06 06:28:31 -05:00
2021-05-27 03:07:13 +01:00
// HOST ACTION COMMANDS (paused, resume, resumed, cancel, etc.)
2021-09-27 13:46:42 -05:00
cap_line ( F ( " HOST_ACTION_COMMANDS " ) , ENABLED ( HOST_ACTION_COMMANDS ) ) ;
2021-05-27 03:07:13 +01:00
2019-02-12 16:55:47 -05:00
// PROMPT SUPPORT (M876)
2021-09-27 13:46:42 -05:00
cap_line ( F ( " PROMPT_SUPPORT " ) , ENABLED ( HOST_PROMPT_SUPPORT ) ) ;
2019-02-12 16:55:47 -05:00
2020-04-27 07:25:14 +05:30
// SDCARD (M20, M23, M24, etc.)
2021-09-27 13:46:42 -05:00
cap_line ( F ( " SDCARD " ) , ENABLED ( SDSUPPORT ) ) ;
2020-04-27 07:25:14 +05:30
2022-02-28 04:38:11 +02:00
// MULTI_VOLUME (M21 S/M21 U)
# if ENABLED(SDSUPPORT)
cap_line ( F ( " MULTI_VOLUME " ) , ENABLED ( MULTI_VOLUME ) ) ;
# endif
2020-11-26 21:18:40 -06:00
// REPEAT (M808)
2021-09-27 13:46:42 -05:00
cap_line ( F ( " REPEAT " ) , ENABLED ( GCODE_REPEAT_MARKERS ) ) ;
2020-11-26 21:18:40 -06:00
2021-03-12 08:34:22 -06:00
// SD_WRITE (M928, M28, M29)
2021-09-27 13:46:42 -05:00
cap_line ( F ( " SD_WRITE " ) , ENABLED ( SDSUPPORT ) & & DISABLED ( SDCARD_READONLY ) ) ;
2021-03-12 08:34:22 -06:00
2018-02-26 22:38:27 +01:00
// AUTOREPORT_SD_STATUS (M27 extension)
2021-09-27 13:46:42 -05:00
cap_line ( F ( " AUTOREPORT_SD_STATUS " ) , ENABLED ( AUTO_REPORT_SD_STATUS ) ) ;
2018-02-26 22:38:27 +01:00
2020-05-03 02:49:40 +05:30
// LONG_FILENAME_HOST_SUPPORT (M33)
2021-09-27 13:46:42 -05:00
cap_line ( F ( " LONG_FILENAME " ) , ENABLED ( LONG_FILENAME_HOST_SUPPORT ) ) ;
2020-05-03 02:49:40 +05:30
2022-01-18 07:56:11 +01:00
// LONG_FILENAME_WRITE_SUPPORT (M23, M28, M30...)
cap_line ( F ( " LFN_WRITE " ) , ENABLED ( LONG_FILENAME_WRITE_SUPPORT ) ) ;
// CUSTOM_FIRMWARE_UPLOAD (M20 F)
cap_line ( F ( " CUSTOM_FIRMWARE_UPLOAD " ) , ENABLED ( CUSTOM_FIRMWARE_UPLOAD ) ) ;
2021-12-14 13:18:24 +13:00
// EXTENDED_M20 (M20 L)
cap_line ( F ( " EXTENDED_M20 " ) , ENABLED ( LONG_FILENAME_HOST_SUPPORT ) ) ;
2018-04-20 16:50:50 -05:00
// THERMAL_PROTECTION
2021-09-27 13:46:42 -05:00
cap_line ( F ( " THERMAL_PROTECTION " ) , ENABLED ( THERMALLY_SAFE ) ) ;
2018-04-20 16:50:50 -05:00
2018-10-05 18:19:45 -05:00
// MOTION_MODES (M80-M89)
2021-09-27 13:46:42 -05:00
cap_line ( F ( " MOTION_MODES " ) , ENABLED ( GCODE_MOTION_MODES ) ) ;
2018-10-05 18:19:45 -05:00
2020-06-14 15:26:28 -05:00
// ARC_SUPPORT (G2-G3)
2021-09-27 13:46:42 -05:00
cap_line ( F ( " ARCS " ) , ENABLED ( ARC_SUPPORT ) ) ;
2020-06-14 15:26:28 -05:00
2020-04-27 14:31:48 +02:00
// BABYSTEPPING (M290)
2021-09-27 13:46:42 -05:00
cap_line ( F ( " BABYSTEPPING " ) , ENABLED ( BABYSTEPPING ) ) ;
2020-04-27 14:31:48 +02:00
2019-03-13 18:09:22 -05:00
// CHAMBER_TEMPERATURE (M141, M191)
2021-09-27 13:46:42 -05:00
cap_line ( F ( " CHAMBER_TEMPERATURE " ) , ENABLED ( HAS_HEATED_CHAMBER ) ) ;
2019-03-13 18:09:22 -05:00
2021-03-06 14:13:28 -06:00
// COOLER_TEMPERATURE (M143, M193)
2021-09-27 13:46:42 -05:00
cap_line ( F ( " COOLER_TEMPERATURE " ) , ENABLED ( HAS_COOLER ) ) ;
2021-03-06 14:13:28 -06:00
2021-03-10 11:35:19 -06:00
// MEATPACK Compression
2021-09-27 13:46:42 -05:00
cap_line ( F ( " MEATPACK " ) , SERIAL_IMPL . has_feature ( port , SerialFeature : : MeatPack ) ) ;
2021-01-24 19:43:23 +13:00
2021-12-14 07:22:06 +01:00
// CONFIG_EXPORT
2022-01-18 07:56:11 +01:00
cap_line ( F ( " CONFIG_EXPORT " ) , ENABLED ( CONFIGURATION_EMBEDDING ) ) ;
2021-12-14 07:22:06 +01:00
2020-05-06 10:04:04 +05:30
// Machine Geometry
# if ENABLED(M115_GEOMETRY_REPORT)
2021-08-19 17:38:05 -05:00
const xyz_pos_t bmin = { 0 , 0 , 0 } ,
bmax = { X_BED_SIZE , Y_BED_SIZE , Z_MAX_POS } ,
dmin = { X_MIN_POS , Y_MIN_POS , Z_MIN_POS } ,
2020-05-06 10:04:04 +05:30
dmax = { X_MAX_POS , Y_MAX_POS , Z_MAX_POS } ;
2021-08-19 17:38:05 -05:00
xyz_pos_t cmin = bmin , cmax = bmax ;
2020-05-06 10:04:04 +05:30
apply_motion_limits ( cmin ) ;
apply_motion_limits ( cmax ) ;
const xyz_pos_t lmin = dmin . asLogical ( ) , lmax = dmax . asLogical ( ) ,
wmin = cmin . asLogical ( ) , wmax = cmax . asLogical ( ) ;
2021-09-09 04:57:05 -05:00
SERIAL_ECHOLNPGM (
2020-05-06 10:04:04 +05:30
" area:{ "
" full:{ "
" min:{x: " , lmin . x , " ,y: " , lmin . y , " ,z: " , lmin . z , " }, "
2020-05-09 21:24:15 -07:00
" max:{x: " , lmax . x , " ,y: " , lmax . y , " ,z: " , lmax . z , " } "
2020-05-06 10:04:04 +05:30
" }, "
" work:{ "
" min:{x: " , wmin . x , " ,y: " , wmin . y , " ,z: " , wmin . z , " }, "
2020-05-09 21:24:15 -07:00
" max:{x: " , wmax . x , " ,y: " , wmax . y , " ,z: " , wmax . z , " } " ,
2020-05-06 10:04:04 +05:30
" } "
" } "
) ;
# endif
2017-09-06 06:28:31 -05:00
# endif // EXTENDED_CAPABILITIES_REPORT
}