Skip to content

Commit

Permalink
Add GSM status check
Browse files Browse the repository at this point in the history
Added GSM status check in shutdown() function to avoid freeze made by a double calling of GSM::suhutdown() API
  • Loading branch information
Rocketct committed Nov 9, 2018
1 parent 02c7c0c commit d88881d
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/GSM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,13 @@ int GSM::isAccessAlive()

bool GSM::shutdown()
{
MODEM.send("AT+CPWROFF");

if (MODEM.waitForResponse(40000) == 1) {
MODEM.end();
_state = GSM_OFF;
return true;
if (_state == READY_STATE_DONE) {
MODEM.send("AT+CPWROFF");
MODEM.waitForResponse(40000);
}

return false;
MODEM.end();
_state = GSM_OFF;
return true;
}

bool GSM::secureShutdown()
Expand Down

0 comments on commit d88881d

Please sign in to comment.