Skip to content

Commit 545ced7

Browse files
committed
docs: clarify config save behavior for GPS position updates
1 parent 97c4f5b commit 545ced7

3 files changed

Lines changed: 11 additions & 10 deletions

File tree

docs/admin-config-save-gating.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -234,9 +234,8 @@ keypair, favorite/unfavorite a node.
234234
### 2. Position live-apply - expanding the Tier-2 live set (outstanding)
235235

236236
The only reason to touch a node for the _reboot_ work: decide whether the GPS-timing fields
237-
left on the reboot path (`gps_mode`, `gps_enabled`, `gps_update_interval`, `gps_attempt_time`
238-
239-
- item 3 above) can actually apply live and be reclassified.
237+
left on the reboot path (`gps_mode`, `gps_enabled`, `gps_update_interval`, `gps_attempt_time` -
238+
item 3 above) can actually apply live and be reclassified.
240239

241240
For each candidate field, one at a time, on a GPS-equipped node: change only that field (over
242241
serial, as above) and observe.
@@ -257,9 +256,11 @@ a cheap confidence test but not a gate.
257256

258257
## Extending this safely
259258

260-
- To stop a config field from reloading the radio: it already doesn't, unless it's `lora`.
261-
Do **not** widen `radioAffected` to non-LoRa config - only `RadioInterface::reconfigure()`
262-
(which reads `config.lora`) consumes it.
259+
- To stop a config field from reloading the radio on an **AdminModule/client config save**: it
260+
already doesn't, unless it's `lora`. Do **not** widen `radioAffected` to non-LoRa config -
261+
only `RadioInterface::reconfigure()` (which reads `config.lora`) consumes it. This does not
262+
apply to the on-device menu `reloadConfig` sites (item 5 above), which still reload on any
263+
Config save regardless of field - that is a separate, untouched code path.
263264
- To move a field off the reboot path: confirm it is consumed live (read from `config` at use
264265
time, no cached/driver state), add it to the live set in the relevant `handleSetConfig`
265266
case, and add a native case asserting no reboot on its change. For anything driver- or

src/mesh/MeshService.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,6 @@ class MeshService
169169
* @param radioAffected when false, suppresses the live LoRa reconfigure even if saveWhat
170170
* includes SEGMENT_CONFIG/SEGMENT_CHANNELS; the save-to-disk always happens. Defaults
171171
* to true so callers that only pass saveWhat keep the historical bitmask behavior.
172-
* @return true if client devices should be sent a new set of radio configs
173172
*/
174173
void reloadConfig(int saveWhat = SEGMENT_CONFIG | SEGMENT_MODULECONFIG | SEGMENT_DEVICESTATE | SEGMENT_CHANNELS,
175174
bool radioAffected = true);

src/modules/AdminModule.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -922,11 +922,12 @@ void AdminModule::handleSetConfig(const meshtastic_Config &c, bool fromOthers)
922922
c.payload_variant.position.gps_mode != meshtastic_Config_PositionConfig_GpsMode_ENABLED &&
923923
config.position.fixed_position == false && c.payload_variant.position.fixed_position == false) {
924924
nodeDB->clearLocalPosition();
925-
saveChanges(SEGMENT_NODEDATABASE | SEGMENT_CONFIG, false, /*radioAffected=*/false);
925+
// SEGMENT_CONFIG is deliberately omitted here: config.position hasn't been updated to the
926+
// incoming value yet, so saving it now would persist stale data. The final saveChanges()
927+
// below re-saves SEGMENT_CONFIG once config.position is current.
928+
saveChanges(SEGMENT_NODEDATABASE, false);
926929
}
927930
config.position = c.payload_variant.position;
928-
929-
// Save nodedb as well in case we got a fixed position packet
930931
break;
931932
} // case meshtastic_Config_position_tag
932933
case meshtastic_Config_power_tag:

0 commit comments

Comments
 (0)