Every second, I call the function “gestion_gnss” so that it generates a new buffer for sending a GPS frame to the microcontroller who is the client.
However each time I call for example the function le_pos_GetTime, I always have the same values, it does not update.
I did not really understand how we manage the update days … Should we use an event handler?
Here is my code:
uint16_t gestion_gnss()
{
state_gnss=le_gnss_GetTtff(&ttff);
//LE_INFO(“TTFF: %d”,ttff);
if(state_gnss == LE_NOT_PERMITTED) // LE_NOT_PERMITTED If the GNSS device is not enabled or not started.
{
LE_INFO("Not enabled/start");
le_gnss_Enable();
if(le_gnss_Start()==LE_OK) state_gnss= LE_NOT_PERMITTED;
else {
memset(buffer_gnss,0,sizeof(buffer_gnss)); // RAZ chaine de caractère
sprintf(buffer_gnss,"DONTSTART\n;");
return false;
}
}
if(state_gnss == LE_BUSY) // LE_BUSY The position is not fixed and TTFF can't be measured.
{
LE_INFO("BUSY");
memset(buffer_gnss,0,sizeof(buffer_gnss)); // RAZ chaine de caractère
sprintf(buffer_gnss,"GNSSBUSY;\n");
return false;
}
if(state_gnss == LE_OK) // - LE_OK Function succeeded.
{ //LE_INFO("OK");
state_gnss=0;
le_pos_Get3DLocation(&latitude,&longitude,&hAccuracy,&altitude,&vAccuracy);
le_pos_GetDate(&yearPtr,&monthPtr,&dayPtr);
le_pos_GetTime(&hours,&minutes,&seconds,&milliseconds);
memset(buffer_gnss,0,sizeof(buffer_gnss)); // RAZ chaine de caractère
sprintf(buffer_gnss,"%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;\n",numTrame,latitude,longitude,hAccuracy,altitude,vAccuracy,yearPtr,monthPtr,dayPtr,hours,minutes,seconds,milliseconds);
LE_INFO("New trame");
LE_INFO("%s",buffer_gnss);
numTrame++;
return true;
}
return false;
}