Skip to content

Commit 6875d27

Browse files
committed
Fix slow survey-in polling response.
1 parent e9d5109 commit 6875d27

File tree

3 files changed

+30
-11
lines changed

3 files changed

+30
-11
lines changed

Firmware/RTK_Surveyor/Display.ino

+21-8
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ void updateDisplay()
5252
paintBaseTempCasterConnected();
5353
break;
5454
case (STATE_BASE_FIXED_NOT_STARTED):
55-
//Do nothing. Static display shown during state change.
55+
paintBaseFixedNotStarted();
5656
break;
5757
case (STATE_BASE_FIXED_TRANSMITTING):
5858
paintBaseFixedTransmitting();
@@ -69,6 +69,9 @@ void updateDisplay()
6969
case (STATE_BASE_FIXED_CASTER_CONNECTED):
7070
paintBaseFixedCasterConnected();
7171
break;
72+
default:
73+
displayError((char*)"Display");
74+
break;
7275
}
7376

7477
oled.display(); //Push internal buffer to display
@@ -546,17 +549,14 @@ void paintBaseTempSurveyStarted()
546549

547550
paintBaseState(); //Top center
548551

549-
float meanAccuracy = i2cGNSS.getSurveyInMeanAccuracy(100);
550-
int elapsedTime = i2cGNSS.getSurveyInObservationTime(100);
551-
552552
oled.setFontType(0);
553553
oled.setCursor(0, 23); //x, y
554554
oled.print("Mean:");
555555

556556
oled.setCursor(29, 20); //x, y
557557
oled.setFontType(1);
558-
if (meanAccuracy < 10.0) //Error check
559-
oled.print(meanAccuracy, 2);
558+
if (svinMeanAccuracy < 10.0) //Error check
559+
oled.print(svinMeanAccuracy, 2);
560560
else
561561
oled.print(">10");
562562

@@ -566,8 +566,8 @@ void paintBaseTempSurveyStarted()
566566

567567
oled.setCursor(30, 36); //x, y
568568
oled.setFontType(1);
569-
if (elapsedTime < 1000) //Error check
570-
oled.print(elapsedTime);
569+
if (svinObservationTime < 1000) //Error check
570+
oled.print(svinObservationTime);
571571
else
572572
oled.print("0");
573573

@@ -738,6 +738,19 @@ void paintBaseTempCasterConnected()
738738
}
739739
}
740740

741+
//Show transmission of RTCM packets
742+
void paintBaseFixedNotStarted()
743+
{
744+
if (online.display == true)
745+
{
746+
paintBatteryLevel(); //Top right corner
747+
748+
paintWirelessIcon(); //Top left corner
749+
750+
paintBaseState(); //Top center
751+
}
752+
}
753+
741754
//Show transmission of RTCM packets
742755
void paintBaseFixedTransmitting()
743756
{

Firmware/RTK_Surveyor/RTK_Surveyor.ino

+2
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,8 @@ uint32_t totalWriteTime = 0; //Used to calculate overall write speed using SdFat
292292

293293
bool setupByPowerButton = false; //We can change setup via tapping power button
294294

295+
uint16_t svinObservationTime = 0; //Use globals so we don't have to request these values multiple times (slow response)
296+
float svinMeanAccuracy = 0;
295297
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
296298

297299
void setup()

Firmware/RTK_Surveyor/States.ino

+7-3
Original file line numberDiff line numberDiff line change
@@ -184,15 +184,19 @@ void updateSystemState()
184184
}
185185
else
186186
{
187+
//Get the data once to avoid duplicate slow responses
188+
svinObservationTime = i2cGNSS.getSurveyInObservationTime(100);
189+
svinMeanAccuracy = i2cGNSS.getSurveyInMeanAccuracy(100);
190+
187191
Serial.print(F("Time elapsed: "));
188-
Serial.print((String)i2cGNSS.getSurveyInObservationTime());
192+
Serial.print(svinObservationTime);
189193
Serial.print(F(" Accuracy: "));
190-
Serial.print((String)i2cGNSS.getSurveyInMeanAccuracy());
194+
Serial.print(svinMeanAccuracy);
191195
Serial.print(F(" SIV: "));
192196
Serial.print(i2cGNSS.getSIV());
193197
Serial.println();
194198

195-
if (i2cGNSS.getSurveyInObservationTime() > maxSurveyInWait_s)
199+
if (svinObservationTime > maxSurveyInWait_s)
196200
{
197201
Serial.printf("Survey-In took more than %d minutes. Returning to rover mode.\n\r", maxSurveyInWait_s / 60);
198202

0 commit comments

Comments
 (0)