File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -231,20 +231,24 @@ bool ArduinoCellular::enableGPS(bool assisted){
231231 this ->debugStream ->println (" Enabling GPS..." );
232232 }
233233
234+ String response;
235+
234236 if (assisted){
235- sendATCommand (" AT +QGPSCFG=\" agpsposmode\" ,33488767" );
237+ response = sendATCommand (" +QGPSCFG=\" agpsposmode\" ,33488767" , 10000 );
236238 } else {
237- sendATCommand (" AT+QGPSCFG=\" agpsposmode\" ,8388608" );
239+ // Sets the 23rd bit to 1 to enable standalone GPS
240+ response = sendATCommand (" +QGPSCFG=\" agpsposmode\" ,8388608" , 10000 );
238241 }
239242
240- // modem.sendAT(GF("+UTIME=1,1"));
241- // modem.waitResponse();
242- // modem.sendAT(GF("+UGPIOC=23,0,1"));
243-
244- // modem.waitResponse();
243+ if (response.indexOf (" OK" ) == -1 ){
244+ if (this ->debugStream != nullptr ){
245+ this ->debugStream ->println (" Failed to set GPS mode." );
246+ this ->debugStream ->println (" Response: " + response);
247+ }
248+ return false ;
249+ }
245250
246251 return modem.enableGPS ();
247- // delay(10000);
248252}
249253
250254String ArduinoCellular::sendATCommand (const char * command, unsigned long timeout){
You can’t perform that action at this time.
0 commit comments