diff --git a/docs/release-notes.rst b/docs/release-notes.rst index 1d4a4ac..979560b 100644 --- a/docs/release-notes.rst +++ b/docs/release-notes.rst @@ -20,6 +20,7 @@ Improvements - Sequencer logic now handles exceptions raised on sequence abort. GUI will no longer hang when a test raises an exception during a test abort. - Fix bug where DSOX1202G appeared to hang both the program and scope - LCR Driver now supports instruments reporting as Keysight or Agilent. Newer models of the LCR meter report as Keysight, whereas older models report as Agilent. +- Jig switching fix to force sending the reset signal regardless of presumed jig state ************* Version 0.6.4 diff --git a/src/fixate/_switching.py b/src/fixate/_switching.py index f9209d7..9e45396 100644 --- a/src/fixate/_switching.py +++ b/src/fixate/_switching.py @@ -619,13 +619,13 @@ def _do_pending_updates(self) -> None: time.sleep(collated.minimum_change_time) self._dispatch_pin_state(collated.final) - def _dispatch_pin_state(self, new_state: PinSetState) -> None: + def _dispatch_pin_state(self, new_state: PinSetState, force: bool = False) -> None: # check all pins actually have an address handler to send to if unknown_pins := (new_state.on | new_state.off) - self._all_pins: raise ValueError(f"Can't switch unknown pin(s) {', '.join(unknown_pins)}.") new_active_pins = (self._active_pins | new_state.on) - new_state.off - if new_active_pins != self._active_pins: + if (new_active_pins != self._active_pins) | force: self._active_pins = new_active_pins for pin_set, handler in self._handler_pin_sets: # Note that we might send an empty set here. We need to do that @@ -645,7 +645,7 @@ def reset(self) -> None: possible the state of each VirtualMux and its related pins will not be in sync. """ - self._dispatch_pin_state(PinSetState(off=self._all_pins)) + self._dispatch_pin_state(PinSetState(off=self._all_pins), force=True) def update_input(self) -> None: """ @@ -743,6 +743,9 @@ def reset(self) -> None: """ Reset all VirtualMux's to the default signal "" (all pins off) """ + # first reset the virtual map of pins to a known default state + self.virtual_map.reset() + # now reset the muxes to ensure the virtual map and muxes are synced self.mux.reset() def _validate(self) -> None: