Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STEAPP-921: fixed bugs in the wizards #249

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions klippy/extras/wizard/wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ def __init__(self, config):
self.type = config.get('type', 'any')
self.steps = config.getlists('steps', [])
self.current_step = self.steps[0]
self.next_step = self.steps[1] if len(self.steps) > 2 else self.steps[0]
# load objects
self.printer = printer = config.get_printer()
self.gcode = printer.lookup_object('gcode')
Expand All @@ -54,8 +53,7 @@ def get_status(self, eventtime=None):
'variables': self.variables,
'name': self.name,
'steps': self.steps,
'type': self.type,
'next_step': self.next_step}
'type': self.type}

cmd_SET_WIZARD_VARIABLE_help = "Set the value of a wizard variable to wizard"

Expand Down Expand Up @@ -89,17 +87,13 @@ def cmd_SET_WIZARD_STEP(self, gcmd):
if step not in self.steps:
raise gcmd.error("2053: Unknown step: '%s'" % step)
self.current_step = step
if self.current_step != self.steps[-1]:
current_step_idx = self.steps.index(self.current_step)
self.next_step = self.steps[current_step_idx + 1]

cmd_RESET_WIZARD_help = "Reset state the wizard"

def cmd_RESET_WIZARD(self, gcmd):
self.error = ''
self.enabled = False
self.current_step = self.steps[0]
self.next_step = self.steps[1] if len(self.steps) > 2 else self.steps[0]
self.variables = dict(self._variables_bk)


Expand Down
11 changes: 11 additions & 0 deletions klippy/extras/wizard/wizard_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,27 @@ def cmd(self, gcmd, gcode):
self.in_script = True
try:
if gcode == 'action_gcode':
kwparams['wizard']['next_step'] = self.get_next_step(kwparams)
self.template_action.run_gcode_from_command(kwparams)
elif gcode == 'cancel_gcode':
self.template_cancel.run_gcode_from_command(kwparams)
finally:
self.in_script = False

def get_next_step(self, kwparams):
steps = kwparams['wizard']['steps']
if self.name == steps[-1]:
next_step = steps[0]
else:
current_step_idx = steps.index(self.name)
next_step = steps[current_step_idx + 1]
return next_step

def get_status(self, eventtime):
return {
'loading': self.loading,
'placeholder': self.placeholder}


def load_config_prefix(config):
return WizardStep(config)
4 changes: 2 additions & 2 deletions stereotech_config/wizards/5d_calibration_auto.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ cancel_gcode:
[wizard_step CALIBRATE_5D_AUTO3]
image: wizards/5d_calibration_auto/auto_five_axis_level_04.jpg
description: Wizards.Common.ConnectAndCheck
placeholder: wizard-step-probe
placeholder: probe
action_gcode:
{% set cmd = 'CALIBRATE_MODULE_FIVE_D' %}
CHANGE_STEP_AND_WAIT_RUN_CMD WIZARD={wizard.name} STEP={wizard.next_step} CMD={cmd}
Expand All @@ -50,7 +50,7 @@ cancel_gcode:
image: wizards/5d_calibration_auto/auto_five_axis_level_05.jpg
description: Wizards.5DCalibrationAuto.Wait
countdown: 420
placeholder: waitProgress true
placeholder: сommand
action_gcode:
SET_WIZARD_STEP WIZARD={wizard.name} STEP={wizard.next_step}
cancel_gcode:
Expand Down
4 changes: 2 additions & 2 deletions stereotech_config/wizards/adjust_basement_auto.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ cancel_gcode:
[wizard_step ADJUST_BASEMENT_AUTO3]
image: wizards/5d_calibration_auto/auto_five_axis_level_04.jpg
description: Wizards.Common.ConnectAndCheck
placeholder: wizard-step-probe
placeholder: probe
action_gcode:
SET_WIZARD_STEP WIZARD={wizard.name} STEP={wizard.next_step}
cancel_gcode:
Expand Down Expand Up @@ -78,7 +78,7 @@ cancel_gcode:
[wizard_step ADJUST_BASEMENT_AUTO6]
image: wizards/5d_calibration_auto/auto_five_axis_level_03.jpg
description: Wizards.Common.DisableSensor
placeholder: waitProgress true
placeholder: сommand
action_gcode:
{% set wcs = wizard.variables.wcs %}
ADJUST_BASEMENT_WCS WCS={wcs}
Expand Down
2 changes: 1 addition & 1 deletion stereotech_config/wizards/adjust_basement_manual.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ cancel_gcode:
image: wizards/zero_point_setup/zero_point_setup.jpg
description: Wizards.Common.SelectMode
items: 5D_spiral, 5D_spiral_full
placeholder: wizard-step-probe
placeholder: probe
action_gcode:
{% set wcs = wizard.variables.wcs|int %}
MOVE_WCS_ZERO WCS={wcs}
Expand Down
2 changes: 1 addition & 1 deletion stereotech_config/wizards/bed_level.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ type: 3d
steps: BED_LEVEL0

