Battery: address two comments from #2242

- use a constant instead of magic number
- fix code comment typo
This commit is contained in:
Matthias Grob 2023-02-10 16:20:31 +01:00
parent edb6c635d5
commit 6f4d903f45
2 changed files with 4 additions and 2 deletions

View File

@ -118,8 +118,8 @@ void Battery::updateBatteryStatus(const hrt_abstime &timestamp)
_current_filter_a.reset(_current_a);
}
// Require minimum voltage toherwise override connected status
if (_voltage_filter_v.getState() < 2.1f) {
// Require minimum voltage otherwise override connected status
if (_voltage_filter_v.getState() < LITHIUM_BATTERY_RECOGNITION_VOLTAGE) {
_connected = false;
}

View File

@ -110,6 +110,8 @@ public:
void updateAndPublishBatteryStatus(const hrt_abstime &timestamp);
protected:
static constexpr float LITHIUM_BATTERY_RECOGNITION_VOLTAGE = 2.1f;
struct {
param_t v_empty;
param_t v_charged;