|
|
|
@ -17,7 +17,9 @@ void AP_InternalError::error(const AP_InternalError::error_t e, uint16_t line) {
@@ -17,7 +17,9 @@ void AP_InternalError::error(const AP_InternalError::error_t e, uint16_t line) {
|
|
|
|
|
// don't panic on these to facilitate watchdog testing
|
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
AP_HAL::panic("internal error %u", unsigned(e)); |
|
|
|
|
char buffer[50]; |
|
|
|
|
AP::internalerror().error_to_string(buffer, ARRAY_SIZE(buffer), e); |
|
|
|
|
AP_HAL::panic("AP_InternalError::error_t::%s", buffer); |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
internal_errors |= uint32_t(e); |
|
|
|
@ -29,9 +31,7 @@ void AP_InternalError::error(const AP_InternalError::error_t e, uint16_t line) {
@@ -29,9 +31,7 @@ void AP_InternalError::error(const AP_InternalError::error_t e, uint16_t line) {
|
|
|
|
|
hal.util->persistent_data.internal_error_last_line = line; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void AP_InternalError::errors_as_string(uint8_t *buffer, const uint16_t len) const |
|
|
|
|
{ |
|
|
|
|
static const char * const error_bit_descriptions[] { |
|
|
|
|
static const char * const error_bit_descriptions[] { |
|
|
|
|
"mapfailure", // logger_mapfailure
|
|
|
|
|
"miss_struct", // logger_missing_logstructure
|
|
|
|
|
"write_mssfmt", // logger_logwrite_missingfmt
|
|
|
|
@ -62,10 +62,18 @@ void AP_InternalError::errors_as_string(uint8_t *buffer, const uint16_t len) con
@@ -62,10 +62,18 @@ void AP_InternalError::errors_as_string(uint8_t *buffer, const uint16_t len) con
|
|
|
|
|
"dma_fail", |
|
|
|
|
"params_restored", |
|
|
|
|
"invalid arguments", |
|
|
|
|
}; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
static_assert((1U<<(ARRAY_SIZE(error_bit_descriptions))) == uint32_t(AP_InternalError::error_t::__LAST__), "too few descriptions for bits"); |
|
|
|
|
|
|
|
|
|
static_assert((1U<<(ARRAY_SIZE(error_bit_descriptions))) == uint32_t(AP_InternalError::error_t::__LAST__), "too few descriptions for bits"); |
|
|
|
|
void AP_InternalError::error_to_string(char *buffer, const uint16_t len, error_t error_code) const |
|
|
|
|
{ |
|
|
|
|
uint32_t temp = log2f(int(error_code)); |
|
|
|
|
strncpy(buffer, error_bit_descriptions[temp], len - 1); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void AP_InternalError::errors_as_string(uint8_t *buffer, const uint16_t len) const |
|
|
|
|
{ |
|
|
|
|
buffer[0] = 0; |
|
|
|
|
uint32_t buffer_used = 0; |
|
|
|
|
for (uint8_t i=0; i<ARRAY_SIZE(error_bit_descriptions); i++) { |
|
|
|
|