Refixed the CBC error found by @VinceKezel
Signed-off-by: Sara Damiano <sdamiano@stroudcenter.org>
This commit is contained in:
		@@ -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?"));
 | 
			
		||||
 
 | 
			
		||||
@@ -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();
 | 
			
		||||
 
 | 
			
		||||
@@ -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; }
 | 
			
		||||
 
 | 
			
		||||
@@ -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();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user