Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/blueapi/BlueapiComponents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ type RunPlanButtonProps = {
* Read the full visit path from the visit PV set by the beamline staff.
* @returns {string} the full visit pV /dls/i24/data/{year}/{visit}
*/
function readVisitFromPv(): string {
export function readVisitFromPv(): string {
const fullVisitPath: RawValue = ReadPvRawValue({
label: "visit",
pv: "ca://BL24I-MO-IOC-13:GP100",
Expand All @@ -57,7 +57,7 @@ function readVisitFromPv(): string {
* @param {string} visit The full visit path
* @returns {string} Only the instrument session part of the visit path
*/
function parseInstrumentSession(visit: string): string {
export function parseInstrumentSession(visit: string): string {
let instrumentSession: string | undefined;
if (visit === "not connected" || visit === "undefined") {
const msg =
Expand Down
19 changes: 15 additions & 4 deletions src/screens/OavMover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ import { PvDescription } from "../pv/types";
import { SelectionWithPlanRunner } from "../components/SelectionControl";
import { BacklightPositions, ZoomLevels } from "../pv/enumPvValues";
import oxfordChipDiagram from "../assets/Oxford Chip Diagram.excalidraw.svg";
import { RunPlanButton } from "../blueapi/BlueapiComponents";
import {
parseInstrumentSession,
readVisitFromPv,
RunPlanButton,
} from "../blueapi/BlueapiComponents";

const buttonStyle = {
color: "white",
Expand Down Expand Up @@ -391,6 +395,9 @@ export function OavMover() {
const [pixelsPerMicron, setPixelsPerMicron] = useState<number>(1.25);
const theme = useTheme();
const bgColor = theme.palette.background.paper;

const fullVisit = readVisitFromPv();

return (
<div>
<Grid2 container spacing={2} columns={12}>
Expand All @@ -412,11 +419,15 @@ export function OavMover() {
"Not submitting plan while disconnected from PVs!"
);
} else {
// This is an example but not useful for actual production use.
submitAndRunPlanImmediately({
planName: "gui_gonio_move_on_click",
planParams: {
position_px: [x_int, y_int],
},
planParams: { position_px: [x_int, y_int] },
instrumentSession: parseInstrumentSession(fullVisit),
}).catch((error) => {
console.log(
`Failed to run plan gui_gonio_move_on_click, see console and logs for full error. Reason: ${error}`
);
});
}
}}
Expand Down