Echo all debug levels in M111, default to DEBUG_NONE

Redo of #3268 by @jbrazio
2.0.x
Scott Lahteine 9 years ago
parent e0ab06cfae
commit 4402760739

@ -229,6 +229,7 @@ void Stop();
* Debug flags - not yet widely applied * Debug flags - not yet widely applied
*/ */
enum DebugFlags { enum DebugFlags {
DEBUG_NONE = 0,
DEBUG_ECHO = _BV(0), DEBUG_ECHO = _BV(0),
DEBUG_INFO = _BV(1), DEBUG_INFO = _BV(1),
DEBUG_ERRORS = _BV(2), DEBUG_ERRORS = _BV(2),

@ -250,7 +250,7 @@
bool Running = true; bool Running = true;
uint8_t marlin_debug_flags = DEBUG_INFO | DEBUG_ERRORS; uint8_t marlin_debug_flags = DEBUG_NONE;
static float feedrate = 1500.0, saved_feedrate; static float feedrate = 1500.0, saved_feedrate;
float current_position[NUM_AXIS] = { 0.0 }; float current_position[NUM_AXIS] = { 0.0 };
@ -4346,27 +4346,39 @@ inline void gcode_M110() {
* M111: Set the debug level * M111: Set the debug level
*/ */
inline void gcode_M111() { inline void gcode_M111() {
marlin_debug_flags = code_seen('S') ? code_value_short() : DEBUG_INFO | DEBUG_COMMUNICATION; marlin_debug_flags = code_seen('S') ? code_value_short() : DEBUG_NONE;
if (marlin_debug_flags & DEBUG_ECHO) { const char str_debug_1[] PROGMEM = MSG_DEBUG_ECHO;
SERIAL_ECHO_START; const char str_debug_2[] PROGMEM = MSG_DEBUG_INFO;
SERIAL_ECHOLNPGM(MSG_DEBUG_ECHO); const char str_debug_4[] PROGMEM = MSG_DEBUG_ERRORS;
} const char str_debug_8[] PROGMEM = MSG_DEBUG_DRYRUN;
// FOR MOMENT NOT ACTIVE const char str_debug_16[] PROGMEM = MSG_DEBUG_COMMUNICATION;
//if (marlin_debug_flags & DEBUG_INFO) SERIAL_ECHOLNPGM(MSG_DEBUG_INFO); #if ENABLED(DEBUG_LEVELING_FEATURE)
//if (marlin_debug_flags & DEBUG_ERRORS) SERIAL_ECHOLNPGM(MSG_DEBUG_ERRORS); const char str_debug_32[] PROGMEM = MSG_DEBUG_LEVELING;
if (marlin_debug_flags & DEBUG_DRYRUN) { #endif
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM(MSG_DEBUG_DRYRUN);
disable_all_heaters();
}
const char* const debug_strings[] PROGMEM = {
str_debug_1, str_debug_2, str_debug_4, str_debug_8, str_debug_16,
#if ENABLED(DEBUG_LEVELING_FEATURE) #if ENABLED(DEBUG_LEVELING_FEATURE)
if (marlin_debug_flags & DEBUG_LEVELING) { str_debug_32
#endif
};
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHOLNPGM(MSG_DEBUG_LEVELING); SERIAL_ECHOPGM(MSG_DEBUG_PREFIX);
if (marlin_debug_flags) {
uint8_t comma = 0;
for (uint8_t i = 0; i < COUNT(debug_strings); i++) {
if (TEST(marlin_debug_flags, i)) {
if (comma++) SERIAL_CHAR('|');
serialprintPGM(debug_strings[i]);
} }
#endif }
}
else {
SERIAL_ECHOPGM(MSG_DEBUG_OFF);
}
SERIAL_EOL;
} }
/** /**

@ -238,11 +238,14 @@
#define MSG_T_MINTEMP "MINTEMP triggered" #define MSG_T_MINTEMP "MINTEMP triggered"
// Debug // Debug
#define MSG_DEBUG_ECHO "DEBUG ECHO ENABLED" #define MSG_DEBUG_PREFIX "DEBUG: "
#define MSG_DEBUG_INFO "DEBUG INFO ENABLED" #define MSG_DEBUG_OFF "off"
#define MSG_DEBUG_ERRORS "DEBUG ERRORS ENABLED" #define MSG_DEBUG_ECHO "ECHO"
#define MSG_DEBUG_DRYRUN "DEBUG DRYRUN ENABLED" #define MSG_DEBUG_INFO "INFO"
#define MSG_DEBUG_LEVELING "DEBUG LEVELING ENABLED" #define MSG_DEBUG_ERRORS "ERRORS"
#define MSG_DEBUG_DRYRUN "DRYRUN"
#define MSG_DEBUG_COMMUNICATION "COMMUNICATION"
#define MSG_DEBUG_LEVELING "LEVELING"
// LCD Menu Messages // LCD Menu Messages

Loading…
Cancel
Save