My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

M115.cpp 8.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
  4. *
  5. * Based on Sprinter and grbl.
  6. * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  20. *
  21. */
  22. #include "../gcode.h"
  23. #include "../../inc/MarlinConfig.h"
  24. #include "../queue.h" // for getting the command port
  25. #if ENABLED(M115_GEOMETRY_REPORT)
  26. #include "../../module/motion.h"
  27. #endif
  28. #if ENABLED(CASE_LIGHT_ENABLE)
  29. #include "../../feature/caselight.h"
  30. #endif
  31. #if ENABLED(HAS_STM32_UID) && !defined(MACHINE_UUID)
  32. #include "../../libs/hex_print.h"
  33. #endif
  34. //#define MINIMAL_CAP_LINES // Don't even mention the disabled capabilities
  35. #if ENABLED(EXTENDED_CAPABILITIES_REPORT)
  36. #if ENABLED(MINIMAL_CAP_LINES)
  37. #define cap_line(S,C) if (C) _cap_line(S)
  38. static void _cap_line(FSTR_P const name) {
  39. SERIAL_ECHOPGM("Cap:");
  40. SERIAL_ECHOF(name);
  41. SERIAL_ECHOLNPGM(":1");
  42. }
  43. #else
  44. #define cap_line(V...) _cap_line(V)
  45. static void _cap_line(FSTR_P const name, bool ena=false) {
  46. SERIAL_ECHOPGM("Cap:");
  47. SERIAL_ECHOF(name);
  48. SERIAL_CHAR(':', '0' + ena);
  49. SERIAL_EOL();
  50. }
  51. #endif
  52. #endif
  53. /**
  54. * M115: Capabilities string and extended capabilities report
  55. * If a capability is not reported, hosts should assume
  56. * the capability is not present.
  57. */
  58. void GcodeSuite::M115() {
  59. SERIAL_ECHOPGM("FIRMWARE_NAME:Marlin"
  60. " " DETAILED_BUILD_VERSION " (" __DATE__ " " __TIME__ ")"
  61. " SOURCE_CODE_URL:" SOURCE_CODE_URL
  62. " PROTOCOL_VERSION:" PROTOCOL_VERSION
  63. " MACHINE_TYPE:" MACHINE_NAME
  64. " EXTRUDER_COUNT:" STRINGIFY(EXTRUDERS)
  65. #if NUM_AXES != XYZ
  66. " AXIS_COUNT:" STRINGIFY(NUM_AXES)
  67. #endif
  68. #ifdef MACHINE_UUID
  69. " UUID:" MACHINE_UUID
  70. #endif
  71. );
  72. // STM32UID:111122223333
  73. #if ENABLED(HAS_STM32_UID) && !defined(MACHINE_UUID)
  74. // STM32 based devices output the CPU device serial number
  75. // Used by LumenPnP / OpenPNP to keep track of unique hardware/configurations
  76. // https://github.com/opulo-inc/lumenpnp
  77. // Although this code should work on all STM32 based boards
  78. SERIAL_ECHOPGM(" UUID:");
  79. uint32_t *uid_address = (uint32_t*)UID_BASE;
  80. LOOP_L_N(i, 3) {
  81. const uint32_t UID = uint32_t(READ_REG(*(uid_address)));
  82. uid_address += 4U;
  83. for (int B = 24; B >= 0; B -= 8) print_hex_byte(UID >> B);
  84. }
  85. #endif
  86. SERIAL_EOL();
  87. #if ENABLED(EXTENDED_CAPABILITIES_REPORT)
  88. // The port that sent M115
  89. serial_index_t port = queue.ring_buffer.command_port();
  90. // PAREN_COMMENTS
  91. TERN_(PAREN_COMMENTS, cap_line(F("PAREN_COMMENTS"), true));
  92. // QUOTED_STRINGS
  93. TERN_(GCODE_QUOTED_STRINGS, cap_line(F("QUOTED_STRINGS"), true));
  94. // SERIAL_XON_XOFF
  95. cap_line(F("SERIAL_XON_XOFF"), ENABLED(SERIAL_XON_XOFF));
  96. // BINARY_FILE_TRANSFER (M28 B1)
  97. cap_line(F("BINARY_FILE_TRANSFER"), ENABLED(BINARY_FILE_TRANSFER)); // TODO: Use SERIAL_IMPL.has_feature(port, SerialFeature::BinaryFileTransfer) once implemented
  98. // EEPROM (M500, M501)
  99. cap_line(F("EEPROM"), ENABLED(EEPROM_SETTINGS));
  100. // Volumetric Extrusion (M200)
  101. cap_line(F("VOLUMETRIC"), DISABLED(NO_VOLUMETRICS));
  102. // AUTOREPORT_POS (M154)
  103. cap_line(F("AUTOREPORT_POS"), ENABLED(AUTO_REPORT_POSITION));
  104. // AUTOREPORT_TEMP (M155)
  105. cap_line(F("AUTOREPORT_TEMP"), ENABLED(AUTO_REPORT_TEMPERATURES));
  106. // PROGRESS (M530 S L, M531 <file>, M532 X L)
  107. cap_line(F("PROGRESS"));
  108. // Print Job timer M75, M76, M77
  109. cap_line(F("PRINT_JOB"), true);
  110. // AUTOLEVEL (G29)
  111. cap_line(F("AUTOLEVEL"), ENABLED(HAS_AUTOLEVEL));
  112. // RUNOUT (M412, M600)
  113. cap_line(F("RUNOUT"), ENABLED(FILAMENT_RUNOUT_SENSOR));
  114. // Z_PROBE (G30)
  115. cap_line(F("Z_PROBE"), ENABLED(HAS_BED_PROBE));
  116. // MESH_REPORT (M420 V)
  117. cap_line(F("LEVELING_DATA"), ENABLED(HAS_LEVELING));
  118. // BUILD_PERCENT (M73)
  119. cap_line(F("BUILD_PERCENT"), ENABLED(SET_PROGRESS_PERCENT));
  120. // SOFTWARE_POWER (M80, M81)
  121. cap_line(F("SOFTWARE_POWER"), ENABLED(PSU_CONTROL));
  122. // TOGGLE_LIGHTS (M355)
  123. cap_line(F("TOGGLE_LIGHTS"), ENABLED(CASE_LIGHT_ENABLE));
  124. cap_line(F("CASE_LIGHT_BRIGHTNESS"), TERN0(CASE_LIGHT_ENABLE, caselight.has_brightness()));
  125. // SPINDLE AND LASER CONTROL (M3, M4, M5)
  126. #if ENABLED(SPINDLE_FEATURE)
  127. cap_line(F("SPINDLE"), true);
  128. #elif ENABLED(LASER_FEATURE)
  129. cap_line(F("LASER"), true);
  130. #endif
  131. // EMERGENCY_PARSER (M108, M112, M410, M876)
  132. cap_line(F("EMERGENCY_PARSER"), ENABLED(EMERGENCY_PARSER));
  133. // HOST ACTION COMMANDS (paused, resume, resumed, cancel, etc.)
  134. cap_line(F("HOST_ACTION_COMMANDS"), ENABLED(HOST_ACTION_COMMANDS));
  135. // PROMPT SUPPORT (M876)
  136. cap_line(F("PROMPT_SUPPORT"), ENABLED(HOST_PROMPT_SUPPORT));
  137. // SDCARD (M20, M23, M24, etc.)
  138. cap_line(F("SDCARD"), ENABLED(SDSUPPORT));
  139. // MULTI_VOLUME (M21 S/M21 U)
  140. #if ENABLED(SDSUPPORT)
  141. cap_line(F("MULTI_VOLUME"), ENABLED(MULTI_VOLUME));
  142. #endif
  143. // REPEAT (M808)
  144. cap_line(F("REPEAT"), ENABLED(GCODE_REPEAT_MARKERS));
  145. // SD_WRITE (M928, M28, M29)
  146. cap_line(F("SD_WRITE"), ENABLED(SDSUPPORT) && DISABLED(SDCARD_READONLY));
  147. // AUTOREPORT_SD_STATUS (M27 extension)
  148. cap_line(F("AUTOREPORT_SD_STATUS"), ENABLED(AUTO_REPORT_SD_STATUS));
  149. // LONG_FILENAME_HOST_SUPPORT (M33)
  150. cap_line(F("LONG_FILENAME"), ENABLED(LONG_FILENAME_HOST_SUPPORT));
  151. // LONG_FILENAME_WRITE_SUPPORT (M23, M28, M30...)
  152. cap_line(F("LFN_WRITE"), ENABLED(LONG_FILENAME_WRITE_SUPPORT));
  153. // CUSTOM_FIRMWARE_UPLOAD (M20 F)
  154. cap_line(F("CUSTOM_FIRMWARE_UPLOAD"), ENABLED(CUSTOM_FIRMWARE_UPLOAD));
  155. // EXTENDED_M20 (M20 L)
  156. cap_line(F("EXTENDED_M20"), ENABLED(LONG_FILENAME_HOST_SUPPORT));
  157. // THERMAL_PROTECTION
  158. cap_line(F("THERMAL_PROTECTION"), ENABLED(THERMALLY_SAFE));
  159. // MOTION_MODES (M80-M89)
  160. cap_line(F("MOTION_MODES"), ENABLED(GCODE_MOTION_MODES));
  161. // ARC_SUPPORT (G2-G3)
  162. cap_line(F("ARCS"), ENABLED(ARC_SUPPORT));
  163. // BABYSTEPPING (M290)
  164. cap_line(F("BABYSTEPPING"), ENABLED(BABYSTEPPING));
  165. // CHAMBER_TEMPERATURE (M141, M191)
  166. cap_line(F("CHAMBER_TEMPERATURE"), ENABLED(HAS_HEATED_CHAMBER));
  167. // COOLER_TEMPERATURE (M143, M193)
  168. cap_line(F("COOLER_TEMPERATURE"), ENABLED(HAS_COOLER));
  169. // MEATPACK Compression
  170. cap_line(F("MEATPACK"), SERIAL_IMPL.has_feature(port, SerialFeature::MeatPack));
  171. // CONFIG_EXPORT
  172. cap_line(F("CONFIG_EXPORT"), ENABLED(CONFIGURATION_EMBEDDING));
  173. // Machine Geometry
  174. #if ENABLED(M115_GEOMETRY_REPORT)
  175. const xyz_pos_t bmin = { 0, 0, 0 },
  176. bmax = { X_BED_SIZE , Y_BED_SIZE, Z_MAX_POS },
  177. dmin = { X_MIN_POS, Y_MIN_POS, Z_MIN_POS },
  178. dmax = { X_MAX_POS, Y_MAX_POS, Z_MAX_POS };
  179. xyz_pos_t cmin = bmin, cmax = bmax;
  180. apply_motion_limits(cmin);
  181. apply_motion_limits(cmax);
  182. const xyz_pos_t lmin = dmin.asLogical(), lmax = dmax.asLogical(),
  183. wmin = cmin.asLogical(), wmax = cmax.asLogical();
  184. SERIAL_ECHOLNPGM(
  185. "area:{"
  186. "full:{"
  187. "min:{x:", lmin.x, ",y:", lmin.y, ",z:", lmin.z, "},"
  188. "max:{x:", lmax.x, ",y:", lmax.y, ",z:", lmax.z, "}"
  189. "},"
  190. "work:{"
  191. "min:{x:", wmin.x, ",y:", wmin.y, ",z:", wmin.z, "},"
  192. "max:{x:", wmax.x, ",y:", wmax.y, ",z:", wmax.z, "}",
  193. "}"
  194. "}"
  195. );
  196. #endif
  197. #endif // EXTENDED_CAPABILITIES_REPORT
  198. }