Compare commits
2 Commits
bc76604d68
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 4260fdf0bb | |||
| b03ad5dbb5 |
@@ -78,12 +78,17 @@ uint8_t Battery::level(uint16_t voltage)
|
||||
}
|
||||
}
|
||||
|
||||
uint16_t Battery::voltage(uint16_t rawMiliVolts)
|
||||
{
|
||||
return rawMiliVolts * dividerRatio;
|
||||
}
|
||||
|
||||
uint16_t Battery::voltage()
|
||||
{
|
||||
if (activationPin != 0xFF)
|
||||
{
|
||||
digitalWrite(activationPin, activationMode);
|
||||
log_i("activationPin on");
|
||||
log_v("activationPin on");
|
||||
delayMicroseconds(10); // copes with slow switching activation circuits
|
||||
}
|
||||
readFunction(sensePin);
|
||||
@@ -92,9 +97,9 @@ uint16_t Battery::voltage()
|
||||
if (activationPin != 0xFF)
|
||||
{
|
||||
digitalWrite(activationPin, !activationMode);
|
||||
log_i("activationPin off");
|
||||
log_v("activationPin off");
|
||||
}
|
||||
log_i("BatteryRead: %d", reading);
|
||||
log_v("BatteryRead: %d", reading);
|
||||
|
||||
return reading;
|
||||
}
|
||||
|
||||
@@ -74,6 +74,7 @@ class Battery {
|
||||
* Returns the current battery voltage in millivolts.
|
||||
*/
|
||||
uint16_t voltage();
|
||||
uint16_t voltage(uint16_t rawMilliVolts);
|
||||
|
||||
private:
|
||||
uint16_t refVoltage;
|
||||
|
||||
Reference in New Issue
Block a user