mirror of
https://github.com/jkingsman/Remote-Terminal-for-MeshCore.git
synced 2026-07-04 17:01:45 +02:00
Be clearer about reality of location inclusion. Closes #53
This commit is contained in:
@@ -54,9 +54,7 @@ export function SettingsRadioSection({
|
||||
const [sf, setSf] = useState('');
|
||||
const [cr, setCr] = useState('');
|
||||
const [pathHashMode, setPathHashMode] = useState('0');
|
||||
const [advertLocationSource, setAdvertLocationSource] = useState<
|
||||
'off' | 'node_gps' | 'saved_coords'
|
||||
>('saved_coords');
|
||||
const [advertLocationSource, setAdvertLocationSource] = useState<'off' | 'current'>('current');
|
||||
const [gettingLocation, setGettingLocation] = useState(false);
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [rebooting, setRebooting] = useState(false);
|
||||
@@ -89,7 +87,7 @@ export function SettingsRadioSection({
|
||||
setSf(String(config.radio.sf));
|
||||
setCr(String(config.radio.cr));
|
||||
setPathHashMode(String(config.path_hash_mode));
|
||||
setAdvertLocationSource(config.advert_location_source ?? 'saved_coords');
|
||||
setAdvertLocationSource(config.advert_location_source ?? 'current');
|
||||
}, [config]);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -179,7 +177,7 @@ export function SettingsRadioSection({
|
||||
lat: parsedLat,
|
||||
lon: parsedLon,
|
||||
tx_power: parsedTxPower,
|
||||
...(advertLocationSource !== (config.advert_location_source ?? 'saved_coords')
|
||||
...(advertLocationSource !== (config.advert_location_source ?? 'current')
|
||||
? { advert_location_source: advertLocationSource }
|
||||
: {}),
|
||||
radio: {
|
||||
@@ -518,21 +516,18 @@ export function SettingsRadioSection({
|
||||
<select
|
||||
id="advert-location-source"
|
||||
value={advertLocationSource}
|
||||
onChange={(e) =>
|
||||
setAdvertLocationSource(e.target.value as 'off' | 'node_gps' | 'saved_coords')
|
||||
}
|
||||
onChange={(e) => setAdvertLocationSource(e.target.value as 'off' | 'current')}
|
||||
className="w-full h-10 px-3 rounded-md border border-input bg-background text-sm ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2"
|
||||
>
|
||||
<option value="off">Off</option>
|
||||
<option value="node_gps">Use Node GPS</option>
|
||||
<option value="saved_coords">Use Saved Coordinates</option>
|
||||
<option value="current">Include Node Location</option>
|
||||
</select>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
This only controls which location source the radio puts into adverts. If you choose Use
|
||||
Node GPS, GPS still has to be enabled manually on the node itself for live coordinates
|
||||
to take effect; RemoteTerm cannot turn it on through the interface library. RemoteTerm
|
||||
still uses the saved coordinates above for local distance math and similar UI
|
||||
calculations.
|
||||
Companion-radio firmware does not distinguish between saved coordinates and live GPS
|
||||
here. When enabled, adverts include the node's current location state. That may be
|
||||
the last coordinates you set from RemoteTerm or live GPS coordinates if the node itself
|
||||
is already updating them. RemoteTerm cannot enable GPS on the node through the interface
|
||||
library.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -32,7 +32,7 @@ const baseConfig: RadioConfig = {
|
||||
},
|
||||
path_hash_mode: 0,
|
||||
path_hash_mode_supported: false,
|
||||
advert_location_source: 'saved_coords',
|
||||
advert_location_source: 'current',
|
||||
};
|
||||
|
||||
const baseHealth: HealthStatus = {
|
||||
@@ -209,13 +209,13 @@ describe('SettingsModal', () => {
|
||||
openRadioSection();
|
||||
|
||||
fireEvent.change(screen.getByLabelText('Advert Location Source'), {
|
||||
target: { value: 'node_gps' },
|
||||
target: { value: 'off' },
|
||||
});
|
||||
fireEvent.click(screen.getByRole('button', { name: 'Save' }));
|
||||
|
||||
await waitFor(() => {
|
||||
expect(onSave).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ advert_location_source: 'node_gps' })
|
||||
expect.objectContaining({ advert_location_source: 'off' })
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -15,7 +15,7 @@ export interface RadioConfig {
|
||||
radio: RadioSettings;
|
||||
path_hash_mode: number;
|
||||
path_hash_mode_supported: boolean;
|
||||
advert_location_source?: 'off' | 'node_gps' | 'saved_coords';
|
||||
advert_location_source?: 'off' | 'current';
|
||||
}
|
||||
|
||||
export interface RadioConfigUpdate {
|
||||
@@ -25,7 +25,7 @@ export interface RadioConfigUpdate {
|
||||
tx_power?: number;
|
||||
radio?: RadioSettings;
|
||||
path_hash_mode?: number;
|
||||
advert_location_source?: 'off' | 'node_gps' | 'saved_coords';
|
||||
advert_location_source?: 'off' | 'current';
|
||||
}
|
||||
|
||||
export interface FanoutStatusEntry {
|
||||
|
||||
Reference in New Issue
Block a user