@@ -261,6 +261,7 @@ void displayUpdate()
261
261
paintLogging (&iconPropertyList);
262
262
displaySivVsOpenShort (&iconPropertyList);
263
263
displayBatteryVsEthernet (&iconPropertyList);
264
+ displayFullIPAddress (&iconPropertyList); // Bottom left - 128x64 only
264
265
setRadioIcons (&iconPropertyList);
265
266
break ;
266
267
case (STATE_ROVER_NO_FIX):
@@ -269,6 +270,7 @@ void displayUpdate()
269
270
paintLogging (&iconPropertyList);
270
271
displaySivVsOpenShort (&iconPropertyList);
271
272
displayBatteryVsEthernet (&iconPropertyList);
273
+ displayFullIPAddress (&iconPropertyList); // Bottom left - 128x64 only
272
274
setRadioIcons (&iconPropertyList);
273
275
break ;
274
276
case (STATE_ROVER_FIX):
@@ -277,6 +279,7 @@ void displayUpdate()
277
279
paintLogging (&iconPropertyList);
278
280
displaySivVsOpenShort (&iconPropertyList);
279
281
displayBatteryVsEthernet (&iconPropertyList);
282
+ displayFullIPAddress (&iconPropertyList); // Bottom left - 128x64 only
280
283
setRadioIcons (&iconPropertyList);
281
284
break ;
282
285
case (STATE_ROVER_RTK_FLOAT):
@@ -285,6 +288,7 @@ void displayUpdate()
285
288
paintLogging (&iconPropertyList);
286
289
displaySivVsOpenShort (&iconPropertyList);
287
290
displayBatteryVsEthernet (&iconPropertyList);
291
+ displayFullIPAddress (&iconPropertyList); // Bottom left - 128x64 only
288
292
setRadioIcons (&iconPropertyList);
289
293
break ;
290
294
case (STATE_ROVER_RTK_FIX):
@@ -293,6 +297,7 @@ void displayUpdate()
293
297
paintLogging (&iconPropertyList);
294
298
displaySivVsOpenShort (&iconPropertyList);
295
299
displayBatteryVsEthernet (&iconPropertyList);
300
+ displayFullIPAddress (&iconPropertyList); // Bottom left - 128x64 only
296
301
setRadioIcons (&iconPropertyList);
297
302
break ;
298
303
@@ -309,27 +314,32 @@ void displayUpdate()
309
314
paintLogging (&iconPropertyList);
310
315
displaySivVsOpenShort (&iconPropertyList);
311
316
displayBatteryVsEthernet (&iconPropertyList);
317
+ displayFullIPAddress (&iconPropertyList); // Bottom left - 128x64 only
312
318
setRadioIcons (&iconPropertyList);
313
319
break ;
314
320
case (STATE_BASE_TEMP_SURVEY_STARTED):
315
321
paintLogging (&iconPropertyList);
316
322
displayBatteryVsEthernet (&iconPropertyList); // Top right
323
+ displayFullIPAddress (&iconPropertyList); // Bottom left - 128x64 only
317
324
setRadioIcons (&iconPropertyList);
318
325
paintBaseTempSurveyStarted (&iconPropertyList);
319
326
break ;
320
327
case (STATE_BASE_TEMP_TRANSMITTING):
321
328
paintLogging (&iconPropertyList);
322
329
displayBatteryVsEthernet (&iconPropertyList); // Top right
330
+ displayFullIPAddress (&iconPropertyList); // Bottom left - 128x64 only
323
331
setRadioIcons (&iconPropertyList);
324
332
paintRTCM (&iconPropertyList);
325
333
break ;
326
334
case (STATE_BASE_FIXED_NOT_STARTED):
327
335
displayBatteryVsEthernet (&iconPropertyList); // Top right
336
+ displayFullIPAddress (&iconPropertyList); // Bottom left - 128x64 only
328
337
setRadioIcons (&iconPropertyList);
329
338
break ;
330
339
case (STATE_BASE_FIXED_TRANSMITTING):
331
340
paintLogging (&iconPropertyList);
332
341
displayBatteryVsEthernet (&iconPropertyList); // Top right
342
+ displayFullIPAddress (&iconPropertyList); // Bottom left - 128x64 only
333
343
setRadioIcons (&iconPropertyList);
334
344
paintRTCM (&iconPropertyList);
335
345
break ;
@@ -1767,36 +1777,66 @@ void paintConnectingToNtripCaster()
1767
1777
printTextwithKerning (" Connecting" , textX, textY, textKerning);
1768
1778
}
1769
1779
1770
- // Scroll through IP address. Wipe with spaces both ends.
1780
+ // Shuttle through IP address
1771
1781
void paintIPAddress ()
1772
1782
{
1773
- char ipAddress[32 ];
1774
- snprintf (ipAddress, sizeof (ipAddress), " %d.%d.%d.%d " ,
1783
+ char ipAddress[16 ];
1784
+ snprintf (ipAddress, sizeof (ipAddress), " %s " ,
1775
1785
#ifdef COMPILE_ETHERNET
1776
- ETH.localIP ()[ 0 ], ETH. localIP ()[ 1 ], ETH. localIP ()[ 2 ], ETH. localIP ()[ 3 ] );
1786
+ ETH.localIP (). toString () );
1777
1787
#else // COMPILE_ETHERNET
1778
- 0 , 0 , 0 , 0 );
1788
+ " 0.0.0.0 " );
1779
1789
#endif // COMPILE_ETHERNET
1780
1790
1781
- static uint8_t ipAddressPosition = 0 ;
1791
+ oled->setFont (QW_FONT_5X7); // Set font to smallest
1792
+ oled->setCursor (0 , 3 );
1782
1793
1783
- // Check if IP address is all single digits and can be printed without scrolling
1784
- if (strlen (ipAddress) <= 21 )
1785
- ipAddressPosition = 7 ;
1794
+ // If we can print the full IP address without shuttling
1795
+ if (strlen (ipAddress) <= 7 )
1796
+ {
1797
+ oled->print (ipAddress);
1798
+ }
1799
+ else
1800
+ {
1801
+ // Print as many characters as we can. Shuttle back and forth to display all.
1802
+ static int startPos = 0 ;
1803
+ char printThis[7 + 1 ];
1804
+ int extras = strlen (ipAddress) - 7 ;
1805
+ int shuttle[(2 * extras) + 2 ]; // Wait for a double state at each end
1806
+ shuttle[0 ] = 0 ;
1807
+ int x;
1808
+ for (x = 0 ; x <= extras; x++)
1809
+ shuttle[x + 1 ] = x;
1810
+ shuttle[extras + 2 ] = extras;
1811
+ x += 2 ;
1812
+ for (int y = extras - 1 ; y > 0 ; y--)
1813
+ shuttle[x++] = y;
1814
+ if (startPos >= (2 * extras) + 2 )
1815
+ startPos = 0 ;
1816
+ snprintf (printThis, sizeof (printThis), &ipAddress[shuttle[startPos]]);
1817
+ startPos++;
1818
+ oled->print (printThis);
1819
+ }
1820
+ }
1821
+
1822
+ void displayFullIPAddress (std::vector<iconPropertyBlinking> *iconList) // Bottom left - 128x64 only
1823
+ {
1824
+ if (present.display_type == DISPLAY_128x64)
1825
+ {
1826
+ char myAddress[16 ];
1786
1827
1787
- // Print seven characters of IP address
1788
- char printThis[9 ];
1789
- snprintf (printThis, sizeof (printThis), " %c%c%c%c%c%c%c" , ipAddress[ipAddressPosition + 0 ],
1790
- ipAddress[ipAddressPosition + 1 ], ipAddress[ipAddressPosition + 2 ], ipAddress[ipAddressPosition + 3 ],
1791
- ipAddress[ipAddressPosition + 4 ], ipAddress[ipAddressPosition + 5 ], ipAddress[ipAddressPosition + 6 ]);
1828
+ uint8_t networkType = networkGetType ();
1829
+ IPAddress ipAddress = networkGetIpAddress (networkType);
1792
1830
1793
- oled-> setFont (QW_FONT_5X7); // Set font to smallest
1794
- oled-> setCursor ( 0 , 3 );
1795
- oled-> print (printThis );
1831
+ if (ipAddress != IPAddress (( uint32_t ) 0 ))
1832
+ {
1833
+ snprintf (myAddress, sizeof (myAddress), " %s " , ipAddress. toString () );
1796
1834
1797
- ipAddressPosition++; // Increment the print position
1798
- if (ipAddress[ipAddressPosition + 7 ] == 0 ) // Wrap
1799
- ipAddressPosition = 0 ;
1835
+ oled->setFont (QW_FONT_5X7); // Set font to smallest
1836
+ oled->setCursor (0 , 55 );
1837
+ oled->print (ipAddress);
1838
+ }
1839
+ }
1800
1840
}
1801
1841
1802
1842
void paintMACAddress4digit (uint8_t xPos, uint8_t yPos)
@@ -2081,7 +2121,7 @@ void displayWiFiConfig()
2081
2121
2082
2122
// Convert to string
2083
2123
char myIP[20 ] = {' \0 ' };
2084
- snprintf (myIP, sizeof (myIP), " %d.%d.%d.%d " , myIpAddress[ 0 ], myIpAddress[ 1 ], myIpAddress[ 2 ], myIpAddress[ 3 ] );
2124
+ snprintf (myIP, sizeof (myIP), " %s " , myIpAddress. toString () );
2085
2125
2086
2126
char myIPFront[displayMaxCharacters + 1 ]; // 1 for null terminator
2087
2127
char myIPBack[displayMaxCharacters + 1 ]; // 1 for null terminator
@@ -3008,7 +3048,7 @@ void displayConfigViaEthernet()
3008
3048
3009
3049
char ipAddress[16 ];
3010
3050
IPAddress localIP = ETH.localIP ();
3011
- snprintf (ipAddress, sizeof (ipAddress), " %d.%d.%d.%d " , localIP[ 0 ], localIP[ 1 ], localIP[ 2 ], localIP[ 3 ] );
3051
+ snprintf (ipAddress, sizeof (ipAddress), " %s " , localIP. toString () );
3012
3052
3013
3053
int displayWidthChars = ((present.display_type == DISPLAY_128x64) ? 21 : 10 );
3014
3054
0 commit comments