Float voltage to int (#444)

* Change voltage float to millivolt integer
* Explain the ADC to milliVolts conversion
This commit is contained in:
Riku Isokoski
2021-07-02 18:30:32 +03:00
committed by GitHub
parent 7075b7f264
commit 38f40034b0
5 changed files with 17 additions and 34 deletions

View File

@@ -50,7 +50,7 @@ namespace Pinetime {
return percentRemainingBuffer.GetAverage();
}
float Voltage() const {
uint16_t Voltage() const {
return voltage;
}
@@ -71,7 +71,7 @@ namespace Pinetime {
static constexpr uint32_t chargingPin = 12;
static constexpr uint32_t powerPresentPin = 19;
static constexpr nrf_saadc_input_t batteryVoltageAdcInput = NRF_SAADC_INPUT_AIN7;
float voltage = 0.0f;
uint16_t voltage = 0;
int percentRemaining = -1;
bool isCharging = false;
@@ -86,4 +86,4 @@ namespace Pinetime {
uint8_t samples = 0;
};
}
}
}