add sim exit cmd

This commit is contained in:
Kevin Hester
2021-03-18 19:09:31 +08:00
parent 719a0c485b
commit b4c379f5fc
3 changed files with 16 additions and 2 deletions

View File

@@ -6,6 +6,10 @@
#include "configuration.h"
#include "main.h"
#ifdef PORTDUINO
#include "unistd.h"
#endif
AdminPlugin *adminPlugin;
void AdminPlugin::handleGetChannel(const MeshPacket &req, uint32_t channelIndex)
@@ -65,6 +69,13 @@ bool AdminPlugin::handleReceivedProtobuf(const MeshPacket &mp, const AdminMessag
handleGetRadio(mp);
break;
#ifdef PORTDUINO
case AdminMessage_exit_simulator_tag:
DEBUG_MSG("Exiting simulator");
_exit(0);
break;
#endif
default:
// Probably a message sent by us or sent to our local node. FIXME, we should avoid scanning these messages
DEBUG_MSG("Ignoring nonrelevant admin %d\n", r->which_variant);