Compat with latest JS lib
This commit is contained in:
@@ -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...",
|
||||
|
||||
Reference in New Issue
Block a user