tryfix: also clear the second buffer.

Todo: do we really need 2 buffers here?
wio-e5
Thomas Göttgens 2023-01-23 12:29:10 +01:00
rodzic 3aebb1ffb3
commit 014946ad0e
3 zmienionych plików z 9 dodań i 1 usunięć

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

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