gcode: Split G0/G1 command handling to new gcode_move class

Split up the main GCodeParser class into GCodeDispatch and GCodeMove
classes.  The GCodeMove class is now available using the "gcode_move"
printer object name.  This split simplifies the gcode.py code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2020-08-05 11:43:45 -04:00
parent cd7c1b8e68
commit 4c5e93d51d
15 changed files with 219 additions and 194 deletions

View file

@ -83,7 +83,7 @@ text: { render("_heater_temperature", param_heater_name="heater_bed") }
position: 1, 10
text:
~feedrate~
{ "{:>4.0%}".format(printer.gcode.speed_factor) }
{ "{:>4.0%}".format(printer.gcode_move.speed_factor) }
[display_data _default_16x4 print_progress]
position: 2, 0
@ -164,7 +164,7 @@ text:
position: 2, 0
text:
~feedrate~
{ "{:^4.0%}".format(printer.gcode.speed_factor) }
{ "{:^4.0%}".format(printer.gcode_move.speed_factor) }
[display_data _default_20x4 print_progress]
position: 2, 8

View file

@ -96,7 +96,7 @@ name: Tune
[menu __main __tune __speed]
type: input
name: Speed: {'%3d' % (menu.input*100)}%
input: {printer.gcode.speed_factor}
input: {printer.gcode_move.speed_factor}
input_min: 0
input_max: 2
input_step: 0.01
@ -107,7 +107,7 @@ gcode:
[menu __main __tune __flow]
type: input
name: Flow: {'%3d' % (menu.input*100)}%
input: {printer.gcode.extrude_factor}
input: {printer.gcode_move.extrude_factor}
input_min: 0
input_max: 2
input_step: 0.01
@ -118,7 +118,7 @@ gcode:
[menu __main __tune __offsetz]
type: input
name: Offset Z:{'%05.3f' % menu.input}
input: {printer.gcode.homing_origin.z}
input: {printer.gcode_move.homing_origin.z}
input_min: -5
input_max: 5
input_step: 0.005
@ -260,7 +260,7 @@ name: Move 10mm
[menu __main __control __move_10mm __axis_x]
type: input
name: Move X:{'%05.1f' % menu.input}
input: {printer.gcode.gcode_position.x}
input: {printer.gcode_move.gcode_position.x}
input_min: 0
input_max: 200
input_step: 10.0
@ -273,7 +273,7 @@ gcode:
[menu __main __control __move_10mm __axis_y]
type: input
name: Move Y:{'%05.1f' % menu.input}
input: {printer.gcode.gcode_position.y}
input: {printer.gcode_move.gcode_position.y}
input_min: 0
input_max: 200
input_step: 10.0
@ -287,7 +287,7 @@ gcode:
type: input
enable: {not printer.idle_timeout.state == "Printing"}
name: Move Z:{'%05.1f' % menu.input}
input: {printer.gcode.gcode_position.z}
input: {printer.gcode_move.gcode_position.z}
input_min: 0
input_max: 200
input_step: 10.0
@ -320,7 +320,7 @@ name: Move 1mm
[menu __main __control __move_1mm __axis_x]
type: input
name: Move X:{'%05.1f' % menu.input}
input: {printer.gcode.gcode_position.x}
input: {printer.gcode_move.gcode_position.x}
input_min: 0
input_max: 200
input_step: 1.0
@ -333,7 +333,7 @@ gcode:
[menu __main __control __move_1mm __axis_y]
type: input
name: Move Y:{'%05.1f' % menu.input}
input: {printer.gcode.gcode_position.y}
input: {printer.gcode_move.gcode_position.y}
input_min: 0
input_max: 200
input_step: 1.0
@ -347,7 +347,7 @@ gcode:
type: input
enable: {not printer.idle_timeout.state == "Printing"}
name: Move Z:{'%05.1f' % menu.input}
input: {printer.gcode.gcode_position.z}
input: {printer.gcode_move.gcode_position.z}
input_min: 0
input_max: 200
input_step: 1.0
@ -380,7 +380,7 @@ name: Move 0.1mm
[menu __main __control __move_01mm __axis_x]
type: input
name: Move X:{'%05.1f' % menu.input}
input: {printer.gcode.gcode_position.x}
input: {printer.gcode_move.gcode_position.x}
input_min: 0
input_max: 200
input_step: 0.1
@ -393,7 +393,7 @@ gcode:
[menu __main __control __move_01mm __axis_y]
type: input
name: Move Y:{'%05.1f' % menu.input}
input: {printer.gcode.gcode_position.y}
input: {printer.gcode_move.gcode_position.y}
input_min: 0
input_max: 200
input_step: 0.1
@ -407,7 +407,7 @@ gcode:
type: input
enable: {not printer.idle_timeout.state == "Printing"}
name: Move Z:{'%05.1f' % menu.input}
input: {printer.gcode.gcode_position.z}
input: {printer.gcode_move.gcode_position.z}
input_min: 0
input_max: 200
input_step: 0.1
@ -677,7 +677,7 @@ gcode:
[menu __main __setup __calib __delta_calib_man __move_z]
type: input
name: Move Z: {'%03.2f' % menu.input}
input: {printer.gcode.gcode_position.z}
input: {printer.gcode_move.gcode_position.z}
input_step: 1
realtime: True
gcode: