AP_Scripting: add arming check for failed scripts

This commit is contained in:
Iampete1
2022-08-28 20:24:21 +01:00
committed by Andrew Tridgell
parent c5c09860da
commit e2c29b09ab
4 changed files with 35 additions and 8 deletions

View File

@@ -531,12 +531,9 @@ void lua_scripts::run(void) {
// re-print the latest error message every 10 seconds 10 times
const uint8_t error_prints = 10;
if ((print_error_count < error_prints) && (AP_HAL::millis() - last_print_ms > 10000)) {
// note that we do not clear the buffer after we have finished printing, this allows it to be used for a pre-arm check
print_error(MAV_SEVERITY_DEBUG);
print_error_count++;
if ((print_error_count >= error_prints) && (error_msg_buf != nullptr)) {
hal.util->heap_realloc(_heap, error_msg_buf, 0);
error_msg_buf = nullptr;
}
}
}