Merge pull request #2192 from meshtastic/xmodem-fix

tryfix: also clear the second buffer.
This commit is contained in:
Ben Meadors 2023-01-23 06:35:38 -06:00 committed by GitHub
commit 76022b65c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 1 deletions

View File

@ -378,8 +378,10 @@ bool PhoneAPI::available()
if (xmodemPacketForPhone.control == meshtastic_XModem_Control_NUL) if (xmodemPacketForPhone.control == meshtastic_XModem_Control_NUL)
xmodemPacketForPhone = xModem.getForPhone(); xmodemPacketForPhone = xModem.getForPhone();
if (xmodemPacketForPhone.control != meshtastic_XModem_Control_NUL) if (xmodemPacketForPhone.control != meshtastic_XModem_Control_NUL) {
xModem.resetForPhone();
return true; return true;
}
if (!packetForPhone) if (!packetForPhone)
packetForPhone = service.getForPhone(); packetForPhone = service.getForPhone();

View File

@ -74,6 +74,11 @@ meshtastic_XModem XModemAdapter::getForPhone()
return xmodemStore; return xmodemStore;
} }
void XModemAdapter::resetForPhone()
{
xmodemStore = meshtastic_XModem_init_zero;
}
void XModemAdapter::handlePacket(meshtastic_XModem xmodemPacket) void XModemAdapter::handlePacket(meshtastic_XModem xmodemPacket)
{ {
switch (xmodemPacket.control) { switch (xmodemPacket.control) {

View File

@ -48,6 +48,7 @@ class XModemAdapter
void handlePacket(meshtastic_XModem xmodemPacket); void handlePacket(meshtastic_XModem xmodemPacket);
meshtastic_XModem getForPhone(); meshtastic_XModem getForPhone();
void resetForPhone();
private: private:
bool isReceiving = false; bool isReceiving = false;