mirror of
https://github.com/liquidraver/ZephCore.git
synced 2026-09-17 10:24:20 +00:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user