Browse Source

Refixed the CBC error found by @VinceKezel

Signed-off-by: Sara Damiano <sdamiano@stroudcenter.org>
v_master
Sara Damiano 5 years ago
parent
commit
efb6450045
4 changed files with 8 additions and 4 deletions
  1. +2
    -0
      src/TinyGsmClientA6.h
  2. +3
    -1
      src/TinyGsmClientSIM5360.h
  3. +1
    -1
      src/TinyGsmClientSIM7600.h
  4. +2
    -2
      src/TinyGsmCommon.h

+ 2
- 0
src/TinyGsmClientA6.h View File

@ -401,6 +401,7 @@ class TinyGsmA6
protected:
uint16_t getBattVoltageImpl() TINY_GSM_ATTR_NOT_AVAILABLE;
// Needs a '?' after CBC, unlike most
int8_t getBattPercentImpl() {
sendAT(GF("+CBC?"));
if (waitResponse(GF(GSM_NL "+CBC:")) != 1) { return false; }
@ -412,6 +413,7 @@ class TinyGsmA6
return res;
}
// Needs a '?' after CBC, unlike most
bool getBattStatsImpl(uint8_t& chargeState, int8_t& percent,
uint16_t& milliVolts) {
sendAT(GF("+CBC?"));


+ 3
- 1
src/TinyGsmClientSIM5360.h 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();


+ 1
- 1
src/TinyGsmClientSIM7600.h View File

@ -445,7 +445,7 @@ class TinyGsmSim7600 : public TinyGsmModem<TinyGsmSim7600, READ_AND_CHECK_SIZE,
* Battery & temperature functions
*/
protected:
// Use: float vBatt = modem.getBattVoltage() / 1000.0;
// returns volts, multiply by 1000 to get mV
uint16_t getBattVoltageImpl() {
sendAT(GF("+CBC"));
if (waitResponse(GF(GSM_NL "+CBC:")) != 1) { return 0; }


+ 2
- 2
src/TinyGsmCommon.h View File

@ -1136,7 +1136,7 @@ class TinyGsmModem {
}
uint8_t getBattChargeStateImpl() {
thisModem().sendAT(GF("+CBC?"));
thisModem().sendAT(GF("+CBC"));
if (thisModem().waitResponse(GF("+CBC:")) != 1) { return false; }
// Read battery charge status
int res = thisModem().stream.readStringUntil(',').toInt();
@ -1147,7 +1147,7 @@ class TinyGsmModem {
bool getBattStatsImpl(uint8_t& chargeState, int8_t& percent,
uint16_t& milliVolts) {
thisModem().sendAT(GF("+CBC?"));
thisModem().sendAT(GF("+CBC"));
if (thisModem().waitResponse(GF("+CBC:")) != 1) { return false; }
chargeState = thisModem().stream.readStringUntil(',').toInt();
percent = thisModem().stream.readStringUntil(',').toInt();


Loading…
Cancel
Save