Skip to content

Commit

Permalink
Added configuration for probe
Browse files Browse the repository at this point in the history
  • Loading branch information
breiler committed Apr 9, 2024
1 parent c828368 commit 791706a
Show file tree
Hide file tree
Showing 7 changed files with 1,761 additions and 1,602 deletions.
3,264 changes: 1,669 additions & 1,595 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@
"firebase": "^10.6.0",
"js-yaml": "^4.1.0",
"react": "^18.2.0",
"react-bootstrap": "^2.8.0",
"react-bootstrap": "^2.10.2",
"react-dom": "^18.2.0",
"react-error-boundary": "^4.0.10",
"react-markdown": "^8.0.7",
"remark-gfm": "^3.0.1",
"xterm": "^5.2.1",
"xterm-addon-fit": "^0.7.0"
"@xterm/xterm": "^5.5.0",
"@xterm/addon-fit": "^0.10.0"
}
}
6 changes: 3 additions & 3 deletions src/components/xterm/Xterm.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from "react";
import PropTypes from "prop-types";

import "xterm/css/xterm.css";
import "@xterm/xterm/css/xterm.css";

// We are using these as types.
// eslint-disable-next-line no-unused-vars
Expand All @@ -10,8 +10,8 @@ import {
ITerminalOptions,
ITerminalAddon,
ITerminalInitOnlyOptions
} from "xterm";
import { FitAddon } from "xterm-addon-fit";
} from "@xterm/xterm";
import { FitAddon } from "@xterm/addon-fit";

interface IProps {
/**
Expand Down
1 change: 1 addition & 0 deletions src/model/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ export type SDCard = {

export type Probe = {
pin?: string;
toolsetter_pin?: string;
check_mode_start?: boolean;
};

Expand Down
2 changes: 1 addition & 1 deletion src/pages/terminal/Terminal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import React, {
useEffect,
useState
} from "react";
import "xterm/css/xterm.css";
import "@xterm/xterm/css/xterm.css";
import Xterm from "../../components/xterm/Xterm";
import { SerialPortState } from "../../utils/serialport/SerialPort";
import { Button } from "react-bootstrap";
Expand Down
7 changes: 7 additions & 0 deletions src/panels/configuration/Configuration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import I2CGroup from "./groups/I2CGroup";
import OLEDGroup from "./groups/OLEDGroup";
import { deepMerge } from "../../utils/utils";
import ControlGroup from "./groups/ControlGroup";
import ProbeGroup from "./groups/ProbeGroup";

const DEFAULT_CONFIG: Config = {};

Expand Down Expand Up @@ -136,6 +137,12 @@ const Configuration = ({
setValue={(spi) => appendConfig({ spi })}
/>

<ProbeGroup
board={Boards[0]}
probe={config.probe}
setValue={(probe) => appendConfig({ probe })}
/>

<SDCardGroup
board={Boards[0]}
sdcard={config.sdcard}
Expand Down
77 changes: 77 additions & 0 deletions src/panels/configuration/groups/ProbeGroup.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import React from "react";
import { Form } from "react-bootstrap";
import { Pin, PinConfig, Probe } from "../../../model/Config";
import { Board } from "../../../model/Boards";
import PinField from "../fields/PinField";
import BooleanField from "../fields/BooleanField";

type ProbeProps = {
board: Board;
probe?: Probe;
setValue: (probe?: Probe) => void;
};

const ProbeGroup = ({ probe, setValue, board }: ProbeProps) => {
return (
<div style={{ marginBottom: "48px" }}>
<h4>Probe</h4>
<Form.Check
type="switch"
label="Include"
checked={!!probe}
onChange={() => {
if (probe) {
setValue(undefined);
} else {
setValue({
pin: Pin.NO_PIN,
toolsetter_pin: Pin.NO_PIN,
check_mode_start: false
});
}
}}
></Form.Check>

{probe && (
<>
<PinField
board={board}
label="Probe pin"
value={PinConfig.fromString(probe?.pin)}
setValue={(value) => {
setValue({
...probe,
...{ pin: value.toString() }
});
}}
/>
<PinField
board={board}
label="Tool setter pin"
value={PinConfig.fromString(probe?.toolsetter_pin)}
setValue={(value) => {
setValue({
...probe,
...{ toolsetter_pin: value.toString() }
});
}}
helpText="This is an optional second probe"
/>
<BooleanField
label="Check mode start"
value={probe?.check_mode_start}
setValue={(value) => {
setValue({
...probe,
...{ check_mode_start: Boolean(value) }
});
}}
helpText="This will force a probe check before a probe is started"
/>
</>
)}
</div>
);
};

export default ProbeGroup;

0 comments on commit 791706a

Please sign in to comment.