Skip to content

Commit a2e917b

Browse files
committed
Use Michael's lock and unlock hooks
1 parent b83b326 commit a2e917b

File tree

2 files changed

+26
-30
lines changed

2 files changed

+26
-30
lines changed

Firmware/RTK_Surveyor/Begin.ino

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -577,8 +577,6 @@ void beginGNSS()
577577
{
578578
SPI.begin(); // Begin SPI here - beginSD has not yet been called
579579

580-
theGNSS._enableCheckUbloxLock = true; // Enable simple checkUblox locking
581-
582580
// setFileBufferSize must be called _before_ .begin
583581
// Use gnssHandlerBufferSize for now. TODO: work out if the SPI GNSS needs its own buffer size setting
584582
// Also used by Tasks.ino

Firmware/RTK_Surveyor/RTK_Surveyor.ino

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -231,34 +231,32 @@ char neoFirmwareVersion[20]; //Output to system status menu.
231231
uint8_t zedFirmwareVersionInt = 0; //Controls which features (constellations) can be configured (v1.12 doesn't support SBAS). Note: will fail above 2.55!
232232
uint8_t zedModuleType = PLATFORM_F9P; //Controls which messages are supported and configured
233233

234-
SFE_UBLOX_GNSS_SUPER theGNSS;
235-
236-
//// Use Michael's lock/unlock methods to prevent the UART2 task from calling checkUblox during a sendCommand and waitForResponse.
237-
//// Also prevents pushRawData from being called too.
238-
//class SFE_UBLOX_GNSS_SUPER_DERIVED : public SFE_UBLOX_GNSS_SUPER
239-
//{
240-
//public:
241-
// volatile bool _iAmLocked = false;
242-
// bool lock(void)
243-
// {
244-
// if (_iAmLocked)
245-
// {
246-
// unsigned long startTime = millis();
247-
// while (_iAmLocked && (millis() < (startTime + 2200)))
248-
// delay(1); // YIELD
249-
// if (_iAmLocked)
250-
// return false;
251-
// }
252-
// _iAmLocked = true;
253-
// return true;
254-
// }
255-
// void unlock(void)
256-
// {
257-
// _iAmLocked = false;
258-
// }
259-
//};
260-
//
261-
//SFE_UBLOX_GNSS_SUPER_DERIVED theGNSS;
234+
// Use Michael's lock/unlock methods to prevent the UART2 task from calling checkUblox during a sendCommand and waitForResponse.
235+
// Also prevents pushRawData from being called too.
236+
class SFE_UBLOX_GNSS_SUPER_DERIVED : public SFE_UBLOX_GNSS_SUPER
237+
{
238+
public:
239+
volatile bool _iAmLocked = false;
240+
bool lock(void)
241+
{
242+
if (_iAmLocked)
243+
{
244+
unsigned long startTime = millis();
245+
while (_iAmLocked && (millis() < (startTime + 2100)))
246+
delay(1); // YIELD
247+
if (_iAmLocked)
248+
return false;
249+
}
250+
_iAmLocked = true;
251+
return true;
252+
}
253+
void unlock(void)
254+
{
255+
_iAmLocked = false;
256+
}
257+
};
258+
259+
SFE_UBLOX_GNSS_SUPER_DERIVED theGNSS;
262260

263261
//These globals are updated regularly via the storePVTdata callback
264262
bool pvtUpdated = false;

0 commit comments

Comments
 (0)