If you are asking a question, please follow this template:
- My goal is: [when my gps code is executed then I am not getting sntp reply]
- My actions are: [I edited some code in pppos but not getting proper result.]
- The result I see is: [show the result - log, etc]
- My expectation & question is: [when we are execute gps commands then we want first sntp reply after that the remaining code will be execute ]
nliviu
2
Activate the gps in the handler for MGOS_EVENT_TIME_CHANGED
.
static void sntp_time_change_cb(int ev, void *evd, void *arg) {
const struct mgos_time_changed_arg *delta =
(const struct mgos_time_changed_arg *) (evd);
LOG(LL_INFO, ("%s - delta=%f", __FUNCTION__, delta->delta));
static bool init = false;
if (!init) {
init = true;
// activate gps only upon first time synch
}
(void) ev;
(void) arg;
}
enum mgos_app_init_result mgos_app_init(void) {
mgos_event_add_handler(MGOS_EVENT_TIME_CHANGED, sntp_time_change_cb, NULL);