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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UBzgZQiUiARJcG1NupWgY2
This commit is contained in:
Oleksandr ShyshatskyiandClaude Fable 5 committed 2026-08-31 23:25:28 +03:00
1 parent 8cd284d3ee
commit 4e041a0897
1 file changed
+12 -3
@@ -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 = ''