You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#ifdef useGlobalFlag // If we are using the global flag
49
-
50
-
newPVTdata = true;
51
-
52
-
#endif
53
-
40
+
Serial.println(F("Hey! The NAV PVT callback has been called!"));
54
41
}
55
42
56
43
voidsetup()
@@ -79,49 +66,17 @@ void setup()
79
66
80
67
voidloop()
81
68
{
82
-
myGNSS.checkUblox(); // Check for the arrival of new data and process it.
83
-
84
-
85
-
#ifndef useGlobalFlag // If we are not using the global flag
86
-
87
-
staticbool callbackDataValid = false; // Flag to show that fresh callback data is available
88
-
89
-
// Is the callback data valid?
90
-
// If automaticFlags.flags.bits.callbackCopyValid is true, it indicates new PVT data has been received and has been copied
91
-
// automaticFlags.flags.bits.callbackCopyValid will be cleared when the callback is called
92
-
93
-
if ((callbackDataValid == false) && (myGNSS.packetUBXNAVPVT->automaticFlags.flags.bits.callbackCopyValid == true))
94
-
{
95
-
Serial.println(F("NAV PVT callback data is now valid"));
96
-
callbackDataValid = true; // Set the flag
97
-
}
98
-
99
-
#endif
100
-
101
69
102
-
myGNSS.checkCallbacks(); // Check if any callbacks are waiting to be processed.
103
-
104
-
// Check if new PVT data has been received
105
-
106
-
107
-
#ifdef useGlobalFlag
108
-
109
-
if (newPVTdata)
110
-
{
111
-
112
-
113
-
#else// If we are not using the global flag
114
-
70
+
myGNSS.checkUblox(); // Check for the arrival of new data and process it.
115
71
116
-
// automaticFlags.flags.bits.callbackCopyValid will have been cleared after the callback was called
72
+
// Check if new NAV PVT data has been received:
73
+
// If myGNSS.packetUBXNAVPVT->automaticFlags.flags.bits.callbackCopyValid is true, it indicates new PVT data has been received and has been copied.
74
+
// automaticFlags.flags.bits.callbackCopyValid will be cleared automatically when the callback is called.
117
75
118
-
if ((callbackDataValid == true) && (myGNSS.packetUBXNAVPVT->automaticFlags.flags.bits.callbackCopyValid == false))
76
+
if (myGNSS.packetUBXNAVPVT->automaticFlags.flags.bits.callbackCopyValid == true)
119
77
{
120
-
callbackDataValid = false; // Clear the flag
121
-
122
-
123
-
#endif
124
-
78
+
// But, we can manually clear the callback flag too. This will prevent the callback from being called!
79
+
myGNSS.packetUBXNAVPVT->automaticFlags.flags.bits.callbackCopyValid = false; // Comment this line if you still want the callback to be called
125
80
126
81
Serial.println();
127
82
@@ -158,6 +113,8 @@ void loop()
158
113
Serial.println(F(" (mm)"));
159
114
}
160
115
116
+
myGNSS.checkCallbacks(); // Check if any callbacks are waiting to be processed. There will not be any in this example, unless you commented the line above
0 commit comments