Add z-direction calibration action to sangaboard

This commit is contained in:
Julian Stirling 2026-07-07 15:11:30 +01:00
parent f68515b17d
commit 274f698fab
4 changed files with 74 additions and 27 deletions

View file

@ -21,13 +21,13 @@
src="/direction_AC.png"
alt="Anti-clockwise"
class="dir-image clickable"
@click="selectDir"
@click="reportDirection('anti-clockwise')"
/>
<button
class="uk-button uk-button-default uk-width-1-1 uk-button-primary"
type="button"
@click="selectDir"
@click="reportDirection('anti-clockwise')"
>
Anti-clockwise
</button>
@ -39,13 +39,13 @@
src="/direction_CW.png"
alt="Clockwise"
class="dir-image clickable"
@click="triggerClockwise"
@click="reportDirection('clockwise')"
/>
<button
class="uk-button uk-button-default uk-width-1-1 uk-button-primary"
type="button"
@click="triggerClockwise"
@click="reportDirection('clockwise')"
>
Clockwise
</button>
@ -68,7 +68,7 @@ export default {
};
},
mounted() {
async mounted() {
this.checkCalibrationState();
},
@ -92,20 +92,25 @@ export default {
}
this.invokeAction("stage", "jog", { stop: true });
},
// Once a direction is selected, advance
selectDir() {
this.invokeAction("stage", "mark_calibration_complete").then(() => {
this.$emit("advance");
});
},
// If motor moves clockwise, invert z direction, then progress to next step
triggerClockwise() {
this.invokeAction("stage", "invert_axis_direction", { axis: "z" }).then(() => {
this.selectDir();
});
/**
* Report the direction to the microscope then advance to next pane in wizard.
*/
async reportDirection(direction) {
await this.invokeAction("stage", "calibrate_z_direction", { positive_motion: direction });
this.$emit("advance");
},
async checkCalibrationState() {
const needsCal = await this.readThingProperty("stage", "calibration_required");
let needsCal = await this.readThingProperty("stage", "calibration_required");
if (needsCal) {
// If it needs calibration check the relevant calibration action exists.
const actions = this.thingDescription("stage").actions;
if (!("calibrate_z_direction" in actions)) {
console.error(
"Stage is requesting calibration but has no 'calibrate_z_direction' action",
);
needsCal = false;
}
}
this.$emit("awaiting-user", needsCal);
},
},

View file

@ -133,4 +133,17 @@ export const componentOverrides = {
"cameraCalibrationSettings.vue": {
props: { cameraUri: "" },
},
"zMotorDirectionStep.vue": {
mocks: {
thingDescription: () => ({
properties: {
test_property_1: {},
test_property_2: {},
},
actions: {
calibrate_z_direction: {},
},
}),
},
},
};