Skip to content

Commit 9205979

Browse files
author
Tamoor Shahid
committed
Fixed error
1 parent 8b32129 commit 9205979

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

src/blueapi/BlueapiComponents.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ type RunPlanButtonProps = {
4141
* Read the full visit path from the visit PV set by the beamline staff.
4242
* @returns {string} the full visit pV /dls/i24/data/{year}/{visit}
4343
*/
44-
function readVisitFromPv(): string {
44+
export function readVisitFromPv(): string {
4545
const fullVisitPath: RawValue = ReadPvRawValue({
4646
label: "visit",
4747
pv: "ca://BL24I-MO-IOC-13:GP100",
@@ -57,7 +57,7 @@ function readVisitFromPv(): string {
5757
* @param {string} visit The full visit path
5858
* @returns {string} Only the instrument session part of the visit path
5959
*/
60-
function parseInstrumentSession(visit: string): string {
60+
export function parseInstrumentSession(visit: string): string {
6161
let instrumentSession: string | undefined;
6262
if (visit === "not connected" || visit === "undefined") {
6363
const msg =

src/screens/OavMover.tsx

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ import { PvDescription } from "../pv/types";
3030
import { SelectionWithPlanRunner } from "../components/SelectionControl";
3131
import { BacklightPositions, ZoomLevels } from "../pv/enumPvValues";
3232
import oxfordChipDiagram from "../assets/Oxford Chip Diagram.excalidraw.svg";
33-
import { RunPlanButton } from "../blueapi/BlueapiComponents";
33+
import {
34+
parseInstrumentSession,
35+
readVisitFromPv,
36+
RunPlanButton,
37+
} from "../blueapi/BlueapiComponents";
3438

3539
const buttonStyle = {
3640
color: "white",
@@ -391,6 +395,9 @@ export function OavMover() {
391395
const [pixelsPerMicron, setPixelsPerMicron] = useState<number>(1.25);
392396
const theme = useTheme();
393397
const bgColor = theme.palette.background.paper;
398+
399+
const fullVisit = readVisitFromPv();
400+
394401
return (
395402
<div>
396403
<Grid2 container spacing={2} columns={12}>
@@ -412,11 +419,15 @@ export function OavMover() {
412419
"Not submitting plan while disconnected from PVs!"
413420
);
414421
} else {
422+
// This is an example but not useful for actual production use.
415423
submitAndRunPlanImmediately({
416424
planName: "gui_gonio_move_on_click",
417-
planParams: {
418-
position_px: [x_int, y_int],
419-
},
425+
planParams: { position_px: [x_int, y_int] },
426+
instrumentSession: parseInstrumentSession(fullVisit),
427+
}).catch((error) => {
428+
console.log(
429+
`Failed to run plan gui_gonio_move_on_click, see console and logs for full error. Reason: ${error}`
430+
);
420431
});
421432
}
422433
}}

0 commit comments

Comments
 (0)