* Room server: added "start ota" CLI command

This commit is contained in:
Scott Powell
2025-02-04 16:03:17 +11:00
parent cc3cf18573
commit 51ab76ecc4

View File

@@ -144,6 +144,7 @@ struct NodePrefs { // persisted to file
class MyMesh : public mesh::Mesh {
RadioLibWrapper* my_radio;
FILESYSTEM* _fs;
mesh::MainBoard* _board;
NodePrefs _prefs;
uint8_t reply_data[MAX_PACKET_PAYLOAD];
int num_clients;
@@ -482,8 +483,8 @@ protected:
}
public:
MyMesh(RadioLibWrapper& radio, mesh::MillisecondClock& ms, mesh::RNG& rng, mesh::RTCClock& rtc, mesh::MeshTables& tables)
: mesh::Mesh(radio, ms, rng, rtc, *new StaticPoolPacketManager(32), tables)
MyMesh(mesh::MainBoard& board, RadioLibWrapper& radio, mesh::MillisecondClock& ms, mesh::RNG& rng, mesh::RTCClock& rtc, mesh::MeshTables& tables)
: mesh::Mesh(radio, ms, rng, rtc, *new StaticPoolPacketManager(32), tables), _board(&board)
{
my_radio = &radio;
@@ -568,6 +569,12 @@ public:
} else {
strcpy(reply, "ERR: clock cannot go backwards");
}
} else if (memcmp(command, "start ota", 9) == 0) {
if (_board->startOTAUpdate()) {
strcpy(reply, "OK");
} else {
strcpy(reply, "Error");
}
} else if (memcmp(command, "clock", 5) == 0) {
uint32_t now = getRTCClock()->getCurrentTime();
DateTime dt = DateTime(now);
@@ -689,7 +696,7 @@ ESP32RTCClock rtc_clock;
VolatileRTCClock rtc_clock;
#endif
MyMesh the_mesh(*new WRAPPER_CLASS(radio, board), *new ArduinoMillis(), fast_rng, rtc_clock, tables);
MyMesh the_mesh(board, *new WRAPPER_CLASS(radio, board), *new ArduinoMillis(), fast_rng, rtc_clock, tables);
void halt() {
while (1) ;