I have modified the quckstart example by adding a card.location request. But the GPS fails to go active unless I comment out a note send request. I also added a card.time request show that should enable the GPS to start.
What is the problem with the original code that is causing the problem? By the way the original code works in that it is sending data to the hub correctly. Just the GPS never activates.
Orginal code that never activates GPS
J *req = notecard.newRequest("note.add");
if (req != NULL)
{
JAddStringToObject(req, "file", "sensors.qo");
JAddBoolToObject(req, "sync", true);
J *body = JAddObjectToObject(req, "body");
if (body)
{
JAddNumberToObject(body, "temp", temperature);
JAddNumberToObject(body, "humidity", humidity);
}
notecard.sendRequest(req);
}
J* req2 =notecard.newRequest("card.time") ;
notecard.sendRequest(req2) ;
J* req1 = notecard.newRequest("card.location");
notecard.sendRequest(req1) ;
[INFO] {“req”:“card.time”,“crc”:“0003:1110F247”}
[INFO] {“minutes”:-300,“lat”:40.902312499999993,“lon”:-81.382578125,“area”:“Greentown OH”,“country”:“US”,“zone”:“EST,America/New_York”,“time”:1700757685}
[INFO] {“req”:“card.location”,“crc”:“0004:F0AE3444”}
[INFO] {“status”:“GPS inactive {gps-inactive}”,“mode”:“continuous”}
Code that works -first notecard.sendRequest commented out
J *req = notecard.newRequest("note.add");
if (req != NULL)
{
JAddStringToObject(req, "file", "sensors.qo");
JAddBoolToObject(req, "sync", true);
J *body = JAddObjectToObject(req, "body");
if (body)
{
JAddNumberToObject(body, "temp", temperature);
JAddNumberToObject(body, "humidity", humidity);
}
// notecard.sendRequest(req);
}
J* req2 =notecard.newRequest("card.time") ;
notecard.sendRequest(req2) ;
J* req1 = notecard.newRequest("card.location");
notecard.sendRequest(req1) ;
[INFO] {“req”:“card.time”,“crc”:“0009:1110F247”}
[INFO] {“minutes”:-300,“lat”:40.902312499999993,“lon”:-81.382578125,“area”:“Greentown OH”,“country”:“US”,“zone”:“EST,America/New_York”,“time”:1700757732}
[INFO] {“req”:“card.location”,“crc”:“000A:F0AE3444”}
[INFO] {“status”:“GPS search (13 sec, 0/0 dB SNR, 0/0 sats) {gps-active}”,“mode”:“continuous”}