Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change ATMCS m3PortSelected mapping #382

Merged
merged 1 commit into from
Jul 18, 2022
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
6 changes: 3 additions & 3 deletions love/src/Config.js
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,9 @@ export const m3RotatorStateMap = {
};

export const m3PortSelectedStateMap = {
1: 'NASMITH1',
2: 'NASMITH2',
3: 'PORT3',
6: 'NASMITH1',
7: 'NASMITH2',
8: 'PORT3',
0: 'UNKNOWN',
};

Expand Down
25 changes: 14 additions & 11 deletions love/src/components/AuxTel/Mount/LightPath.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ import StatusText from '../../GeneralPurpose/StatusText/StatusText';
import CurrentTargetValue from '../../GeneralPurpose/CurrentTargetValue/CurrentTargetValue';
import Limits from '../../GeneralPurpose/Limits/Limits';

const M3PORTNASMITH1 = 6;
const M3PORTNASMITH2 = 7;

export default class LightPath extends Component {
componentDidMount = () => {
this.props.subscribeToStream();
Expand Down Expand Up @@ -194,7 +197,7 @@ export default class LightPath extends Component {
const m3InPosition = this.props.m3InPosition;

const m3StateText = m3RotatorStateMap[m3State];
const m3PortSelectedText = m3PortSelectedStateMap[portSelected] || m3PortSelectedStateMap[0];
const m3PortSelectedText = m3PortSelectedStateMap[portSelected] ?? m3PortSelectedStateMap[0];
let m3InPositionState = 0; // UNKNOWN
if (m3InPosition !== 0) {
m3InPositionState = m3InPosition ? 2 : 1; // IN POSITION : NOT READY
Expand Down Expand Up @@ -303,7 +306,7 @@ export default class LightPath extends Component {
}
const nasmyth1RotatorInPositionText = nasmythRotatorInPositionStateMap[nasmyth1RotatorInPositionState];
let nasmyth1Class = styles[stateToStyleLightpath[nasmyth1RotatorInPositionText]];
if (m3PortSelected !== 1) nasmyth1Class = styles.disabled;
if (m3PortSelected !== M3PORTNASMITH1) nasmyth1Class = styles.disabled;
const mountEncoders = props.mountEncoders;
const target = props.target;
const mountRotator = {
Expand Down Expand Up @@ -391,7 +394,7 @@ export default class LightPath extends Component {
}
const nasmyth2RotatorInPositionText = nasmythRotatorInPositionStateMap[nasmyth2RotatorInPositionState];
let nasmyth2Class = styles[stateToStyleLightpath[nasmyth2RotatorInPositionText]];
if (m3PortSelected !== 2) nasmyth2Class = styles.disabled;
if (m3PortSelected !== M3PORTNASMITH2) nasmyth2Class = styles.disabled;
const mountEncoders = props.mountEncoders;
const target = props.target;
const mountRotator = {
Expand Down Expand Up @@ -519,8 +522,8 @@ export default class LightPath extends Component {
<path
className={styles.lightpath}
d={`M 40 24
L 45 ${portSelected === 2 ? higherHeight : lowerHeight}
L 55 ${portSelected === 1 ? higherHeight : lowerHeight}
L 45 ${portSelected === M3PORTNASMITH2 ? higherHeight : lowerHeight}
L 55 ${portSelected === M3PORTNASMITH1 ? higherHeight : lowerHeight}
L 60 24
L 40 24`}
></path>
Expand All @@ -535,16 +538,16 @@ export default class LightPath extends Component {
const lowerPort = 208;
const higherPort = 204;

if (portSelected !== 1 && portSelected !== 2) return null;
if (portSelected !== M3PORTNASMITH1 && portSelected !== M3PORTNASMITH2) return null;
return (
<svg viewBox="0 0 100 10" x={121.5 - 140 / 2} y={0} width={140} height={15}>
<path
className={styles.lightpath}
d={`M 45 ${portSelected === 2 ? higherHeight : lowerHeight}
L 55 ${portSelected === 1 ? higherHeight : lowerHeight}
L ${portSelected === 1 ? -11 : 111} ${portSelected === 1 ? higherPort : lowerPort}
L ${portSelected === 1 ? -11 : 111} ${portSelected === 2 ? higherPort : lowerPort}
L 45 ${portSelected === 2 ? higherHeight : lowerHeight}`}
d={`M 45 ${portSelected === M3PORTNASMITH2 ? higherHeight : lowerHeight}
L 55 ${portSelected === M3PORTNASMITH1 ? higherHeight : lowerHeight}
L ${portSelected === M3PORTNASMITH1 ? -11 : 111} ${portSelected === M3PORTNASMITH1 ? higherPort : lowerPort}
L ${portSelected === M3PORTNASMITH1 ? -11 : 111} ${portSelected === M3PORTNASMITH2 ? higherPort : lowerPort}
L 45 ${portSelected === M3PORTNASMITH2 ? higherHeight : lowerHeight}`}
></path>
</svg>
);
Expand Down