One thing I have noticed with the OLED is that after 2 mins of getting the fix the display outputs the "----" to all fields.
Would it be possible to keep the last data set on display.
Actually just done this with
// *** Begin OLED support ****************************************************************************************************
#if OLED_ENABLED
#include <SSD1306AsciiWire.h>
#define OLED_I2C_ADDRESS 0x3c
#define MMDDYY false // true - American MM/DD/YY Date format, false gives DD/MM/YY UK format
#define D128x64 true // Larger than std 128x32 display
static SSD1306AsciiWire oled; // 0X3C+SA0 - 0x3C or 0x3D
static bool oled_detected = false;
#if D128x64
static int row_inc = 3;
#else
static int row_inc = 0;
#endif
static void oled_setup ()
{
//Wire.begin();
Wire.beginTransmission(OLED_I2C_ADDRESS);
oled_detected = (Wire.endTransmission() == 0);
if (!oled_detected) {
Serial.println("OLED not detected");
} else {
Serial.println("OLED detected");
Wire.setClock(400000L);
oled.begin(&SH1106_128x64, OLED_I2C_ADDRESS); //Select type of display. See SSD1306init.h
oled.setFont(System5x7);
oled.clear();
}
}
static void oled_write_row (int row, const char *text)
{
Wire.setClock(400000L);
oled.setRow(row);
oled.setCol(0);
oled.print(text);
oled.clearToEOL();
}
static void gps_oled_update (void)
{
static bool had_gps = true;
static bool had_fix = false;
static long next_update = 0;
if (!oled_detected || (next_update && time_before(millis(), next_update)))
return;
next_update = get_timeout(1000); // update once every second
char text[50];
#if D128x64
oled_write_row(0, "HOMEBREW GEN3 - mlord");
oled_write_row(1, "WiFi+BT+GPS+MUSB+RLY.");
#endif
if (!gps_detected) {
if (had_gps) {
had_gps = false;
//oled.clear();
oled_write_row(0 + row_inc, "GPS not detected.");
}
return;
}
had_gps = true;
if (gps_has_fix) had_fix = true;
snprintf(text, sizeof(text), "GPS Sats: %02u/%02u", gps.satellites.value(), gps.satellitesInView());
oled_write_row(0 + row_inc, text);
if (had_fix)
snprintf(text, sizeof(text), "Latitude: %c%9s", ((gps.location.lat() < 0.0) ? 'S' : 'N'), String(fabs(gps.location.lat()), 5).c_str());
else
snprintf(text, sizeof(text), "Latitude: ----.-----");
oled_write_row(1 + row_inc, text);
if (had_fix)
snprintf(text, sizeof(text), "Longitude: %c%9s", ((gps.location.lng() < 0.0) ? 'W' : 'E'), String(fabs(gps.location.lng()), 5).c_str());
else
snprintf(text, sizeof(text), "Longitude: ----.-----");
oled_write_row(2 + row_inc, text);
snprintf(text, sizeof(text),
((gps_has_fix) ? "%02d/%02d/%02d UTC %02d:%02d:%02d" : "--/--/-- UTC --:--:--"),
#if MMDDYY
gps.date.month(), gps.date.day(), gps.date.year() % 100,
#else
gps.date.day(), gps.date.month(), gps.date.year() % 100,
#endif
gps.time.hour(), gps.time.minute(), gps.time.second());
oled_write_row(3 + row_inc, text);
}
#endif /* OLED_ENABLED */
// *** End OLED support ****************************************************************************************************
Edited by KenF9000, 09 April 2023 - 09:12 AM.