Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App crash on Bangle.js 2 related to GPS time #1155

HilmarSt opened this issue Dec 21, 2021 · 2 comments

App crash on Bangle.js 2 related to GPS time #1155

HilmarSt opened this issue Dec 21, 2021 · 2 comments


Copy link

@HilmarSt HilmarSt commented Dec 21, 2021

Eventually GPS time is not usable on Bangle.js 2

On my Bangle.js 2 there are 2 cyclic NMEA telegrams, e.g.:


The $GPGSV is long time standard but I've never seen $GNGGA before. $G?GGA contains the UTC time in the first field.

I'm not sure if this applies to the hardware of Bangle.js version 2 but there is some evidence:
"Side note on the Ublox 8 series GPGGA is replaced by GNGGA by default to indicate the navigation information is from multiple GNSS sources (I.e American GPS and Russian GLONASS normally)."

The event Bangle.GPS with Call type: Bangle.on('GPS', function(fix) { ... });
provides a "fix" object with contains "time": Date, // Current Time (or undefined if not known)"

It seems to me that the parser which fills fix.time does only look for "GPGGA" and always returns "undefined" on Bangle.js2, even in the GPS fix state.

This leads to a crash in the GPS Info App:
The function formatTime(fix.time) in gps-info.js crashes in toUTCString() if fix.time contains "undefined".

function formatTime(now) {
  if (now == undefined) { return "no GPS time available"; }
    else {
  var fd = now.toUTCString().split(" ");
  var time = fd[4].substr(0, 5);
  var date = [fd[0], fd[1], fd[2]].join(" ");
  return time + " - " + date; }

-> Probably all Apps that rely on fix.time will not work on Bangle.js2

Copy link
Contributor Author

@HilmarSt HilmarSt commented Dec 22, 2021

Pull request created: #1167
The PR also contains an improvement: "The 4-dot progress indicator is replaced by the number of satellites in view."

@HilmarSt HilmarSt changed the title App crash on Bangle.js 2 with GPS NMEA telegram GNGGA instead of GPGGA (contains UTC time) App crash on Bangle.js 2 related to GPS time Dec 27, 2021
Copy link
Contributor Author

@HilmarSt HilmarSt commented Jan 3, 2022

I found out that the parser works with GGA and not GPGGA as assumed by me.
The crash will be solved with Pull Request #1167

@HilmarSt HilmarSt closed this as completed Jan 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

No branches or pull requests

1 participant