[Solved] Lat OK but Long is wrong (64 bits Linux compilation)

Bracame

Member
Hi, i'm building my Ardumower (Alfred Linux firmware) and my GPS report strange value :

LOG :
ctlDur=0.03 op=GpsRebootRecovery(initiatedByOperator 0)->Dock mem=3924 bat=28.32,-0.003(-0.43) chg=-1.07,0(1.24) diff=-29.442 tg=15.47,0.11 x=15.22 y=1.19 delta=0.80 tow=53825400 lon=427.93XXXXX lat=49.5XXXXX h=118.9 n=1.19 e=15.22 d=42949672.00 sol=1 age=0.32

I live at Latitude : 49.XXXX | Longitude : -1.5XXXXX

A lot of GPSjump with great position change :

Capture d’écran du 2024-05-19 16-38-42.png
Using actual github code... The other side of the greenwich meridian is an issue ?

GPS came from Marotronic.

Thank you for help please.

Christophe
 
Hi,

It look like a size of long bug -> I'm compliling on a 64bits Linux. Will change some variables type in Ublox driver ....
 
Bug solved by using defined variables length in ublox.cpp file :

int32_t UBLOX::unpack_int32(int offset) {

return (
int32_t)this->unpack(offset, 4);
}

int16_t UBLOX::unpack_int16(int offset) {

return (
int16_t)this->unpack(offset, 2);
}

int8_t UBLOX::unpack_int8(int offset) {

return (int8_t)this->unpack(offset, 1);
}

int32_t UBLOX::unpack(int offset, int size) {

int32_t value = 0; // use the good type

for (
uint8_t k=0; k<size; ++k) {
value <<= 8;
value |= (0xFF & this->payload[offset+size-k-1]);
}

return value;
}


Now this code is portable to 32 or 64 bits systems.
 
Oben