mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-03 06:28:27 -04:00
AP_Generator: use enum class For Battery Failsafe
This commit is contained in:
parent
00a8a8fe8e
commit
b21fdb7743
@ -120,11 +120,11 @@ bool AP_Generator::pre_arm_check(char* failmsg, uint8_t failmsg_len) const
|
||||
}
|
||||
|
||||
// Tell backend check failsafes
|
||||
AP_BattMonitor::BatteryFailsafe AP_Generator::update_failsafes()
|
||||
AP_BattMonitor::Failsafe AP_Generator::update_failsafes()
|
||||
{
|
||||
// Don't invoke a failsafe if driver not assigned
|
||||
if (_driver_ptr == nullptr) {
|
||||
return AP_BattMonitor::BatteryFailsafe_None;
|
||||
return AP_BattMonitor::Failsafe::None;
|
||||
}
|
||||
return _driver_ptr->update_failsafes();
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ public:
|
||||
|
||||
bool pre_arm_check(char *failmsg, uint8_t failmsg_len) const;
|
||||
|
||||
AP_BattMonitor::BatteryFailsafe update_failsafes(void);
|
||||
AP_BattMonitor::Failsafe update_failsafes(void);
|
||||
|
||||
// Helpers to retrieve measurements
|
||||
float get_voltage(void) const { return _voltage; }
|
||||
|
@ -21,8 +21,8 @@ public:
|
||||
virtual bool pre_arm_check(char *failmsg, uint8_t failmsg_len) const { return true; }
|
||||
|
||||
// Set default to not fail failsafes
|
||||
virtual AP_BattMonitor::BatteryFailsafe update_failsafes(void) const {
|
||||
return AP_BattMonitor::BatteryFailsafe::BatteryFailsafe_None;
|
||||
virtual AP_BattMonitor::Failsafe update_failsafes(void) const {
|
||||
return AP_BattMonitor::Failsafe::None;
|
||||
}
|
||||
|
||||
virtual bool healthy(void) const = 0;
|
||||
|
@ -120,19 +120,19 @@ void AP_Generator_IE_2400::decode_latest_term()
|
||||
}
|
||||
|
||||
// Check for failsafes
|
||||
AP_BattMonitor::BatteryFailsafe AP_Generator_IE_2400::update_failsafes() const
|
||||
AP_BattMonitor::Failsafe AP_Generator_IE_2400::update_failsafes() const
|
||||
{
|
||||
// Check for error codes that lead to critical action battery monitor failsafe
|
||||
if (is_critical_error(_err_code)) {
|
||||
return AP_BattMonitor::BatteryFailsafe::BatteryFailsafe_Critical;
|
||||
return AP_BattMonitor::Failsafe::Critical;
|
||||
}
|
||||
|
||||
// Check for error codes that lead to low action battery monitor failsafe
|
||||
if (is_low_error(_err_code)) {
|
||||
return AP_BattMonitor::BatteryFailsafe::BatteryFailsafe_Low;
|
||||
return AP_BattMonitor::Failsafe::Low;
|
||||
}
|
||||
|
||||
return AP_BattMonitor::BatteryFailsafe::BatteryFailsafe_None;
|
||||
return AP_BattMonitor::Failsafe::None;
|
||||
}
|
||||
|
||||
// Check for error codes that are deemed critical
|
||||
|
@ -13,7 +13,7 @@ public:
|
||||
|
||||
void init(void) override;
|
||||
|
||||
AP_BattMonitor::BatteryFailsafe update_failsafes() const override;
|
||||
AP_BattMonitor::Failsafe update_failsafes() const override;
|
||||
|
||||
private:
|
||||
|
||||
|
@ -107,19 +107,19 @@ bool AP_Generator_IE_650_800::check_for_err_code(char* msg_txt, uint8_t msg_len)
|
||||
}
|
||||
|
||||
// Check for failsafes
|
||||
AP_BattMonitor::BatteryFailsafe AP_Generator_IE_650_800::update_failsafes() const
|
||||
AP_BattMonitor::Failsafe AP_Generator_IE_650_800::update_failsafes() const
|
||||
{
|
||||
// Check if we are in a critical failsafe
|
||||
if ((_err_code & fs_crit_mask) != 0) {
|
||||
return AP_BattMonitor::BatteryFailsafe::BatteryFailsafe_Critical;
|
||||
return AP_BattMonitor::Failsafe::Critical;
|
||||
}
|
||||
|
||||
// Check if we are in a low failsafe
|
||||
if ((_err_code & fs_low_mask) != 0) {
|
||||
return AP_BattMonitor::BatteryFailsafe::BatteryFailsafe_Low;
|
||||
return AP_BattMonitor::Failsafe::Low;
|
||||
}
|
||||
|
||||
return AP_BattMonitor::BatteryFailsafe::BatteryFailsafe_None;
|
||||
return AP_BattMonitor::Failsafe::None;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -13,7 +13,7 @@ public:
|
||||
|
||||
void init(void) override;
|
||||
|
||||
AP_BattMonitor::BatteryFailsafe update_failsafes() const override;
|
||||
AP_BattMonitor::Failsafe update_failsafes() const override;
|
||||
|
||||
private:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user