Merge pull request #1973 from thinkyhead/m111_debug_level

M111 - Debug Level
master
Scott Lahteine 10 years ago
commit 01bedd17c9

@ -223,6 +223,18 @@ void Stop();
void filrunout(); void filrunout();
#endif #endif
/**
* Debug flags - not yet widely applied
*/
enum DebugFlags {
DEBUG_ECHO = BIT(0),
DEBUG_INFO = BIT(1),
DEBUG_ERRORS = BIT(2),
DEBUG_DRYRUN = BIT(3),
DEBUG_COMMUNICATION = BIT(4)
};
extern uint8_t marlin_debug_flags;
extern bool Running; extern bool Running;
inline bool IsRunning() { return Running; } inline bool IsRunning() { return Running; }
inline bool IsStopped() { return !Running; } inline bool IsStopped() { return !Running; }

@ -138,6 +138,7 @@
* M109 - Sxxx Wait for extruder current temp to reach target temp. Waits only when heating * M109 - Sxxx Wait for extruder current temp to reach target temp. Waits only when heating
* Rxxx Wait for extruder current temp to reach target temp. Waits when heating and cooling * Rxxx Wait for extruder current temp to reach target temp. Waits when heating and cooling
* IF AUTOTEMP is enabled, S<mintemp> B<maxtemp> F<factor>. Exit autotemp by any M109 without F * IF AUTOTEMP is enabled, S<mintemp> B<maxtemp> F<factor>. Exit autotemp by any M109 without F
* M111 - Set debug flags with S<mask>. See flag bits defined in Marlin.h.
* M112 - Emergency stop * M112 - Emergency stop
* M114 - Output current position to serial port * M114 - Output current position to serial port
* M115 - Capabilities string * M115 - Capabilities string
@ -218,6 +219,8 @@
bool Running = true; bool Running = true;
uint8_t marlin_debug_flags = DEBUG_INFO|DEBUG_ERRORS;
static float feedrate = 1500.0, next_feedrate, saved_feedrate; static float feedrate = 1500.0, next_feedrate, saved_feedrate;
float current_position[NUM_AXIS] = { 0.0 }; float current_position[NUM_AXIS] = { 0.0 };
static float destination[NUM_AXIS] = { 0.0 }; static float destination[NUM_AXIS] = { 0.0 };
@ -749,9 +752,10 @@ void get_command() {
gcode_N = (strtol(strchr_pointer + 1, NULL, 10)); gcode_N = (strtol(strchr_pointer + 1, NULL, 10));
if (gcode_N != gcode_LastN + 1 && strstr_P(command, PSTR("M110")) == NULL) { if (gcode_N != gcode_LastN + 1 && strstr_P(command, PSTR("M110")) == NULL) {
SERIAL_ERROR_START; SERIAL_ERROR_START;
SERIAL_ERRORPGM(MSG_ERR_LINE_NO); SERIAL_ERRORPGM(MSG_ERR_LINE_NO1);
SERIAL_ERRORLN(gcode_LastN); SERIAL_ERROR(gcode_LastN + 1);
//Serial.println(gcode_N); SERIAL_ERRORPGM(MSG_ERR_LINE_NO2);
SERIAL_ERRORLN(gcode_N);
FlushSerialRequestResend(); FlushSerialRequestResend();
serial_count = 0; serial_count = 0;
return; return;
@ -3337,12 +3341,17 @@ inline void gcode_M109() {
#endif // HAS_TEMP_BED #endif // HAS_TEMP_BED
/** /**
* M112: Emergency Stop * M111: Set the debug level
*/ */
inline void gcode_M112() { inline void gcode_M111() {
kill(); marlin_debug_flags = code_seen('S') ? code_value_short() : DEBUG_INFO|DEBUG_ERRORS;
} }
/**
* M112: Emergency Stop
*/
inline void gcode_M112() { kill(); }
#ifdef BARICUDA #ifdef BARICUDA
#if HAS_HEATER_1 #if HAS_HEATER_1
@ -4781,6 +4790,12 @@ inline void gcode_T() {
* This is called from the main loop() * This is called from the main loop()
*/ */
void process_commands() { void process_commands() {
if ((marlin_debug_flags & DEBUG_ECHO)) {
SERIAL_ECHO_START;
SERIAL_ECHOLN(command_queue[cmd_queue_index_r]);
}
if (code_seen('G')) { if (code_seen('G')) {
int gCode = code_value_short(); int gCode = code_value_short();
@ -4919,34 +4934,38 @@ void process_commands() {
gcode_M104(); gcode_M104();
break; break;
case 112: // M112 Emergency Stop case 111: // M111: Set debug level
gcode_M111();
break;
case 112: // M112: Emergency Stop
gcode_M112(); gcode_M112();
break; break;
case 140: // M140 Set bed temp case 140: // M140: Set bed temp
gcode_M140(); gcode_M140();
break; break;
case 105: // M105 Read current temperature case 105: // M105: Read current temperature
gcode_M105(); gcode_M105();
return; return;
break; break;
case 109: // M109 Wait for temperature case 109: // M109: Wait for temperature
gcode_M109(); gcode_M109();
break; break;
#if HAS_TEMP_BED #if HAS_TEMP_BED
case 190: // M190 - Wait for bed heater to reach target. case 190: // M190: Wait for bed heater to reach target
gcode_M190(); gcode_M190();
break; break;
#endif // HAS_TEMP_BED #endif // HAS_TEMP_BED
#if HAS_FAN #if HAS_FAN
case 106: //M106 Fan On case 106: // M106: Fan On
gcode_M106(); gcode_M106();
break; break;
case 107: //M107 Fan Off case 107: // M107: Fan Off
gcode_M107(); gcode_M107();
break; break;
#endif // HAS_FAN #endif // HAS_FAN
@ -4954,20 +4973,20 @@ void process_commands() {
#ifdef BARICUDA #ifdef BARICUDA
// PWM for HEATER_1_PIN // PWM for HEATER_1_PIN
#if HAS_HEATER_1 #if HAS_HEATER_1
case 126: // M126 valve open case 126: // M126: valve open
gcode_M126(); gcode_M126();
break; break;
case 127: // M127 valve closed case 127: // M127: valve closed
gcode_M127(); gcode_M127();
break; break;
#endif // HAS_HEATER_1 #endif // HAS_HEATER_1
// PWM for HEATER_2_PIN // PWM for HEATER_2_PIN
#if HAS_HEATER_2 #if HAS_HEATER_2
case 128: // M128 valve open case 128: // M128: valve open
gcode_M128(); gcode_M128();
break; break;
case 129: // M129 valve closed case 129: // M129: valve closed
gcode_M129(); gcode_M129();
break; break;
#endif // HAS_HEATER_2 #endif // HAS_HEATER_2
@ -4975,13 +4994,13 @@ void process_commands() {
#if HAS_POWER_SWITCH #if HAS_POWER_SWITCH
case 80: // M80 - Turn on Power Supply case 80: // M80: Turn on Power Supply
gcode_M80(); gcode_M80();
break; break;
#endif // HAS_POWER_SWITCH #endif // HAS_POWER_SWITCH
case 81: // M81 - Turn off Power, including Power Supply, if possible case 81: // M81: Turn off Power, including Power Supply, if possible
gcode_M81(); gcode_M81();
break; break;
@ -4991,7 +5010,7 @@ void process_commands() {
case 83: case 83:
gcode_M83(); gcode_M83();
break; break;
case 18: //compatibility case 18: // (for compatibility)
case 84: // M84 case 84: // M84
gcode_M18_M84(); gcode_M18_M84();
break; break;

@ -122,7 +122,8 @@
#define MSG_PLANNER_BUFFER_BYTES " PlannerBufferBytes: " #define MSG_PLANNER_BUFFER_BYTES " PlannerBufferBytes: "
#define MSG_OK "ok" #define MSG_OK "ok"
#define MSG_FILE_SAVED "Done saving file." #define MSG_FILE_SAVED "Done saving file."
#define MSG_ERR_LINE_NO "Line Number is not Last Line Number+1, Last Line: " #define MSG_ERR_LINE_NO1 "Line Number out of sequence. Expected: "
#define MSG_ERR_LINE_NO2 " Got: "
#define MSG_ERR_CHECKSUM_MISMATCH "checksum mismatch, Last Line: " #define MSG_ERR_CHECKSUM_MISMATCH "checksum mismatch, Last Line: "
#define MSG_ERR_NO_CHECKSUM "No Checksum with line number, Last Line: " #define MSG_ERR_NO_CHECKSUM "No Checksum with line number, Last Line: "
#define MSG_ERR_NO_LINENUMBER_WITH_CHECKSUM "No Line Number with checksum, Last Line: " #define MSG_ERR_NO_LINENUMBER_WITH_CHECKSUM "No Line Number with checksum, Last Line: "

@ -122,7 +122,8 @@
#define MSG_PLANNER_BUFFER_BYTES " PlannerBufferBytes: " #define MSG_PLANNER_BUFFER_BYTES " PlannerBufferBytes: "
#define MSG_OK "ok" #define MSG_OK "ok"
#define MSG_FILE_SAVED "Done saving file." #define MSG_FILE_SAVED "Done saving file."
#define MSG_ERR_LINE_NO "Line Number is not Last Line Number+1, Last Line: " #define MSG_ERR_LINE_NO1 "Line Number out of sequence. Expected: "
#define MSG_ERR_LINE_NO2 " Got: "
#define MSG_ERR_CHECKSUM_MISMATCH "checksum mismatch, Last Line: " #define MSG_ERR_CHECKSUM_MISMATCH "checksum mismatch, Last Line: "
#define MSG_ERR_NO_CHECKSUM "No Checksum with line number, Last Line: " #define MSG_ERR_NO_CHECKSUM "No Checksum with line number, Last Line: "
#define MSG_ERR_NO_LINENUMBER_WITH_CHECKSUM "No Line Number with checksum, Last Line: " #define MSG_ERR_NO_LINENUMBER_WITH_CHECKSUM "No Line Number with checksum, Last Line: "

Loading…
Cancel
Save