Refixed the CBC error found by @VinceKezel

Signed-off-by: Sara Damiano <sdamiano@stroudcenter.org>
This commit is contained in:
Sara Damiano
2020-02-07 13:42:26 -05:00
parent 0a0e66dc94
commit efb6450045
4 changed files with 8 additions and 4 deletions

View File

@@ -438,6 +438,7 @@ class TinyGsmSim5360 : public TinyGsmModem<TinyGsmSim5360, READ_AND_CHECK_SIZE,
* Battery & temperature functions
*/
protected:
// SRGD Note: Returns voltage in VOLTS instead of millivolts
uint16_t getBattVoltageImpl() {
sendAT(GF("+CBC"));
if (waitResponse(GF(GSM_NL "+CBC:")) != 1) { return 0; }
@@ -452,9 +453,10 @@ class TinyGsmSim5360 : public TinyGsmModem<TinyGsmSim5360, READ_AND_CHECK_SIZE,
return res;
}
// SRGD Note: Returns voltage in VOLTS instead of millivolts
bool getBattStatsImpl(uint8_t& chargeState, int8_t& percent,
uint16_t& milliVolts) {
sendAT(GF("+CBC?"));
sendAT(GF("+CBC"));
if (waitResponse(GF(GSM_NL "+CBC:")) != 1) { return false; }
chargeState = stream.readStringUntil(',').toInt();
percent = stream.readStringUntil(',').toInt();