AGC reset don't crash, don't naively call

This commit is contained in:
Jonathan Bennett
2026-02-01 22:20:00 -06:00
parent 39bac0db01
commit e9c551a419
3 changed files with 4 additions and 1 deletions

View File

@@ -1169,7 +1169,7 @@ void loop()
#endif
power->powerCommandsCheck();
if (last_listen + 1000 * 60 < millis() &&
if (RadioLibInterface::instance != nullptr && last_listen + 1000 * 60 < millis() &&
!(RadioLibInterface::instance->isSending() || RadioLibInterface::instance->isActivelyReceiving())) {
RadioLibInterface::instance->startReceive();
LOG_DEBUG("attempting AGC reset");

View File

@@ -33,6 +33,7 @@ extern ScanI2C::DeviceAddress cardkb_found;
extern uint8_t kb_model;
extern bool kb_found;
extern bool osk_found;
extern unsigned long last_listen;
extern ScanI2C::DeviceAddress rtc_found;
extern ScanI2C::DeviceAddress accelerometer_found;
extern ScanI2C::FoundDevice rgb_found;

View File

@@ -514,6 +514,8 @@ void RadioLibInterface::handleReceiveInterrupt()
void RadioLibInterface::startReceive()
{
// Note the updated timestamp, to avoid unneeded AGC resets
last_listen = millis();
isReceiving = true;
powerMon->setState(meshtastic_PowerMon_State_Lora_RXOn);
}