[wizard_step_wizards BED_LEVEL0]
description: ChangeMaterialFilament.ManagersChoiceDescription
description: Wizards.ChangeMaterialFilament.ManagersChoiceDescription
wizards: BED_LEVEL_AUTO, BED_LEVEL_MANUAL
action_gcode:
# pass
Expand Down
6 changes: 3 additions & 3 deletions stereotech_config/wizards/bed_level_auto.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ steps: BED_LEVEL_MANUAL0, CLEAR_NOZZLE0, CLEAR_NOZZLE1, BED_LEVEL_MANUAL1, BED_L
[wizard_step_button BED_LEVEL_AUTO3]
image: wizards/bed_level_manual/bed_leveling04.jpg
description: Wizards.Common.WaitBedStop
placeholder: wizard-step-preheat
placeholder: preheat
action_gcode:
ABORT
ACCEPT_Z_ENDSTOP PROBE=1
Expand All @@ -28,7 +28,7 @@ cancel_gcode:
[wizard_step BED_LEVEL_AUTO5]
image: wizards/5d_calibration_auto/auto_five_axis_level_04.jpg
description: Wizards.Common.ConnectAndCheck
placeholder: wizard-step-probe
placeholder: probe
action_gcode:
{% set cmd = 'CALIBRATE_MODULE_THREE_D' %}
CHANGE_STEP_AND_WAIT_RUN_CMD WIZARD={wizard.name} STEP={wizard.next_step} CMD={cmd}
Expand All @@ -39,7 +39,7 @@ cancel_gcode:
image: wizards/bed_level_auto/auto_bed_leveling_02.jpg
description: Wizards.BedLevelAuto.Wait
countdown: 420
placeholder: waitProgress true
placeholder: сommand
action_gcode:
SET_WIZARD_STEP WIZARD={wizard.name} STEP={wizard.next_step}
cancel_gcode:
Expand Down
2 changes: 1 addition & 1 deletion stereotech_config/wizards/bed_level_manual.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ cancel_gcode:
[wizard_step_button BED_LEVEL_MANUAL3]
image: wizards/bed_level_manual/bed_leveling04.jpg
description: Wizards.Common.WaitBedStop
placeholder: wizard-step-preheat
placeholder: preheat
action_gcode:
ABORT
SET_WIZARD_STEP WIZARD={wizard.name} STEP={wizard.next_step}
Expand Down
8 changes: 4 additions & 4 deletions stereotech_config/wizards/change_material_fiber.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ cancel_gcode:
[wizard_step_button CHANGE_MATERIAL_FIBER3]
image: wizards/change_material/change_material03.jpg
description: Wizards.ChangeMaterialFiber.WaitHeater
placeholder: wizard-step-preheat
placeholder: preheat
action_gcode:
{% set selected_e = wizard.variables.selected_e %}
{% set cooldown_temp = wizard.variables.cooldown_temp %}
Expand All @@ -80,7 +80,7 @@ button_cut_gcode:
[wizard_step CHANGE_MATERIAL_FIBER4]
image: wizards/change_material/change_material.jpg
description: Wizards.ChangeMaterialFiber.InstallMaterialSpool
placeholder: wizard-step-preheat # COOL DOWN
placeholder: preheat # COOL DOWN
action_gcode:
{% set temperature = wizard.variables.temperature %}
{% set selected_e = wizard.variables.selected_e %}
Expand All @@ -91,7 +91,7 @@ cancel_gcode:
[wizard_step_button CHANGE_MATERIAL_FIBER5]
image: wizards/change_material/change_material04.jpg
description: Wizards.ChangeMaterialFiber.LoadPushPull
placeholder: wizard-step-preheat
placeholder: preheat
action_gcode:
SET_WIZARD_STEP WIZARD={wizard.name} STEP={wizard.next_step}
cancel_gcode:
Expand Down Expand Up @@ -121,7 +121,7 @@ cancel_gcode:
[wizard_step_button CHANGE_MATERIAL_FIBER7]
image: wizards/change_material/change_material04.jpg
description: Wizards.ChangeMaterialFiber.FiberFromNozzle
placeholder: wizard-step-preheat
placeholder: preheat
action_gcode:
SET_WIZARD_STEP WIZARD={wizard.name} STEP={wizard.next_step}
cancel_gcode:
Expand Down
24 changes: 12 additions & 12 deletions stereotech_config/wizards/change_material_filament.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ cancel_gcode:
[wizard_step_slider CHANGE_MATERIAL_FILAMENT4]
image: wizards/change_material/change_material02.jpg
description: Wizards.Common.SelectUnloadingTemperature
slider_slider1_min: 150
slider_slider1_max: 300
slider_slider1_step: 5
slider_slider1_default: 240
slider_set_temp_min: 150
slider_set_temp_max: 300
slider_set_temp_step: 5
slider_set_temp_default: 240
action_gcode:
{% set temperature = printer["wizard_step_slider " ~ wizard.wizard_step_name].slider1|float %}
{% set selected_e = wizard.variables.selected_e %}
Expand All @@ -84,7 +84,7 @@ cancel_gcode:
[wizard_step_button CHANGE_MATERIAL_FILAMENT5]
image: wizards/change_material/change_material03.jpg
description: Wizards.ChangeMaterialFilament.UnloadMaterial
placeholder: wizard-step-preheat
placeholder: preheat
action_gcode:
{% set action = wizard.variables.action %}
{% if action == 'remove' %}
Expand Down Expand Up @@ -119,10 +119,10 @@ cancel_gcode:
[wizard_step_slider CHANGE_MATERIAL_FILAMENT7]
image: wizards/change_material/change_material02.jpg
description: Wizards.Common.SelectLoadingTemperature
slider_slider1_min: 150
slider_slider1_max: 300
slider_slider1_step: 5
slider_slider1_default: 240
slider_set_temp_min: 150
slider_set_temp_max: 300
slider_set_temp_step: 5
slider_set_temp_default: 240
action_gcode:
{% set temperature = printer["wizard_step_slider " ~ wizard.wizard_step_name].slider1|float %}
{% set selected_e = wizard.variables.selected_e %}
Expand All @@ -133,7 +133,7 @@ cancel_gcode:
[wizard_step CHANGE_MATERIAL_FILAMENT8]
image: wizards/change_material/change_material.jpg
description: Wizards.ChangeMaterialFilament.LoadNewSpool
placeholder: wizard-step-preheat
placeholder: preheat
action_gcode:
{% set selected_e = wizard.variables.selected_e %}
{% set temperature = printer[selected_e].target|float %}
Expand All @@ -144,7 +144,7 @@ cancel_gcode:
[wizard_step_button CHANGE_MATERIAL_FILAMENT9]
image: wizards/change_material/change_material04.jpg
description: Wizards.ChangeMaterialFilament.PressLoad
placeholder: wizard-step-preheat
placeholder: preheat
action_gcode:
SET_WIZARD_STEP WIZARD={wizard.name} STEP=CHANGE_MATERIAL_FILAMENT11
cancel_gcode:
Expand All @@ -160,7 +160,7 @@ button_insert_gcode:
[wizard_step_button CHANGE_MATERIAL_FILAMENT10]
image: wizards/change_material/change_material04.jpg
description: Wizards.ChangeMaterialFilament.PressLoadFiber
placeholder: wizard-step-preheat
placeholder: preheat
action_gcode:
SET_WIZARD_STEP WIZARD={wizard.name} STEP={wizard.next_step}
cancel_gcode:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -------------------------------step 0

