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