Switch to OTA firmware

This commit is contained in:
Thomas Göttgens
2022-10-08 11:10:29 +02:00
parent e50e15dc04
commit b591e35442
3 changed files with 76 additions and 0 deletions

View File

@@ -2,6 +2,7 @@
#include "Channels.h"
#include "MeshService.h"
#include "NodeDB.h"
#include "BleOta.h"
#include "Router.h"
#include "configuration.h"
#include "main.h"
@@ -103,6 +104,17 @@ bool AdminModule::handleReceivedProtobuf(const MeshPacket &mp, AdminMessage *r)
rebootAtMsec = (s < 0) ? 0 : (millis() + s * 1000);
break;
}
case AdminMessage_reboot_ota_seconds_tag: {
int32_t s = r->reboot_ota_seconds;
if (BleOta::getOtaAppVersion().isEmpty()) {
DEBUG_MSG("No OTA firmware available, just rebooting\n");
}else{
BleOta::switchToOtaApp();
}
DEBUG_MSG("Rebooting to OTA in %d seconds\n", s);
rebootAtMsec = (s < 0) ? 0 : (millis() + s * 1000);
break;
}
case AdminMessage_shutdown_seconds_tag: {
int32_t s = r->shutdown_seconds;
DEBUG_MSG("Shutdown in %d seconds\n", s);