Merge remote-tracking branch 'origin/master' into traceroute

This commit is contained in:
Hunter Thornsberry
2024-06-16 11:01:06 -04:00
30 changed files with 1280 additions and 958 deletions
+32 -2
View File
@@ -1,4 +1,4 @@
import type { ChannelValidation } from "@app/validation/channel.js";
import type{ ChannelValidation } from "@app/validation/channel.js";
import { DynamicForm } from "@components/Form/DynamicForm.js";
import { useToast } from "@core/hooks/useToast.js";
import { useDevice } from "@core/stores/deviceStore.js";
@@ -10,7 +10,7 @@ export interface SettingsPanelProps {
}
export const Channel = ({ channel }: SettingsPanelProps): JSX.Element => {
const { connection, addChannel } = useDevice();
const { config, connection, addChannel } = useDevice();
const { toast } = useToast();
const onSubmit = (data: ChannelValidation) => {
@@ -19,6 +19,9 @@ export const Channel = ({ channel }: SettingsPanelProps): JSX.Element => {
settings: {
...data.settings,
psk: toByteArray(data.settings.psk ?? ""),
moduleSettings: {
positionPrecision: data.settings.positionEnabled ? data.settings.preciseLocation ? 32 : data.settings.positionPrecision : 0,
}
},
});
connection?.setChannel(channel).then(() => {
@@ -40,6 +43,9 @@ export const Channel = ({ channel }: SettingsPanelProps): JSX.Element => {
settings: {
...channel?.settings,
psk: fromByteArray(channel?.settings?.psk ?? new Uint8Array(0)),
positionEnabled: channel?.settings?.moduleSettings?.positionPrecision != undefined && channel?.settings?.moduleSettings?.positionPrecision > 0,
preciseLocation: channel?.settings?.moduleSettings?.positionPrecision == 32,
positionPrecision: channel?.settings?.moduleSettings?.positionPrecision == undefined ? 10 : channel?.settings?.moduleSettings?.positionPrecision
},
},
}}
@@ -86,6 +92,30 @@ export const Channel = ({ channel }: SettingsPanelProps): JSX.Element => {
label: "Downlink Enabled",
description: "Send messages from MQTT to the local mesh",
},
{
type: "toggle",
name: "settings.positionEnabled",
label: "Allow Position Requests",
description: "Send position to channel",
},
{
type: "toggle",
name: "settings.preciseLocation",
label: "Precise Location",
description: "Send precise location to channel",
},
{
type: "select",
name: "settings.positionPrecision",
label: "Approximate Location",
description:
"If not sharing precise location, position shared on channel will be accurate within this distance",
properties: {
enumValue: config.display?.units == 0 ?
{ "Within 23 km":10, "Within 12 km":11, "Within 5.8 km":12, "Within 2.9 km":13, "Within 1.5 km":14, "Within 700 m":15, "Within 350 m":16, "Within 200 m":17, "Within 90 m":18, "Within 50 m":19 } :
{ "Within 15 miles":10, "Within 7.3 miles":11, "Within 3.6 miles":12, "Within 1.8 miles":13, "Within 0.9 miles":14, "Within 0.5 miles":15, "Within 0.2 miles":16, "Within 600 feet":17, "Within 300 feet":18, "Within 150 feet":19 }
},
},
],
},
]}
@@ -32,7 +32,7 @@ export const Display = (): JSX.Element => {
label: "Screen Timeout",
description: "Turn off the display after this long",
properties: {
suffix: "seconds",
suffix: "Seconds",
},
},
{
@@ -50,6 +50,9 @@ export const Display = (): JSX.Element => {
name: "autoScreenCarouselSecs",
label: "Carousel Delay",
description: "How fast to cycle through windows",
properties: {
suffix: "Seconds",
},
},
{
type: "toggle",
@@ -36,10 +36,13 @@ export const LoRa = (): JSX.Element => {
},
},
{
type: "number",
type: "select",
name: "hopLimit",
label: "Hop Limit",
description: "Maximum number of hops",
properties: {
enumValue: {1:1, 2:2, 3:3, 4:4, 5:5, 6:6, 7:7}
},
},
{
type: "number",
@@ -94,12 +94,18 @@ export const Position = (): JSX.Element => {
name: "positionBroadcastSecs",
label: "Broadcast Interval",
description: "How often your position is sent out over the mesh",
properties: {
suffix: "Seconds",
},
},
{
type: "number",
name: "gpsUpdateInterval",
label: "GPS Update Interval",
description: "How often a GPS fix should be acquired",
properties: {
suffix: "Seconds",
},
},
{
type: "number",
@@ -38,6 +38,9 @@ export const DetectionSensor = (): JSX.Element => {
label: "Minimum Broadcast Seconds",
description:
"The interval in seconds of how often we can send a message to the mesh when a state change is detected",
properties: {
suffix: "Seconds",
},
disabledBy: [
{
fieldName: "enabled",
@@ -138,6 +138,9 @@ export const MQTT = (): JSX.Element => {
name: "mapReportSettings.publishIntervalSecs",
label: "Map Report Publish Interval (s)",
description: "Interval in seconds to publish map reports",
properties: {
suffix: "Seconds",
},
disabledBy: [
{
fieldName: "enabled",
@@ -36,8 +36,11 @@ export const NeighborInfo = (): JSX.Element => {
type: "number",
name: "updateInterval",
label: "Update Interval",
description:
description:
"Interval in seconds of how often we should try to send our Neighbor Info to the mesh",
properties: {
suffix: "Seconds",
},
disabledBy: [
{
fieldName: "enabled",
@@ -37,6 +37,9 @@ export const Paxcounter = (): JSX.Element => {
name: "paxcounterUpdateInterval",
label: "Update Interval (seconds)",
description: "How long to wait between sending paxcounter packets",
properties: {
suffix: "Seconds",
},
disabledBy: [
{
fieldName: "enabled",
@@ -37,6 +37,9 @@ export const RangeTest = (): JSX.Element => {
name: "sender",
label: "Message Interval",
description: "How long to wait between sending test packets",
properties: {
suffix: "Seconds",
},
disabledBy: [
{
fieldName: "enabled",
@@ -32,7 +32,7 @@ export const Telemetry = (): JSX.Element => {
label: "Query Interval",
description: "Interval to get telemetry data",
properties: {
suffix: "seconds",
suffix: "Seconds",
},
},
{
@@ -41,7 +41,7 @@ export const Telemetry = (): JSX.Element => {
label: "Update Interval",
description: "How often to send Metrics over the mesh",
properties: {
suffix: "seconds",
suffix: "Seconds",
},
},
{