mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-24 01:16:55 +00:00
bug #53 - report the error on console and fixup (will add analytics in
a separate call)
This commit is contained in:
parent
f108e24bc1
commit
3f1161b68b
@ -130,6 +130,8 @@ void MeshRadio::reloadConfig()
|
|||||||
|
|
||||||
ErrorCode MeshRadio::send(MeshPacket *p)
|
ErrorCode MeshRadio::send(MeshPacket *p)
|
||||||
{
|
{
|
||||||
|
lastTxStart = millis();
|
||||||
|
|
||||||
if (useHardware)
|
if (useHardware)
|
||||||
return rf95.send(p);
|
return rf95.send(p);
|
||||||
else {
|
else {
|
||||||
@ -138,7 +140,15 @@ ErrorCode MeshRadio::send(MeshPacket *p)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define TX_WATCHDOG_TIMEOUT 30 * 1000
|
||||||
|
|
||||||
void MeshRadio::loop()
|
void MeshRadio::loop()
|
||||||
{
|
{
|
||||||
// Currently does nothing, since we do it all in ISRs now
|
// It should never take us more than 30 secs to send a packet, if it does, we have a bug
|
||||||
|
uint32_t now = millis();
|
||||||
|
if (lastTxStart != 0 && (now - lastTxStart) > TX_WATCHDOG_TIMEOUT && rf95.mode() == RHGenericDriver::RHModeTx) {
|
||||||
|
DEBUG_MSG("ERROR! Bug! Tx packet took too long to send, forcing radio into rx mode");
|
||||||
|
rf95.setModeRx();
|
||||||
|
lastTxStart = 0; // Stop checking for now, because we just warned the developer
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -87,10 +87,11 @@ class MeshRadio
|
|||||||
void reloadConfig();
|
void reloadConfig();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// RHDatagram manager;
|
|
||||||
// RHReliableDatagram manager; // don't use mesh yet
|
// RHReliableDatagram manager; // don't use mesh yet
|
||||||
RHMesh manager;
|
RHMesh manager;
|
||||||
// MeshRXHandler rxHandler;
|
|
||||||
|
/// Used for the tx timer watchdog, to check for bugs in our transmit code, msec of last time we did a send
|
||||||
|
uint32_t lastTxStart = 0;
|
||||||
|
|
||||||
/// low level send, might block for mutiple seconds
|
/// low level send, might block for mutiple seconds
|
||||||
ErrorCode sendTo(NodeNum dest, const uint8_t *buf, size_t len);
|
ErrorCode sendTo(NodeNum dest, const uint8_t *buf, size_t len);
|
||||||
|
Loading…
Reference in New Issue
Block a user