From cbdb1d19c92f384e39602b3be00294b8de6b4be0 Mon Sep 17 00:00:00 2001 From: jirogit Date: Sat, 15 Aug 2026 10:17:32 -0700 Subject: [PATCH] Set agc_reset_interval default to 3 (12s) for M5Stack Unit C6L On M5Stack Unit C6L (JP region), SX1262 AGC drifts to maximum gain on each RX re-entry. Once the AGC latches at high gain (e.g. after exposure to a noisy environment), raw RSSI stays at -72~-74 dBm even after moving away from the noise source. This permanently exceeds the JP LBT threshold of -80 dBm, creating a deadlock: isChannelActive() always returns busy, TX never occurs, and without TX there is no opportunity for the AGC to reset. Setting agc_reset_interval=3 (12 seconds) causes periodic AGC resets via sx126xResetAGC(), breaking the deadlock by creating regular transmission windows regardless of prior noise exposure. Verified on M5Stack Unit C6L with jp firmware. The 12-second interval was chosen from basic field testing and is not optimized; more rigorous testing may yield a better value. Also expose agc_int in companion_radio NodePrefs so the parameter is accessible via future CLI in companion_radio_ble/usb firmware. Add agc_reset_interval field to companion_radio NodePrefs The field existed in CommonCLI.h but was missing from the companion_radio NodePrefs class, causing a build error when agc_int was exposed via CLI. Add agc_reset_interval field to companion_radio NodePrefs The field existed in CommonCLI.h but was missing from the companion_radio NodePrefs class, causing a build failure. Default set to 3 (12s) to match CommonCLI.h and resolve the AGC deadlock on companion_radio firmware. --- examples/companion_radio/NodePrefs.h | 1 + src/helpers/CommonCLI.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/companion_radio/NodePrefs.h b/examples/companion_radio/NodePrefs.h index 21766de82d..e1a36054bc 100644 --- a/examples/companion_radio/NodePrefs.h +++ b/examples/companion_radio/NodePrefs.h @@ -33,6 +33,7 @@ class NodePrefs : public ConfigSerializer { // persisted to file uint32_t gps_interval = 0; // GPS read interval in seconds uint8_t autoadd_config = 0; // bitmask for auto-add contacts config uint8_t rx_boosted_gain = 0; // SX126x RX boosted gain mode (0=power saving, 1=boosted) + uint8_t agc_reset_interval = 3; // secs / 4 uint8_t radio_fem_rxgain = 0; // external LoRa FEM RX gain (LNA) uint8_t radio_fem_txgain = 0; // external LoRa FEM TX gain (low by default) uint8_t _client_repeat = 0; // DEPRECATED -> use repeat.disable_fwd diff --git a/src/helpers/CommonCLI.h b/src/helpers/CommonCLI.h index 237c758e9f..f6619194ba 100644 --- a/src/helpers/CommonCLI.h +++ b/src/helpers/CommonCLI.h @@ -46,7 +46,7 @@ class NodePrefs : public ConfigSerializer { uint8_t flood_max_unscoped = 0; uint8_t flood_max_advert = 0; uint8_t interference_threshold = 0; - uint8_t agc_reset_interval = 0; // secs / 4 + uint8_t agc_reset_interval = 3; // secs / 4 // Bridge settings uint8_t bridge_enabled = 0; // boolean uint16_t bridge_delay = 0; // milliseconds (default 500 ms)