Skip to content

Commit

Permalink
Add reslew stage to goto-field
Browse files Browse the repository at this point in the history
  • Loading branch information
albireox committed May 31, 2022
1 parent e08f2a8 commit 9e741a7
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
25 changes: 23 additions & 2 deletions src/renderer/views/HAL/goto_field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @License: BSD 3-clause (http://www.opensource.org/licenses/BSD-3-Clause)
*/

import { Box, Divider, Paper, Stack, Typography } from '@mui/material';
import { Box, Checkbox, Divider, FormControlLabel, Paper, Stack, Typography } from '@mui/material';
import React from 'react';
import { CommandButton } from 'renderer/components/commandButton';
import { MacroStageSelect } from 'renderer/components/macroStageSelect';
Expand All @@ -18,6 +18,7 @@ import MacroStepper from './macro_stepper';

export default function GotoFieldView(): JSX.Element | null {
const [guiderTime, setGuiderTime] = React.useState<any>(macros.goto_field.defaults.guider_time);
const [fixedAltAz, setFixedAltAz] = React.useState<boolean>(false);
const [commandString, setCommandString] = React.useState('hal goto-field');

const keywords = useKeywords(['jaeger.configuration_loaded']);
Expand All @@ -31,6 +32,14 @@ export default function GotoFieldView(): JSX.Element | null {
}
};

const getCommandString = () => {
let cmdString = `${commandString} --guider-time ${guiderTime || 15}`;
if (fixedAltAz) {
cmdString += ' --fixed-altaz';
}
return cmdString;
};

const checkConfiguration = async () => {
// If the design is cloned, show a confirmation dialog.

Expand Down Expand Up @@ -83,9 +92,21 @@ export default function GotoFieldView(): JSX.Element | null {
value={guiderTime}
onChange={(e) => setGuiderTime(e.target.value)}
/>
<FormControlLabel
control={
<Checkbox
sx={{ pl: 0 }}
checked={fixedAltAz}
disableRipple
onChange={(e) => setFixedAltAz(e.target.checked)}
size='small'
/>
}
label='Fix Alt/Az'
/>
<Box flexGrow={1} />
<CommandButton
commandString={`${commandString} --guider-time ${guiderTime || 15}`}
commandString={getCommandString()}
beforeCallback={checkConfiguration}
abortCommand='hal goto-field --stop'
size='medium'
Expand Down
7 changes: 4 additions & 3 deletions src/renderer/views/HAL/macros.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@
"stages": [
"slew",
"reconfigure",
"boss_hartmann",
"fvc",
"boss_arcs",
"reslew",
"boss_flat",
"boss_hartmann",
"boss_arcs",
"acquire",
"guide"
],
"precondition_stages": ["prepare"],
"cleanup_stages": ["cleanup"],
"concurrent": [["slew", "reconfigure"], ["fvc", "boss_arcs"]],
"concurrent": [["slew", "reconfigure"]],
"descriptions": {
"reconfigure": "Reconf.",
"boss_hartmann": "Hartmann",
Expand Down

0 comments on commit 9e741a7

Please sign in to comment.