Skip to content

Commit c2bf797

Browse files
committed
New voltage read
1 parent ef0026a commit c2bf797

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

Http.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
#define NORMAL_MODE "AT+CFUN=1,1\r\n"
4848
#define REGISTRATION_STATUS "AT+CREG?\r\n"
4949
#define SIGNAL_QUALITY "AT+CSQ\r\n"
50+
#define READ_VOLTAGE "AT+CBC\r\n"
5051
#define SLEEP_MODE "AT+CSCLK=1\r\n"
5152

5253
#define OK "OK\r\n"
@@ -66,7 +67,8 @@ Result HTTP::configureBearer(const char *apn){
6667
sendATTest();
6768

6869
while (sendCmdAndWaitForResp(REGISTRATION_STATUS, CONNECTED, 2000) != TRUE && attempts < MAX_ATTEMPTS){
69-
sendCmdAndWaitForResp(SIGNAL_QUALITY, CONNECTED, 1000);
70+
sendCmdAndWaitForResp(READ_VOLTAGE, OK, 1000);
71+
sendCmdAndWaitForResp(SIGNAL_QUALITY, OK, 1000);
7072
attempts ++;
7173
delay(1000 * attempts);
7274
if (attempts == MAX_ATTEMPTS) {

Sim800.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ void SIM800::sendCmd(const char* cmd)
9090

9191
int SIM800::sendATTest(void)
9292
{
93-
int ret = sendCmdAndWaitForResp("AT\r\n","OK",DEFAULT_TIMEOUT);
93+
int ret = sendCmdAndWaitForResp("AT\r\n", "OK", DEFAULT_TIMEOUT);
9494
return ret;
9595
}
9696

@@ -126,7 +126,6 @@ void SIM800::sendEndMark(void)
126126
serialSIM800.println((char)26);
127127
}
128128

129-
130129
int SIM800::sendCmdAndWaitForResp(const char* cmd, const char *resp, unsigned timeout)
131130
{
132131
delay(1000);

0 commit comments

Comments
 (0)