Apply suggestions from code review of branch flash-led-sim

Co-authored-by: Julian Stirling <julian@julianstirling.co.uk>
This commit is contained in:
Joe Knapper 2026-02-11 10:19:19 +00:00
parent f05cb396c8
commit 676d34842a
4 changed files with 16 additions and 7 deletions

View file

@ -340,7 +340,7 @@ class SimulatedCamera(BaseCamera):
pl_img = Image.fromarray(np_img.astype("uint8"))
return pl_img.resize((self.shape[1], self.shape[0]), Image.Resampling.BILINEAR)
@lt.action
def set_led(self, led_on: bool = True) -> None:
def set_led(self, led_on: bool = True, led_channel: str = None) -> None: # noqa: ARG002
"""Set the simulated LED to on or off."""
if led_on:

View file

@ -5,8 +5,8 @@ from typing import Literal
import labthings_fastapi as lt
from .camera import BaseCamera
from .stage import BaseStage
from .camera import SimulatedCamera
from .stage import SangaboardThing
class Illumination(lt.Thing):
@ -27,7 +27,7 @@ class Illumination(lt.Thing):
class SangaIllumination(Illumination):
"""Illumination driven by a Sangaboard."""
_stage: BaseStage = lt.thing_slot()
_stage: SangaboardThing = lt.thing_slot()
@lt.action
def flash(
@ -51,7 +51,7 @@ class SangaIllumination(Illumination):
class SimulatorIllumination(Illumination):
"""Illumination control in the simulator."""
_cam: BaseCamera = lt.thing_slot()
_cam: SimulatedCamera = lt.thing_slot()
@lt.action
def flash(

View file

@ -173,7 +173,6 @@ class SangaboardThing(BaseStage):
sb.zero_position()
self.update_position()
@lt.action
def set_led(
self,
led_on: bool = True,

View file

@ -13,7 +13,7 @@
{{ $store.state.origin }}
</div>
<action-button
v-if="stageType"
v-if="illuminationType"
thing="illumination"
action="flash"
submit-label="Flash Illumination"
@ -46,6 +46,13 @@
{{ stageType }}
</div>
</div>
<div v-if="illuminationType">
<b>Illumination:</b>
<br />
<div>
{{ illuminationType }}
</div>
</div>
<hr />
</div>
@ -77,6 +84,9 @@ export default {
stageType() {
return this.thingAvailable("stage") ? this.thingDescription("stage").title : undefined;
},
illuminationType() {
return this.thingAvailable("illumination") ? this.thingDescription("illumination").title : undefined;
},
},
async mounted() {