From 67f2c79717ff3385bd56ba5c27c0d8c920abf233 Mon Sep 17 00:00:00 2001 From: Randy Mackay Date: Fri, 5 Feb 2021 13:57:49 +0900 Subject: [PATCH] AP_InternalError: added invalid_arguments failure this is intended to catch problems where we have unexpectedly received invalid arguments. For example an out-of-bounds target speed that should have been caught somewhere else. running out of bits so we use a single bit to capture invalid inputs to or output from a calculation --- libraries/AP_InternalError/AP_InternalError.cpp | 1 + libraries/AP_InternalError/AP_InternalError.h | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/libraries/AP_InternalError/AP_InternalError.cpp b/libraries/AP_InternalError/AP_InternalError.cpp index 0c61d7b8ad..525d03ecb7 100644 --- a/libraries/AP_InternalError/AP_InternalError.cpp +++ b/libraries/AP_InternalError/AP_InternalError.cpp @@ -61,6 +61,7 @@ void AP_InternalError::errors_as_string(uint8_t *buffer, const uint16_t len) con "mem_guard", "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"); diff --git a/libraries/AP_InternalError/AP_InternalError.h b/libraries/AP_InternalError/AP_InternalError.h index c489f885c8..cce75435ea 100644 --- a/libraries/AP_InternalError/AP_InternalError.h +++ b/libraries/AP_InternalError/AP_InternalError.h @@ -66,7 +66,8 @@ public: mem_guard = (1U << 26), //0x4000000 67108864 dma_fail = (1U << 27), //0x8000000 134217728 params_restored = (1U << 28), //0x10000000 268435456 - __LAST__ = (1U << 29), // used only for sanity check + invalid_arg_or_result = (1U << 29), //0x20000000 536870912 + __LAST__ = (1U << 30), // used only for sanity check }; // if you've changed __LAST__ to be 32, then you will want to