Merge pull request #4895 from meshtastic/4884-unset-rx

Don't process RX when region unset
This commit is contained in:
Thomas Göttgens 2024-09-28 17:50:29 +02:00 committed by GitHub
commit ef1f0cb074
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -167,7 +167,7 @@ ErrorCode RadioLibInterface::send(meshtastic_MeshPacket *p)
} }
} else { } else {
LOG_WARN("send - lora tx disable because RegionCode_Unset\n"); LOG_WARN("send - lora tx disabled because RegionCode_Unset\n");
packetPool.release(p); packetPool.release(p);
return ERRNO_DISABLED; return ERRNO_DISABLED;
} }
@ -379,6 +379,14 @@ void RadioLibInterface::handleReceiveInterrupt()
xmitMsec = getPacketTime(length); xmitMsec = getPacketTime(length);
#ifndef DISABLE_WELCOME_UNSET
if (config.lora.region == meshtastic_Config_LoRaConfig_RegionCode_UNSET) {
LOG_WARN("recv - lora rx disabled because RegionCode_Unset\n");
airTime->logAirtime(RX_ALL_LOG, xmitMsec);
return;
}
#endif
int state = iface->readData(radiobuf, length); int state = iface->readData(radiobuf, length);
if (state != RADIOLIB_ERR_NONE) { if (state != RADIOLIB_ERR_NONE) {
LOG_ERROR("ignoring received packet due to error=%d\n", state); LOG_ERROR("ignoring received packet due to error=%d\n", state);