From fdf33ce4a88d0e51529a973c8541417c6234fdff Mon Sep 17 00:00:00 2001 From: Joe Knapper Date: Thu, 12 Feb 2026 13:48:12 +0000 Subject: [PATCH] Apply suggestions from code review of branch flash-led-sim Co-authored-by: Julian Stirling --- .../things/camera/simulation.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/openflexure_microscope_server/things/camera/simulation.py b/src/openflexure_microscope_server/things/camera/simulation.py index a8a00862..36dc600a 100644 --- a/src/openflexure_microscope_server/things/camera/simulation.py +++ b/src/openflexure_microscope_server/things/camera/simulation.py @@ -140,7 +140,8 @@ class SimulatedCamera(BaseCamera): self._capture_thread: Optional[Thread] = None self._capture_enabled = False self.generate_sprites() - self.mult = 1 + # Whether the LED is on + self.led_on = True repeating: bool = lt.property(default=False) @@ -342,17 +343,14 @@ class SimulatedCamera(BaseCamera): def set_led(self, led_on: bool = True) -> None: """Set the simulated LED to on or off.""" - if led_on: - self.mult = 1 - else: - self.mult = 0 + self.led_on = led_on def generate_frame(self) -> Image.Image: """Generate a frame with blobs based on the stage coordinates.""" pos = self._stage.instantaneous_position frame = self.generate_image((pos["y"], pos["x"], pos["z"])) # Simulate LED turning off by setting all channels to 0 - if self.mult == 0: + if not self.led_on: return Image.new(frame.mode, frame.size, 0) return frame