EXECUTE_WIZARD_STEP WIZARD=ALIGN_NOZZLES STEP=ALIGN_NOZZLES0
WIZARD_STEP_BUTTON WIZARD=ALIGN_NOZZLES STEP=ALIGN_NOZZLES0 BUTTON=calibarate_module
WIZARD_STEP_BUTTON WIZARD=ALIGN_NOZZLES STEP=ALIGN_NOZZLES0 BUTTON=calibrate_module
CANCEL_WIZARD_STEP WIZARD=ALIGN_NOZZLES STEP=ALIGN_NOZZLES0

# -------------------------------step 1
Expand Down
2 changes: 1 addition & 1 deletion stereotech_config/wizards/common.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ gcode:

[wizard_step CLEAR_NOZZLE0]
description: Wizards.ClearNozzle.WaitHeating
placeholder: wizard-step-preheat
placeholder: preheat
action_gcode:
RETRACT_MATERIAL
SET_WIZARD_STEP WIZARD={wizard.name} STEP={wizard.next_step}
Expand Down
2 changes: 1 addition & 1 deletion stereotech_config/wizards/nozzle_offset_5d.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ cancel_gcode:
[wizard_step NOZZLE_OFFSET_5D3]
image: wizards/5d_calibration_auto/auto_five_axis_level_04.jpg
description: Wizards.Common.ConnectAndCheck
placeholder: wizard-step-probe
placeholder: probe
action_gcode:
ADJUST_NOZZLE_OFFSET_Z
SET_WIZARD_STEP WIZARD={wizard.name} STEP={wizard.next_step}
Expand Down
2 changes: 1 addition & 1 deletion stereotech_config/wizards/nozzle_offset_fiber.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ cancel_gcode:
image: wizards/nozzle_offset/wait_for_print.jpg
description: Wizards.NozzleOffset.WaitForPrint
countdown: 1140
placeholder: wizard-step-preheat
placeholder: preheat
axes: z
steps: 0.05, 0.1, 1
default_step: 0.1
Expand Down
2 changes: 1 addition & 1 deletion stereotech_config/wizards/nozzle_offset_hybrid.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ cancel_gcode:
image: wizards/nozzle_offset/wait_for_print.jpg
description: Wizards.NozzleOffset.WaitForPrint
countdown: 540
placeholder: wizard-step-preheat
placeholder: preheat
axes: z
steps: 0.05, 0.1, 1
default_step: 0.1
Expand Down
6 changes: 3 additions & 3 deletions stereotech_config/wizards/nozzles_height_align_5d.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ action_gcode:
# 5d
SET_WIZARD_STEP WIZARD={wizard.name} STEP={wizard.next_step}
{% endif %}
button_calibarate_module_gcode:
button_calibrate_module_gcode:
{% if printer["gcode_button five_axis_module"].state == "RELEASED" %}
# 3d
{% if printer.probe %}
Expand Down Expand Up @@ -65,7 +65,7 @@ cancel_gcode:

[wizard_step ALIGN_NOZZLES3]
image: wizards/nozzle_offset/adjust_nozzle.jpg
description: AlignHeightNozzles5D.TightNozzle
description: Wizards.AlignHeightNozzles5D.TightNozzle
action_gcode:
G91
G0 Z30 F600
Expand All @@ -76,7 +76,7 @@ cancel_gcode:

[wizard_step ALIGN_NOZZLES4]
image: wizards/nozzle_offset/wait_for_print.jpg
description: AlignHeightNozzles5D.Completed
description: Wizards.AlignHeightNozzles5D.Completed
action_gcode:
RESET_WIZARD WIZARD={wizard.name} ABORT=0
cancel_gcode:
Expand Down
Loading