Skip to content

Commit 30e0b22

Browse files
committed
Add multi-attempts to display begin
1 parent 71c09d2 commit 30e0b22

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

Firmware/RTK_Surveyor/Display.ino

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -57,29 +57,31 @@ static uint32_t icons;
5757
void beginDisplay()
5858
{
5959
blinking_icons = 0;
60-
if (oled.begin() == true)
61-
{
62-
online.display = true;
63-
64-
Serial.println("Display started");
6560

66-
//Display the SparkFun LOGO
67-
oled.erase();
68-
displayBitmap(0, 0, logoSparkFun_Width, logoSparkFun_Height, logoSparkFun);
69-
oled.display();
70-
splashStart = millis();
71-
}
72-
else
61+
//At this point we have not identified the RTK platform
62+
//If it's surveyor, there won't be a display and we have a 100ms delay
63+
//If it's other platforms, we will try 3 times
64+
int maxTries = 3;
65+
for (int x = 0 ; x < maxTries ; x++)
7366
{
74-
if (productVariant == RTK_SURVEYOR)
67+
if (oled.begin() == true)
7568
{
76-
Serial.println("Display not detected");
77-
}
78-
else if (productVariant == RTK_EXPRESS || productVariant == RTK_EXPRESS_PLUS || productVariant == RTK_FACET || productVariant == RTK_FACET_LBAND)
79-
{
80-
Serial.println("Display Error: Not detected.");
69+
online.display = true;
70+
71+
Serial.println("Display started");
72+
73+
//Display the SparkFun LOGO
74+
oled.erase();
75+
displayBitmap(0, 0, logoSparkFun_Width, logoSparkFun_Height, logoSparkFun);
76+
oled.display();
77+
splashStart = millis();
78+
return;
8179
}
80+
81+
delay(50); //Give display time to startup before attempting again
8282
}
83+
84+
Serial.println("Display not detected");
8385
}
8486

8587
//Given the system state, display the appropriate information

0 commit comments

Comments
 (0)