13 lines
317 B
C++
13 lines
317 B
C++
#pragma once
|
|||
|
|
#include <Arduino.h>
|
||
|
|
|
||
|
|
// Battery voltage through a resistor divider (Config.h BATTERY_*), smoothed.
|
||
|
|
class Battery {
|
||
|
|
public:
|
||
|
|
void update(float dt);
|
||
|
|
uint16_t millivolts() const { return (uint16_t)(volts_ * 1000.0f + 0.5f); } // 0 = not fitted
|
||
|
|
|
||
|
|
private:
|
||
|
|
float volts_ = 0;
|
||
|
|
bool primed_ = false;
|
||
|
|
};
|