port upstream: AGC reset, autoadd max hops, noise floor EMA, fixes

- AGC reset: proper warm sleep + Calibrate(ALL) + image recal for both
  SX126x and LR1110 (was cancel+restart / no-op respectively)
- Guard AGC reset against mid-receive (matches upstream RadioLib)
- Noise floor calibration: replace blocking 64-sample burst with
  single-sample EMA (alpha=1/8) per housekeeping tick — zero blocking,
  better temporal spread for real-world noise floor tracking
- Auto-add max hops: filter new contacts by hop count (NodePrefs,
  BaseChatMesh, CompanionMesh, ZephyrDataStore persistence)
- Fix CommonCLI memcmp("prefs", 4) → 5
This commit is contained in:
liquidraver
2026-03-03 23:26:58 +01:00
parent 86efd92f52
commit 383f23f448
14 changed files with 143 additions and 31 deletions
+12 -2
View File
@@ -1171,6 +1171,11 @@ bool CompanionMesh::shouldOverwriteWhenFull() const
return (prefs.autoadd_config & AUTO_ADD_OVERWRITE_OLDEST) != 0;
}
uint8_t CompanionMesh::getAutoAddMaxHops() const
{
return prefs.autoadd_max_hops;
}
void CompanionMesh::onContactsFull()
{
sendPush(PUSH_CODE_CONTACTS_FULL);
@@ -2538,16 +2543,21 @@ bool CompanionMesh::handleProtocolFrame(const uint8_t *data, size_t len)
case CMD_SET_AUTOADD_CONFIG:
if (len >= 2) {
prefs.autoadd_config = data[1];
LOG_INF("SET_AUTOADD_CONFIG: autoadd_config=0x%02x", prefs.autoadd_config);
if (len >= 3) {
prefs.autoadd_max_hops = (data[2] > 64) ? 64 : data[2];
}
LOG_INF("SET_AUTOADD_CONFIG: autoadd_config=0x%02x max_hops=%u",
prefs.autoadd_config, prefs.autoadd_max_hops);
_store->savePrefs(prefs);
}
sendPacketOk();
return true;
case CMD_GET_AUTOADD_CONFIG: {
uint8_t rsp[2];
uint8_t rsp[3];
rsp[0] = PACKET_AUTOADD_CONFIG;
rsp[1] = prefs.autoadd_config;
rsp[2] = prefs.autoadd_max_hops;
writeFrame(rsp, sizeof(rsp));
return true;
}