Skip to content

Commit 9f9db75

Browse files
committed
New sleep and wake up functions for minimal consumption
1 parent 28308ae commit 9f9db75

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

Http.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
#define NORMAL_MODE "AT+CFUN=1,1\r\n"
4646
#define REGISTRATION_STATUS "AT+CREG?\r\n"
4747
#define SIGNAL_QUALITY "AT+CSQ\r\n"
48+
#define SLEEP_MODE "AT+CSCLK=1\r\n"
4849

4950
#define OK "OK\r\n"
5051
#define DOWNLOAD "DOWNLOAD"
@@ -155,6 +156,14 @@ Result HTTP::get(const char *uri, char *response) {
155156
return result;
156157
}
157158

159+
void HTTP::sleep(){
160+
sendCmdAndWaitForResp(SLEEP_MODE, OK, 2000);
161+
}
162+
163+
void HTTP::wakeUp(){
164+
if (sendATTest() != TRUE) preInit();
165+
}
166+
158167
Result HTTP::setHTTPSession(const char *uri){
159168

160169
Result result;

Http.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ class HTTP : public SIM800 {
5959
Result disconnect();
6060
Result get(const char *uri, char *response);
6161
Result post(const char *uri, const char *body, char *response);
62+
void sleep();
63+
void wakeUp();
6264

6365
private:
6466
void readResponse(char *response);

0 commit comments

Comments
 (0)