Skip to content

Commit 0339462

Browse files
committed
Example updates. Remove default parameters from Internal functions.
1 parent 859a5d0 commit 0339462

File tree

6 files changed

+97
-9
lines changed

6 files changed

+97
-9
lines changed

examples/AssistNow/AssistNow_Offline/Example1_AssistNowOffline/Example1_AssistNowOffline.ino

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,11 @@ void setup()
114114
if(!getLocalTime(&timeinfo))
115115
{
116116
Serial.println("Failed to obtain time");
117-
return;
118117
}
119-
Serial.println(&timeinfo, "Time is: %A, %B %d %Y %H:%M:%S");
118+
else
119+
{
120+
Serial.println(&timeinfo, "Time is: %A, %B %d %Y %H:%M:%S");
121+
}
120122

121123
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
122124
// Use HTTP GET to receive the AssistNow_Online data

examples/AssistNow/AssistNow_Online/Example1_AssistNowClient/Example1_AssistNowClient.ino renamed to examples/AssistNow/AssistNow_Online/Example1_AssistNowOnline/Example1_AssistNowOnline.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,8 @@ void setup()
186186
// So, we could set the pushAssistNowData mgaAck parameter to SFE_UBLOX_MGA_ASSIST_ACK_YES.
187187
// But, just for giggles, let's use SFE_UBLOX_MGA_ASSIST_ACK_ENQUIRE just to confirm that the
188188
// MGA-ACK messages are actually enabled.
189-
// Wait for up to 1000ms for each ACK to arrive! 1000ms is a bit excessive... 7ms is nearer the mark.
190-
myGNSS.pushAssistNowData(payload, (size_t)payloadSize, SFE_UBLOX_MGA_ASSIST_ACK_ENQUIRE, 1000);
189+
// Wait for up to 100ms for each ACK to arrive! 100ms is a bit excessive... 7ms is nearer the mark.
190+
myGNSS.pushAssistNowData(payload, (size_t)payloadSize, SFE_UBLOX_MGA_ASSIST_ACK_ENQUIRE, 100);
191191

192192
// Set setI2CpollingWait to 125ms to avoid pounding the I2C bus
193193
myGNSS.setI2CpollingWait(125);
@@ -233,4 +233,4 @@ void loop()
233233
else if(fixType == 5) Serial.print(F("Time only"));
234234

235235
Serial.println();
236-
}
236+
}

examples/AssistNow/AssistNow_Online/Example2_AssistNowOnline_TimeDelay/Example2_AssistNowOnline_TimeDelay.ino

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,11 @@ void setup()
109109
if(!getLocalTime(&timeinfo))
110110
{
111111
Serial.println("Failed to obtain time");
112-
return;
113112
}
114-
Serial.println(&timeinfo, "Time is: %A, %B %d %Y %H:%M:%S");
113+
else
114+
{
115+
Serial.println(&timeinfo, "Time is: %A, %B %d %Y %H:%M:%S");
116+
}
115117

116118
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
117119
// Use HTTP GET to receive the AssistNow_Online data

examples/AssistNow/README.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ With AssistNow Online, an Internet connected host downloads assistance data from
1010

1111
Please see the [AssistNow_Online](./AssistNow_Online) examples for more details. These examples were written for the ESP32, but will run on other platforms too.
1212

13+
The new functions we've added to the library to support AssistNow Online are described [Code Support for AssistNow below](#Code-Support-for-AssistNow)
14+
1315
## AssistNow<sup>TM</sup> Offline
1416

1517
With the AssistNow Offline service, users can download long-term orbit data over the Internet at their convenience. The orbit data can be stored in the memory of the application processor. The function requires no connectivity at system start-up, enabling a position fix within seconds, even when no network is available. AssistNow Offline offers augmentation for up to 35 days.
@@ -18,6 +20,8 @@ Please see the [AssistNow_Offline](./AssistNow_Offline) examples for more detail
1820

1921
**Note: AssistNow Offline is not supported by the ZED-F9P. "The ZED-F9P supports AssistNow Online only."**
2022

23+
The new functions we've added to the library to support AssistNow Offline are described [Code Support for AssistNow below](#Code-Support-for-AssistNow)
24+
2125
## AssistNow<sup>TM</sup> Autonomous
2226

2327
AssistNow Autonomous provides aiding information without the need for a host or external network connection. Based on previous broadcast satellite ephemeris data downloaded to and stored by the GNSS receiver, AssistNow Autonomous automatically generates accurate predictions of satellite orbital data (“AssistNow Autonomous data”) that is usable for future GNSS position fixes.
@@ -33,6 +37,8 @@ AssistNow Autonomous offers augmentation for up to 6 days.
3337

