ota updates
This commit is contained in:
+17
-5
@@ -1,5 +1,10 @@
|
||||
#include "TFT_eSPI.h"
|
||||
#include "ChronoBLE.h"
|
||||
#include "ChronoVersion.h"
|
||||
|
||||
// External declaration for BLE reading flag and value
|
||||
extern volatile bool newReadingAvailable;
|
||||
extern volatile int lastReadFPS;
|
||||
#include "ChronoReading.h"
|
||||
#include <LinkedList.h>
|
||||
#include "Display.h"
|
||||
@@ -89,8 +94,9 @@ void setup()
|
||||
chronoBLE.setSpeedCallback(speedCallback);
|
||||
}
|
||||
void setDateTime(){
|
||||
// NTP server configuration
|
||||
configTime("EST5EDT,M3.2.0/2,M11.1.0/2", "pool.ntp.org", "time.nist.gov");
|
||||
// NTP server configuration - ESP32 API uses gmtOffset (seconds) and dstOffset (seconds)
|
||||
// EST = UTC-5, EDT = UTC-4, so gmtOffset = -5*3600 = -18000
|
||||
configTime(-18000, 3600, "pool.ntp.org", "time.nist.gov");
|
||||
|
||||
// Wait for time to be set
|
||||
time_t now;
|
||||
@@ -134,9 +140,7 @@ void updateTime(){
|
||||
char strftime_buf[64];
|
||||
struct tm timeinfo;
|
||||
time(&now);
|
||||
const char* TZ_EST = "EST5EDT,M3.2.0/2,M11.1.0/2";
|
||||
setenv("TZ", TZ_EST, 1);
|
||||
tzset();
|
||||
// Use the timezone that was configured via configTime
|
||||
localtime_r(&now, &timeinfo);
|
||||
strftime(strftime_buf, sizeof(strftime_buf), "%R", &timeinfo);
|
||||
|
||||
@@ -191,6 +195,14 @@ void loop()
|
||||
}
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
// Check for new BLE readings and process them
|
||||
// This is done here instead of in the BLE callback to avoid heap fragmentation
|
||||
// and display updates in interrupt context
|
||||
if (newReadingAvailable) {
|
||||
newReadingAvailable = false;
|
||||
addReading(lastReadFPS);
|
||||
}
|
||||
|
||||
//update display
|
||||
Display::refreshDisplay();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user