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) {
case 'G': switch (parser.codenum) {
// G0, G1
case 0:
case 1:
case 0: case 1: G0_G1( // G0: Fast Move, G1: Linear Move
#if IS_SCARA
G0_G1(parser.codenum == 0);
#else
G0_G1();
parser.codenum == 0
#endif
);
break;
// G2, G3
#if ENABLED(ARC_SUPPORT) && DISABLED(SCARA)
case 2: // G2: CW ARC
case 3: // G3: CCW ARC
G2_G3(parser.codenum == 2);
break;
case 2: case 3: G2_G3(parser.codenum == 2); break; // G2: CW ARC, G3: CCW ARC
#endif
// G4 Dwell
case 4:
G4();
break;
case 4: G4(); break; // G4: Dwell
#if ENABLED(BEZIER_CURVE_SUPPORT)
case 5: // G5: Cubic B_spline
G5();
break;
#endif // BEZIER_CURVE_SUPPORT
case 5: G5(); break; // G5: Cubic B_spline
#endif
#if ENABLED(FWRETRACT)
case 10: // G10: retract
G10();
break;
case 11: // G11: retract_recover
G11();
break;
#endif // FWRETRACT
case 10: G10(); break; // G10: Retract / Swap Retract
case 11: G11(); break; // G11: Recover / Swap Recover
#endif
#if ENABLED(NOZZLE_CLEAN_FEATURE)
case 12:
G12(); // G12: Nozzle Clean
break;
#endif // NOZZLE_CLEAN_FEATURE
case 12: G12(); break; // G12: Nozzle Clean
#endif
#if ENABLED(CNC_WORKSPACE_PLANES)
case 17: // G17: Select Plane XY
G17();
break;
case 18: // G18: Select Plane ZX
G18();
break;
case 19: // G19: Select Plane YZ
G19();
break;
#endif // CNC_WORKSPACE_PLANES
case 17: G17(); break; // G17: Select Plane XY
case 18: G18(); break; // G18: Select Plane ZX
case 19: G19(); break; // G19: Select Plane YZ
#endif
#if ENABLED(INCH_MODE_SUPPORT)
case 20: // G20: Inch Mode
G20();
break;
case 21: // G21: MM Mode
G21();
break;
#endif // INCH_MODE_SUPPORT
case 20: G20(); break; // G20: Inch Mode
case 21: G21(); break; // G21: MM Mode
#endif
#if ENABLED(G26_MESH_VALIDATION)
case 26: // G26: Mesh Validation Pattern generation
G26();
break;
#endif // AUTO_BED_LEVELING_UBL
case 26: G26(); break; // G26: Mesh Validation Pattern generation
#endif
#if ENABLED(NOZZLE_PARK_FEATURE)
case 27: // G27: Nozzle Park
G27();
break;
#endif // NOZZLE_PARK_FEATURE
case 27: G27(); break; // G27: Nozzle Park
#endif
case 28: // G28: Home all axes, one at a time
G28(false);
break;
case 28: G28(false); break; // G28: Home all axes, one at a time
#if HAS_LEVELING
case 29: // G29 Detailed Z probe, probes the bed at 3 or more points,
// or provides access to the UBL System if enabled.
G29();
break;
#endif // HAS_LEVELING
case 29: G29(); break; // G29: Bed leveling calibration
#endif
#if HAS_BED_PROBE
case 30: // G30 Single Z probe
G30();
break;
case 30: G30(); break; // G30: Single Z probe
#if ENABLED(Z_PROBE_SLED)
case 31: // G31: dock the sled
G31();
break;
case 32: // G32: undock the sled
G32();
break;
#endif // Z_PROBE_SLED
#endif // HAS_BED_PROBE
case 31: G31(); break; // G31: dock the sled
case 32: G32(); break; // G32: undock the sled
#endif
#endif
#if ENABLED(DELTA_AUTO_CALIBRATION)
case 33: // G33: Delta Auto-Calibration
G33();
break;
#endif // DELTA_AUTO_CALIBRATION
case 33: G33(); break; // G33: Delta Auto-Calibration
#endif
#if ENABLED(G38_PROBE_TARGET)
case 38: // G38.2 & G38.3
@ -264,25 +212,17 @@ void GcodeSuite::process_parsed_command() {
break;
#endif
case 90: // G90
relative_mode = false;
break;
case 91: // G91
relative_mode = true;
break;
case 90: relative_mode = false; break; // G90: Relative Mode
case 91: relative_mode = true; break; // G91: Absolute Mode
case 92: // G92 - Set current axis position(s)
G92();
break;
case 92: G92(); break; // G92: Set current axis position(s)
#if HAS_MESH
case 42: G42(); break; // G42: Coordinated move to a mesh point
#endif
#if ENABLED(DEBUG_GCODE_PARSER)
case 800:
parser.debug(); // GCode Parser Test for G
break;
case 800: parser.debug(); break; // G800: GCode Parser Test for G
#endif
}
break;
@ -290,21 +230,16 @@ void GcodeSuite::process_parsed_command() {
case 'M': switch (parser.codenum) {
#if HAS_RESUME_CONTINUE
case 0: // M0: Unconditional stop - Wait for user button press on LCD
case 1: // M1: Conditional stop - Wait for user button press on LCD
M0_M1();
break;
#endif // ULTIPANEL
case 1: M0_M1(); break; // M1: Conditional stop - Wait for user button press on LCD
#endif
#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 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
#endif
case 17: // M17: Enable all stepper motors
M17();
break;
case 17: M17(); break; // M17: Enable all stepper motors
#if ENABLED(SDSUPPORT)
case 20: M20(); break; // M20: list SD card
@ -332,7 +267,6 @@ void GcodeSuite::process_parsed_command() {
#endif // SDSUPPORT
case 31: M31(); break; // M31: Report time since the start of SD print or last M109
case 42: M42(); break; // M42: Change pin state
#if ENABLED(PINS_DEBUGGING)
@ -365,9 +299,7 @@ void GcodeSuite::process_parsed_command() {
case 104: M104(); break; // M104: Set hot end temperature
case 109: M109(); break; // M109: Wait for hotend temperature to reach target
case 110: M110(); break; // M110: Set Current Line Number
case 111: M111(); break; // M111: Set debug level
#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
#endif
case 105: // M105: Report current temperature
M105();
KEEPALIVE_STATE(NOT_BUSY);
return; // "ok" already printed
case 105: M105(); KEEPALIVE_STATE(NOT_BUSY); return; // M105: Report Temperatures (and say "ok")
#if ENABLED(AUTO_REPORT_TEMPERATURES) && HAS_TEMP_SENSOR
case 155: M155(); break; // M155: Set temperature auto-report interval
@ -420,25 +349,17 @@ void GcodeSuite::process_parsed_command() {
#if HAS_POWER_SWITCH
case 80: M80(); break; // M80: Turn on Power Supply
#endif
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 83: M83(); break; // M83: Set E axis relative mode
case 18: // M18 => M84
case 84: M18_M84(); break; // M84: Disable all steppers or set timeout
case 18: case 84: M18_M84(); break; // M18/M84: Disable Steppers / Set 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 114: M114(); break; // M114: Report current position
case 115: M115(); break; // M115: Report capabilities
case 117: M117(); break; // M117: Set LCD message text, if possible
case 118: M118(); break; // M118: Display a message in the host console
case 119: M119(); break; // M119: Report endstop states
case 120: M120(); break; // M120: Enable 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)
#if 0
case 202: M202(); break; // Not used for Sprinter/grbl gen6
case 202: M202(); break; // M202: Not used for Sprinter/grbl gen6
#endif
case 203: M203(); break; // M203: Set max feedrate (units/sec)
@ -494,23 +415,19 @@ void GcodeSuite::process_parsed_command() {
#if ENABLED(FWRETRACT)
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 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
case 211: M211(); break; // M211: Enable, Disable, and/or Report software endstops
#if HOTENDS > 1
case 218: // M218: Set a tool offset
M218();
break;
case 218: M218(); break; // M218: Set a tool offset
#endif
case 220: M220(); break; // M220: Set Feedrate Percentage: S<percent> ("FR" on your LCD)
case 221: // M221: Set Flow Percentage
M221();
break;
case 221: M221(); break; // M221: Set Flow Percentage
case 226: M226(); break; // M226: Wait until a pin reaches a state
#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)
#endif
case 303: // M303: PID autotune
M303();
break;
case 303: M303(); break; // M303: PID autotune
#if ENABLED(MORGAN_SCARA)
case 360: if (M360()) return; break; // M360: SCARA Theta pos1
@ -575,30 +490,18 @@ void GcodeSuite::process_parsed_command() {
#endif
#if ENABLED(FILAMENT_WIDTH_SENSOR)
case 404: // M404: Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or display nominal filament width
M404();
break;
case 405: // M405: Turn on filament sensor for control
M405();
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
case 404: M404(); break; // M404: Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or display nominal filament width
case 405: M405(); break; // M405: Turn on filament sensor for control
case 406: M406(); break; // M406: Turn off filament sensor for control
case 407: M407(); break; // M407: Display measured filament diameter
#endif
#if HAS_LEVELING
case 420: // M420: Enable/Disable Bed Leveling
M420();
break;
case 420: M420(); break; // M420: Enable/Disable Bed Leveling
#endif
#if HAS_MESH
case 421: // M421: Set a Mesh Bed Leveling Z coordinate
M421();
break;
case 421: M421(); break; // M421: Set a Mesh Bed Leveling Z coordinate
#endif
#if HAS_M206_COMMAND
@ -620,21 +523,17 @@ void GcodeSuite::process_parsed_command() {
#endif
#if HAS_BED_PROBE
case 851: // M851: Set Z Probe Z Offset
M851();
break;
#endif // HAS_BED_PROBE
case 851: M851(); break; // M851: Set Z Probe Z Offset
#endif
#if ENABLED(SKEW_CORRECTION_GCODE)
case 852: // M852: Set Skew factors
M852();
break;
case 852: M852(); break; // M852: Set Skew factors
#endif
#if ENABLED(ADVANCED_PAUSE_FEATURE)
case 600: M600(); break; // M600: Pause for 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)
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.
#if HAS_DIGIPOTSS || ENABLED(DAC_STEPPER_CURRENT)
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 910: M910(); break; // M910: Commit digipot/DAC value to external EEPROM
#endif
@ -686,9 +585,7 @@ void GcodeSuite::process_parsed_command() {
case 355: M355(); break; // M355: Set case light brightness
#if ENABLED(DEBUG_GCODE_PARSER)
case 800:
parser.debug(); // GCode Parser Test for M
break;
case 800: parser.debug(); break; // M800: GCode Parser Test for M
#endif
#if ENABLED(I2C_POSITION_ENCODERS)