vshymanskyy / TinyGSM

A small Arduino library for GSM modules, that just works
GNU Lesser General Public License v3.0
1.91k stars 708 forks source link

getGsmLocation(...) latitude and longitude values are in reversed order. #792

Open cognoquest opened 1 month ago

cognoquest commented 1 month ago
bool getGsmLocationImpl(float* lat, float* lon, float* accuracy = 0,
                    int* year = 0, int* month = 0, int* day = 0,
                    int* hour = 0, int* minute = 0, int* second = 0) 
// AT+CLBS=<type>,<cid>
// <type> 1 = location using 3 cell's information
//        3 = get number of times location has been accessed
//        4 = Get longitude latitude and date time
thisModem().sendAT(GF("+CLBS=4,1"));

ilat      = thisModem().streamGetFloatBefore(',');  // Latitude
ilon      = thisModem().streamGetFloatBefore(',');  // Longitude

The parameter option 4 states that it gets the longitude latitude and date time. The code requires a small change to the fetching order from the stream, first ilon then ilat.

ilon      = thisModem().streamGetFloatBefore(',');  // Longitude
ilat      = thisModem().streamGetFloatBefore(',');  // Latitude

Regards