mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-20 01:32:40 +00:00
Adding to generated for now, protobuf PR will come when it works ... :-)
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include "PowerFSM.h"
|
||||
#include "RadioInterface.h"
|
||||
#include "configuration.h"
|
||||
#include "xmodem.h"
|
||||
#include <assert.h>
|
||||
|
||||
#if FromRadio_size > MAX_TO_FROM_RADIO_SIZE
|
||||
@@ -91,6 +92,10 @@ bool PhoneAPI::handleToRadio(const uint8_t *buf, size_t bufLength)
|
||||
LOG_INFO("Disconnecting from phone\n");
|
||||
close();
|
||||
break;
|
||||
case ToRadio_xmodemPacket_tag:
|
||||
LOG_INFO("Got xmodem packet\n");
|
||||
xModem.handlePacket(toRadioScratch.xmodemPacket);
|
||||
break;
|
||||
default:
|
||||
// Ignore nop messages
|
||||
// LOG_DEBUG("Error: unexpected ToRadio variant\n");
|
||||
@@ -284,10 +289,14 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
|
||||
// Do we have a message from the mesh?
|
||||
LOG_INFO("getFromRadio=STATE_SEND_PACKETS\n");
|
||||
if (queueStatusPacketForPhone) {
|
||||
|
||||
fromRadioScratch.which_payload_variant = FromRadio_queueStatus_tag;
|
||||
fromRadioScratch.queueStatus = *queueStatusPacketForPhone;
|
||||
releaseQueueStatusPhonePacket();
|
||||
} else if (xmodemPacketForPhone) {
|
||||
fromRadioScratch.which_payload_variant = FromRadio_xmodemPacket_tag;
|
||||
fromRadioScratch.xmodemPacket = *xmodemPacketForPhone;
|
||||
free(xmodemPacketForPhone);
|
||||
xmodemPacketForPhone = NULL;
|
||||
} else if (packetForPhone) {
|
||||
printPacket("phone downloaded packet", packetForPhone);
|
||||
|
||||
@@ -350,6 +359,7 @@ bool PhoneAPI::available()
|
||||
case STATE_SEND_MODULECONFIG:
|
||||
case STATE_SEND_COMPLETE_ID:
|
||||
return true;
|
||||
|
||||
case STATE_SEND_NODEINFO:
|
||||
if (!nodeInfoForPhone)
|
||||
nodeInfoForPhone = nodeDB.readNextInfo();
|
||||
@@ -362,6 +372,12 @@ bool PhoneAPI::available()
|
||||
if (hasPacket)
|
||||
return true;
|
||||
|
||||
if (!xmodemPacketForPhone)
|
||||
xmodemPacketForPhone = xModem.getForPhone();
|
||||
hasPacket = !!packetForPhone;
|
||||
if (hasPacket)
|
||||
return true;
|
||||
|
||||
if (!packetForPhone)
|
||||
packetForPhone = service.getForPhone();
|
||||
hasPacket = !!packetForPhone;
|
||||
|
||||
Reference in New Issue
Block a user