diff --git a/src/components/config/ActuatorsTable.tsx b/src/components/config/ActuatorsTable.tsx
index 81472b3..59c74ee 100644
--- a/src/components/config/ActuatorsTable.tsx
+++ b/src/components/config/ActuatorsTable.tsx
@@ -112,6 +112,14 @@ function gpioChannelField(entry: ActuatorEntry, setBinding: DetailProps["setBind
);
}
+function relayTypeField(entry: ActuatorEntry, setActions: DetailProps["setActions"]) {
+ return (
+
+ setActions({ relay_type: v || null })} />
+
+ );
+}
+
function TypeDetail({ entry, setBinding, setActions, usedRelay, usedServo, usedGpio }: DetailProps) {
const act = entry.actions ?? {};
switch (entry.type) {
@@ -127,6 +135,7 @@ function TypeDetail({ entry, setBinding, setActions, usedRelay, usedServo, usedG
/>
{relayChannelField(entry, setBinding, usedRelay)}
+ {relayTypeField(entry, setActions)}
{aliasesField(entry, setActions)}
setActions({ solenoid_type: v || null })} />
+ {relayTypeField(entry, setActions)}
{relayChannelField(entry, setBinding, usedRelay)}
);
case "powered_device":
return (
-
- setActions({ relay_type: v || null })} />
-
+ {relayTypeField(entry, setActions)}
{relayChannelField(entry, setBinding, usedRelay)}
);
case "powered_gpio_device":
return (
-
- setActions({ relay_type: v || null })} />
-
+ {relayTypeField(entry, setActions)}
{relayChannelField(entry, setBinding, usedRelay)}
{gpioChannelField(entry, setBinding, usedGpio)}
{gpioField(entry, setActions, "arm, disarm")}
diff --git a/src/components/config/SensorsTable.tsx b/src/components/config/SensorsTable.tsx
index f4f6f40..6db494e 100644
--- a/src/components/config/SensorsTable.tsx
+++ b/src/components/config/SensorsTable.tsx
@@ -17,7 +17,7 @@ import { CalibrationModal } from "./CalibrationModal";
const SENSOR_TYPES: SensorType[] = ["PT", "LC", "TC"];
const SOURCES = ["GCS", "TCS", "FAS"] as const;
-const CONVERT_METHODS: ConvertMethod[] = ["none", "linear", "polynomial"];
+const CONVERT_METHODS: ConvertMethod[] = ["none", "zero_offset", "linear", "polynomial"];
export interface SensorsTableProps {
sensors: SensorEntry[];
@@ -41,6 +41,10 @@ export function SensorsTable({ sensors, onChange }: SensorsTableProps) {
: { source: source as "GCS" | "TCS", hat_id: 0, channel_id: 0 };
update(i, { binding });
}
+ function setRange(i: number, index: 0 | 1, v: number | undefined) {
+ const [lo, hi] = sensors[i].range ?? [0, 0];
+ update(i, { range: index === 0 ? [v ?? 0, hi] : [lo, v ?? 0] });
+ }
function remove(i: number) {
onChange(sensors.filter((_, idx) => idx !== i));
}
@@ -63,6 +67,7 @@ export function SensorsTable({ sensors, onChange }: SensorsTableProps) {
Source
Hat / Node
Channel
+ Range
Convert
Calibration
@@ -71,7 +76,7 @@ export function SensorsTable({ sensors, onChange }: SensorsTableProps) {
{sensors.length === 0 ? (
-
+
No sensors. Add one below.
@@ -104,6 +109,15 @@ export function SensorsTable({ sensors, onChange }: SensorsTableProps) {
)}
+
+ |
+
+ setRange(i, 0, v)} placeholder="min" />
+ setRange(i, 1, v)} placeholder="max" />
+ {s.range && update(i, { range: undefined })} />}
+
+ |
+
update(i, { convert: { ...s.convert, method: v as ConvertMethod } })} /> |
diff --git a/src/lib/types.ts b/src/lib/types.ts
index 0dc48b3..4605146 100644
--- a/src/lib/types.ts
+++ b/src/lib/types.ts
@@ -19,7 +19,7 @@ export type ActuatorType =
| "powered_gpio_device"
| "gpio_device"
| "motor";
-export type ConvertMethod = "none" | "linear" | "polynomial";
+export type ConvertMethod = "none" | "zero_offset" | "linear" | "polynomial";
export type ClientRole = "viewer" | "pad" | "operator" | "admin";
export type SensorBinding =
|