Skip to content

Commit 5924d0d

Browse files
committed
Display horizontal accuracy
1 parent 8ff0d9f commit 5924d0d

File tree

2 files changed

+55
-87
lines changed

2 files changed

+55
-87
lines changed

Firmware/RTK_Surveyor/Display.ino

Lines changed: 55 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -52,34 +52,45 @@ void updateDisplay()
5252
case (STATE_ROVER_NOT_STARTED):
5353
icons = paintWirelessIcon() //Top left
5454
| ICON_BATTERY //Top right
55+
| ICON_CROSS_HAIR //Center left
56+
| ICON_HORIZONTAL_ACCURACY //Center right
5557
| ICON_LOGGING; //Bottom right
5658
paintRoverNoFix();
5759
break;
5860
case (STATE_ROVER_NO_FIX):
5961
icons = paintWirelessIcon() //Top left
6062
| ICON_DYNAMIC_MODEL //Top center
6163
| ICON_BATTERY //Top right
64+
| ICON_CROSS_HAIR //Center left
65+
| ICON_HORIZONTAL_ACCURACY //Center right
6266
| ICON_LOGGING; //Bottom right
6367
paintRoverNoFix();
6468
break;
6569
case (STATE_ROVER_FIX):
6670
icons = paintWirelessIcon() //Top left
6771
| ICON_DYNAMIC_MODEL //Top center
6872
| ICON_BATTERY //Top right
73+
| ICON_CROSS_HAIR //Center left
74+
| ICON_HORIZONTAL_ACCURACY //Center right
6975
| ICON_LOGGING; //Bottom right
7076
paintRoverFix();
7177
break;
7278
case (STATE_ROVER_RTK_FLOAT):
79+
blinking_icons ^= ICON_CROSS_HAIR_DUAL;
7380
icons = paintWirelessIcon() //Top left
7481
| ICON_DYNAMIC_MODEL //Top center
7582
| ICON_BATTERY //Top right
83+
| (blinking_icons & ICON_CROSS_HAIR_DUAL) //Center left
84+
| ICON_HORIZONTAL_ACCURACY //Center right
7685
| ICON_LOGGING; //Bottom right
7786
paintRoverRTKFloat();
7887
break;
7988
case (STATE_ROVER_RTK_FIX):
8089
icons = paintWirelessIcon() //Top left
8190
| ICON_DYNAMIC_MODEL //Top center
8291
| ICON_BATTERY //Top right
92+
| ICON_CROSS_HAIR_DUAL//Center left
93+
| ICON_HORIZONTAL_ACCURACY //Center right
8394
| ICON_LOGGING; //Bottom right
8495
paintRoverRTKFix();
8596
break;
@@ -88,20 +99,26 @@ void updateDisplay()
8899
icons = paintWirelessIcon() //Top left
89100
| ICON_DYNAMIC_MODEL //Top center
90101
| ICON_BATTERY //Top right
102+
| ICON_CROSS_HAIR //Center left
103+
| ICON_HORIZONTAL_ACCURACY //Center right
91104
| ICON_LOGGING; //Bottom right
92105
paintRoverWiFiStarted();
93106
break;
94107
case (STATE_ROVER_CLIENT_WIFI_CONNECTED):
95108
icons = paintWirelessIcon() //Top left
96109
| ICON_DYNAMIC_MODEL //Top center
97110
| ICON_BATTERY //Top right
111+
| ICON_CROSS_HAIR //Center left
112+
| ICON_HORIZONTAL_ACCURACY //Center right
98113
| ICON_LOGGING; //Bottom right
99114
paintRoverWiFiStarted();
100115
break;
101116
case (STATE_ROVER_CLIENT_STARTED):
102117
icons = paintWirelessIcon() //Top left
103118
| ICON_DYNAMIC_MODEL //Top center
104119
| ICON_BATTERY //Top right
120+
| ICON_CROSS_HAIR //Center left
121+
| ICON_HORIZONTAL_ACCURACY //Center right
105122
| ICON_LOGGING; //Bottom right
106123
paintRoverWiFiStarted();
107124
break;
@@ -110,10 +127,13 @@ void updateDisplay()
110127
//Do nothing. Static display shown during state change.
111128
break;
112129
case (STATE_BASE_TEMP_SETTLE):
113-
blinking_icons ^= ICON_BASE_TEMPORARY;
130+
//Blink crosshair icon until we achieve <5m horz accuracy (user definable)
131+
blinking_icons ^= ICON_BASE_TEMPORARY | ICON_CROSS_HAIR;
114132
icons = paintWirelessIcon() //Top left
115133
| (blinking_icons & ICON_BASE_TEMPORARY) //Top center
116134
| ICON_BATTERY //Top right
135+
| (blinking_icons & ICON_CROSS_HAIR) //Center left
136+
| ICON_HORIZONTAL_ACCURACY //Center right
117137
| ICON_LOGGING; //Bottom right
118138
paintBaseTempSettle();
119139
break;
@@ -317,6 +337,16 @@ void updateDisplay()
317337
if (icons & ICON_BATTERY)
318338
paintBatteryLevel();
319339

