AP_HAL_ChibiOS: factor panic code to remove duplication

the code inside and above the loop are the same, it's just the delay which changes
This commit is contained in:
Peter Barker 2024-12-13 10:32:59 +11:00 committed by Peter Barker
parent d1cbf30286
commit dc6c799dad

View File

@ -330,16 +330,13 @@ void panic(const char *errormsg, ...)
INTERNAL_ERROR(AP_InternalError::error_t::panic); INTERNAL_ERROR(AP_InternalError::error_t::panic);
va_list ap; va_list ap;
va_start(ap, errormsg); uint16_t delay_ms = 10000;
vprintf(errormsg, ap);
va_end(ap);
hal.scheduler->delay_microseconds(10000);
while (1) { while (1) {
va_start(ap, errormsg); va_start(ap, errormsg);
vprintf(errormsg, ap); vprintf(errormsg, ap);
va_end(ap); va_end(ap);
hal.scheduler->delay(500); hal.scheduler->delay(delay_ms);
delay_ms = 500;
} }
#else #else
// we don't support variable args in bootlaoder // we don't support variable args in bootlaoder