AP_Generator: IE 2400: only return custom msg if error is critial or low severity

This commit is contained in:
Iampete1 2023-10-09 11:26:49 +01:00 committed by Andrew Tridgell
parent c861e15853
commit c91407d662
1 changed files with 5 additions and 5 deletions

View File

@ -394,16 +394,16 @@ bool AP_Generator_IE_2400::is_low_error(const uint32_t err_in) const
// Check error codes and populate message with error code // Check error codes and populate message with error code
bool AP_Generator_IE_2400::check_for_err_code(char* msg_txt, uint8_t msg_len) const bool AP_Generator_IE_2400::check_for_err_code(char* msg_txt, uint8_t msg_len) const
{ {
if ((_version == ProtocolVersion::V2) && (strlen(_valid_V2.info_str) > 0)) {
hal.util->snprintf(msg_txt, msg_len, "Fuel cell err %u.%u: %s", (unsigned)_err_code, (unsigned)_sub_err_code, _valid_V2.info_str);
return true;
}
// Check if we have received an error code // Check if we have received an error code
if (!is_critical_error(_err_code) && !is_low_error(_err_code)) { if (!is_critical_error(_err_code) && !is_low_error(_err_code)) {
return false; return false;
} }
if ((_version == ProtocolVersion::V2) && (strlen(_valid_V2.info_str) > 0)) {
hal.util->snprintf(msg_txt, msg_len, "Fuel cell err %u.%u: %s", (unsigned)_err_code, (unsigned)_sub_err_code, _valid_V2.info_str);
return true;
}
hal.util->snprintf(msg_txt, msg_len, "Fuel cell err code <%u>", (unsigned)_err_code); hal.util->snprintf(msg_txt, msg_len, "Fuel cell err code <%u>", (unsigned)_err_code);
return true; return true;
} }