GPS_Math not calculating correctly for Southern Hemisphere with Particle Asset Tracker

Hi,

I am building an Asset Tracking solution using the Particle Electron Asset Tracker using fancy-asset-tracker, (using https://github.com/dmiddlecamp/fancy-asset-tracker) as a basis.
(Seems to work nicely with the wake-on-move / GPS Reading).

I’m not sure if I’ve picked up a bug in GPS_Math.h?

I am in the Southern Hemisphere and instead of coming up as -28.00, it comes up as 28.00, (putting me in the wrong location).

The library I am using is as follows;
###########################

#include <math.h>
#include <ctype.h>
#ifndef _GPS_MATH_H
#define _GPS_MATH_H

 //http://arduinodev.woofex.net/2013/02/06/adafruit_gps_forma/
double convertDegMinToDecDeg (float degMin) {
  double min = 0.0;
  double decDeg = 0.0;

  //get the minutes, fmod() requires double
  min = fmod((double)degMin, 100.0);

  //rebuild coordinates in decimal degrees
  degMin = (int) ( degMin / 100 );
  decDeg = degMin + ( min / 60 );

  return decDeg;
}
#endif

##############

Is someone able to assist me in debugging this to get the correct latitude?
Or else let me know if I’m looking in the wrong location.

Much appreciated!

I don’t think there’s anything wrong in that function…

Can you show us your actual code?

1 Like

HI Dougal, thanks for responding. This morning I flashed my unit with the wake-on-move sample from AssetTrackerRK library 0.2.1 released and it appears to be reporting correctly.

I’m porting my routines to his samples and will go from there… No need to trouble-shoot at this point.
If the problem reappears then I know where to start looking :wink:

3 Likes