Compat with latest JS lib
This commit is contained in:
@@ -49,27 +49,27 @@ export const ImportDialog = ({
|
||||
|
||||
const apply = () => {
|
||||
channelSet?.settings.map((ch, index) => {
|
||||
connection?.setChannel({
|
||||
channel: {
|
||||
connection?.setChannel(
|
||||
new Protobuf.Channel({
|
||||
index,
|
||||
role:
|
||||
index === 0
|
||||
? Protobuf.Channel_Role.PRIMARY
|
||||
: Protobuf.Channel_Role.SECONDARY,
|
||||
settings: ch
|
||||
}
|
||||
});
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
if (channelSet?.loraConfig) {
|
||||
connection?.setConfig({
|
||||
config: {
|
||||
connection?.setConfig(
|
||||
new Protobuf.Config({
|
||||
payloadVariant: {
|
||||
oneofKind: "lora",
|
||||
lora: channelSet.loraConfig
|
||||
case: "lora",
|
||||
value: channelSet.loraConfig
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -32,13 +32,13 @@ export const QRDialog = ({
|
||||
.filter((channel) => selectedChannels.includes(channel.index))
|
||||
.map((channel) => channel.settings)
|
||||
.filter((ch): ch is Protobuf.ChannelSettings => !!ch);
|
||||
const encoded = Protobuf.ChannelSet.toBinary(
|
||||
Protobuf.ChannelSet.create({
|
||||
const encoded = new Protobuf.ChannelSet(
|
||||
new Protobuf.ChannelSet({
|
||||
loraConfig,
|
||||
settings: channelsToEncode
|
||||
})
|
||||
);
|
||||
const base64 = fromByteArray(encoded)
|
||||
const base64 = fromByteArray(encoded.toBinary())
|
||||
.replace(/=/g, "")
|
||||
.replace(/\+/g, "-")
|
||||
.replace(/\//g, "_");
|
||||
|
||||
@@ -37,9 +37,7 @@ export const RebootDialog = ({
|
||||
icon: <ClockIcon className="w-4" />,
|
||||
action() {
|
||||
connection
|
||||
?.reboot({
|
||||
time: time * 60
|
||||
})
|
||||
?.reboot(time * 60)
|
||||
.then(() => setRebootDialogOpen(false));
|
||||
}
|
||||
}}
|
||||
@@ -48,11 +46,7 @@ export const RebootDialog = ({
|
||||
className="w-24"
|
||||
iconBefore={<ArrowPathIcon className="w-4" />}
|
||||
onClick={() => {
|
||||
connection
|
||||
?.reboot({
|
||||
time: 0
|
||||
})
|
||||
.then(() => setRebootDialogOpen(false));
|
||||
connection?.reboot(2).then(() => setRebootDialogOpen(false));
|
||||
}}
|
||||
>
|
||||
Now
|
||||
|
||||
@@ -37,9 +37,7 @@ export const ShutdownDialog = ({
|
||||
icon: <ClockIcon className="w-4" />,
|
||||
action() {
|
||||
connection
|
||||
?.shutdown({
|
||||
time: time * 60
|
||||
})
|
||||
?.shutdown(time * 60)
|
||||
.then(() => setShutdownDialogOpen(false));
|
||||
}
|
||||
}}
|
||||
@@ -48,11 +46,7 @@ export const ShutdownDialog = ({
|
||||
className="w-24"
|
||||
iconBefore={<PowerIcon className="w-4" />}
|
||||
onClick={() => {
|
||||
connection
|
||||
?.shutdown({
|
||||
time: 0
|
||||
})
|
||||
.then(() => setShutdownDialogOpen(false));
|
||||
connection?.shutdown(2).then(() => setShutdownDialogOpen(false));
|
||||
}}
|
||||
>
|
||||
Now
|
||||
|
||||
@@ -81,7 +81,7 @@ export const Metrics = (): JSX.Element => {
|
||||
data: myNode?.deviceMetrics.map((metric) => {
|
||||
return {
|
||||
x: metric.timestamp,
|
||||
y: metric.airUtilTx
|
||||
y: metric.metric.airUtilTx
|
||||
};
|
||||
}),
|
||||
backgroundColor: "rgba(102, 126, 234, 0.25)",
|
||||
@@ -95,7 +95,7 @@ export const Metrics = (): JSX.Element => {
|
||||
data: myNode?.deviceMetrics.map((metric) => {
|
||||
return {
|
||||
x: metric.timestamp,
|
||||
y: metric.channelUtilization
|
||||
y: metric.metric.channelUtilization
|
||||
};
|
||||
}),
|
||||
backgroundColor: "rgba(237, 100, 166, 0.25)",
|
||||
@@ -109,7 +109,7 @@ export const Metrics = (): JSX.Element => {
|
||||
data: myNode?.deviceMetrics.map((metric) => {
|
||||
return {
|
||||
x: metric.timestamp,
|
||||
y: metric.batteryLevel
|
||||
y: metric.metric.batteryLevel
|
||||
};
|
||||
}),
|
||||
backgroundColor: "rgba(113, 234, 102, 0.25)",
|
||||
@@ -123,7 +123,7 @@ export const Metrics = (): JSX.Element => {
|
||||
data: myNode?.deviceMetrics.map((metric) => {
|
||||
return {
|
||||
x: metric.timestamp,
|
||||
y: metric.voltage
|
||||
y: metric.metric.voltage
|
||||
};
|
||||
}),
|
||||
backgroundColor: "rgba(234, 166, 102, 0.25)",
|
||||
|
||||
@@ -87,7 +87,7 @@ export const Sensor = (): JSX.Element => {
|
||||
data: myNode?.environmentMetrics.map((metric) => {
|
||||
return {
|
||||
x: metric.timestamp,
|
||||
y: metric.barometricPressure
|
||||
y: metric.metric.barometricPressure
|
||||
};
|
||||
}),
|
||||
backgroundColor: "rgba(102, 126, 234, 0.25)",
|
||||
@@ -101,7 +101,7 @@ export const Sensor = (): JSX.Element => {
|
||||
data: myNode?.environmentMetrics.map((metric) => {
|
||||
return {
|
||||
x: metric.timestamp,
|
||||
y: metric.current
|
||||
y: metric.metric.current
|
||||
};
|
||||
}),
|
||||
backgroundColor: "rgba(237, 100, 166, 0.25)",
|
||||
@@ -115,7 +115,7 @@ export const Sensor = (): JSX.Element => {
|
||||
data: myNode?.environmentMetrics.map((metric) => {
|
||||
return {
|
||||
x: metric.timestamp,
|
||||
y: metric.gasResistance
|
||||
y: metric.metric.gasResistance
|
||||
};
|
||||
}),
|
||||
backgroundColor: "rgba(113, 234, 102, 0.25)",
|
||||
@@ -129,7 +129,7 @@ export const Sensor = (): JSX.Element => {
|
||||
data: myNode?.environmentMetrics.map((metric) => {
|
||||
return {
|
||||
x: metric.timestamp,
|
||||
y: metric.relativeHumidity
|
||||
y: metric.metric.relativeHumidity
|
||||
};
|
||||
}),
|
||||
backgroundColor: "rgba(234, 166, 102, 0.25)",
|
||||
@@ -143,7 +143,7 @@ export const Sensor = (): JSX.Element => {
|
||||
data: myNode?.environmentMetrics.map((metric) => {
|
||||
return {
|
||||
x: metric.timestamp,
|
||||
y: metric.temperature
|
||||
y: metric.metric.temperature
|
||||
};
|
||||
}),
|
||||
backgroundColor: "rgba(38, 255, 212, 0.25)",
|
||||
@@ -157,7 +157,7 @@ export const Sensor = (): JSX.Element => {
|
||||
data: myNode?.environmentMetrics.map((metric) => {
|
||||
return {
|
||||
x: metric.timestamp,
|
||||
y: metric.voltage
|
||||
y: metric.metric.voltage
|
||||
};
|
||||
}),
|
||||
backgroundColor: "rgba(247, 255, 15, 0.25)",
|
||||
|
||||
@@ -66,8 +66,8 @@ export const Channel = ({ channel }: SettingsPanelProps): JSX.Element => {
|
||||
if (connection) {
|
||||
void toast.promise(
|
||||
connection
|
||||
.setChannel({
|
||||
channel: {
|
||||
.setChannel(
|
||||
new Protobuf.Channel({
|
||||
role:
|
||||
channel?.role === Protobuf.Channel_Role.PRIMARY
|
||||
? Protobuf.Channel_Role.PRIMARY
|
||||
@@ -79,18 +79,18 @@ export const Channel = ({ channel }: SettingsPanelProps): JSX.Element => {
|
||||
...data,
|
||||
psk: toByteArray(data.psk ?? "")
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
)
|
||||
.then(() =>
|
||||
addChannel({
|
||||
config: {
|
||||
config: new Protobuf.Channel({
|
||||
index: channel.index,
|
||||
role: channel.role,
|
||||
settings: {
|
||||
...data,
|
||||
psk: toByteArray(data.psk ?? "")
|
||||
}
|
||||
},
|
||||
}),
|
||||
lastInterraction: new Date(),
|
||||
messages: []
|
||||
})
|
||||
|
||||
@@ -36,21 +36,23 @@ export const Bluetooth = (): JSX.Element => {
|
||||
if (connection) {
|
||||
void toast.promise(
|
||||
connection
|
||||
.setConfig({
|
||||
config: {
|
||||
.setConfig(
|
||||
new Protobuf.Config({
|
||||
payloadVariant: {
|
||||
oneofKind: "bluetooth",
|
||||
bluetooth: data
|
||||
}
|
||||
}
|
||||
})
|
||||
.then(() =>
|
||||
setConfig({
|
||||
payloadVariant: {
|
||||
oneofKind: "bluetooth",
|
||||
bluetooth: data
|
||||
case: "bluetooth",
|
||||
value: data
|
||||
}
|
||||
})
|
||||
)
|
||||
.then(() =>
|
||||
setConfig(
|
||||
new Protobuf.Config({
|
||||
payloadVariant: {
|
||||
case: "bluetooth",
|
||||
value: data
|
||||
}
|
||||
})
|
||||
)
|
||||
),
|
||||
{
|
||||
loading: "Saving...",
|
||||
|
||||
@@ -35,21 +35,23 @@ export const Device = (): JSX.Element => {
|
||||
if (connection) {
|
||||
void toast.promise(
|
||||
connection
|
||||
.setConfig({
|
||||
config: {
|
||||
.setConfig(
|
||||
new Protobuf.Config({
|
||||
payloadVariant: {
|
||||
oneofKind: "device",
|
||||
device: data
|
||||
}
|
||||
}
|
||||
})
|
||||
.then(() =>
|
||||
setConfig({
|
||||
payloadVariant: {
|
||||
oneofKind: "device",
|
||||
device: data
|
||||
case: "device",
|
||||
value: data
|
||||
}
|
||||
})
|
||||
)
|
||||
.then(() =>
|
||||
setConfig(
|
||||
new Protobuf.Config({
|
||||
payloadVariant: {
|
||||
case: "device",
|
||||
value: data
|
||||
}
|
||||
})
|
||||
)
|
||||
),
|
||||
{
|
||||
loading: "Saving...",
|
||||
|
||||
@@ -35,21 +35,23 @@ export const Display = (): JSX.Element => {
|
||||
if (connection) {
|
||||
void toast.promise(
|
||||
connection
|
||||
.setConfig({
|
||||
config: {
|
||||
.setConfig(
|
||||
new Protobuf.Config({
|
||||
payloadVariant: {
|
||||
oneofKind: "display",
|
||||
display: data
|
||||
}
|
||||
}
|
||||
})
|
||||
.then(() =>
|
||||
setConfig({
|
||||
payloadVariant: {
|
||||
oneofKind: "display",
|
||||
display: data
|
||||
case: "display",
|
||||
value: data
|
||||
}
|
||||
})
|
||||
)
|
||||
.then(() =>
|
||||
setConfig(
|
||||
new Protobuf.Config({
|
||||
payloadVariant: {
|
||||
case: "display",
|
||||
value: data
|
||||
}
|
||||
})
|
||||
)
|
||||
),
|
||||
{
|
||||
loading: "Saving...",
|
||||
@@ -127,6 +129,25 @@ export const Display = (): JSX.Element => {
|
||||
>
|
||||
{renderOptions(Protobuf.Config_DisplayConfig_OledType)}
|
||||
</Select>
|
||||
<Select
|
||||
label="Display Mode"
|
||||
description="Screen layout variant"
|
||||
{...register("displaymode", { valueAsNumber: true })}
|
||||
>
|
||||
{renderOptions(Protobuf.Config_DisplayConfig_DisplayMode)}
|
||||
</Select>
|
||||
<Controller
|
||||
name="headingBold"
|
||||
control={control}
|
||||
render={({ field: { value, ...rest } }) => (
|
||||
<Toggle
|
||||
label="Bold Heading"
|
||||
description="Bolden the heading text"
|
||||
checked={value}
|
||||
{...rest}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
</Form>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -43,21 +43,23 @@ export const LoRa = (): JSX.Element => {
|
||||
if (connection) {
|
||||
void toast.promise(
|
||||
connection
|
||||
.setConfig({
|
||||
config: {
|
||||
.setConfig(
|
||||
new Protobuf.Config({
|
||||
payloadVariant: {
|
||||
oneofKind: "lora",
|
||||
lora: data
|
||||
}
|
||||
}
|
||||
})
|
||||
.then(() =>
|
||||
setConfig({
|
||||
payloadVariant: {
|
||||
oneofKind: "lora",
|
||||
lora: data
|
||||
case: "lora",
|
||||
value: data
|
||||
}
|
||||
})
|
||||
)
|
||||
.then(() =>
|
||||
setConfig(
|
||||
new Protobuf.Config({
|
||||
payloadVariant: {
|
||||
case: "lora",
|
||||
value: data
|
||||
}
|
||||
})
|
||||
)
|
||||
),
|
||||
{
|
||||
loading: "Saving...",
|
||||
|
||||
@@ -56,21 +56,23 @@ export const Network = (): JSX.Element => {
|
||||
if (connection) {
|
||||
void toast.promise(
|
||||
connection
|
||||
.setConfig({
|
||||
config: {
|
||||
.setConfig(
|
||||
new Protobuf.Config({
|
||||
payloadVariant: {
|
||||
oneofKind: "network",
|
||||
network: Protobuf.Config_NetworkConfig.create(data)
|
||||
}
|
||||
}
|
||||
})
|
||||
.then(() =>
|
||||
setConfig({
|
||||
payloadVariant: {
|
||||
oneofKind: "network",
|
||||
network: data
|
||||
case: "network",
|
||||
value: new Protobuf.Config_NetworkConfig(data)
|
||||
}
|
||||
})
|
||||
)
|
||||
.then(() =>
|
||||
setConfig(
|
||||
new Protobuf.Config({
|
||||
payloadVariant: {
|
||||
case: "network",
|
||||
value: data
|
||||
}
|
||||
})
|
||||
)
|
||||
),
|
||||
{
|
||||
loading: "Saving...",
|
||||
|
||||
@@ -55,19 +55,19 @@ export const Position = (): JSX.Element => {
|
||||
|
||||
const configHasChanged = !Protobuf.Config_PositionConfig.equals(
|
||||
config.position,
|
||||
Protobuf.Config_PositionConfig.create(rest)
|
||||
new Protobuf.Config_PositionConfig(rest)
|
||||
);
|
||||
|
||||
if (connection) {
|
||||
void toast.promise(
|
||||
connection
|
||||
.setPosition({
|
||||
position: Protobuf.Position.create({
|
||||
.setPosition(
|
||||
new Protobuf.Position({
|
||||
altitude: fixedAlt,
|
||||
latitudeI: fixedLat * 1e7,
|
||||
longitudeI: fixedLng * 1e7
|
||||
})
|
||||
})
|
||||
)
|
||||
.then(() => reset({ ...data })),
|
||||
{
|
||||
loading: "Saving...",
|
||||
@@ -78,21 +78,23 @@ export const Position = (): JSX.Element => {
|
||||
if (configHasChanged) {
|
||||
void toast.promise(
|
||||
connection
|
||||
.setConfig({
|
||||
config: {
|
||||
.setConfig(
|
||||
new Protobuf.Config({
|
||||
payloadVariant: {
|
||||
oneofKind: "position",
|
||||
position: rest
|
||||
}
|
||||
}
|
||||
})
|
||||
.then(() =>
|
||||
setConfig({
|
||||
payloadVariant: {
|
||||
oneofKind: "position",
|
||||
position: data
|
||||
case: "position",
|
||||
value: rest
|
||||
}
|
||||
})
|
||||
)
|
||||
.then(() =>
|
||||
setConfig(
|
||||
new Protobuf.Config({
|
||||
payloadVariant: {
|
||||
case: "position",
|
||||
value: rest
|
||||
}
|
||||
})
|
||||
)
|
||||
),
|
||||
{
|
||||
loading: "Saving...",
|
||||
|
||||
@@ -11,6 +11,7 @@ import { PowerValidation } from "@app/validation/config/power.js";
|
||||
import { Form } from "@components/form/Form";
|
||||
import { useDevice } from "@core/providers/useDevice.js";
|
||||
import { classValidatorResolver } from "@hookform/resolvers/class-validator";
|
||||
import { Protobuf } from "@meshtastic/meshtasticjs";
|
||||
|
||||
export const Power = (): JSX.Element => {
|
||||
const { config, connection, setConfig } = useDevice();
|
||||
@@ -33,21 +34,23 @@ export const Power = (): JSX.Element => {
|
||||
if (connection) {
|
||||
void toast.promise(
|
||||
connection
|
||||
.setConfig({
|
||||
config: {
|
||||
.setConfig(
|
||||
new Protobuf.Config({
|
||||
payloadVariant: {
|
||||
oneofKind: "power",
|
||||
power: data
|
||||
}
|
||||
}
|
||||
})
|
||||
.then(() =>
|
||||
setConfig({
|
||||
payloadVariant: {
|
||||
oneofKind: "power",
|
||||
power: data
|
||||
case: "power",
|
||||
value: data
|
||||
}
|
||||
})
|
||||
)
|
||||
.then(() =>
|
||||
setConfig(
|
||||
new Protobuf.Config({
|
||||
payloadVariant: {
|
||||
case: "power",
|
||||
value: data
|
||||
}
|
||||
})
|
||||
)
|
||||
),
|
||||
{
|
||||
loading: "Saving...",
|
||||
|
||||
@@ -44,9 +44,12 @@ export const User = (): JSX.Element => {
|
||||
if (connection && myNode?.data.user) {
|
||||
void toast.promise(
|
||||
connection
|
||||
.setOwner({
|
||||
owner: { ...myNode.data.user, ...data }
|
||||
})
|
||||
.setOwner(
|
||||
new Protobuf.User({
|
||||
...myNode.data.user,
|
||||
...data
|
||||
})
|
||||
)
|
||||
.then(() => reset({ ...data })),
|
||||
{
|
||||
loading: "Saving...",
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
import { useMap } from "react-map-gl";
|
||||
import { lineString, bbox } from "@turf/turf";
|
||||
import { useEffect } from "react";
|
||||
|
||||
import { useMap } from "react-map-gl";
|
||||
|
||||
import { useDevice } from "@app/core/providers/useDevice.js";
|
||||
import {
|
||||
MagnifyingGlassMinusIcon,
|
||||
MagnifyingGlassPlusIcon,
|
||||
ShareIcon
|
||||
} from "@heroicons/react/24/outline";
|
||||
import { useDevice } from "@app/core/providers/useDevice.js";
|
||||
import { useEffect } from "react";
|
||||
import { bbox, lineString } from "@turf/turf";
|
||||
|
||||
export const MapControlls = (): JSX.Element => {
|
||||
const { current: map } = useMap();
|
||||
@@ -15,36 +16,23 @@ export const MapControlls = (): JSX.Element => {
|
||||
|
||||
const getBBox = () => {
|
||||
const nodesWithPosition = nodes.filter((n) => n.data.position?.latitudeI);
|
||||
|
||||
if (nodesWithPosition.length > 1) {
|
||||
const line = lineString(
|
||||
nodesWithPosition.map((n) => [
|
||||
(n.data.position?.latitudeI ?? 0) / 1e7,
|
||||
(n.data.position?.longitudeI ?? 0) / 1e7
|
||||
])
|
||||
);
|
||||
|
||||
const bounds = bbox(line);
|
||||
|
||||
const center = map?.cameraForBounds(
|
||||
[
|
||||
[bounds[1], bounds[0]],
|
||||
[bounds[3], bounds[2]]
|
||||
],
|
||||
{
|
||||
padding: {
|
||||
top: 10,
|
||||
bottom: 10,
|
||||
left: 10,
|
||||
right: 10
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
if (center) {
|
||||
map?.easeTo(center);
|
||||
}
|
||||
} else if (nodesWithPosition.length === 1) {
|
||||
if (!nodesWithPosition.length) return;
|
||||
const line = lineString(
|
||||
nodesWithPosition.map((n) => [
|
||||
(n.data.position?.latitudeI ?? 0) / 1e7,
|
||||
(n.data.position?.longitudeI ?? 0) / 1e7
|
||||
])
|
||||
);
|
||||
const bounds = bbox(line);
|
||||
const center = map?.cameraForBounds(
|
||||
[
|
||||
[bounds[1], bounds[0]],
|
||||
[bounds[3], bounds[2]]
|
||||
],
|
||||
{ padding: { top: 10, bottom: 10, left: 10, right: 10 } }
|
||||
);
|
||||
if (center) map?.easeTo(center);
|
||||
else if (nodesWithPosition.length === 1)
|
||||
map?.easeTo({
|
||||
zoom: 12,
|
||||
center: [
|
||||
@@ -52,7 +40,6 @@ export const MapControlls = (): JSX.Element => {
|
||||
(nodesWithPosition[0].data.position?.latitudeI ?? 0) / 1e7
|
||||
]
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@@ -17,11 +17,12 @@ export const MessageInput = ({ channel }: MessageInputProps): JSX.Element => {
|
||||
|
||||
const sendText = async (message: string) => {
|
||||
await connection
|
||||
?.sendText({
|
||||
text: message,
|
||||
wantAck: true,
|
||||
channel: channel.config.index as Types.ChannelNumber
|
||||
})
|
||||
?.sendText(
|
||||
message,
|
||||
"broadcast",
|
||||
true,
|
||||
channel.config.index as Types.ChannelNumber
|
||||
)
|
||||
.then((id) => setMessageState(channel.config.index, id, "ack"))
|
||||
.catch((e: Types.PacketError) =>
|
||||
setMessageState(channel.config.index, e.id, e.error)
|
||||
|
||||
@@ -31,15 +31,15 @@ export const NewLocationMessage = (): JSX.Element => {
|
||||
<Input label="Coordinates" />
|
||||
<Button
|
||||
onClick={() => {
|
||||
void connection?.sendWaypoint({
|
||||
waypoint: Protobuf.Waypoint.create({
|
||||
void connection?.sendWaypoint(
|
||||
new Protobuf.Waypoint({
|
||||
latitudeI: Math.floor(3.89103 * 1e7),
|
||||
longitudeI: Math.floor(105.87005 * 1e7),
|
||||
name: "TEST",
|
||||
description: "This is a description"
|
||||
}),
|
||||
destination: "broadcast"
|
||||
});
|
||||
"broadcast"
|
||||
);
|
||||
}}
|
||||
>
|
||||
Send
|
||||
|
||||
@@ -35,21 +35,23 @@ export const Audio = (): JSX.Element => {
|
||||
if (connection) {
|
||||
void toast.promise(
|
||||
connection
|
||||
.setModuleConfig({
|
||||
moduleConfig: {
|
||||
.setModuleConfig(
|
||||
new Protobuf.ModuleConfig({
|
||||
payloadVariant: {
|
||||
oneofKind: "audio",
|
||||
audio: data
|
||||
}
|
||||
}
|
||||
})
|
||||
.then(() =>
|
||||
setModuleConfig({
|
||||
payloadVariant: {
|
||||
oneofKind: "audio",
|
||||
audio: data
|
||||
case: "audio",
|
||||
value: data
|
||||
}
|
||||
})
|
||||
)
|
||||
.then(() =>
|
||||
setModuleConfig(
|
||||
new Protobuf.ModuleConfig({
|
||||
payloadVariant: {
|
||||
case: "audio",
|
||||
value: data
|
||||
}
|
||||
})
|
||||
)
|
||||
),
|
||||
{
|
||||
loading: "Saving...",
|
||||
@@ -97,25 +99,25 @@ export const Audio = (): JSX.Element => {
|
||||
label="i2SWs"
|
||||
description="Enter a description."
|
||||
type="number"
|
||||
{...register("i2SWs", { valueAsNumber: true })}
|
||||
{...register("i2sWs", { valueAsNumber: true })}
|
||||
/>
|
||||
<Input
|
||||
label="i2SSd"
|
||||
description="Enter a description."
|
||||
type="number"
|
||||
{...register("i2SSd", { valueAsNumber: true })}
|
||||
{...register("i2sSd", { valueAsNumber: true })}
|
||||
/>
|
||||
<Input
|
||||
label="i2SDin"
|
||||
description="Enter a description."
|
||||
type="number"
|
||||
{...register("i2SDin", { valueAsNumber: true })}
|
||||
{...register("i2sDin", { valueAsNumber: true })}
|
||||
/>
|
||||
<Input
|
||||
label="i2SSck"
|
||||
description="Enter a description."
|
||||
type="number"
|
||||
{...register("i2SSck", { valueAsNumber: true })}
|
||||
{...register("i2sSck", { valueAsNumber: true })}
|
||||
/>
|
||||
</Form>
|
||||
);
|
||||
|
||||
@@ -41,21 +41,23 @@ export const CannedMessage = (): JSX.Element => {
|
||||
if (connection) {
|
||||
void toast.promise(
|
||||
connection
|
||||
.setModuleConfig({
|
||||
moduleConfig: {
|
||||
.setModuleConfig(
|
||||
new Protobuf.ModuleConfig({
|
||||
payloadVariant: {
|
||||
oneofKind: "cannedMessage",
|
||||
cannedMessage: data
|
||||
}
|
||||
}
|
||||
})
|
||||
.then(() =>
|
||||
setModuleConfig({
|
||||
payloadVariant: {
|
||||
oneofKind: "cannedMessage",
|
||||
cannedMessage: data
|
||||
case: "cannedMessage",
|
||||
value: data
|
||||
}
|
||||
})
|
||||
)
|
||||
.then(() =>
|
||||
setModuleConfig(
|
||||
new Protobuf.ModuleConfig({
|
||||
payloadVariant: {
|
||||
case: "cannedMessage",
|
||||
value: data
|
||||
}
|
||||
})
|
||||
)
|
||||
),
|
||||
{
|
||||
loading: "Saving...",
|
||||
|
||||
@@ -10,6 +10,7 @@ import { ExternalNotificationValidation } from "@app/validation/moduleConfig/ext
|
||||
import { Form } from "@components/form/Form";
|
||||
import { useDevice } from "@core/providers/useDevice.js";
|
||||
import { classValidatorResolver } from "@hookform/resolvers/class-validator";
|
||||
import { Protobuf } from "@meshtastic/meshtasticjs";
|
||||
|
||||
export const ExternalNotification = (): JSX.Element => {
|
||||
const { moduleConfig, connection, setModuleConfig } = useDevice();
|
||||
@@ -31,21 +32,23 @@ export const ExternalNotification = (): JSX.Element => {
|
||||
if (connection) {
|
||||
void toast.promise(
|
||||
connection
|
||||
.setModuleConfig({
|
||||
moduleConfig: {
|
||||
.setModuleConfig(
|
||||
new Protobuf.ModuleConfig({
|
||||
payloadVariant: {
|
||||
oneofKind: "externalNotification",
|
||||
externalNotification: data
|
||||
}
|
||||
}
|
||||
})
|
||||
.then(() =>
|
||||
setModuleConfig({
|
||||
payloadVariant: {
|
||||
oneofKind: "externalNotification",
|
||||
externalNotification: data
|
||||
case: "externalNotification",
|
||||
value: data
|
||||
}
|
||||
})
|
||||
)
|
||||
.then(() =>
|
||||
setModuleConfig(
|
||||
new Protobuf.ModuleConfig({
|
||||
payloadVariant: {
|
||||
case: "externalNotification",
|
||||
value: data
|
||||
}
|
||||
})
|
||||
)
|
||||
),
|
||||
{
|
||||
loading: "Saving...",
|
||||
|
||||
@@ -10,6 +10,7 @@ import { MQTTValidation } from "@app/validation/moduleConfig/mqtt.js";
|
||||
import { Form } from "@components/form/Form";
|
||||
import { useDevice } from "@core/providers/useDevice.js";
|
||||
import { classValidatorResolver } from "@hookform/resolvers/class-validator";
|
||||
import { Protobuf } from "@meshtastic/meshtasticjs";
|
||||
|
||||
export const MQTT = (): JSX.Element => {
|
||||
const { moduleConfig, connection, setModuleConfig } = useDevice();
|
||||
@@ -38,21 +39,23 @@ export const MQTT = (): JSX.Element => {
|
||||
if (connection) {
|
||||
void toast.promise(
|
||||
connection
|
||||
.setModuleConfig({
|
||||
moduleConfig: {
|
||||
.setModuleConfig(
|
||||
new Protobuf.ModuleConfig({
|
||||
payloadVariant: {
|
||||
oneofKind: "mqtt",
|
||||
mqtt: data
|
||||
}
|
||||
}
|
||||
})
|
||||
.then(() =>
|
||||
setModuleConfig({
|
||||
payloadVariant: {
|
||||
oneofKind: "mqtt",
|
||||
mqtt: data
|
||||
case: "mqtt",
|
||||
value: data
|
||||
}
|
||||
})
|
||||
)
|
||||
.then(() =>
|
||||
setModuleConfig(
|
||||
new Protobuf.ModuleConfig({
|
||||
payloadVariant: {
|
||||
case: "mqtt",
|
||||
value: data
|
||||
}
|
||||
})
|
||||
)
|
||||
),
|
||||
{
|
||||
loading: "Saving...",
|
||||
|
||||
@@ -10,6 +10,7 @@ import { RangeTestValidation } from "@app/validation/moduleConfig/rangeTest.js";
|
||||
import { Form } from "@components/form/Form";
|
||||
import { useDevice } from "@core/providers/useDevice.js";
|
||||
import { classValidatorResolver } from "@hookform/resolvers/class-validator";
|
||||
import { Protobuf } from "@meshtastic/meshtasticjs";
|
||||
|
||||
export const RangeTest = (): JSX.Element => {
|
||||
const { moduleConfig, connection, setModuleConfig } = useDevice();
|
||||
@@ -32,21 +33,23 @@ export const RangeTest = (): JSX.Element => {
|
||||
if (connection) {
|
||||
void toast.promise(
|
||||
connection
|
||||
.setModuleConfig({
|
||||
moduleConfig: {
|
||||
.setModuleConfig(
|
||||
new Protobuf.ModuleConfig({
|
||||
payloadVariant: {
|
||||
oneofKind: "rangeTest",
|
||||
rangeTest: data
|
||||
}
|
||||
}
|
||||
})
|
||||
.then(() =>
|
||||
setModuleConfig({
|
||||
payloadVariant: {
|
||||
oneofKind: "rangeTest",
|
||||
rangeTest: data
|
||||
case: "rangeTest",
|
||||
value: data
|
||||
}
|
||||
})
|
||||
)
|
||||
.then(() =>
|
||||
setModuleConfig(
|
||||
new Protobuf.ModuleConfig({
|
||||
payloadVariant: {
|
||||
case: "rangeTest",
|
||||
value: data
|
||||
}
|
||||
})
|
||||
)
|
||||
),
|
||||
{
|
||||
loading: "Saving...",
|
||||
|
||||
@@ -35,21 +35,23 @@ export const Serial = (): JSX.Element => {
|
||||
if (connection) {
|
||||
void toast.promise(
|
||||
connection
|
||||
.setModuleConfig({
|
||||
moduleConfig: {
|
||||
.setModuleConfig(
|
||||
new Protobuf.ModuleConfig({
|
||||
payloadVariant: {
|
||||
oneofKind: "serial",
|
||||
serial: data
|
||||
}
|
||||
}
|
||||
})
|
||||
.then(() =>
|
||||
setModuleConfig({
|
||||
payloadVariant: {
|
||||
oneofKind: "serial",
|
||||
serial: data
|
||||
case: "serial",
|
||||
value: data
|
||||
}
|
||||
})
|
||||
)
|
||||
.then(() =>
|
||||
setModuleConfig(
|
||||
new Protobuf.ModuleConfig({
|
||||
payloadVariant: {
|
||||
case: "serial",
|
||||
value: data
|
||||
}
|
||||
})
|
||||
)
|
||||
),
|
||||
{
|
||||
loading: "Saving...",
|
||||
|
||||
@@ -10,6 +10,7 @@ import { StoreForwardValidation } from "@app/validation/moduleConfig/storeForwar
|
||||
import { Form } from "@components/form/Form";
|
||||
import { useDevice } from "@core/providers/useDevice.js";
|
||||
import { classValidatorResolver } from "@hookform/resolvers/class-validator";
|
||||
import { Protobuf } from "@meshtastic/meshtasticjs";
|
||||
|
||||
export const StoreForward = (): JSX.Element => {
|
||||
const { moduleConfig, connection, setModuleConfig } = useDevice();
|
||||
@@ -32,21 +33,23 @@ export const StoreForward = (): JSX.Element => {
|
||||
if (connection) {
|
||||
void toast.promise(
|
||||
connection
|
||||
.setModuleConfig({
|
||||
moduleConfig: {
|
||||
.setModuleConfig(
|
||||
new Protobuf.ModuleConfig({
|
||||
payloadVariant: {
|
||||
oneofKind: "storeForward",
|
||||
storeForward: data
|
||||
}
|
||||
}
|
||||
})
|
||||
.then(() =>
|
||||
setModuleConfig({
|
||||
payloadVariant: {
|
||||
oneofKind: "storeForward",
|
||||
storeForward: data
|
||||
case: "storeForward",
|
||||
value: data
|
||||
}
|
||||
})
|
||||
)
|
||||
.then(() =>
|
||||
setModuleConfig(
|
||||
new Protobuf.ModuleConfig({
|
||||
payloadVariant: {
|
||||
case: "storeForward",
|
||||
value: data
|
||||
}
|
||||
})
|
||||
)
|
||||
),
|
||||
{
|
||||
loading: "Saving...",
|
||||
|
||||
@@ -10,6 +10,7 @@ import { TelemetryValidation } from "@app/validation/moduleConfig/telemetry.js";
|
||||
import { Form } from "@components/form/Form";
|
||||
import { useDevice } from "@core/providers/useDevice.js";
|
||||
import { classValidatorResolver } from "@hookform/resolvers/class-validator";
|
||||
import { Protobuf } from "@meshtastic/meshtasticjs";
|
||||
|
||||
export const Telemetry = (): JSX.Element => {
|
||||
const { moduleConfig, connection, setModuleConfig } = useDevice();
|
||||
@@ -32,21 +33,23 @@ export const Telemetry = (): JSX.Element => {
|
||||
if (connection) {
|
||||
void toast.promise(
|
||||
connection
|
||||
.setModuleConfig({
|
||||
moduleConfig: {
|
||||
.setModuleConfig(
|
||||
new Protobuf.ModuleConfig({
|
||||
payloadVariant: {
|
||||
oneofKind: "telemetry",
|
||||
telemetry: data
|
||||
}
|
||||
}
|
||||
})
|
||||
.then(() =>
|
||||
setModuleConfig({
|
||||
payloadVariant: {
|
||||
oneofKind: "telemetry",
|
||||
telemetry: data
|
||||
case: "telemetry",
|
||||
value: data
|
||||
}
|
||||
})
|
||||
)
|
||||
.then(() =>
|
||||
setModuleConfig(
|
||||
new Protobuf.ModuleConfig({
|
||||
payloadVariant: {
|
||||
case: "telemetry",
|
||||
value: data
|
||||
}
|
||||
})
|
||||
)
|
||||
),
|
||||
{
|
||||
loading: "Saving...",
|
||||
|
||||
@@ -30,12 +30,12 @@ export const BatteryWidget = ({
|
||||
let previousStat: number | undefined = undefined;
|
||||
let previousTime = new Date();
|
||||
for (const stat of [...stats].reverse()) {
|
||||
if (stat.batteryLevel) {
|
||||
if (stat.metric.batteryLevel) {
|
||||
if (!currentStat) {
|
||||
currentStat = stat.batteryLevel;
|
||||
currentStat = stat.metric.batteryLevel;
|
||||
currentTime = stat.timestamp;
|
||||
} else {
|
||||
previousStat = stat.batteryLevel;
|
||||
previousStat = stat.metric.batteryLevel;
|
||||
previousTime = stat.timestamp;
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user