Skip to content

Commit 73eb7bb

Browse files
authored
Merge branch 'release_candidate' into after-set-cmd
2 parents b64114b + c3c9f50 commit 73eb7bb

27 files changed

+185
-76
lines changed

Firmware/RTK_Everywhere/AP-Config/index.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,17 @@
363363
</div>
364364
</div>
365365

366+
<div id="useMSM7Setting">
367+
<div class="form-check mt-3">
368+
<label class="form-check-label" for="useMSM7">MSM7 RTCM Selection</label>
369+
<input class="form-check-input" type="checkbox" value="" id="useMSM7">
370+
<span class="tt" data-bs-placement="right"
371+
title="Use MSM7 format RTCM mesages. Default: Disabled (MSM4).">
372+
<span class="icon-info-circle text-primary ms-2"></span>
373+
</span>
374+
</div>
375+
</div>
376+
366377
<div class="form-check mt-3">
367378
<label class="form-check-label" for="enableNtripClient">Enable NTRIP Client</label>
368379
<input class="form-check-input" type="checkbox" value="" id="enableNtripClient">

Firmware/RTK_Everywhere/AP-Config/src/main.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ function parseIncoming(msg) {
112112
hide("externalPortOptions");
113113
show("logToSDCard");
114114
hide("galileoHasSetting");
115+
hide("useMSM7Setting");
115116
hide("tiltConfig");
116117
hide("beeperControl");
117118
show("measurementRateInput");
@@ -145,6 +146,7 @@ function parseIncoming(msg) {
145146
show("externalPortOptions");
146147
show("logToSDCard");
147148
hide("galileoHasSetting");
149+
hide("useMSM7Setting");
148150
hide("tiltConfig");
149151
hide("beeperControl");
150152
show("measurementRateInput");
@@ -165,6 +167,7 @@ function parseIncoming(msg) {
165167
show("externalPortOptions");
166168
show("logToSDCard");
167169
hide("galileoHasSetting");
170+
hide("useMSM7Setting");
168171
hide("tiltConfig");
169172
hide("beeperControl");
170173
hide("measurementRateInput");
@@ -255,6 +258,7 @@ function parseIncoming(msg) {
255258
show("logToSDCard");
256259

257260
hide("galileoHasSetting");
261+
show("useMSM7Setting");
258262
hide("tiltConfig");
259263
hide("beeperControl");
260264

@@ -324,6 +328,7 @@ function parseIncoming(msg) {
324328
hide("constellationSbas"); //Not supported on LG290P
325329
show("constellationNavic");
326330
hide("galileoHasSetting"); //Not supported on LG290P
331+
show("useMSM7Setting");
327332
hide("tiltConfig"); //Not supported on Torch X2
328333

329334
show("measurementRateInput");

Firmware/RTK_Everywhere/Begin.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1955,10 +1955,10 @@ void tpISR()
19551955
{
19561956
if (timTpUpdated) // Only sync if timTpUpdated is true - set by storeTIMTPdata on ZED platforms only
19571957
{
1958-
if (millisNow - lastRTCSync >
1958+
if ((millisNow - lastRTCSync) >
19591959
syncRTCInterval) // Only sync if it is more than syncRTCInterval since the last sync
19601960
{
1961-
if (millisNow < (timTpArrivalMillis + 999)) // Only sync if the GNSS time is not stale
1961+
if ((millisNow - timTpArrivalMillis) < 999) // Only sync if the GNSS time is not stale
19621962
{
19631963
if (gnss->isFullyResolved()) // Only sync if GNSS time is fully resolved
19641964
{

Firmware/RTK_Everywhere/Bluetooth.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ void bluetoothUpdate()
5959
{
6060
#ifdef COMPILE_BT
6161
static uint32_t lastCheck = millis(); // Check if connected every 100ms
62-
if (millis() > (lastCheck + 100))
62+
if ((millis() - lastCheck) > 100)
6363
{
6464
lastCheck = millis();
6565

Firmware/RTK_Everywhere/Display.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ void displayUpdate()
212212
if (online.display == true)
213213
{
214214
static unsigned long lastDisplayUpdate = 0;
215-
if (millis() - lastDisplayUpdate > 500 || forceDisplayUpdate == true) // Update display at 2Hz
215+
if (((millis() - lastDisplayUpdate) > 500) || (forceDisplayUpdate == true)) // Update display at 2Hz
216216
{
217217
lastDisplayUpdate = millis();
218218
forceDisplayUpdate = false;
@@ -2493,7 +2493,7 @@ void paintSystemTest()
24932493
if (online.display == true)
24942494
{
24952495
// Toggle between two displays
2496-
if (millis() - systemTestDisplayTime > 3000)
2496+
if ((millis() - systemTestDisplayTime) > 3000)
24972497
{
24982498
systemTestDisplayTime = millis();
24992499
systemTestDisplayNumber++;
@@ -3206,7 +3206,7 @@ void displayWebConfig(std::vector<iconPropertyBlinking> &iconPropertyList)
32063206

32073207
// Toggle display back and forth for long SSIDs and IPs
32083208
// Run the timer no matter what, but load firstHalf/lastHalf with the same thing if strlen < maxWidth
3209-
if (millis() - ssidDisplayTimer > 2000)
3209+
if ((millis() - ssidDisplayTimer) > 2000)
32103210
{
32113211
ssidDisplayTimer = millis();
32123212
ssidDisplayFirstHalf = !ssidDisplayFirstHalf;

Firmware/RTK_Everywhere/ESPNOW.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ void espNowUpdate()
638638

639639
// If it's been longer than 50ms since we last added a byte to the buffer
640640
// then we've reached the end of the RTCM stream. Send partial buffer.
641-
if (espNowOutgoingSpot > 0 && (millis() - espNowLastAdd) > 50)
641+
if ((espNowOutgoingSpot > 0) && ((millis() - espNowLastAdd) > 50))
642642
{
643643
if (espNowState == ESPNOW_PAIRED)
644644
esp_now_send(0, (uint8_t *)&espNowOutgoing, espNowOutgoingSpot); // Send partial packet to all peers
@@ -654,7 +654,7 @@ void espNowUpdate()
654654

655655
// If we don't receive an ESP NOW packet after some time, set RSSI to very negative
656656
// This removes the ESPNOW icon from the display when the link goes down
657-
if (millis() - espNowLastRssiUpdate > 5000 && espNowRSSI > -255)
657+
if (((millis() - espNowLastRssiUpdate) > 5000) && (espNowRSSI > -255))
658658
espNowRSSI = -255;
659659

660660
// The display menu, serial menu, or CLI may request pairing be started
@@ -682,7 +682,7 @@ void espNowUpdate()
682682
randomSeed(millis());
683683
static unsigned long lastMacSend = millis();
684684
static int timeout = 1000 + random(0, 100); // Pick a random number between 1000 to 1100ms
685-
if (millis() - lastMacSend > timeout)
685+
if ((millis() - lastMacSend) > timeout)
686686
{
687687
lastMacSend = millis();
688688
espNowSendPairMessage(

Firmware/RTK_Everywhere/GNSS.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ static void pushGPGGA(char *ggaData)
106106
// Provide the caster with our current position as needed
107107
if (ntripClient->connected() && settings.ntripClient_TransmitGGA == true)
108108
{
109-
if (millis() - lastGGAPush > NTRIPCLIENT_MS_BETWEEN_GGA)
109+
if ((millis() - lastGGAPush) > NTRIPCLIENT_MS_BETWEEN_GGA)
110110
{
111111
lastGGAPush = millis();
112112

@@ -359,7 +359,7 @@ void gnssFirmwareBeginUpdate()
359359
// Button task will gnssFirmwareRemoveUpdate and restart
360360

361361
// Temporary fix for buttonless Flex. TODO - remove
362-
if ((productVariant == RTK_FLEX) && (millis() > (lastSerial + 30000)))
362+
if ((productVariant == RTK_FLEX) && ((millis() - lastSerial) > 30000))
363363
{
364364
// Beep to indicate exit
365365
beepOn();

Firmware/RTK_Everywhere/GNSS_LG290P.ino

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -598,11 +598,16 @@ bool GNSS_LG290P::enterConfigMode(unsigned long waitForSemaphoreTimeout_millis)
598598
do
599599
{ // Wait for up to waitForSemaphoreTimeout for library to stop blocking
600600
isBlocking = _lg290p->isBlocking();
601-
} while (isBlocking && (millis() < (start + waitForSemaphoreTimeout_millis)));
601+
} while (isBlocking && ((millis() - start) < waitForSemaphoreTimeout_millis));
602602

603603
// This will fail if the library is still blocking, but it is worth a punt...
604-
return (_lg290p->sendOkCommand("$PQTMCFGPROT",
605-
",W,1,2,00000000,00000000")); // Disable NMEA and RTCM on the LG290P UART2
604+
605+
if (lg290pFirmwareVersion >= 6) // See #747
606+
// Disable NMEA and RTCM on the LG290P UART2, but leave the undocumented Bit 1 enabled
607+
return (_lg290p->sendOkCommand("$PQTMCFGPROT", ",W,1,2,00000007,00000002"));
608+
609+
// Disable NMEA and RTCM on the LG290P UART2
610+
return (_lg290p->sendOkCommand("$PQTMCFGPROT", ",W,1,2,00000000,00000000"));
606611
}
607612
return (false);
608613
}
@@ -613,8 +618,14 @@ bool GNSS_LG290P::enterConfigMode(unsigned long waitForSemaphoreTimeout_millis)
613618
bool GNSS_LG290P::exitConfigMode()
614619
{
615620
if (online.gnss)
616-
return (_lg290p->sendOkCommand("$PQTMCFGPROT",
617-
",W,1,2,00000005,00000005")); // Enable NMEA and RTCM on the LG290P UART2
621+
{
622+
if (lg290pFirmwareVersion >= 6) // See #747
623+
// Enable NMEA and RTCM on the LG290P UART2, plus the undocumented Bit 1
624+
return (_lg290p->sendOkCommand("$PQTMCFGPROT", ",W,1,2,00000007,00000007"));
625+
626+
// Enable NMEA and RTCM on the LG290P UART2
627+
return (_lg290p->sendOkCommand("$PQTMCFGPROT", ",W,1,2,00000005,00000005"));
628+
}
618629
return (false);
619630
}
620631

@@ -849,8 +860,10 @@ bool GNSS_LG290P::enableRTCMBase()
849860
systemPrintln("Enabling Base RTCM output");
850861

851862
// PQTMCFGRTCM fails to respond with OK over UART2 of LG290P, so don't look for it
863+
char cfgRtcm[40];
864+
snprintf(cfgRtcm, sizeof(cfgRtcm), "PQTMCFGRTCM,W,%c,0,-90,07,06,2,1", settings.useMSM7 ? '7' : '4');
852865
_lg290p->sendOkCommand(
853-
"PQTMCFGRTCM,W,4,0,-90,07,06,2,1"); // Enable MSM4, output regular intervals, interval (seconds)
866+
cfgRtcm); // Enable MSM4/7, output regular intervals, interval (seconds)
854867
}
855868

856869
return (response);
@@ -1005,12 +1018,13 @@ bool GNSS_LG290P::enableRTCMRover()
10051018
if (settings.debugCorrections)
10061019
systemPrintf("Enabling Rover RTCM MSM output with rate of %d\r\n", minimumRtcmRate);
10071020

1008-
// Enable MSM7 (for faster PPP CSRS results), output at a rate equal to the minimum RTCM rate (EPH Mode = 2)
1021+
// Enable MSM4/7 (for faster PPP CSRS results), output at a rate equal to the minimum RTCM rate (EPH Mode = 2)
10091022
// PQTMCFGRTCM, W, <MSM_Type>, <MSM_Mode>, <MSM_ElevThd>, <Reserved>, <Reserved>, <EPH_Mode>, <EPH_Interval>
10101023
// Set MSM_ElevThd to 15 degrees from rftop suggestion
10111024

10121025
char msmCommand[40] = {0};
1013-
snprintf(msmCommand, sizeof(msmCommand), "PQTMCFGRTCM,W,7,0,15,07,06,2,%d", minimumRtcmRate);
1026+
snprintf(msmCommand, sizeof(msmCommand), "PQTMCFGRTCM,W,%c,0,15,07,06,2,%d",
1027+
settings.useMSM7 ? '7' : '4', minimumRtcmRate);
10141028

10151029
// PQTMCFGRTCM fails to respond with OK over UART2 of LG290P, so don't look for it
10161030
_lg290p->sendOkCommand(msmCommand);
@@ -1904,6 +1918,10 @@ void GNSS_LG290P::menuMessages()
19041918
systemPrintln("11) Reset to PPP Logging (NMEAx7 / RTCMx4 - 30 second decimation)");
19051919
systemPrintln("12) Reset to High-rate PPP Logging (NMEAx7 / RTCMx4 - 1Hz)");
19061920

1921+
1922+
if (namedSettingAvailableOnPlatform("useMSM7")) // Redundant - but good practice for code reuse
1923+
systemPrintf("13) MSM Selection: MSM%c\r\n", settings.useMSM7 ? '7' : '4');
1924+
19071925
systemPrintln("x) Exit");
19081926

19091927
int incoming = getUserInputNumber(); // Returns EXIT, TIMEOUT, or long
@@ -1977,6 +1995,8 @@ void GNSS_LG290P::menuMessages()
19771995
systemPrintln("Reset to PPP Logging Defaults (NMEAx7 / RTCMx4 - 30 second decimation)");
19781996
}
19791997
}
1998+
else if ((incoming == 13) && (namedSettingAvailableOnPlatform("useMSM7"))) // Redundant - but good practice for code reuse)
1999+
settings.useMSM7 ^= 1;
19802000

19812001
else if (incoming == INPUT_RESPONSE_GETNUMBER_EXIT)
19822002
break;

Firmware/RTK_Everywhere/GNSS_Mosaic.ino

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2121,7 +2121,7 @@ bool GNSS_MOSAIC::sendAndWaitForIdle(HardwareSerial *serialPort, const char *mes
21212121
unsigned long startTime = millis();
21222122
size_t replySeen = 0;
21232123

2124-
while ((millis() < (startTime + timeout)) && (replySeen < strlen(reply))) // While not timed out and reply not seen
2124+
while (((millis() - startTime) < timeout) && (replySeen < strlen(reply))) // While not timed out and reply not seen
21252125
{
21262126
if (serialPort->available()) // If a char is available
21272127
{
@@ -2145,7 +2145,7 @@ bool GNSS_MOSAIC::sendAndWaitForIdle(HardwareSerial *serialPort, const char *mes
21452145
if (replySeen == strlen(reply)) // If the reply was seen
21462146
{
21472147
startTime = millis();
2148-
while (millis() < (startTime + idle))
2148+
while ((millis() - startTime) < idle)
21492149
{
21502150
if (serialPort->available())
21512151
{
@@ -2256,18 +2256,18 @@ bool GNSS_MOSAIC::sendWithResponse(HardwareSerial *serialPort, const char *messa
22562256
}
22572257

22582258
// If the reply has started to arrive at the timeout, allow extra time
2259-
if (millis() > (startTime + timeout)) // Have we timed out?
2259+
if ((millis() - startTime) > timeout) // Have we timed out?
22602260
if (replySeen == 0) // If replySeen is zero, don't keepGoing
22612261
keepGoing = false;
22622262

2263-
if (millis() > (startTime + timeout + wait)) // Have we really timed out?
2263+
if ((millis() - startTime) > (timeout + wait)) // Have we really timed out?
22642264
keepGoing = false; // Don't keepGoing
22652265
}
22662266

22672267
if (replySeen == strlen(reply)) // If the reply was seen
22682268
{
22692269
startTime = millis();
2270-
while (millis() < (startTime + wait))
2270+
while ((millis() - startTime) < wait)
22712271
{
22722272
if (serialPort->available())
22732273
{
@@ -2433,6 +2433,8 @@ bool GNSS_MOSAIC::setDataBaudRate(uint32_t baud)
24332433
// Set the elevation in degrees
24342434
// Inputs:
24352435
// elevationDegrees: The elevation value in degrees
2436+
// Notes:
2437+
// mosaic supports negative elevations, but our firmware only support 0-90
24362438
//----------------------------------------
24372439
bool GNSS_MOSAIC::setElevation(uint8_t elevationDegrees)
24382440
{
@@ -2795,7 +2797,7 @@ void GNSS_MOSAIC::update()
27952797
const unsigned long sdCardSizeCheckInterval = 5000; // Matches the interval in logUpdate
27962798
static unsigned long sdCardLastFreeChange = millis(); // X5 is slow to update free. Seems to be about every ~20s?
27972799
static uint64_t previousFreeSpace = 0;
2798-
if (millis() > (sdCardSizeLastCheck + sdCardSizeCheckInterval))
2800+
if ((millis() - sdCardSizeLastCheck) > sdCardSizeCheckInterval)
27992801
{
28002802
updateSD(); // Check if the card has been removed / inserted
28012803

@@ -2817,7 +2819,7 @@ void GNSS_MOSAIC::update()
28172819
// The free space has not changed
28182820
// X5 is slow to update free. Seems to be about every ~20s?
28192821
// So only set logIncreasing to false after 30s
2820-
if (millis() > (sdCardLastFreeChange + 30000))
2822+
if ((millis() - sdCardLastFreeChange) > 30000)
28212823
logIncreasing = false;
28222824
}
28232825
else // if (sdFreeSpace > previousFreeSpace)
@@ -2839,7 +2841,7 @@ void GNSS_MOSAIC::update()
28392841

28402842
// Update spartnCorrectionsReceived
28412843
// Does this need if(online.lband_gnss) ? Not sure... TODO
2842-
if (millis() > (lastSpartnReception + (settings.correctionsSourcesLifetime_s * 1000))) // Timeout
2844+
if ((millis() - lastSpartnReception) > (settings.correctionsSourcesLifetime_s * 1000)) // Timeout
28432845
{
28442846
if (spartnCorrectionsReceived) // If corrections were being received
28452847
{
@@ -2920,7 +2922,7 @@ void GNSS_MOSAIC::waitSBFReceiverSetup(HardwareSerial *serialPort, unsigned long
29202922
reportFatalError("Failed to initialize the SBF parser");
29212923

29222924
unsigned long startTime = millis();
2923-
while ((millis() < (startTime + timeout)) && (_receiverSetupSeen == false))
2925+
while (((millis() - startTime) < timeout) && (_receiverSetupSeen == false))
29242926
{
29252927
if (serialPort->available())
29262928
{
@@ -3223,7 +3225,7 @@ void mosaicX5flushRX(unsigned long timeout)
32233225
if (timeout > 0)
32243226
{
32253227
unsigned long startTime = millis();
3226-
while (millis() < (startTime + timeout))
3228+
while ((millis() - startTime) < timeout)
32273229
{
32283230
if (serial2GNSS->available())
32293231
{
@@ -3247,7 +3249,7 @@ void mosaicX5flushRX(unsigned long timeout)
32473249
bool mosaicX5waitCR(unsigned long timeout)
32483250
{
32493251
unsigned long startTime = millis();
3250-
while (millis() < (startTime + timeout))
3252+
while ((millis() - startTime) < timeout)
32513253
{
32523254
if (serial2GNSS->available())
32533255
{

Firmware/RTK_Everywhere/GNSS_ZED.ino

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,9 @@ bool GNSS_ZED::configureBase()
406406
settings.ubxMessageRatesBase[x]); // UBLOX_CFG UART1 + 2 = USB
407407
}
408408

409-
response &= _zed->addCfgValset(UBLOX_CFG_NAVSPG_INFIL_MINELEV, settings.minElev); // Set minimum elevation
409+
// Set minimum elevation
410+
// Note: ZED supports negative elevations, but our firmware only allows 0-90
411+
response &= _zed->addCfgValset(UBLOX_CFG_NAVSPG_INFIL_MINELEV, settings.minElev);
410412

411413
response &= _zed->sendCfgValset(); // Closing value
412414

@@ -1375,7 +1377,7 @@ float GNSS_ZED::getSurveyInMeanAccuracy()
13751377

13761378
// Use a local static so we don't have to request these values multiple times (ZED takes many ms to respond
13771379
// to this command)
1378-
if (millis() - lastCheck > 1000)
1380+
if ((millis() - lastCheck) > 1000)
13791381
{
13801382
lastCheck = millis();
13811383
svinMeanAccuracy = _zed->getSurveyInMeanAccuracy(50);
@@ -1396,7 +1398,7 @@ int GNSS_ZED::getSurveyInObservationTime()
13961398

13971399
// Use a local static so we don't have to request these values multiple times (ZED takes many ms to respond
13981400
// to this command)
1399-
if (millis() - lastCheck > 1000)
1401+
if ((millis() - lastCheck) > 1000)
14001402
{
14011403
lastCheck = millis();
14021404
svinObservationTime = _zed->getSurveyInObservationTime(50);
@@ -2668,7 +2670,7 @@ bool GNSS_ZED::surveyInReset()
26682670
while (_zed->getSurveyInActive(100) || _zed->getSurveyInValid(100))
26692671
{
26702672
delay(100);
2671-
if (millis() - startTime > maxTime)
2673+
if ((millis() - startTime) > maxTime)
26722674
return (false); // Reset of survey failed
26732675
}
26742676

@@ -2732,7 +2734,7 @@ bool GNSS_ZED::surveyInStart()
27322734
while (_zed->getSurveyInActive(100) == false)
27332735
{
27342736
delay(100);
2735-
if (millis() - startTime > maxTime)
2737+
if ((millis() - startTime) > maxTime)
27362738
return (false); // Reset of survey failed
27372739
}
27382740

0 commit comments

Comments
 (0)