Description
Here I am again with a new question regarding the Sparkfun AssetTracker board and the SARA-R5 Arduino Library.
I was wondering how to invoke the API function gpsPower()
, and how to relate that function to SARA-R5 AT command AT+UGPS
:
// GPS
typedef enum
{
GNSS_SYSTEM_GPS = 1,
GNSS_SYSTEM_SBAS = 2,
GNSS_SYSTEM_GALILEO = 4,
GNSS_SYSTEM_BEIDOU = 8,
GNSS_SYSTEM_IMES = 16,
GNSS_SYSTEM_QZSS = 32,
GNSS_SYSTEM_GLONASS = 64
} gnss_system_t;
typedef enum
{
GNSS_AIDING_MODE_NONE = 0,
GNSS_AIDING_MODE_AUTOMATIC = 1,
GNSS_AIDING_MODE_ASSISTNOW_OFFLINE = 2,
GNSS_AIDING_MODE_ASSISTNOW_ONLINE = 4,
GNSS_AIDING_MODE_ASSISTNOW_AUTONOMOUS = 8
} gnss_aiding_mode_t;
bool isGPSon(void);
SARA_R5_error_t gpsPower(bool enable = true,
gnss_system_t gnss_sys = GNSS_SYSTEM_GPS,
gnss_aiding_mode_t gnss_aiding = GNSS_AIDING_MODE_AUTOMATIC);
First question: the call to gpsPower()
function is mandatory ? Actually the board get GPS fixes also without calling that function.
Second question: as far as I understood, you cannot set the gnss_sys
parameter with a bitmask of multiple values (while you can do that with the corresponding AT command) because the API function only accepts an enumerated value. Then I tried to invoke successively multiple instances of the gpsPower()
function, each instance with different parameter, for example:
gpsPower(true, GNSS_SYSTEM_GPS); delay(100);
gpsPower(true, GNSS_SYSTEM_GALILEO); delay(100);
gpsPower(true, GNSS_SYSTEM_BEIDOU); delay(100);
gpsPower(true, GNSS_SYSTEM_GLONASS); delay(100);
But, the AT debugging says that GPS is the only enabled GNNS system:
08:59:06.702 -> AT+UGPS?
08:59:06.702 ->
08:59:06.702 -> +UGPS: 1,1,1
On the other hand, you can set bitmasks through AT command "AT+UGPS", for example the AT command:
AT+UGPS=1,1,77
should set aiding_mode=1
(=automatic local aiding) and GNSS_systems=77
(=GPS+GLONASS+BEIDOU+GALILEO).
In this specific case, the strange behaviour I have found is that the AT+UGPS?
command reports:
09:35:18.913 -> AT+UGPS=1,1,77
09:35:18.913 -> AT+UGRMC=1
...
09:36:07.109 -> AT+UGPS?
09:36:07.145 ->
09:36:07.145 -> +UGPS: 1,1,99
that is, 99
instead of 77
!
This is the code (is it correct?):
enableAtDebugging();
enableGNSSAntennaPower();
setUtimeConfiguration(); // Use default offset (offsetNanoseconds = 0, offsetSeconds = 0)
const char* str2 = "=1,1,77";
char atCommand[100];
strcpy(atCommand, SARA_R5_GNSS_POWER);
strcat(atCommand, str2);
sendCommand(atCommand, true);
gpsEnableRmc(); // Enable GPRMC messages
setGpsReadCallback(&processGpsReadStatic);
Any help would be very much appreciated! :-)
David