AP_Scripting: init sends failure message

This commit is contained in:
Randy Mackay 2019-11-26 14:39:17 +09:00
parent 356ece6682
commit c78112564c
2 changed files with 4 additions and 6 deletions

View File

@ -79,19 +79,17 @@ AP_Scripting::AP_Scripting() {
_singleton = this; _singleton = this;
} }
bool AP_Scripting::init(void) { void AP_Scripting::init(void) {
if (!_enable) { if (!_enable) {
return true; return;
} }
if (!hal.scheduler->thread_create(FUNCTOR_BIND_MEMBER(&AP_Scripting::thread, void), if (!hal.scheduler->thread_create(FUNCTOR_BIND_MEMBER(&AP_Scripting::thread, void),
"Scripting", SCRIPTING_STACK_SIZE, AP_HAL::Scheduler::PRIORITY_SCRIPTING, 0)) { "Scripting", SCRIPTING_STACK_SIZE, AP_HAL::Scheduler::PRIORITY_SCRIPTING, 0)) {
gcs().send_text(MAV_SEVERITY_CRITICAL, "Could not create scripting stack (%d)", SCRIPTING_STACK_SIZE); gcs().send_text(MAV_SEVERITY_CRITICAL, "Could not create scripting stack (%d)", SCRIPTING_STACK_SIZE);
gcs().send_text(MAV_SEVERITY_ERROR, "Scripting failed to start");
_init_failed = true; _init_failed = true;
return false;
} }
return true;
} }
void AP_Scripting::thread(void) { void AP_Scripting::thread(void) {

View File

@ -28,7 +28,7 @@ public:
AP_Scripting(const AP_Scripting &other) = delete; AP_Scripting(const AP_Scripting &other) = delete;
AP_Scripting &operator=(const AP_Scripting&) = delete; AP_Scripting &operator=(const AP_Scripting&) = delete;
bool init(void); void init(void);
bool init_failed(void) const { return _init_failed; } bool init_failed(void) const { return _init_failed; }
bool enabled(void) const { return _enable != 0; }; bool enabled(void) const { return _enable != 0; };