3438
Please see the [AssistNow_Autonomous](./AssistNow_Autonomous) examples for more details.
3539

40+
The new functions we've added to the library to support AssistNow Autonomous are described [Code Support for AssistNow below](#Code-Support-for-AssistNow)
41+
3642
## AssistNow Service Token
3743

3844
To be able to use AssistNow Online or AssistNow Offline, you will need a token to access the u-blox Thingstream server.
@@ -55,3 +61,81 @@ The _free_ AssistNow Developer token entitles you to:
5561
* CellLocate Developer: 5K free location requests per month. Capped.
5662

5763
The free token will expire after 90 days, but you can continue to use it beyond that by registering it on [Thingstream](https://portal.thingstream.io/).
64+
65+
## Code Support for AssistNow
66+
67+
```pushAssistNowData``` allows the AssistNow Online data or Offline data from the u-blox server to be pushed to the module. As the ESP32 HTTP GET function returns a ```String```, we've included overloaded functions which allow you to pass the data as a ```String``` or as ```const uint8_t *```.
68+
69+
The String-based function declarations are:
70+
71+
* size_t pushAssistNowData(const String &dataBytes, size_t numDataBytes, sfe_ublox_mga_assist_ack_e mgaAck, uint16_t maxWait);
72+
* size_t pushAssistNowData(bool skipTime, const String &dataBytes, size_t numDataBytes, sfe_ublox_mga_assist_ack_e mgaAck, uint16_t maxWait);
73+
* size_t pushAssistNowData(size_t offset, bool skipTime, const String &dataBytes, size_t numDataBytes, sfe_ublox_mga_assist_ack_e mgaAck, uint16_t maxWait);
74+
75+
The const uint8_t * function declarations are:
76+
77+
* size_t pushAssistNowData(const uint8_t *dataBytes, size_t numDataBytes, sfe_ublox_mga_assist_ack_e mgaAck, uint16_t maxWait);
78+
* size_t pushAssistNowData(bool skipTime, const uint8_t *dataBytes, size_t numDataBytes, sfe_ublox_mga_assist_ack_e mgaAck, uint16_t maxWait);
79+
* size_t pushAssistNowData(size_t offset, bool skipTime, const uint8_t *dataBytes, size_t numDataBytes, sfe_ublox_mga_assist_ack_e mgaAck, uint16_t maxWait);
80+
81+
```dataBytes``` is a pointer to the AssistNow Online data.
82+
<br>
83+
```numDataBytes``` is the length of the AssistNow Online data.
84+
<br>
85+
86+
```pushAssistNowData``` pushes individual packets of data to the u-blox module. Sending all of the data contiguously would overload the module, so ```pushAssistNowData``` can either:
87+
88+
* insert a small delay between each packet (the default is 7ms)
89+
* or use the ```UBX-MGA-ACK-DATA0``` acknowledgement message to acknowledge each packet
90+
91+
```mgaAck``` controls which method is used.
92+
93+
* if ```mgaAck``` is ```SFE_UBLOX_MGA_ASSIST_ACK_NO``` (**default**), a delay of ```maxWait``` milliseconds is inserted between eack packet. ```maxWait``` defaults to 7ms.
94+
* if ```mgaAck``` is ```SFE_UBLOX_MGA_ASSIST_ACK_YES```, acknowledgement messages will be expected with a _timeout_ of ```maxWait``` milliseconds. The default timeout is again 7ms, but you can increase this if required by passing a larger value.
95+
* if ```mgaAck``` is ```SFE_UBLOX_MGA_ASSIST_ACK_ENQUIRE```, the code will poll the module to enquire if the achnowledgement messages are enabled. If they are, they will be used. If not, a delay is used.
96+
97+
```setAckAiding``` enables or disables the acknowledgement messages. By default they are disabled. ```setAckAiding(1)``` will enable them. ```setAckAiding(0)``` will disable them again.
98+
<br>
99+
```getAckAiding``` returns 1 if the acknowledgement messages are enabled, 0 if they are disabled. 255 indicates an error or timeout.
100+
<br>
101+
102+
AssistNow Online data is valid for 2-4 hours. 'Stale' data can be re-used but:
103+
104+
* ```pushAssistNowData``` needs to be told to skip the time information contained in the AssistNow data
105+
* the user needs to provide the module with UTC time separately
106+
107+
The ```skipTime``` parameter tells ```pushAssistNowData``` to skip any time information in the data. ```skipTime``` is bool. Set it to ```true``` to skip the time information.
108+
<br>
109+
UTC time can be pushed to the module first by calling ```setUTCTimeAssistance```:
110+
111+
* bool setUTCTimeAssistance(uint16_t year, uint8_t month, uint8_t day, uint8_t hour, uint8_t minute, uint8_t second, uint32_t nanos, uint16_t tAccS, uint32_t tAccNs, uint8_t source, sfe_ublox_mga_assist_ack_e mgaAck, uint16_t maxWait);
112+
113+
Only the ```year```, ```month```, ```day```, ```hour```, ```minute``` and ```second``` parameters are mandatory. The others default to sensible values. Again ```mgaAck``` and ```maxWait``` control if a delay is used when configuring the time, or if an acknowledgement message will be expected.
114+
<br>
115+
```nanos``` (nanoseconds), ```tAccS``` (time accuracy estimate (seconds)), ```tAccNs``` (time accuracy estimate (nanoseconds)) and ```source``` (if a clock signal will be provided on EXT_INT) are optional, but are available for advanced users.
116+
<br>
117+
```year``` numbering starts at 0; 2021 is 2021, not 121 (years since 1900). ```month``` and ```day``` numbering starts at 1, not 0.
118+
<br>
119+
120+
Call ```setUTCTimeAssistance``` _before_ ```pushAssistNowData```.
121+
122+
## Additional Code Support for AssistNow Offline
123+
124+
AssistNow Offline data downloaded from the u-blox server can contain 1-5 weeks of data. However, only the data for _today_ should be pushed the module. Sending data for past or future days will confuse the module.
125+
```findMGAANOForDate``` can be used to find the location of the start of the UBX-MGA-ANO data for the specified date within the offline data. That location can then be passed to ```pushAssistNowData``` using the ```offset``` parameter.
126+
127+
* size_t findMGAANOForDate(const uint8_t *dataBytes, size_t numDataBytes, uint16_t year, uint8_t month, uint8_t day, uint8_t daysIntoFuture);
128+
129+
The sequence of events is:
130+
131+
* call ```findMGAANOForDate``` passing the ```year```, ```month``` and ```day``` for today. ```findMGAANOForDate``` will return the location / offset of the data for today within the offline data.
132+
* call ```findMGAANOForDate``` again passing the ```year```, ```month``` and ```day``` for _today_ but also set ```daysIntoFuture``` to 1. ```findMGAANOForDate``` will then return the location / offset of the data for _tomorrow_ (one day into the future).
133+
* call ```pushAssistNowData``` setting:
134+
* ```offset``` to the location (offset) of today's data within the offline data
135+
* ```skipTime``` to ```true```
136+
* ```numDataBytes``` to ((tomorrow's location) - (today's location)). Only the offline data for today will be pushed.
137+
138+
```findMGAANOForDate``` will return a value of numDataBytes if the data for the chosen day cannot be found.
139+
<br>
140+
Again, call ```setUTCTimeAssistance``` _before_ ```pushAssistNowData```.
141+

src/SparkFun_u-blox_GNSS_Arduino_Library.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1328,8 +1328,8 @@ class SFE_UBLOX_GNSS
13281328
//Functions
13291329
bool checkUbloxInternal(ubxPacket *incomingUBX, uint8_t requestedClass = 255, uint8_t requestedID = 255); //Checks module with user selected commType
13301330
void addToChecksum(uint8_t incoming); //Given an incoming byte, adjust rollingChecksumA/B
1331-
size_t pushAssistNowDataInternal(size_t offset, bool skipTime, const uint8_t *dataBytes, size_t numDataBytes, sfe_ublox_mga_assist_ack_e mgaAck = SFE_UBLOX_MGA_ASSIST_ACK_NO, uint16_t maxWait = defaultMGAdelay);
1332-
size_t findMGAANOForDateInternal(const uint8_t *dataBytes, size_t numDataBytes, uint16_t year, uint8_t month, uint8_t day, uint8_t daysIntoFuture = 0);
1331+
size_t pushAssistNowDataInternal(size_t offset, bool skipTime, const uint8_t *dataBytes, size_t numDataBytes, sfe_ublox_mga_assist_ack_e mgaAck, uint16_t maxWait);
1332+
size_t findMGAANOForDateInternal(const uint8_t *dataBytes, size_t numDataBytes, uint16_t year, uint8_t month, uint8_t day, uint8_t daysIntoFuture);
13331333

13341334
//Return true if this "automatic" message has storage allocated for it
13351335
bool checkAutomatic(uint8_t Class, uint8_t ID);

0 commit comments

Comments
 (0)