--- a/ptz_tracker_modular/postprocess.py +++ b/ptz_tracker_modular/postprocess.py @@ -4619,10 +4619,33 @@ if useful_cmd > 0.0: # A useful-pulse caller revalidates its entire framing envelope on # every frame. Never turn one accepted pulse into 10 -> 5 -> 1. + below_useful = float(zoom_cmd) < useful_cmd - 1e-9 + same_native = False + if below_useful and ( + pulse_kind == st.get("zoom_step_pending_kind") == "normal" + and pulse_timing is not None + and optics_observed_now is not None + and max(float(now), float(optics_observed_now)) < pulse_until + and not st.get("zoom_stop_obligation_active", False) + and st.get("zoom_step_stop_started", False) + and st.get("zoom_step_stop_timer") is not None + and st.get("zoom_step_stop_source") == "track" + and st.get("zoom_step_stop_direction") == 1 + and st.get("zoom_step_stop_generation") == st.get("ptz_generation") + ): + # A newly authorized fraction in the same native bucket + # sends the same lens speed for the original owned pulse. + native = _zoom_speed_to_int(useful_cmd) + same_native = ( + 10 <= native <= 12 + and _zoom_speed_to_int(zoom_cmd) == native + and _zoom_speed_to_int(pulse_floor) == native + and _zoom_native_pending_matches(st, native) + ) if ( not math.isfinite(float(pulse_floor)) or float(pulse_floor) <= 0.0 - or float(zoom_cmd) < useful_cmd - 1e-9 + or (below_useful and not same_native) or float(getattr(config, "ZOOM_STEP_MAX_IN_CMD", 0.12)) < useful_cmd ): _finish_zoom_step(st, now, stable_key=stable_key)