GPS start fix when requesting telemetry

APC disabled by default, but compiled in
This commit is contained in:
liquidraver
2026-04-24 22:32:05 +02:00
parent 5015827c02
commit 57aab5f522
6 changed files with 36 additions and 7 deletions
+1 -1
View File
@@ -370,7 +370,7 @@ Autonomous operation features:
- **Region filtering**: `RegionMap` with transport key matching per flood packet
- **Rate limiting**: 4 requests per 120s (discovery), 4 per 180s (anonymous)
- **Neighbor tracking**: 16-slot table with RSSI/SNR/name/timestamp
- **Temporary radio params**: `tempradio` command with auto-revert timer
- **Temporary radio params**: `tempradio` command applies freq/bw/sf/cr via `LoRaRadioBase::setRadioOverride()` (does not mutate `_prefs`); auto-revert timer calls `clearRadioOverride()` to fall back to saved prefs
### 6.4 CommonCLI Commands
+3 -3
View File
@@ -418,7 +418,7 @@ config ZEPHCORE_LORA_RX_DUTY_CYCLE
config ZEPHCORE_APC
bool "Adaptive Power Control (APC)"
default n
default y
help
Automatically reduce TX power when echo packets from neighbors
indicate excess SNR margin. Saves battery and reduces channel
@@ -428,8 +428,8 @@ config ZEPHCORE_APC
Uses rogue-filtering: clusters echo SNRs to avoid one badly
placed high-SNR neighbor from over-reducing power.
Off by default. Enable with CONFIG_ZEPHCORE_APC=y in board.conf
or via EXTRA_CONF_FILE.
Compiled in by default; disabled at runtime (enable per-node
via CLI "set tx apc" — persisted in prefs).
endmenu
+1 -1
View File
@@ -131,7 +131,7 @@ Regions control which flood packets the repeater forwards. The region tree is hi
| Command | Description |
|---------|-------------|
| `tempradio <freq> <bw> <sf> <cr> <timeout_mins>` | Apply temporary radio parameters; automatically reverts after `timeout_mins`. Constraints: freq 1502500 MHz, bw 7500 kHz, sf 512, cr 58 |
| `tempradio <freq> <bw> <sf> <cr> <timeout_mins>` | Apply temporary radio parameters; automatically reverts after `timeout_mins`. Constraints: freq 1502500 MHz, bw 7500 kHz, sf 512, cr 58. Saved prefs are never mutated — concurrent `set` commands and reboots both restore the real saved values. |
---
+21 -1
View File
@@ -1464,7 +1464,27 @@ void gps_request_fresh_fix(void)
k_work_cancel_delayable(&gps_wake_work);
gps_start_acquiring();
} else if (gps_current_state == GPS_STATE_ACQUIRING) {
LOG_DBG("GPS: Fresh fix requested but already acquiring");
/* Already acquiring — reschedule the timeout so the caller's
* fresh-fix request gets a full window from now. Otherwise, a
* telemetry request that arrives 25s into a 30s acquire window
* only has 5s left, which in marginal signal usually means the
* chip goes to standby before producing a fix the requester
* could use. Repeater mode uses its own 5min timeout; companion
* mode pre-first-fix has no timeout (nothing to reschedule). */
uint32_t timeout_ms = 0;
if (gps_repeater_mode) {
timeout_ms = GPS_REPEATER_SYNC_TIMEOUT_MS;
} else if (first_fix_acquired) {
timeout_ms = gps_acquire_timeout_ms;
}
if (timeout_ms > 0) {
LOG_INF("GPS: Fresh fix requested, extending acquire "
"timeout by %u ms", timeout_ms);
k_work_reschedule(&gps_timeout_work, K_MSEC(timeout_ms));
} else {
LOG_DBG("GPS: Fresh fix requested, already acquiring "
"(no timeout active)");
}
}
#endif
}
+9
View File
@@ -309,6 +309,15 @@ int RepeaterMesh::handleRequest(ClientInfo* sender, uint32_t sender_timestamp, u
gpos.altitude_mm / 1000.0f);
}
/* Wake GPS / extend acquire window so the next telemetry poll has
* a fresher fix. In repeater mode GPS is normally off between the
* 48h time-sync cycles — this opportunistically rearms acquire
* when someone actually cares about our position. No-op if GPS
* is disabled in prefs. */
if (gps_is_available() && gps_is_enabled()) {
gps_request_fresh_fix();
}
return 4 + lpp.getSize();
}
+1 -1
View File
@@ -59,7 +59,7 @@ public:
// Adaptive Power Control
virtual int8_t getAPCReduction() const { return 0; }
virtual float getAPCMargin() const { return 0.0f; }
virtual bool isAPCEnabled() const { return true; }
virtual bool isAPCEnabled() const { return false; }
virtual void setAPCEnabled(bool en) { (void)en; }
virtual uint8_t getAPCTargetMargin() const { return 16; }
virtual void setAPCTargetMargin(uint8_t margin_db) { (void)margin_db; }