mirror of
https://github.com/meshtastic/firmware.git
synced 2025-05-01 03:39:18 +00:00
add sim exit cmd
This commit is contained in:
parent
719a0c485b
commit
b4c379f5fc
2
proto
2
proto
@ -1 +1 @@
|
|||||||
Subproject commit 39bb8b26bbc107aae3586d5a5e11a06ea12680bc
|
Subproject commit b8c0499f28f9673d1df17d04da562e30703f01cb
|
@ -25,6 +25,7 @@ typedef struct _AdminMessage {
|
|||||||
Channel get_channel_response;
|
Channel get_channel_response;
|
||||||
bool confirm_set_channel;
|
bool confirm_set_channel;
|
||||||
bool confirm_set_radio;
|
bool confirm_set_radio;
|
||||||
|
bool exit_simulator;
|
||||||
};
|
};
|
||||||
} AdminMessage;
|
} AdminMessage;
|
||||||
|
|
||||||
@ -47,6 +48,7 @@ extern "C" {
|
|||||||
#define AdminMessage_get_channel_response_tag 7
|
#define AdminMessage_get_channel_response_tag 7
|
||||||
#define AdminMessage_confirm_set_channel_tag 32
|
#define AdminMessage_confirm_set_channel_tag 32
|
||||||
#define AdminMessage_confirm_set_radio_tag 33
|
#define AdminMessage_confirm_set_radio_tag 33
|
||||||
|
#define AdminMessage_exit_simulator_tag 34
|
||||||
|
|
||||||
/* Struct field encoding specification for nanopb */
|
/* Struct field encoding specification for nanopb */
|
||||||
#define AdminMessage_FIELDLIST(X, a) \
|
#define AdminMessage_FIELDLIST(X, a) \
|
||||||
@ -58,7 +60,8 @@ X(a, STATIC, ONEOF, MESSAGE, (variant,get_radio_response,get_radio_respons
|
|||||||
X(a, STATIC, ONEOF, UINT32, (variant,get_channel_request,get_channel_request), 6) \
|
X(a, STATIC, ONEOF, UINT32, (variant,get_channel_request,get_channel_request), 6) \
|
||||||
X(a, STATIC, ONEOF, MESSAGE, (variant,get_channel_response,get_channel_response), 7) \
|
X(a, STATIC, ONEOF, MESSAGE, (variant,get_channel_response,get_channel_response), 7) \
|
||||||
X(a, STATIC, ONEOF, BOOL, (variant,confirm_set_channel,confirm_set_channel), 32) \
|
X(a, STATIC, ONEOF, BOOL, (variant,confirm_set_channel,confirm_set_channel), 32) \
|
||||||
X(a, STATIC, ONEOF, BOOL, (variant,confirm_set_radio,confirm_set_radio), 33)
|
X(a, STATIC, ONEOF, BOOL, (variant,confirm_set_radio,confirm_set_radio), 33) \
|
||||||
|
X(a, STATIC, ONEOF, BOOL, (variant,exit_simulator,exit_simulator), 34)
|
||||||
#define AdminMessage_CALLBACK NULL
|
#define AdminMessage_CALLBACK NULL
|
||||||
#define AdminMessage_DEFAULT NULL
|
#define AdminMessage_DEFAULT NULL
|
||||||
#define AdminMessage_variant_set_radio_MSGTYPE RadioConfig
|
#define AdminMessage_variant_set_radio_MSGTYPE RadioConfig
|
||||||
|
@ -6,6 +6,10 @@
|
|||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
||||||
|
#ifdef PORTDUINO
|
||||||
|
#include "unistd.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
AdminPlugin *adminPlugin;
|
AdminPlugin *adminPlugin;
|
||||||
|
|
||||||
void AdminPlugin::handleGetChannel(const MeshPacket &req, uint32_t channelIndex)
|
void AdminPlugin::handleGetChannel(const MeshPacket &req, uint32_t channelIndex)
|
||||||
@ -65,6 +69,13 @@ bool AdminPlugin::handleReceivedProtobuf(const MeshPacket &mp, const AdminMessag
|
|||||||
handleGetRadio(mp);
|
handleGetRadio(mp);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#ifdef PORTDUINO
|
||||||
|
case AdminMessage_exit_simulator_tag:
|
||||||
|
DEBUG_MSG("Exiting simulator");
|
||||||
|
_exit(0);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// Probably a message sent by us or sent to our local node. FIXME, we should avoid scanning these messages
|
// 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);
|
DEBUG_MSG("Ignoring nonrelevant admin %d\n", r->which_variant);
|
||||||
|
Loading…
Reference in New Issue
Block a user