From 4e041a0897c3398438c7d51843ea02df02dd4e36 Mon Sep 17 00:00:00 2001 From: Oleksandr Shyshatskyi Date: Mon, 31 Aug 2026 23:25:28 +0300 Subject: [PATCH] A failed pre-flight check must not leak the PARK= override _probe wrote the PARK= argument into self.park before running the pre-flight checks, but the restore sat in the finally inside _guarded -- so a probe refused for a cold extruder or unhomed axes kept the override. FF_PA_PROBE PARK=0 followed by any refusal would silently turn parking off for every later FF_PA_CALIBRATE, landing the gram on the plate instead of down the chute. The override now goes on inside its own try/finally that covers the checks too, with the rest of the probe split into _probe_inner. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01UBzgZQiUiARJcG1NupWgY2 --- .../payload/klipper/klippy/extras/ff_pa.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/pkgs/klipper/payload/klipper/klippy/extras/ff_pa.py b/pkgs/klipper/payload/klipper/klippy/extras/ff_pa.py index c533f35..7b42a9b 100644 --- a/pkgs/klipper/payload/klipper/klippy/extras/ff_pa.py +++ b/pkgs/klipper/payload/klipper/klippy/extras/ff_pa.py @@ -923,9 +923,19 @@ class FFPA: raise gcmd.error("%s: PA='%s' is not a number" % (self.name, pa_text)) y = gcmd.get_float('Y', self.y_start) + # PARK= is a per-invocation override of a persistent default, so it + # must be undone on EVERY exit -- including a refusal from the checks + # below, which run before _guarded gets a finally in place. Leaking it + # would flip what the next FF_PA_CALIBRATE does with its gram. saved_park = self.park - self.park = bool(gcmd.get_int('PARK', int(self.park), - minval=0, maxval=1)) + try: + self.park = bool(gcmd.get_int('PARK', int(self.park), + minval=0, maxval=1)) + self._probe_inner(gcmd, y, pa_text) + finally: + self.park = saved_park + + def _probe_inner(self, gcmd, y, pa_text): tool = self._resolve_tool(gcmd) self._check_homed(gcmd) self._check_filament(gcmd, tool) @@ -951,7 +961,6 @@ class FFPA: raise gcmd.error("%s: %s" % (self.name, err)) finally: self.y_start = saved_y - self.park = saved_park if self.dry_run: return extra = ''