diff --git a/libraries/APO/AP_BatteryMonitor.cpp b/libraries/APO/AP_BatteryMonitor.cpp index e5550d2798..835f3072d2 100644 --- a/libraries/APO/AP_BatteryMonitor.cpp +++ b/libraries/APO/AP_BatteryMonitor.cpp @@ -8,3 +8,5 @@ namespace apo { } // apo + +// vim:ts=4:sw=4:expandtab diff --git a/libraries/APO/AP_BatteryMonitor.h b/libraries/APO/AP_BatteryMonitor.h index 7f82db349d..96b94bc46d 100644 --- a/libraries/APO/AP_BatteryMonitor.h +++ b/libraries/APO/AP_BatteryMonitor.h @@ -13,39 +13,41 @@ namespace apo { class AP_BatteryMonitor { public: - AP_BatteryMonitor(uint8_t pin, float voltageDivRatio, float minVolt, float maxVolt) : - _pin(pin), _voltageDivRatio(voltageDivRatio), - _minVolt(minVolt), _maxVolt(maxVolt), _voltage(maxVolt) { - } + AP_BatteryMonitor(uint8_t pin, float voltageDivRatio, float minVolt, float maxVolt) : + _pin(pin), _voltageDivRatio(voltageDivRatio), + _minVolt(minVolt), _maxVolt(maxVolt), _voltage(maxVolt) { + } - void update() { - // low pass filter on voltage - _voltage = _voltage*.9 + (analogRead(_pin)/255)*_voltageDivRatio*0.1; - } + void update() { + // low pass filter on voltage + _voltage = _voltage*.9 + (analogRead(_pin)/255)*_voltageDivRatio*0.1; + } - /** - * Accessors - */ - float getVoltage() { - return _voltage; - } + /** + * Accessors + */ + float getVoltage() { + return _voltage; + } - uint8_t getPercentage() { - float norm = (_voltage-_minVolt)/(_maxVolt-_minVolt); - if (norm < 0) norm = 0; - else if (norm > 1) norm = 1; - return 100*norm; - } + uint8_t getPercentage() { + float norm = (_voltage-_minVolt)/(_maxVolt-_minVolt); + if (norm < 0) norm = 0; + else if (norm > 1) norm = 1; + return 100*norm; + } private: - uint8_t _pin; - float _voltageDivRatio; - float _voltage; - float _minVolt; - float _maxVolt; + uint8_t _pin; + float _voltageDivRatio; + float _voltage; + float _minVolt; + float _maxVolt; }; } // namespace apo #endif /* AP_BATTERYMONITOR_H_ */ + +// vim:ts=4:sw=4:expandtab