diff --git a/src/openflexure_microscope_server/things/stage/__init__.py b/src/openflexure_microscope_server/things/stage/__init__.py index a42190c6..11c22097 100644 --- a/src/openflexure_microscope_server/things/stage/__init__.py +++ b/src/openflexure_microscope_server/things/stage/__init__.py @@ -166,6 +166,9 @@ class BaseStage(lt.Thing): ) """Used to convert coordinates between the program frame and the hardware frame.""" + calibration_required: bool = lt.setting(default=False) + """Whether calibration of the stage z axis is required.""" + def update_position(self) -> None: """Update the position property from the stage.""" # Copy the position before the move. @@ -535,3 +538,8 @@ class BaseStage(lt.Thing): This method provides the interface expected by the camera_stage_mapping. """ self.move_absolute(x=xyz_pos[0], y=xyz_pos[1], z=xyz_pos[2]) + + @lt.action + def mark_calibration_complete(self) -> None: + """Mark stage calibration as complete.""" + self.calibration_required = False diff --git a/src/openflexure_microscope_server/things/stage/sangaboard.py b/src/openflexure_microscope_server/things/stage/sangaboard.py index b8ad994c..ed34b41d 100644 --- a/src/openflexure_microscope_server/things/stage/sangaboard.py +++ b/src/openflexure_microscope_server/things/stage/sangaboard.py @@ -236,3 +236,6 @@ class SangaboardThing(BaseStage): self._sangaboard.query(f"{led_command} {on_brightness}") else: self._sangaboard.query(f"{led_command} 0") + + calibration_required: bool = lt.setting(default=True) + """By default, Sangaboard stage will require calibration of z direction.""" diff --git a/webapp/src/components/modalComponents/calibrationWizard.vue b/webapp/src/components/modalComponents/calibrationWizard.vue index 0eabd2f2..cc5993f0 100644 --- a/webapp/src/components/modalComponents/calibrationWizard.vue +++ b/webapp/src/components/modalComponents/calibrationWizard.vue @@ -28,7 +28,7 @@ diff --git a/webapp/src/components/modalComponents/calibrationWizardComponents/zMotorDirectionStep.vue b/webapp/src/components/modalComponents/calibrationWizardComponents/zMotorDirectionStep.vue index f7f3505b..23d73660 100644 --- a/webapp/src/components/modalComponents/calibrationWizardComponents/zMotorDirectionStep.vue +++ b/webapp/src/components/modalComponents/calibrationWizardComponents/zMotorDirectionStep.vue @@ -69,7 +69,7 @@ export default { }, mounted() { - this.$emit("awaiting-user", true); + this.checkCalibrationState(); }, methods: { @@ -94,7 +94,9 @@ export default { }, // Once a direction is selected, advance selectDir() { - this.$emit("advance"); + this.invokeAction("stage", "mark_calibration_complete").then(() => { + this.$emit("advance"); + }); }, // If motor moves clockwise, invert z direction, then progress to next step triggerClockwise() { @@ -102,6 +104,10 @@ export default { this.selectDir(); }); }, + async checkCalibrationState() { + const needsCal = await this.readThingProperty("stage", "calibration_required"); + this.$emit("awaiting-user", needsCal); + }, }, };