Browse Source

position precision rework

pull/513/head
Hunter275 1 year ago
parent
commit
52b80613f8
  1. 64
      src/components/PageComponents/Channel.tsx

64
src/components/PageComponents/Channel.tsx

@ -34,12 +34,8 @@ export const Channel = ({ channel }: SettingsPanelProps) => {
settings: { settings: {
...data.settings, ...data.settings,
psk: toByteArray(pass), psk: toByteArray(pass),
moduleSettings: { moduleSettings: {...data.settings.moduleSettings,
positionPrecision: data.settings.positionEnabled positionPrecision: data.settings.moduleSettings.positionPrecision,
? data.settings.preciseLocation
? 32
: data.settings.positionPrecision
: 0,
}, },
}, },
}); });
@ -100,17 +96,9 @@ export const Channel = ({ channel }: SettingsPanelProps) => {
settings: { settings: {
...channel?.settings, ...channel?.settings,
psk: pass, psk: pass,
positionEnabled: moduleSettings: {...channel?.settings?.moduleSettings,
channel?.settings?.moduleSettings?.positionPrecision !== positionPrecision: channel?.settings?.moduleSettings?.positionPrecision === undefined ? 10 : 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,
}, },
}, },
}} }}
@ -173,39 +161,30 @@ export const Channel = ({ channel }: SettingsPanelProps) => {
label: "Downlink Enabled", label: "Downlink Enabled",
description: "Send messages from MQTT to the local mesh", 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", type: "select",
name: "settings.positionPrecision", name: "settings.moduleSettings.positionPrecision",
label: "Approximate Location", label: "Location",
description: description:
"If not sharing precise location, position shared on channel will be accurate within this distance", "The precision of the location to share with the channel. Can be disabled.",
properties: { properties: {
enumValue: config.display?.units === 0 enumValue: config.display?.units === 0
? { ? {
"Within 23 km": 10, "Do not share location": 0,
"Within 12 km": 11, "Within 23 kilometers": 10,
"Within 5.8 km": 12, "Within 12 kilometers": 11,
"Within 2.9 km": 13, "Within 5.8 kilometers": 12,
"Within 1.5 km": 14, "Within 2.9 kilometers": 13,
"Within 700 m": 15, "Within 1.5 kilometers": 14,
"Within 350 m": 16, "Within 700 meters": 15,
"Within 200 m": 17, "Within 350 meters": 16,
"Within 90 m": 18, "Within 200 meters": 17,
"Within 50 m": 19, "Within 90 meters": 18,
"Within 50 meters": 19,
"Precise Location": 32,
} }
: { : {
"Do not share location": 0,
"Within 15 miles": 10, "Within 15 miles": 10,
"Within 7.3 miles": 11, "Within 7.3 miles": 11,
"Within 3.6 miles": 12, "Within 3.6 miles": 12,
@ -216,6 +195,7 @@ export const Channel = ({ channel }: SettingsPanelProps) => {
"Within 600 feet": 17, "Within 600 feet": 17,
"Within 300 feet": 18, "Within 300 feet": 18,
"Within 150 feet": 19, "Within 150 feet": 19,
"Precise Location": 32,
}, },
}, },
}, },

Loading…
Cancel
Save