mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-18 16:52:27 +00:00
SimRadio: clean-up and emulate collisions (#5487)
* Clean up SimRadio and don't let it use PKC * Add collision emulation for SimRadio * Add stats from SimRadio to LocalStats * Make emulating collisions optional
This commit is contained in:
@@ -613,13 +613,14 @@ bool PhoneAPI::handleToRadioPacket(meshtastic_MeshPacket &p)
|
||||
{
|
||||
printPacket("PACKET FROM PHONE", &p);
|
||||
|
||||
// For use with the simulator, we should not ignore duplicate packets
|
||||
#if !(defined(ARCH_PORTDUINO) && !HAS_RADIO)
|
||||
if (p.id > 0 && wasSeenRecently(p.id)) {
|
||||
LOG_DEBUG("Ignore packet from phone, already seen recently");
|
||||
return false;
|
||||
}
|
||||
#if defined(ARCH_PORTDUINO)
|
||||
// For use with the simulator, we should not ignore duplicate packets from the phone
|
||||
if (SimRadio::instance == nullptr)
|
||||
#endif
|
||||
if (p.id > 0 && wasSeenRecently(p.id)) {
|
||||
LOG_DEBUG("Ignore packet from phone, already seen recently");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (p.decoded.portnum == meshtastic_PortNum_TRACEROUTE_APP && lastPortNumToRadio[p.decoded.portnum] &&
|
||||
Throttle::isWithinTimespanMs(lastPortNumToRadio[p.decoded.portnum], THIRTY_SECONDS_MS)) {
|
||||
@@ -656,4 +657,4 @@ int PhoneAPI::onNotify(uint32_t newValue)
|
||||
}
|
||||
|
||||
return timeout ? -1 : 0; // If we timed out, MeshService should stop iterating through observers as we just removed one
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user