Prettify process_parsed_command

This commit is contained in:
Scott Lahteine 2018-04-13 00:08:28 -05:00
parent 0535ebc4d2
commit 3c5c6d478a

View file

@ -142,120 +142,68 @@ void GcodeSuite::process_parsed_command() {
switch (parser.command_letter) { switch (parser.command_letter) {
case 'G': switch (parser.codenum) { case 'G': switch (parser.codenum) {
// G0, G1 case 0: case 1: G0_G1( // G0: Fast Move, G1: Linear Move
case 0:
case 1:
#if IS_SCARA #if IS_SCARA
G0_G1(parser.codenum == 0); parser.codenum == 0
#else
G0_G1();
#endif #endif
);
break; break;
// G2, G3
#if ENABLED(ARC_SUPPORT) && DISABLED(SCARA) #if ENABLED(ARC_SUPPORT) && DISABLED(SCARA)
case 2: // G2: CW ARC case 2: case 3: G2_G3(parser.codenum == 2); break; // G2: CW ARC, G3: CCW ARC
case 3: // G3: CCW ARC
G2_G3(parser.codenum == 2);
break;
#endif #endif
// G4 Dwell case 4: G4(); break; // G4: Dwell
case 4:
G4();
break;
#if ENABLED(BEZIER_CURVE_SUPPORT) #if ENABLED(BEZIER_CURVE_SUPPORT)
case 5: // G5: Cubic B_spline case 5: G5(); break; // G5: Cubic B_spline
G5(); #endif
break;
#endif // BEZIER_CURVE_SUPPORT
#if ENABLED(FWRETRACT) #if ENABLED(FWRETRACT)
case 10: // G10: retract case 10: G10(); break; // G10: Retract / Swap Retract
G10(); case 11: G11(); break; // G11: Recover / Swap Recover
break; #endif
case 11: // G11: retract_recover
G11();
break;
#endif // FWRETRACT
#if ENABLED(NOZZLE_CLEAN_FEATURE) #if ENABLED(NOZZLE_CLEAN_FEATURE)
case 12: case 12: G12(); break; // G12: Nozzle Clean
G12(); // G12: Nozzle Clean #endif
break;
#endif // NOZZLE_CLEAN_FEATURE
#if ENABLED(CNC_WORKSPACE_PLANES) #if ENABLED(CNC_WORKSPACE_PLANES)
case 17: // G17: Select Plane XY case 17: G17(); break; // G17: Select Plane XY
G17(); case 18: G18(); break; // G18: Select Plane ZX
break; case 19: G19(); break; // G19: Select Plane YZ
case 18: // G18: Select Plane ZX #endif
G18();
break;
case 19: // G19: Select Plane YZ
G19();
break;
#endif // CNC_WORKSPACE_PLANES
#if ENABLED(INCH_MODE_SUPPORT) #if ENABLED(INCH_MODE_SUPPORT)
case 20: // G20: Inch Mode case 20: G20(); break; // G20: Inch Mode
G20(); case 21: G21(); break; // G21: MM Mode
break; #endif
case 21: // G21: MM Mode
G21();
break;
#endif // INCH_MODE_SUPPORT
#if ENABLED(G26_MESH_VALIDATION) #if ENABLED(G26_MESH_VALIDATION)
case 26: // G26: Mesh Validation Pattern generation case 26: G26(); break; // G26: Mesh Validation Pattern generation
G26(); #endif
break;
#endif // AUTO_BED_LEVELING_UBL
#if ENABLED(NOZZLE_PARK_FEATURE) #if ENABLED(NOZZLE_PARK_FEATURE)
case 27: // G27: Nozzle Park case 27: G27(); break; // G27: Nozzle Park
G27(); #endif
break;
#endif // NOZZLE_PARK_FEATURE
case 28: // G28: Home all axes, one at a time case 28: G28(false); break; // G28: Home all axes, one at a time
G28(false);
break;
#if HAS_LEVELING #if HAS_LEVELING
case 29: // G29 Detailed Z probe, probes the bed at 3 or more points, case 29: G29(); break; // G29: Bed leveling calibration
// or provides access to the UBL System if enabled. #endif
G29();
break;
#endif // HAS_LEVELING
#if HAS_BED_PROBE #if HAS_BED_PROBE
case 30: G30(); break; // G30: Single Z probe
case 30: // G30 Single Z probe
G30();
break;
#if ENABLED(Z_PROBE_SLED) #if ENABLED(Z_PROBE_SLED)
case 31: G31(); break; // G31: dock the sled
case 31: // G31: dock the sled case 32: G32(); break; // G32: undock the sled
G31(); #endif
break; #endif
case 32: // G32: undock the sled
G32();
break;
#endif // Z_PROBE_SLED
#endif // HAS_BED_PROBE
#if ENABLED(DELTA_AUTO_CALIBRATION) #if ENABLED(DELTA_AUTO_CALIBRATION)
case 33: // G33: Delta Auto-Calibration case 33: G33(); break; // G33: Delta Auto-Calibration
G33(); #endif
break;
#endif // DELTA_AUTO_CALIBRATION
#if ENABLED(G38_PROBE_TARGET) #if ENABLED(G38_PROBE_TARGET)
case 38: // G38.2 & G38.3 case 38: // G38.2 & G38.3
@ -264,25 +212,17 @@ void GcodeSuite::process_parsed_command() {
break; break;
#endif #endif
case 90: // G90 case 90: relative_mode = false; break; // G90: Relative Mode
relative_mode = false; case 91: relative_mode = true; break; // G91: Absolute Mode
break;
case 91: // G91
relative_mode = true;
break;
case 92: // G92 - Set current axis position(s) case 92: G92(); break; // G92: Set current axis position(s)
G92();
break;
#if HAS_MESH #if HAS_MESH
case 42: G42(); break; // G42: Coordinated move to a mesh point case 42: G42(); break; // G42: Coordinated move to a mesh point
#endif #endif
#if ENABLED(DEBUG_GCODE_PARSER) #if ENABLED(DEBUG_GCODE_PARSER)
case 800: case 800: parser.debug(); break; // G800: GCode Parser Test for G
parser.debug(); // GCode Parser Test for G
break;
#endif #endif
} }
break; break;
@ -290,21 +230,16 @@ void GcodeSuite::process_parsed_command() {
case 'M': switch (parser.codenum) { case 'M': switch (parser.codenum) {
#if HAS_RESUME_CONTINUE #if HAS_RESUME_CONTINUE
case 0: // M0: Unconditional stop - Wait for user button press on LCD case 0: // M0: Unconditional stop - Wait for user button press on LCD
case 1: // M1: Conditional stop - Wait for user button press on LCD case 1: M0_M1(); break; // M1: Conditional stop - Wait for user button press on LCD
M0_M1(); #endif
break;
#endif // ULTIPANEL
#if ENABLED(SPINDLE_LASER_ENABLE) #if ENABLED(SPINDLE_LASER_ENABLE)
// These synchronize with movement commands...
case 3: M3_M4(true ); break; // M3: turn spindle/laser on, set laser/spindle power/speed, set rotation direction CW case 3: M3_M4(true ); break; // M3: turn spindle/laser on, set laser/spindle power/speed, set rotation direction CW
case 4: M3_M4(false); break; // M4: turn spindle/laser on, set laser/spindle power/speed, set rotation direction CCW case 4: M3_M4(false); break; // M4: turn spindle/laser on, set laser/spindle power/speed, set rotation direction CCW
case 5: M5(); break; // M5 - turn spindle/laser off case 5: M5(); break; // M5 - turn spindle/laser off
#endif #endif
case 17: // M17: Enable all stepper motors case 17: M17(); break; // M17: Enable all stepper motors
M17();
break;
#if ENABLED(SDSUPPORT) #if ENABLED(SDSUPPORT)
case 20: M20(); break; // M20: list SD card case 20: M20(); break; // M20: list SD card
@ -332,7 +267,6 @@ void GcodeSuite::process_parsed_command() {
#endif // SDSUPPORT #endif // SDSUPPORT
case 31: M31(); break; // M31: Report time since the start of SD print or last M109 case 31: M31(); break; // M31: Report time since the start of SD print or last M109
case 42: M42(); break; // M42: Change pin state case 42: M42(); break; // M42: Change pin state
#if ENABLED(PINS_DEBUGGING) #if ENABLED(PINS_DEBUGGING)
@ -365,9 +299,7 @@ void GcodeSuite::process_parsed_command() {
case 104: M104(); break; // M104: Set hot end temperature case 104: M104(); break; // M104: Set hot end temperature
case 109: M109(); break; // M109: Wait for hotend temperature to reach target case 109: M109(); break; // M109: Wait for hotend temperature to reach target
case 110: M110(); break; // M110: Set Current Line Number case 110: M110(); break; // M110: Set Current Line Number
case 111: M111(); break; // M111: Set debug level case 111: M111(); break; // M111: Set debug level
#if DISABLED(EMERGENCY_PARSER) #if DISABLED(EMERGENCY_PARSER)
@ -385,10 +317,7 @@ void GcodeSuite::process_parsed_command() {
case 190: M190(); break; // M190: Wait for bed temperature to reach target case 190: M190(); break; // M190: Wait for bed temperature to reach target
#endif #endif
case 105: // M105: Report current temperature case 105: M105(); KEEPALIVE_STATE(NOT_BUSY); return; // M105: Report Temperatures (and say "ok")
M105();
KEEPALIVE_STATE(NOT_BUSY);
return; // "ok" already printed
#if ENABLED(AUTO_REPORT_TEMPERATURES) && HAS_TEMP_SENSOR #if ENABLED(AUTO_REPORT_TEMPERATURES) && HAS_TEMP_SENSOR
case 155: M155(); break; // M155: Set temperature auto-report interval case 155: M155(); break; // M155: Set temperature auto-report interval
@ -420,25 +349,17 @@ void GcodeSuite::process_parsed_command() {
#if HAS_POWER_SWITCH #if HAS_POWER_SWITCH
case 80: M80(); break; // M80: Turn on Power Supply case 80: M80(); break; // M80: Turn on Power Supply
#endif #endif
case 81: M81(); break; // M81: Turn off Power, including Power Supply, if possible case 81: M81(); break; // M81: Turn off Power, including Power Supply, if possible
case 82: M82(); break; // M82: Set E axis normal mode (same as other axes) case 82: M82(); break; // M82: Set E axis normal mode (same as other axes)
case 83: M83(); break; // M83: Set E axis relative mode case 83: M83(); break; // M83: Set E axis relative mode
case 18: case 84: M18_M84(); break; // M18/M84: Disable Steppers / Set Timeout
case 18: // M18 => M84
case 84: M18_M84(); break; // M84: Disable all steppers or set timeout
case 85: M85(); break; // M85: Set inactivity stepper shutdown timeout case 85: M85(); break; // M85: Set inactivity stepper shutdown timeout
case 92: M92(); break; // M92: Set the steps-per-unit for one or more axes case 92: M92(); break; // M92: Set the steps-per-unit for one or more axes
case 114: M114(); break; // M114: Report current position case 114: M114(); break; // M114: Report current position
case 115: M115(); break; // M115: Report capabilities case 115: M115(); break; // M115: Report capabilities
case 117: M117(); break; // M117: Set LCD message text, if possible case 117: M117(); break; // M117: Set LCD message text, if possible
case 118: M118(); break; // M118: Display a message in the host console case 118: M118(); break; // M118: Display a message in the host console
case 119: M119(); break; // M119: Report endstop states case 119: M119(); break; // M119: Report endstop states
case 120: M120(); break; // M120: Enable endstops case 120: M120(); break; // M120: Enable endstops
case 121: M121(); break; // M121: Disable endstops case 121: M121(); break; // M121: Disable endstops
@ -472,7 +393,7 @@ void GcodeSuite::process_parsed_command() {
case 201: M201(); break; // M201: Set max acceleration for print moves (units/s^2) case 201: M201(); break; // M201: Set max acceleration for print moves (units/s^2)
#if 0 #if 0
case 202: M202(); break; // Not used for Sprinter/grbl gen6 case 202: M202(); break; // M202: Not used for Sprinter/grbl gen6
#endif #endif
case 203: M203(); break; // M203: Set max feedrate (units/sec) case 203: M203(); break; // M203: Set max feedrate (units/sec)
@ -494,23 +415,19 @@ void GcodeSuite::process_parsed_command() {
#if ENABLED(FWRETRACT) #if ENABLED(FWRETRACT)
case 207: M207(); break; // M207: Set Retract Length, Feedrate, and Z lift case 207: M207(); break; // M207: Set Retract Length, Feedrate, and Z lift
case 208: M208(); break; // M208: Set Recover (unretract) Additional Length and Feedrate case 208: M208(); break; // M208: Set Recover (unretract) Additional Length and Feedrate
case 209: if (MIN_AUTORETRACT <= MAX_AUTORETRACT) M209(); break; // M209: Turn Automatic Retract Detection on/off case 209:
if (MIN_AUTORETRACT <= MAX_AUTORETRACT) M209(); // M209: Turn Automatic Retract Detection on/off
break;
#endif #endif
case 211: M211(); break; // M211: Enable, Disable, and/or Report software endstops case 211: M211(); break; // M211: Enable, Disable, and/or Report software endstops
#if HOTENDS > 1 #if HOTENDS > 1
case 218: // M218: Set a tool offset case 218: M218(); break; // M218: Set a tool offset
M218();
break;
#endif #endif
case 220: M220(); break; // M220: Set Feedrate Percentage: S<percent> ("FR" on your LCD) case 220: M220(); break; // M220: Set Feedrate Percentage: S<percent> ("FR" on your LCD)
case 221: M221(); break; // M221: Set Flow Percentage
case 221: // M221: Set Flow Percentage
M221();
break;
case 226: M226(); break; // M226: Wait until a pin reaches a state case 226: M226(); break; // M226: Wait until a pin reaches a state
#if HAS_SERVOS #if HAS_SERVOS
@ -550,9 +467,7 @@ void GcodeSuite::process_parsed_command() {
case 302: M302(); break; // M302: Allow cold extrudes (set the minimum extrude temperature) case 302: M302(); break; // M302: Allow cold extrudes (set the minimum extrude temperature)
#endif #endif
case 303: // M303: PID autotune case 303: M303(); break; // M303: PID autotune
M303();
break;
#if ENABLED(MORGAN_SCARA) #if ENABLED(MORGAN_SCARA)
case 360: if (M360()) return; break; // M360: SCARA Theta pos1 case 360: if (M360()) return; break; // M360: SCARA Theta pos1
@ -575,30 +490,18 @@ void GcodeSuite::process_parsed_command() {
#endif #endif
#if ENABLED(FILAMENT_WIDTH_SENSOR) #if ENABLED(FILAMENT_WIDTH_SENSOR)
case 404: // M404: Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or display nominal filament width case 404: M404(); break; // M404: Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or display nominal filament width
M404(); case 405: M405(); break; // M405: Turn on filament sensor for control
break; case 406: M406(); break; // M406: Turn off filament sensor for control
case 405: // M405: Turn on filament sensor for control case 407: M407(); break; // M407: Display measured filament diameter
M405(); #endif
break;
case 406: // M406: Turn off filament sensor for control
M406();
break;
case 407: // M407: Display measured filament diameter
M407();
break;
#endif // FILAMENT_WIDTH_SENSOR
#if HAS_LEVELING #if HAS_LEVELING
case 420: // M420: Enable/Disable Bed Leveling case 420: M420(); break; // M420: Enable/Disable Bed Leveling
M420();
break;
#endif #endif
#if HAS_MESH #if HAS_MESH
case 421: // M421: Set a Mesh Bed Leveling Z coordinate case 421: M421(); break; // M421: Set a Mesh Bed Leveling Z coordinate
M421();
break;
#endif #endif
#if HAS_M206_COMMAND #if HAS_M206_COMMAND
@ -620,21 +523,17 @@ void GcodeSuite::process_parsed_command() {
#endif #endif
#if HAS_BED_PROBE #if HAS_BED_PROBE
case 851: // M851: Set Z Probe Z Offset case 851: M851(); break; // M851: Set Z Probe Z Offset
M851(); #endif
break;
#endif // HAS_BED_PROBE
#if ENABLED(SKEW_CORRECTION_GCODE) #if ENABLED(SKEW_CORRECTION_GCODE)
case 852: // M852: Set Skew factors case 852: M852(); break; // M852: Set Skew factors
M852();
break;
#endif #endif
#if ENABLED(ADVANCED_PAUSE_FEATURE) #if ENABLED(ADVANCED_PAUSE_FEATURE)
case 600: M600(); break; // M600: Pause for Filament Change case 600: M600(); break; // M600: Pause for Filament Change
case 603: M603(); break; // M603: Configure Filament Change case 603: M603(); break; // M603: Configure Filament Change
#endif // ADVANCED_PAUSE_FEATURE #endif
#if ENABLED(DUAL_X_CARRIAGE) || ENABLED(DUAL_NOZZLE_DUPLICATION_MODE) #if ENABLED(DUAL_X_CARRIAGE) || ENABLED(DUAL_NOZZLE_DUPLICATION_MODE)
case 605: M605(); break; // M605: Set Dual X Carriage movement mode case 605: M605(); break; // M605: Set Dual X Carriage movement mode
@ -653,7 +552,7 @@ void GcodeSuite::process_parsed_command() {
case 907: M907(); break; // M907: Set digital trimpot motor current using axis codes. case 907: M907(); break; // M907: Set digital trimpot motor current using axis codes.
#if HAS_DIGIPOTSS || ENABLED(DAC_STEPPER_CURRENT) #if HAS_DIGIPOTSS || ENABLED(DAC_STEPPER_CURRENT)
case 908: M908(); break; // M908: Control digital trimpot directly. case 908: M908(); break; // M908: Control digital trimpot directly.
#if ENABLED(DAC_STEPPER_CURRENT) // As with Printrbot RevF #if ENABLED(DAC_STEPPER_CURRENT)
case 909: M909(); break; // M909: Print digipot/DAC current value case 909: M909(); break; // M909: Print digipot/DAC current value
case 910: M910(); break; // M910: Commit digipot/DAC value to external EEPROM case 910: M910(); break; // M910: Commit digipot/DAC value to external EEPROM
#endif #endif
@ -686,9 +585,7 @@ void GcodeSuite::process_parsed_command() {
case 355: M355(); break; // M355: Set case light brightness case 355: M355(); break; // M355: Set case light brightness
#if ENABLED(DEBUG_GCODE_PARSER) #if ENABLED(DEBUG_GCODE_PARSER)
case 800: case 800: parser.debug(); break; // M800: GCode Parser Test for M
parser.debug(); // GCode Parser Test for M
break;
#endif #endif
#if ENABLED(I2C_POSITION_ENCODERS) #if ENABLED(I2C_POSITION_ENCODERS)