added toggle for node reversal to the component form, limited it to firmware version 2.1.8 or higher
This commit is contained in:
parent
d831677769
commit
54d995ae2d
4 changed files with 64 additions and 5 deletions
4
package-lock.json
generated
4
package-lock.json
generated
|
|
@ -42,7 +42,7 @@
|
||||||
"mui-tel-input": "^7.0.0",
|
"mui-tel-input": "^7.0.0",
|
||||||
"notistack": "^3.0.1",
|
"notistack": "^3.0.1",
|
||||||
"openweathermap-ts": "^1.2.10",
|
"openweathermap-ts": "^1.2.10",
|
||||||
"protobuf-ts": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#staging",
|
"protobuf-ts": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#reverse_nodes",
|
||||||
"query-string": "^9.2.1",
|
"query-string": "^9.2.1",
|
||||||
"react": "^18.3.1",
|
"react": "^18.3.1",
|
||||||
"react-beautiful-dnd": "^13.1.1",
|
"react-beautiful-dnd": "^13.1.1",
|
||||||
|
|
@ -10953,7 +10953,7 @@
|
||||||
},
|
},
|
||||||
"node_modules/protobuf-ts": {
|
"node_modules/protobuf-ts": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#31866a5a4ebad3770b82f4687bec2fd4c3b8417e",
|
"resolved": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#5f63b242407086b5a43c923d94aaad70ce405b1a",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"protobufjs": "^6.8.8"
|
"protobufjs": "^6.8.8"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@
|
||||||
"mui-tel-input": "^7.0.0",
|
"mui-tel-input": "^7.0.0",
|
||||||
"notistack": "^3.0.1",
|
"notistack": "^3.0.1",
|
||||||
"openweathermap-ts": "^1.2.10",
|
"openweathermap-ts": "^1.2.10",
|
||||||
"protobuf-ts": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#master",
|
"protobuf-ts": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#reverse_nodes",
|
||||||
"query-string": "^9.2.1",
|
"query-string": "^9.2.1",
|
||||||
"react": "^18.3.1",
|
"react": "^18.3.1",
|
||||||
"react-beautiful-dnd": "^13.1.1",
|
"react-beautiful-dnd": "^13.1.1",
|
||||||
|
|
|
||||||
|
|
@ -133,7 +133,7 @@ export default function ComponentForm(props: Props) {
|
||||||
length: "0",
|
length: "0",
|
||||||
height: "0",
|
height: "0",
|
||||||
width: "0",
|
width: "0",
|
||||||
sensorDistance: "0"
|
sensorDistance: "0",
|
||||||
});
|
});
|
||||||
const [compMode, setCompMode] = useState<any>();
|
const [compMode, setCompMode] = useState<any>();
|
||||||
//const [numCalibrations, setNumCalibrations] = useState(0)
|
//const [numCalibrations, setNumCalibrations] = useState(0)
|
||||||
|
|
@ -204,7 +204,7 @@ export default function ComponentForm(props: Props) {
|
||||||
length: length.toFixed(2),
|
length: length.toFixed(2),
|
||||||
width: width.toFixed(2),
|
width: width.toFixed(2),
|
||||||
height: height.toFixed(2),
|
height: height.toFixed(2),
|
||||||
sensorDistance: sensorDistance.toFixed(2)
|
sensorDistance: sensorDistance.toFixed(2),
|
||||||
});
|
});
|
||||||
}, [component]);
|
}, [component]);
|
||||||
|
|
||||||
|
|
@ -377,6 +377,12 @@ export default function ComponentForm(props: Props) {
|
||||||
setForm(f);
|
setForm(f);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const toggleReverseNodes = (event: any) => {
|
||||||
|
let f = cloneDeep(form);
|
||||||
|
f.component.settings.reverseNodes = event.target.checked;
|
||||||
|
setForm(f);
|
||||||
|
};
|
||||||
|
|
||||||
const updateGrainType = (option: Option | null) => {
|
const updateGrainType = (option: Option | null) => {
|
||||||
let f = cloneDeep(form);
|
let f = cloneDeep(form);
|
||||||
|
|
||||||
|
|
@ -908,6 +914,42 @@ export default function ComponentForm(props: Props) {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const reverseCheck = () => {
|
||||||
|
const {reverseNodes} = form.component.settings
|
||||||
|
let ext = extension(component.type(), component.subType())
|
||||||
|
|
||||||
|
if (ext.isArray && device.featureSupported("reverseNodes")) {
|
||||||
|
return (
|
||||||
|
<Grid
|
||||||
|
container
|
||||||
|
direction="row"
|
||||||
|
justifyContent="space-between"
|
||||||
|
alignItems="center"
|
||||||
|
alignContent="center"
|
||||||
|
spacing={1}>
|
||||||
|
<Grid container size={{ xs: 4, sm: 3 }} justifyContent="center">
|
||||||
|
<FormControlLabel
|
||||||
|
control={
|
||||||
|
<Switch
|
||||||
|
checked={reverseNodes}
|
||||||
|
onChange={toggleReverseNodes}
|
||||||
|
name="nodesReversed"
|
||||||
|
aria-label="nodesReversed"
|
||||||
|
color="secondary"
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
label={<Typography variant="caption">Reverse Nodes</Typography>}
|
||||||
|
labelPlacement="top"
|
||||||
|
className={classes.switchControl}
|
||||||
|
disabled={!canEdit}
|
||||||
|
/>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
const generalForm = () => {
|
const generalForm = () => {
|
||||||
const {
|
const {
|
||||||
component,
|
component,
|
||||||
|
|
@ -975,6 +1017,7 @@ export default function ComponentForm(props: Props) {
|
||||||
)}
|
)}
|
||||||
{component.settings.type === quack.ComponentType.COMPONENT_TYPE_GRAIN_CABLE &&
|
{component.settings.type === quack.ComponentType.COMPONENT_TYPE_GRAIN_CABLE &&
|
||||||
grainSelect()}
|
grainSelect()}
|
||||||
|
{reverseCheck()}
|
||||||
{component.settings.type === quack.ComponentType.COMPONENT_TYPE_GRAIN_CABLE && (
|
{component.settings.type === quack.ComponentType.COMPONENT_TYPE_GRAIN_CABLE && (
|
||||||
<Grid
|
<Grid
|
||||||
container
|
container
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,22 @@ const featureVersions: Map<string, FeatureVersionByPlatform> = new Map([
|
||||||
v2EthBlue: "2.0.44"
|
v2EthBlue: "2.0.44"
|
||||||
}
|
}
|
||||||
],[
|
],[
|
||||||
|
"reverseNodes",
|
||||||
|
{
|
||||||
|
photon: "N/A",
|
||||||
|
electron: "N/A",
|
||||||
|
v2Wifi: "N/A",
|
||||||
|
v2Cell: "N/A",
|
||||||
|
v2WifiS3: "N/A",
|
||||||
|
v2CellS3: "N/A",
|
||||||
|
v2CellBlack: "2.1.8",
|
||||||
|
v2CellGreen: "N/A",
|
||||||
|
v2WifiBlue: "2.1.8",
|
||||||
|
v2CellBlue: "2.1.8",
|
||||||
|
v2EthBlue: "2.1.8"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
"detectI2C",
|
"detectI2C",
|
||||||
{
|
{
|
||||||
photon: "N/A",
|
photon: "N/A",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue