mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-03 06:28:27 -04:00
AP_HAL_SITL: add support for starting node in maintenance mode
This commit is contained in:
parent
48f1e18161
commit
8e81ee0292
@ -193,6 +193,13 @@ uint8_t HAL_SITL::get_instance() const
|
|||||||
return _sitl_state->get_instance();
|
return _sitl_state->get_instance();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(HAL_BUILD_AP_PERIPH)
|
||||||
|
bool HAL_SITL::run_in_maintenance_mode() const
|
||||||
|
{
|
||||||
|
return _sitl_state->run_in_maintenance_mode();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void HAL_SITL::run(int argc, char * const argv[], Callbacks* callbacks) const
|
void HAL_SITL::run(int argc, char * const argv[], Callbacks* callbacks) const
|
||||||
{
|
{
|
||||||
assert(callbacks);
|
assert(callbacks);
|
||||||
|
@ -37,6 +37,10 @@ public:
|
|||||||
|
|
||||||
uint8_t get_instance() const;
|
uint8_t get_instance() const;
|
||||||
|
|
||||||
|
#if defined(HAL_BUILD_AP_PERIPH)
|
||||||
|
bool run_in_maintenance_mode() const;
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HALSITL::SITL_State *_sitl_state;
|
HALSITL::SITL_State *_sitl_state;
|
||||||
|
|
||||||
|
@ -29,12 +29,13 @@ void SITL_State::init(int argc, char * const argv[]) {
|
|||||||
const struct GetOptLong::option options[] = {
|
const struct GetOptLong::option options[] = {
|
||||||
{"help", false, 0, 'h'},
|
{"help", false, 0, 'h'},
|
||||||
{"instance", true, 0, 'I'},
|
{"instance", true, 0, 'I'},
|
||||||
|
{"maintenance", false, 0, 'M'},
|
||||||
};
|
};
|
||||||
|
|
||||||
setvbuf(stdout, (char *)0, _IONBF, 0);
|
setvbuf(stdout, (char *)0, _IONBF, 0);
|
||||||
setvbuf(stderr, (char *)0, _IONBF, 0);
|
setvbuf(stderr, (char *)0, _IONBF, 0);
|
||||||
|
|
||||||
GetOptLong gopt(argc, argv, "hI:",
|
GetOptLong gopt(argc, argv, "hI:M",
|
||||||
options);
|
options);
|
||||||
|
|
||||||
while((opt = gopt.getoption()) != -1) {
|
while((opt = gopt.getoption()) != -1) {
|
||||||
@ -42,10 +43,15 @@ void SITL_State::init(int argc, char * const argv[]) {
|
|||||||
case 'I':
|
case 'I':
|
||||||
_instance = atoi(gopt.optarg);
|
_instance = atoi(gopt.optarg);
|
||||||
break;
|
break;
|
||||||
|
case 'M':
|
||||||
|
printf("Running in Maintenance Mode\n");
|
||||||
|
_maintenance = true;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
printf("Options:\n"
|
printf("Options:\n"
|
||||||
"\t--help|-h display this help information\n"
|
"\t--help|-h display this help information\n"
|
||||||
"\t--instance|-I N set instance of SITL Periph\n");
|
"\t--instance|-I N set instance of SITL Periph\n"
|
||||||
|
"\t--maintenance|-M run in maintenance mode\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -61,6 +61,8 @@ public:
|
|||||||
|
|
||||||
uint8_t get_instance() const { return _instance; }
|
uint8_t get_instance() const { return _instance; }
|
||||||
|
|
||||||
|
bool run_in_maintenance_mode() const { return _maintenance; }
|
||||||
|
|
||||||
SITL::SerialDevice *create_serial_sim(const char *name, const char *arg) {
|
SITL::SerialDevice *create_serial_sim(const char *name, const char *arg) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -74,6 +76,7 @@ private:
|
|||||||
const char *defaults_path = HAL_PARAM_DEFAULTS_PATH;
|
const char *defaults_path = HAL_PARAM_DEFAULTS_PATH;
|
||||||
|
|
||||||
uint8_t _instance;
|
uint8_t _instance;
|
||||||
|
bool _maintenance;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user