From 245cbc2deab871125fe0ac3d1a70a7741b6eaac5 Mon Sep 17 00:00:00 2001 From: Chris Liebman Date: Sat, 26 May 2018 18:34:56 -0700 Subject: [PATCH] minor changes - invert display due to current hardware layout mistake --- Display.cpp | 2 +- ESPNTPServer.cpp | 4 ++-- ESPNTPServer.h | 2 +- GPS.cpp | 19 +++++++++++++------ 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/Display.cpp b/Display.cpp index 5454a92..3ebc78c 100644 --- a/Display.cpp +++ b/Display.cpp @@ -32,7 +32,7 @@ void Display::begin() { dlog.error(TAG, F("display.init() failed!")); } - _dsp.flipScreenVertically(); + //_dsp.flipScreenVertically(); font(ArialMT_Plain_10); } diff --git a/ESPNTPServer.cpp b/ESPNTPServer.cpp index 08a4229..b357734 100644 --- a/ESPNTPServer.cpp +++ b/ESPNTPServer.cpp @@ -61,12 +61,12 @@ void setup() // // Setup DLog with Serial1, set the pre function to add the date/time // - Serial1.begin(115200); + Serial1.begin(76800); dlog.begin(new DLogPrintWriter(Serial1)); dlog.setPreFunc(&logTimeFirst); + //dlog.setLevel("GPS", DLogLevel::DLOG_LEVEL_DEBUG); dlog.info(SETUP_TAG, F("Startup!")); - dlog.info(SETUP_TAG, F("initializing display")); display.begin(); diff --git a/ESPNTPServer.h b/ESPNTPServer.h index 4216169..dd34d37 100644 --- a/ESPNTPServer.h +++ b/ESPNTPServer.h @@ -32,7 +32,7 @@ #include // pin definitions -#define SYNC_PIN 14 // (GPIO14) pin tied to 1hz square wave from GPS +#define SYNC_PIN 12 // (GPIO12) pin tied to 1hz square wave from GPS #define SDA_PIN 4 #define SCL_PIN 5 diff --git a/GPS.cpp b/GPS.cpp index 4c31dfe..d1ede4e 100644 --- a/GPS.cpp +++ b/GPS.cpp @@ -207,12 +207,17 @@ void ICACHE_RAM_ATTR GPS::timeout() */ void ICACHE_RAM_ATTR GPS::invalidate(const char* fmt, ...) { - va_list ap; - va_start(ap, fmt); - vsnprintf(_reason, REASON_SIZE-1, fmt, ap); - _reason[REASON_SIZE-1] = '\0'; - va_end(ap); - + // + // only update the reason if there is not one already + // + if (_reason[0] == '\0') + { + va_list ap; + va_start(ap, fmt); + vsnprintf(_reason, REASON_SIZE-1, fmt, ap); + _reason[REASON_SIZE-1] = '\0'; + va_end(ap); + } _valid = false; _gps_valid = false; _last_micros = 0; @@ -228,6 +233,7 @@ void ICACHE_RAM_ATTR GPS::pps() uint32_t cur_micros = micros(); (void)cur_micros; +#if 0 // // don't trust PPS if GPS is not valid. // @@ -236,6 +242,7 @@ void ICACHE_RAM_ATTR GPS::pps() PPS_TIMING_PIN_OFF(); return; } +#endif // // increment seconds