Skip to content

Commit 1811d91

Browse files
committed
Better server display
1 parent 80b9bf1 commit 1811d91

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

Firmware/RTK_Surveyor/Display.ino

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -193,22 +193,31 @@ void updateDisplay()
193193
oled.reset(false); // Incase of previous corruption, force re-alignment of CGRAM. Do not init buffers as it
194194
// takes time and causes screen to blink.
195195

196-
#ifdef COMPILE_NETWORK
197-
bool displayPvtServerIP = settings.displayServerIP && ((millis() % 10000) < 4000)
198-
&& pvtServerRunning();
199-
bool displayUdpServerIP = settings.displayServerIP && ((millis() % 10000) < 4000)
200-
&& udpServerRunning();
196+
#if COMPILE_NETWORK
197+
// If enabled, display server info every displayServerRepeatInterval millis
198+
// Display "PVT Server" for displayServerSplashTime millis
199+
// Display the IP for (displayServerTotalTime - displayServerSplashTime) millis
200+
// These won't be exact, due to the >= 500ms display updates
201+
const unsigned long displayServerRepeatInterval = 16384;
202+
const unsigned long displayServerTotalTime = 4096;
203+
const unsigned long displayServerSplashTime = 1024;
204+
bool displayPvtServerIP = settings.displayServerIP
205+
&& ((millis() % displayServerRepeatInterval) < displayServerTotalTime)
206+
&& pvtServerRunning();
207+
bool displayUdpServerIP = settings.displayServerIP
208+
&& ((millis() % displayServerRepeatInterval) < displayServerTotalTime)
209+
&& udpServerRunning();
201210

202211
if (displayPvtServerIP)
203212
{
204-
if ((millis() % 10000) < 2000)
213+
if ((millis() % displayServerRepeatInterval) < displayServerSplashTime)
205214
paintPvtServer();
206215
else
207-
paintPvtServerIP();
216+
paintPvtServerIP();
208217
}
209218
else if (displayUdpServerIP)
210219
{
211-
if ((millis() % 10000) < 2000)
220+
if ((millis() % displayServerRepeatInterval) < displayServerSplashTime)
212221
paintUdpServer();
213222
else
214223
paintUdpServerIP();

0 commit comments

Comments
 (0)