How to check for GPS fix using script ? - General Help and Assistance on using CHDK stable releases - CHDK Forum

How to check for GPS fix using script ?

  • 2 Replies
  • 1976 Views
How to check for GPS fix using script ?
« on: 21 / June / 2015, 12:24:50 »
Advertisements
I need my script to verify that we have GPS fix (S100) 
how can I do that ?

Re: How to check for GPS fix using script ?
« Reply #1 on: 21 / June / 2015, 14:44:34 »
There is a propcase containing structure for GPS status (defined in core/gps.h) that looks like this :

Code: [Select]
typedef struct {
    char    latitudeRef[4];
    int     latitude[6];
    char    longitudeRef[4];
    int     longitude[6];
    char    heightRef[4];
    int     height[2];
    int     timeStamp[6];
    char    status[2];
    char    mapDatum[7];
    char    dateStamp[11];
    char    unknown2[160];
} tGPS;

It's propcasee 359 for propset 4,  358 for propset 5, and 357 for propset 6.   

In Lua, you can use
Code: [Select]
props=require("propcase")
get_prop(props.GPS)

rudi & msl have done a lot of work on this for several cameras including the S100.  You can find a lot of useful information and examples here : chdkde gps lib although you might have to puzzle out some German translations.
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline reyalp

  • ******
  • 14125
Re: How to check for GPS fix using script ?
« Reply #2 on: 21 / June / 2015, 16:47:25 »
It's propcasee 359 for propset 4,  358 for propset 5, and 357 for propset 6.   

In Lua, you can use
Code: [Select]
props=require("propcase")
get_prop(props.GPS)
To read more than the first 4 bytes, you need to use get_prop_str rather than get_prop (the chdkde gpsLib.lua has an example)
Don't forget what the H stands for.

 

Related Topics


SimplePortal © 2008-2014, SimplePortal