340+
//Center left
341+
if (icons & ICON_CROSS_HAIR)
342+
displayBitmap(0, 18, CrossHair_Width, CrossHair_Height, CrossHair);
343+
else if (icons & ICON_CROSS_HAIR_DUAL)
344+
displayBitmap(0, 18, CrossHairDual_Width, CrossHairDual_Height, CrossHairDual);
345+
346+
//Center right
347+
if (icons & ICON_HORIZONTAL_ACCURACY)
348+
paintHorizontalAccuracy();
349+
320350
//Bottom right corner
321351
if (icons & ICON_LOGGING)
322352
paintLogging();
@@ -453,81 +483,33 @@ uint32_t paintWirelessIcon()
453483
return icons;
454484
}
455485

456-
//Display cross hairs and horizontal accuracy
457-
//Display double circle if we have RTK (blink = float, solid = fix)
486+
//Display horizontal accuracy
458487
void paintHorizontalAccuracy()
459488
{
460-
if (online.display == true)
461-
{
462-
//Blink crosshair icon until we achieve <5m horz accuracy (user definable)
463-
if (systemState == STATE_BASE_TEMP_SETTLE)
464-
{
465-
if (millis() - lastCrosshairIconUpdate > 500)
466-
{
467-
lastCrosshairIconUpdate = millis();
468-
if (crosshairIconDisplayed == false)
469-
{
470-
crosshairIconDisplayed = true;
489+
oled.setFont(QW_FONT_8X16); //Set font to type 1: 8x16
490+
oled.setCursor(16, 20); //x, y
491+
oled.print(":");
471492

472-
//Draw the icon
473-
displayBitmap(0, 18, CrossHair_Width, CrossHair_Height, CrossHair);
474-
}
475-
else
476-
crosshairIconDisplayed = false;
477-
}
478-
}
479-
else if (systemState == STATE_ROVER_RTK_FLOAT)
480-
{
481-
if (millis() - lastCrosshairIconUpdate > 500)
482-
{
483-
lastCrosshairIconUpdate = millis();
484-
if (crosshairIconDisplayed == false)
485-
{
486-
crosshairIconDisplayed = true;
487-
488-
//Draw dual crosshair
489-
displayBitmap(0, 18, CrossHairDual_Width, CrossHairDual_Height, CrossHairDual);
490-
}
491-
else
492-
crosshairIconDisplayed = false;
493-
}
494-
}
495-
else if (systemState == STATE_ROVER_RTK_FIX)
496-
{
497-
//Draw dual crosshair
498-
displayBitmap(0, 18, CrossHairDual_Width, CrossHairDual_Height, CrossHairDual);
499-
}
500-
else
501-
{
502-
//Draw crosshair
503-
displayBitmap(0, 18, CrossHair_Width, CrossHair_Height, CrossHair);
504-
}
505-
506-
oled.setFont(QW_FONT_8X16); //Set font to type 1: 8x16
507-
oled.setCursor(16, 20); //x, y
508-
oled.print(":");
509-
510-
if (online.gnss == false)
511-
{
512-
oled.print(F("N/A"));
513-
}
514-
else if (horizontalAccuracy > 30.0)
515-
{
516-
oled.print(F(">30m"));
517-
}
518-
else if (horizontalAccuracy > 9.9)
519-
{
520-
oled.print(horizontalAccuracy, 1); //Print down to decimeter
521-
}
522-
else if (horizontalAccuracy > 1.0)
523-
{
524-
oled.print(horizontalAccuracy, 2); //Print down to centimeter
525-
}
526-
else
527-
{
528-
oled.print("."); //Remove leading zero
529-
oled.printf("%03d", (int)(horizontalAccuracy * 1000)); //Print down to millimeter
530-
}
493+
if (online.gnss == false)
494+
{
495+
oled.print(F("N/A"));
496+
}
497+
else if (horizontalAccuracy > 30.0)
498+
{
499+
oled.print(F(">30m"));
500+
}
501+
else if (horizontalAccuracy > 9.9)
502+
{
503+
oled.print(horizontalAccuracy, 1); //Print down to decimeter
504+
}
505+
else if (horizontalAccuracy > 1.0)
506+
{
507+
oled.print(horizontalAccuracy, 2); //Print down to centimeter
508+
}
509+
else
510+
{
511+
oled.print("."); //Remove leading zero
512+
oled.printf("%03d", (int)(horizontalAccuracy * 1000)); //Print down to millimeter
531513
}
532514
}
533515

@@ -705,8 +687,6 @@ void paintRoverNoFix()
705687
{
706688
if (online.display == true)
707689
{
708-
paintHorizontalAccuracy();
709-
710690
paintSIV();
711691
}
712692
}
@@ -716,8 +696,6 @@ void paintRoverFix()
716696
{
717697
if (online.display == true)
718698
{
719-
paintHorizontalAccuracy();
720-
721699
paintSIV();
722700
}
723701
}
@@ -727,8 +705,6 @@ void paintRoverRTKFloat()
727705
{
728706
if (online.display == true)
729707
{
730-
paintHorizontalAccuracy();
731-
732708
paintSIV();
733709
}
734710
}
@@ -737,8 +713,6 @@ void paintRoverRTKFix()
737713
{
738714
if (online.display == true)
739715
{
740-
paintHorizontalAccuracy();
741-
742716
paintSIV();
743717
}
744718
}
@@ -748,8 +722,6 @@ void paintRoverWiFiStarted()
748722
{
749723
if (online.display == true)
750724
{
751-
paintHorizontalAccuracy();
752-
753725
paintSIV();
754726
}
755727
}
@@ -761,8 +733,6 @@ void paintBaseTempSettle()
761733
{
762734
if (online.display == true)
763735
{
764-
paintHorizontalAccuracy(); //2nd line
765-
766736
paintSIV();
767737
}
768738
}

Firmware/RTK_Surveyor/RTK_Surveyor.ino

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,8 +388,6 @@ uint32_t lastRTCAttempt = 0; //Wait 1000ms between checking GNSS for current dat
388388

389389
uint32_t lastSatelliteDishIconUpdate = 0;
390390
bool satelliteDishIconDisplayed = false; //Toggles as lastSatelliteDishIconUpdate goes above 1000ms
391-
uint32_t lastCrosshairIconUpdate = 0;
392-
bool crosshairIconDisplayed = false; //Toggles as lastCrosshairIconUpdate goes above 1000ms
393391
uint32_t lastBaseIconUpdate = 0;
394392
bool baseIconDisplayed = false; //Toggles as lastBaseIconUpdate goes above 1000ms
395393
int loggingIconDisplayed = 0; //Increases every 500ms while logging

0 commit comments

Comments
 (0)