GPS speed from Android/Gadgetbridge in m/s

Posted on
  • Hi fellow Banglers

    While working on an app which also displays the current speed, I've noticed that the read-out was wrong when using the "Overwrite GPS" function of the Android integration. I'm not a Java expert, but as far as I can tell, the code in Gadgetbride (app/src/main/java/nodomain/freeyourgadg­et/gadgetbridge/service/devices/banglejs­/BangleJSDeviceSupport.java) forwards the Android location.getSpeed() unchanged. According to the Android SDK, that's in "meters per second" - so, not what the Bangle API should return (ie. kph).

    I think the correct fix (speed * 3.6) should be done in Gadgetbridge. Alternatively, the Bangle android app could do the same. Thoughts?

    BTW I'm new to Bangle coding. The watch is brilliant!

  • Hi! Thanks for tracking this down, that's a huge help!

    I think you're right - it's nicer to put it in Gadgetbridge so all the GPS structs on the Bangle have speed in the same format.

    I've just put a fix into Gadgetbridge, so it should be in the next nightly build (or next time I update the play store)

  • Thanks Gordon!
    I'll wait for the next F-Droid Bangle.js Gadgetbridge update.

    For anybody stumbling across this post, this is my temporary work-around:

    var androidOverwriteGps = false;
    var androidSettings = require("Storage").readJSON("android.set­tings.json",1)||{};
    if ('overwriteGps' in androidSettings && androidSettings.overwriteGps)
          androidOverwriteGps = true;
    
    ... [snip] ...
    
    if (androidOverwriteGps) // speed from Android GPS is in m/s (not kph)
          fix.speed *= 3.6;
    
  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

GPS speed from Android/Gadgetbridge in m/s

Posted by Avatar for flaparoo @flaparoo

Actions