stanleyhuangyc / Freematics

Official source code repository for Freematics
https://freematics.com
419 stars 345 forks source link

A bug and a meaningless(?) calculation #195

Closed Bluebrain2000 closed 3 months ago

Bluebrain2000 commented 6 months ago

in: firmware_v5/telelogger/telelogger.ino line 301

if ((lastGPSLat || lastGPSLng) && (abs(gd->lat - lastGPSLat) > 0.001 || abs(gd->lng - lastGPSLng > 0.001))) {
  // invalid coordinates data

1st: a bracket is wrong at the end, this should be abs(gd->lng - lastGPSLng) > 0.001 instead of abs(gd->lng - lastGPSLng > 0.001)

2nd: Why is it assumed that the GPS coordinates are invalid if they have differed by more than 0.001 since the last position? Then all data would be treated as invalid if the vehicle is in motion, since the GPS coordinates are constantly changing.

stanleyhuangyc commented 3 months ago

Thanks. Fixed.