Echo all debug levels in M111, default to DEBUG_NONE

Redo of #3268 by @jbrazio
This commit is contained in:
Scott Lahteine 2016-03-29 19:18:45 -07:00
parent e0ab06cfae
commit 4402760739
3 changed files with 40 additions and 24 deletions

View file

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

View file

@ -250,7 +250,7 @@
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;
float current_position[NUM_AXIS] = { 0.0 };
@ -4346,27 +4346,39 @@ inline void gcode_M110() {
* M111: Set the debug level
*/
inline void gcode_M111() {
marlin_debug_flags = code_seen('S') ? code_value_short() : DEBUG_INFO | DEBUG_COMMUNICATION;
if (marlin_debug_flags & DEBUG_ECHO) {
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM(MSG_DEBUG_ECHO);
}
// FOR MOMENT NOT ACTIVE
//if (marlin_debug_flags & DEBUG_INFO) SERIAL_ECHOLNPGM(MSG_DEBUG_INFO);
//if (marlin_debug_flags & DEBUG_ERRORS) SERIAL_ECHOLNPGM(MSG_DEBUG_ERRORS);
if (marlin_debug_flags & DEBUG_DRYRUN) {
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM(MSG_DEBUG_DRYRUN);
disable_all_heaters();
}
marlin_debug_flags = code_seen('S') ? code_value_short() : DEBUG_NONE;
const char str_debug_1[] PROGMEM = MSG_DEBUG_ECHO;
const char str_debug_2[] PROGMEM = MSG_DEBUG_INFO;
const char str_debug_4[] PROGMEM = MSG_DEBUG_ERRORS;
const char str_debug_8[] PROGMEM = MSG_DEBUG_DRYRUN;
const char str_debug_16[] PROGMEM = MSG_DEBUG_COMMUNICATION;
#if ENABLED(DEBUG_LEVELING_FEATURE)
if (marlin_debug_flags & DEBUG_LEVELING) {
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM(MSG_DEBUG_LEVELING);
}
const char str_debug_32[] PROGMEM = MSG_DEBUG_LEVELING;
#endif
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)
str_debug_32
#endif
};
SERIAL_ECHO_START;
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]);
}
}
}
else {
SERIAL_ECHOPGM(MSG_DEBUG_OFF);
}
SERIAL_EOL;
}
/**

View file

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