1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-26 05:17:17 +00:00

🔪 Options to slim M111, remove M115 (#26603)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
ellensp 2024-01-03 13:52:12 +13:00 committed by GitHub
parent 7c159a20e5
commit 1ac6428c82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 62 additions and 30 deletions

View File

@ -3935,6 +3935,18 @@
//#define REPETIER_GCODE_M360 // Add commands originally from Repetier FW
/**
* Enable M111 debug flags 1=ECHO, 2=INFO, 4=ERRORS (unimplemented).
* Disable to save some flash. Some hosts (Repetier Host) may rely on this feature.
*/
#define DEBUG_FLAGS_GCODE
/**
* M115 - Report capabilites. Disable to save ~1150 bytes of flash.
* Some hosts (and serial TFT displays) rely on this feature.
*/
#define REPORT_CAPABILITIES_GCODE
/**
* Enable this option for a leaner build of Marlin that removes
* workspace offsets to slightly optimize performance.

View File

@ -33,19 +33,14 @@
//
enum MarlinDebugFlags : uint8_t {
MARLIN_DEBUG_NONE = 0,
MARLIN_DEBUG_ECHO = _BV(0), ///< Echo commands in order as they are processed
MARLIN_DEBUG_INFO = _BV(1), ///< Print messages for code that has debug output
MARLIN_DEBUG_ERRORS = _BV(2), ///< Not implemented
MARLIN_DEBUG_DRYRUN = _BV(3), ///< Ignore temperature setting and E movement commands
MARLIN_DEBUG_COMMUNICATION = _BV(4), ///< Not implemented
#if ENABLED(DEBUG_LEVELING_FEATURE)
MARLIN_DEBUG_LEVELING = _BV(5), ///< Print detailed output for homing and leveling
MARLIN_DEBUG_MESH_ADJUST = _BV(6), ///< UBL bed leveling
#else
MARLIN_DEBUG_LEVELING = 0,
MARLIN_DEBUG_MESH_ADJUST = 0,
#endif
MARLIN_DEBUG_ALL = 0xFF
MARLIN_DEBUG_ECHO = TERN0(DEBUG_FLAGS_GCODE, _BV(0)), //!< Echo commands in order as they are processed
MARLIN_DEBUG_INFO = TERN0(DEBUG_FLAGS_GCODE, _BV(1)), //!< Print messages for code that has debug output
MARLIN_DEBUG_ERRORS = TERN0(DEBUG_FLAGS_GCODE, _BV(2)), //!< Not implemented
MARLIN_DEBUG_DRYRUN = _BV(3), //!< Ignore temperature setting and E movement commands
MARLIN_DEBUG_COMMUNICATION = TERN0(DEBUG_FLAGS_GCODE, _BV(4)), //!< Not implemented
MARLIN_DEBUG_LEVELING = TERN0(DEBUG_LEVELING_FEATURE, _BV(5)), //!< Print detailed output for homing and leveling
MARLIN_DEBUG_MESH_ADJUST = TERN0(DEBUG_LEVELING_FEATURE, _BV(6)), //!< UBL bed leveling
MARLIN_DEBUG_ALL = MARLIN_DEBUG_ECHO|MARLIN_DEBUG_INFO|MARLIN_DEBUG_ERRORS|MARLIN_DEBUG_COMMUNICATION|MARLIN_DEBUG_LEVELING|MARLIN_DEBUG_MESH_ADJUST
};
extern uint8_t marlin_debug_flags;

View File

@ -20,6 +20,7 @@
*
*/
#include "../../inc/MarlinConfig.h"
#include "../gcode.h"
/**
@ -27,18 +28,25 @@
*/
void GcodeSuite::M111() {
if (parser.seenval('S')) marlin_debug_flags = parser.value_byte();
static PGMSTR(str_debug_1, STR_DEBUG_ECHO);
static PGMSTR(str_debug_2, STR_DEBUG_INFO);
static PGMSTR(str_debug_4, STR_DEBUG_ERRORS);
#if ENABLED(DEBUG_FLAGS_GCODE)
static PGMSTR(str_debug_1, STR_DEBUG_ECHO);
static PGMSTR(str_debug_2, STR_DEBUG_INFO);
static PGMSTR(str_debug_4, STR_DEBUG_ERRORS);
#endif
static PGMSTR(str_debug_8, STR_DEBUG_DRYRUN);
static PGMSTR(str_debug_16, STR_DEBUG_COMMUNICATION);
#if ENABLED(DEBUG_FLAGS_GCODE)
static PGMSTR(str_debug_16, STR_DEBUG_COMMUNICATION);
#endif
#if ENABLED(DEBUG_LEVELING_FEATURE)
static PGMSTR(str_debug_detail, STR_DEBUG_DETAIL);
#endif
static PGM_P const debug_strings[] PROGMEM = {
str_debug_1, str_debug_2, str_debug_4, str_debug_8, str_debug_16,
TERN(DEBUG_FLAGS_GCODE, str_debug_1, nullptr),
TERN(DEBUG_FLAGS_GCODE, str_debug_2, nullptr),
TERN(DEBUG_FLAGS_GCODE, str_debug_4, nullptr),
str_debug_8,
TERN(DEBUG_FLAGS_GCODE, str_debug_16, nullptr),
TERN_(DEBUG_LEVELING_FEATURE, str_debug_detail)
};
@ -47,31 +55,29 @@ void GcodeSuite::M111() {
if (marlin_debug_flags) {
uint8_t comma = 0;
for (uint8_t i = 0; i < COUNT(debug_strings); ++i) {
if (TEST(marlin_debug_flags, i)) {
PGM_P const pstr = (PGM_P)pgm_read_ptr(&debug_strings[i]);
if (pstr && TEST(marlin_debug_flags, i)) {
if (comma++) SERIAL_CHAR(',');
SERIAL_ECHOPGM_P((PGM_P)pgm_read_ptr(&debug_strings[i]));
SERIAL_ECHOPGM_P(pstr);
}
}
}
else {
SERIAL_ECHOPGM(STR_DEBUG_OFF);
#if !defined(__AVR__) || !defined(USBCON)
#if !(defined(__AVR__) && defined(USBCON))
#if ENABLED(SERIAL_STATS_RX_BUFFER_OVERRUNS)
SERIAL_ECHOPGM("\nBuffer Overruns: ", MYSERIAL1.buffer_overruns());
#endif
#if ENABLED(SERIAL_STATS_RX_FRAMING_ERRORS)
SERIAL_ECHOPGM("\nFraming Errors: ", MYSERIAL1.framing_errors());
#endif
#if ENABLED(SERIAL_STATS_DROPPED_RX)
SERIAL_ECHOPGM("\nDropped bytes: ", MYSERIAL1.dropped());
#endif
#if ENABLED(SERIAL_STATS_MAX_RX_QUEUED)
SERIAL_ECHOPGM("\nMax RX Queue Size: ", MYSERIAL1.rxMaxEnqueued());
#endif
#endif // !__AVR__ || !USBCON
#endif // !(__AVR__ && USBCON)
}
SERIAL_EOL();
}

View File

@ -669,7 +669,10 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
case 92: M92(); break; // M92: Set the steps-per-unit for one or more axes
case 114: M114(); break; // M114: Report current position
case 115: M115(); break; // M115: Report capabilities
#if ENABLED(REPORT_CAPABILITIES_GCODE)
case 115: M115(); break; // M115: Report capabilities
#endif
case 117: TERN_(HAS_STATUS_MESSAGE, M117()); break; // M117: Set LCD message text, if possible

View File

@ -760,7 +760,10 @@ private:
#endif
static void M114();
static void M115();
#if ENABLED(REPORT_CAPABILITIES_GCODE)
static void M115();
#endif
#if HAS_STATUS_MESSAGE
static void M117();

View File

@ -20,8 +20,11 @@
*
*/
#include "../gcode.h"
#include "../../inc/MarlinConfig.h"
#if ENABLED(REPORT_CAPABILITIES_GCODE)
#include "../gcode.h"
#include "../queue.h" // for getting the command port
#if ENABLED(M115_GEOMETRY_REPORT)
@ -271,3 +274,5 @@ void GcodeSuite::M115() {
#endif // EXTENDED_CAPABILITIES_REPORT
}
#endif // REPORT_CAPABILITIES_GCODE

View File

@ -42,6 +42,14 @@
#endif
#endif
#if DISABLED(DEBUG_FLAGS_GCODE)
#warning "DEBUG_FLAGS_GCODE is recommended if you have space. Some hosts rely on it."
#endif
#if DISABLED(REPORT_CAPABILITIES_GCODE)
#warning "REPORT_CAPABILITIES_GCODE is recommended if you have space. Some hosts rely on it."
#endif
#if ENABLED(LA_DEBUG)
#warning "WARNING! Disable LA_DEBUG for the final build!"
#endif

View File

@ -322,6 +322,7 @@ CNC_COORDINATE_SYSTEMS = build_src_filter=+<src/gcode/geometry/G
HAS_HOME_OFFSET = build_src_filter=+<src/gcode/geometry/M206_M428.cpp>
EXPECTED_PRINTER_CHECK = build_src_filter=+<src/gcode/host/M16.cpp>
HOST_KEEPALIVE_FEATURE = build_src_filter=+<src/gcode/host/M113.cpp>
REPORT_CAPABILITIES_GCODE = build_src_filter=+<src/gcode/host/M115.cpp>
AUTO_REPORT_POSITION = build_src_filter=+<src/gcode/host/M154.cpp>
REPETIER_GCODE_M360 = build_src_filter=+<src/gcode/host/M360.cpp>
HAS_GCODE_M876 = build_src_filter=+<src/gcode/host/M876.cpp>

View File

@ -111,7 +111,6 @@ default_src_filter = +<src/*> -<src/config> -<src/tests>
+<src/gcode/geometry/G92.cpp>
+<src/gcode/host/M110.cpp>
+<src/gcode/host/M114.cpp>
+<src/gcode/host/M115.cpp>
+<src/gcode/host/M118.cpp>
+<src/gcode/host/M119.cpp>
+<src/gcode/motion/G0_G1.cpp>