Skip to content

Commit d88881d

Browse files
committed
Add GSM status check
Added GSM status check in shutdown() function to avoid freeze made by a double calling of GSM::suhutdown() API
1 parent 02c7c0c commit d88881d

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/GSM.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,13 @@ int GSM::isAccessAlive()
100100

101101
bool GSM::shutdown()
102102
{
103-
MODEM.send("AT+CPWROFF");
104-
105-
if (MODEM.waitForResponse(40000) == 1) {
106-
MODEM.end();
107-
_state = GSM_OFF;
108-
return true;
103+
if (_state == READY_STATE_DONE) {
104+
MODEM.send("AT+CPWROFF");
105+
MODEM.waitForResponse(40000);
109106
}
110-
111-
return false;
107+
MODEM.end();
108+
_state = GSM_OFF;
109+
return true;
112110
}
113111

114112
bool GSM::secureShutdown()

0 commit comments

Comments
 (0)