nasty rxbuffer underfill bug fixed

This commit is contained in:
geeksville
2020-02-08 09:39:26 -08:00
parent 59ca54a6bb
commit b2b832c608
6 changed files with 42 additions and 10 deletions

View File

@@ -59,11 +59,9 @@ void MeshService::sendOurOwner(NodeNum dest)
sendToMesh(p);
}
/// Do idle processing (mostly processing messages which have been queued from the radio)
void MeshService::loop()
{
radio.loop(); // FIXME, possibly move radio interaction to own thread
void MeshService::handleFromRadio()
{
MeshPacket *mp;
uint32_t oldFromNum = fromNum;
while ((mp = fromRadioQueue.dequeuePtr(0)) != NULL)
@@ -92,6 +90,24 @@ void MeshService::loop()
bluetoothNotifyFromNum(fromNum);
}
/// Do idle processing (mostly processing messages which have been queued from the radio)
void MeshService::loop()
{
radio.loop(); // FIXME, possibly move radio interaction to own thread
handleFromRadio();
// FIXME, don't send user this often, but for now it is useful for testing
static uint32_t lastsend;
uint32_t now = millis();
if(now - lastsend > 20 * 1000) {
lastsend = now;
sendOurOwner();
}
}
/// Given a ToRadio buffer parse it and properly handle it (setup radio, owner or send packet into the mesh)
void MeshService::handleToRadio(std::string s)
{