2017-09-06 11:28:31 +00:00
/**
* Marlin 3 D Printer Firmware
2020-02-03 14:00:57 +00:00
* Copyright ( c ) 2020 MarlinFirmware [ https : //github.com/MarlinFirmware/Marlin]
2017-09-06 11:28:31 +00:00
*
* Based on Sprinter and grbl .
2019-06-28 04:57:50 +00:00
* Copyright ( c ) 2011 Camiel Gubbels / Erik van der Zalm
2017-09-06 11:28:31 +00: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 03:20:14 +00:00
* along with this program . If not , see < https : //www.gnu.org/licenses/>.
2017-09-06 11:28:31 +00:00
*
*/
2017-09-17 05:38:39 +00:00
# include "../gcode.h"
# include "../../inc/MarlinConfig.h"
2021-03-30 02:36:01 +00:00
# include "../queue.h" // for getting the command port
2017-09-17 05:38:39 +00:00
2020-05-06 04:34:04 +00:00
# if ENABLED(M115_GEOMETRY_REPORT)
# include "../../module/motion.h"
# endif
2020-10-23 03:31:48 +00:00
# if ENABLED(CASE_LIGHT_ENABLE)
# include "../../feature/caselight.h"
# endif
2017-12-20 02:08:24 +00:00
# if ENABLED(EXTENDED_CAPABILITIES_REPORT)
2018-10-01 04:44:33 +00:00
static void cap_line ( PGM_P const name , bool ena = false ) {
2018-11-29 22:58:58 +00:00
SERIAL_ECHOPGM ( " Cap: " ) ;
2021-03-01 01:43:46 +00:00
SERIAL_ECHOPGM_P ( name ) ;
SERIAL_CHAR ( ' : ' , ' 0 ' + ena ) ;
2021-01-31 23:21:27 +00:00
SERIAL_EOL ( ) ;
2017-12-20 02:08:24 +00:00
}
# endif
2017-09-06 11:28:31 +00:00
/**
2020-02-10 20:52:15 +00: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 11:28:31 +00:00
*/
2017-09-17 05:38:39 +00:00
void GcodeSuite : : M115 ( ) {
2020-09-11 03:02:18 +00: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 ) " "
# ifdef MACHINE_UUID
" UUID: " MACHINE_UUID
# endif
) ;
2017-09-06 11:28:31 +00:00
# if ENABLED(EXTENDED_CAPABILITIES_REPORT)
2021-03-30 02:36:01 +00:00
// The port that sent M115
serial_index_t port = queue . ring_buffer . command_port ( ) ;
2020-02-10 20:52:15 +00:00
// PAREN_COMMENTS
2020-04-22 21:35:03 +00:00
TERN_ ( PAREN_COMMENTS , cap_line ( PSTR ( " PAREN_COMMENTS " ) , true ) ) ;
2020-02-10 20:52:15 +00:00
// QUOTED_STRINGS
2020-04-22 21:35:03 +00:00
TERN_ ( GCODE_QUOTED_STRINGS , cap_line ( PSTR ( " QUOTED_STRINGS " ) , true ) ) ;
2020-02-10 20:52:15 +00:00
2017-12-03 05:07:21 +00:00
// SERIAL_XON_XOFF
2020-03-08 04:20:41 +00:00
cap_line ( PSTR ( " SERIAL_XON_XOFF " ) , ENABLED ( SERIAL_XON_XOFF ) ) ;
2017-12-03 05:07:21 +00:00
2019-02-28 01:57:48 +00:00
// BINARY_FILE_TRANSFER (M28 B1)
2021-03-30 02:36:01 +00:00
cap_line ( PSTR ( " 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 11:28:31 +00:00
// EEPROM (M500, M501)
2020-03-08 04:20:41 +00:00
cap_line ( PSTR ( " EEPROM " ) , ENABLED ( EEPROM_SETTINGS ) ) ;
2017-12-20 02:08:24 +00:00
// Volumetric Extrusion (M200)
2020-03-08 04:20:41 +00:00
cap_line ( PSTR ( " VOLUMETRIC " ) , DISABLED ( NO_VOLUMETRICS ) ) ;
2017-09-06 11:28:31 +00:00
// AUTOREPORT_TEMP (M155)
2020-03-08 04:20:41 +00:00
cap_line ( PSTR ( " AUTOREPORT_TEMP " ) , ENABLED ( AUTO_REPORT_TEMPERATURES ) ) ;
2017-09-06 11:28:31 +00:00
// PROGRESS (M530 S L, M531 <file>, M532 X L)
2017-12-20 02:08:24 +00:00
cap_line ( PSTR ( " PROGRESS " ) ) ;
2017-09-06 11:28:31 +00:00
// Print Job timer M75, M76, M77
2017-12-20 02:08:24 +00:00
cap_line ( PSTR ( " PRINT_JOB " ) , true ) ;
2017-09-06 11:28:31 +00:00
// AUTOLEVEL (G29)
2020-03-08 04:20:41 +00:00
cap_line ( PSTR ( " AUTOLEVEL " ) , ENABLED ( HAS_AUTOLEVEL ) ) ;
2017-09-06 11:28:31 +00:00
2020-07-08 11:33:30 +00:00
// RUNOUT (M412, M600)
cap_line ( PSTR ( " RUNOUT " ) , ENABLED ( FILAMENT_RUNOUT_SENSOR ) ) ;
2017-09-06 11:28:31 +00:00
// Z_PROBE (G30)
2020-03-08 04:20:41 +00:00
cap_line ( PSTR ( " Z_PROBE " ) , ENABLED ( HAS_BED_PROBE ) ) ;
2017-09-06 11:28:31 +00:00
// MESH_REPORT (M420 V)
2020-03-08 04:20:41 +00:00
cap_line ( PSTR ( " LEVELING_DATA " ) , ENABLED ( HAS_LEVELING ) ) ;
2017-09-06 11:28:31 +00:00
2017-10-15 07:15:19 +00:00
// BUILD_PERCENT (M73)
2020-03-08 04:20:41 +00:00
cap_line ( PSTR ( " BUILD_PERCENT " ) , ENABLED ( LCD_SET_PROGRESS_MANUALLY ) ) ;
2017-10-15 07:15:19 +00:00
2017-09-06 11:28:31 +00:00
// SOFTWARE_POWER (M80, M81)
2020-03-08 04:20:41 +00:00
cap_line ( PSTR ( " SOFTWARE_POWER " ) , ENABLED ( PSU_CONTROL ) ) ;
2017-09-06 11:28:31 +00:00
2020-07-08 11:33:30 +00:00
// TOGGLE_LIGHTS (M355)
2020-08-06 13:14:00 +00:00
cap_line ( PSTR ( " TOGGLE_LIGHTS " ) , ENABLED ( CASE_LIGHT_ENABLE ) ) ;
2021-02-27 22:06:48 +00:00
cap_line ( PSTR ( " CASE_LIGHT_BRIGHTNESS " ) , TERN0 ( CASE_LIGHT_ENABLE , caselight . has_brightness ( ) ) ) ;
2017-09-06 11:28:31 +00:00
2019-02-12 21:55:47 +00:00
// EMERGENCY_PARSER (M108, M112, M410, M876)
2020-03-08 04:20:41 +00:00
cap_line ( PSTR ( " EMERGENCY_PARSER " ) , ENABLED ( EMERGENCY_PARSER ) ) ;
2017-09-06 11:28:31 +00:00
2019-02-12 21:55:47 +00:00
// PROMPT SUPPORT (M876)
2020-03-08 04:20:41 +00:00
cap_line ( PSTR ( " PROMPT_SUPPORT " ) , ENABLED ( HOST_PROMPT_SUPPORT ) ) ;
2019-02-12 21:55:47 +00:00
2020-04-27 01:55:14 +00:00
// SDCARD (M20, M23, M24, etc.)
cap_line ( PSTR ( " SDCARD " ) , ENABLED ( SDSUPPORT ) ) ;
2020-11-27 03:18:40 +00:00
// REPEAT (M808)
cap_line ( PSTR ( " REPEAT " ) , ENABLED ( GCODE_REPEAT_MARKERS ) ) ;
2021-03-12 14:34:22 +00:00
// SD_WRITE (M928, M28, M29)
cap_line ( PSTR ( " SD_WRITE " ) , ENABLED ( SDSUPPORT ) & & DISABLED ( SDCARD_READONLY ) ) ;
2018-02-26 21:38:27 +00:00
// AUTOREPORT_SD_STATUS (M27 extension)
2020-03-08 04:20:41 +00:00
cap_line ( PSTR ( " AUTOREPORT_SD_STATUS " ) , ENABLED ( AUTO_REPORT_SD_STATUS ) ) ;
2018-02-26 21:38:27 +00:00
2020-05-02 21:19:40 +00:00
// LONG_FILENAME_HOST_SUPPORT (M33)
cap_line ( PSTR ( " LONG_FILENAME " ) , ENABLED ( LONG_FILENAME_HOST_SUPPORT ) ) ;
2018-04-20 21:50:50 +00:00
// THERMAL_PROTECTION
2020-03-08 04:20:41 +00:00
cap_line ( PSTR ( " THERMAL_PROTECTION " ) , ENABLED ( THERMALLY_SAFE ) ) ;
2018-04-20 21:50:50 +00:00
2018-10-05 23:19:45 +00:00
// MOTION_MODES (M80-M89)
2020-03-08 04:20:41 +00:00
cap_line ( PSTR ( " MOTION_MODES " ) , ENABLED ( GCODE_MOTION_MODES ) ) ;
2018-10-05 23:19:45 +00:00
2020-06-14 20:26:28 +00:00
// ARC_SUPPORT (G2-G3)
cap_line ( PSTR ( " ARCS " ) , ENABLED ( ARC_SUPPORT ) ) ;
2020-04-27 12:31:48 +00:00
// BABYSTEPPING (M290)
cap_line ( PSTR ( " BABYSTEPPING " ) , ENABLED ( BABYSTEPPING ) ) ;
2019-03-13 23:09:22 +00:00
// CHAMBER_TEMPERATURE (M141, M191)
2020-03-08 04:20:41 +00:00
cap_line ( PSTR ( " CHAMBER_TEMPERATURE " ) , ENABLED ( HAS_HEATED_CHAMBER ) ) ;
2019-03-13 23:09:22 +00:00
2021-03-06 20:13:28 +00:00
// COOLER_TEMPERATURE (M143, M193)
cap_line ( PSTR ( " COOLER_TEMPERATURE " ) , ENABLED ( HAS_COOLER ) ) ;
2021-03-10 17:35:19 +00:00
// MEATPACK Compression
2021-03-30 02:36:01 +00:00
cap_line ( PSTR ( " MEATPACK " ) , SERIAL_IMPL . has_feature ( port , SerialFeature : : MeatPack ) ) ;
2021-01-24 06:43:23 +00:00
2020-05-06 04:34:04 +00:00
// Machine Geometry
# if ENABLED(M115_GEOMETRY_REPORT)
const xyz_pos_t dmin = { X_MIN_POS , Y_MIN_POS , Z_MIN_POS } ,
dmax = { X_MAX_POS , Y_MAX_POS , Z_MAX_POS } ;
xyz_pos_t cmin = dmin , cmax = dmax ;
apply_motion_limits ( cmin ) ;
apply_motion_limits ( cmax ) ;
const xyz_pos_t lmin = dmin . asLogical ( ) , lmax = dmax . asLogical ( ) ,
wmin = cmin . asLogical ( ) , wmax = cmax . asLogical ( ) ;
SERIAL_ECHOLNPAIR (
" area:{ "
" full:{ "
" min:{x: " , lmin . x , " ,y: " , lmin . y , " ,z: " , lmin . z , " }, "
2020-05-10 04:24:15 +00:00
" max:{x: " , lmax . x , " ,y: " , lmax . y , " ,z: " , lmax . z , " } "
2020-05-06 04:34:04 +00:00
" }, "
" work:{ "
" min:{x: " , wmin . x , " ,y: " , wmin . y , " ,z: " , wmin . z , " }, "
2020-05-10 04:24:15 +00:00
" max:{x: " , wmax . x , " ,y: " , wmax . y , " ,z: " , wmax . z , " } " ,
2020-05-06 04:34:04 +00:00
" } "
" } "
) ;
# endif
2017-09-06 11:28:31 +00:00
# endif // EXTENDED_CAPABILITIES_REPORT
}