Skip to content

fix(macros): Fix extrusion mode, error handling and Klipper compatibility - #67

Open
AlexandrTyshchenko wants to merge 1 commit into
frap129:mainfrom
AlexandrTyshchenko:fix-macros
Open

AlexandrTyshchenko wants to merge 1 commit into
frap129:mainfrom
AlexandrTyshchenko:fix-macros

Conversation

@AlexandrTyshchenko

Copy link
Copy Markdown
Contributor
  • TIP_FORMING / M603 assumed relative extrusion but never set M83. In absolute mode (Klipper's default after a restart) the "retraction" re-extruded 9.4 mm (-15, +9.4, +4.0, +0.8) and the cooling moves swung 20 mm instead of 10. Now M83 is set and the previous gcode state is restored afterwards (SAVE_GCODE_STATE/RESTORE_GCODE_STATE).
  • _ERROR called CANCEL_PRINT, but the rest of the already-running PRINT_START (homing, heating, mesh, purge) continued. It now raises an error (action_raise_error), which stops the macro; during a print virtual_sdcard then runs on_error_gcode: CANCEL_PRINT.
  • PRINT_END (also run by CANCEL_PRINT) moved Z/XY even when not homed, failing with "Must home axis first" before BASE_CANCEL_PRINT ran. Moves are now skipped unless xyz is homed.
  • PRINT_START with BED=0 waited forever for the bed to reach 0 °C (MINIMUM=0 MAXIMUM=0). The wait is skipped when the bed is off.
  • M204 override removed: SET_VELOCITY_LIMIT ACCEL_TO_DECEL was removed from Klipper (Config_Changes 20250811), so every slicer M204 dumped the velocity limits to the console. Klipper's native M204 handles S and min(P,T).
  • hall_filament_width_sensor: enable_flow_compensation: False. It defaults to True, so after ENABLE_FILAMENT_SENSORS the sensor sends M221 S100 every second and any flow override (e.g. the Fluidd slider) is reset. The option exists since Klipper 2026-04-08; OpenQ1 already needs newer Klipper for qidi_auto_z_offset.

Testing: rendered the macros with Klipper's Jinja2 settings and emulated the extruder position for M82/M83/G92/SAVE/RESTORE, on main and on this branch: TIP_FORMING/M603 from M82 now give -15, -5.6, -1.6, -0.8, ±10 cooling, then -90, and return to M82; PRINT_START without an offset stops before G28/heating; PRINT_END renders no moves when unhomed; no bed wait with BED=0. Not tested on hardware.

…lity

- TIP_FORMING and M603 assumed relative extrusion but never set M83.
  In absolute mode (Klipper's default after a restart) the retraction
  re-extruded 9.4mm and the cooling moves swung 20mm. Use M83 and
  restore the previous gcode state afterwards.
- _ERROR called CANCEL_PRINT, but the rest of PRINT_START (homing,
  heating, mesh, purge) kept running. Raise an error instead, which
  stops the macro and lets on_error_gcode cancel the print.
- PRINT_END (also run by CANCEL_PRINT) moved Z/XY even when not homed,
  failing with "Must home axis first" before BASE_CANCEL_PRINT ran.
- PRINT_START waited for the bed to reach 0C forever with BED=0.
- Remove the M204 override: SET_VELOCITY_LIMIT ACCEL_TO_DECEL was
  removed from Klipper (20250811), so every M204 dumped the velocity
  limits to the console. Klipper's own M204 handles S and P/T.
- hall_filament_width_sensor: set enable_flow_compensation: False
  (Klipper 2026-04-08+), otherwise it resets the flow rate to 100%
  every second once the sensor is enabled at print start.
@frap129

frap129 commented Oct 23, 2026

Copy link
Copy Markdown
Owner

"enable_flow_compensation" works fine for me, are you having any particular issues with it?

@AlexandrTyshchenko

Copy link
Copy Markdown
Contributor Author

It works in the sense that it doesn't break anything, but with this config it can't do anything except reset the flow. In Klipper the compensation window is nominal ± max_difference (hall_filament_width_sensor.py, min_diameter/max_diameter), so with max_difference: 0 it is exactly 1.75–1.75 mm. Every real reading falls outside it, and extrude_factor_update_event then sends M221 S100 once per second while the sensor is enabled (after ENABLE_FILAMENT_SENSORS in PRINT_START). So any flow change from the Fluidd slider or the slicer is reverted within a second. That's what #58 describes ("the value is set, but then again becomes 100%"). Setting enable_flow_compensation: False only stops that reset; runout detection is unaffected. Easy to check: start a print, set flow to 95% in Fluidd and watch it go back to 100%.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants