ChipChop Support Forum
Log in
Log out
Join the forum
My Details
REPLIES: 2
VIEWS: 216
BACK
REPLY TO THIS POST
Gizmo
06 Apr 2024
New Component - GPS Coordinates
New component type GPS is now available in the Dev Console.

This component takes advantage of the new ChipChop engine data type "value array" that allows storing combined numeric data, which in this case is GPS latitude & longitude coordinates combined in one.

Dev Console setup

You will find the GPS in the list of pre-set components. There is nothing special you need to do, simply select it as a component and there are no additional settings required.



ChipChop App view

In the ChipChop App the GPS component shows combined values and also provides a "View Map" button that opens Google Maps in a browser window with the marker set at the coordinates values.




Usage

The format of the status you would send from your device has to be an array as a String, meaning that the values have to be enclosed in square brackets [ ]

Important:

    1. The latitude value is the first item in the array and the longitude is second. If you reverse the order it will not show the correct location in Google Maps

    2. The values have to be numbers (float)

    3. There is no floating precision limit but large numbers (over 9 decimal places) may look very small in the App widget view

Example




    float latitude = 51.5285262;
    float longitude = -0.2664036;

    String status = "[" + String(latitude) + "," + String(longitude) + "]"; // so it would look like this >>> [51.5285262,-0.2664036]

    ChipChop.updateStatus("gps_coordinates",status);





Limitations

Currently there is no option for using this component in an Action trigger IF statement simply because the IF expects a single value and here we have two.
Don't worry, as this will be a standard component I will be expanding the Actions soon and you will be able to use it as any other component.


Future Improvements

As requested by some users I will be expanding the Small Log so you will be able to log a set of coordinates that can be later viewed as a "route map" so you can use this component to log and view nicely walking or driving routes.







Attached images
abuenop
21 Apr 2024
ACCEPTED

Thanks Gizmo!

It works great! Just a note about your example. If you do it in that way in the Arduino IDE, the precision is truncated to 2 digits, so it's better to use this code, which gives a precision of 7:




float latitude = 51.5285262;
float longitude = -0.2664036;

String status = "[" + String(latitude,7) + "," + String(longitude,7) + "]"; // so it would look like this >>> [51.5285262,-0.2664036]

ChipChop.updateStatus("gps_coordinates",status);


Gizmo
21 Apr 2024

Ah, well spotted! 👍🏻

I completely forgot to mention that little issue (and there was a long post with Edgardo few weeks ago on that topic https://forum.chipchop.io/post/455/)

Hey, I will be looking into the route mapping for GPS, I am stuck at the moment re-writing all Docs & API to include all the new stuff. And also, I had a look at LVGL, looks really interesting I may dig into that at some point but can't promise when.

How's the bike project going?...have you started on that ...'cmon, where's the pictures I am dying to see something :-))