Fix clock update frequency
This commit is contained in:
parent
c0220110d6
commit
152144671d
1 changed files with 19 additions and 16 deletions
|
@ -62,7 +62,10 @@ public:
|
|||
}
|
||||
void loop() {
|
||||
static constexpr const char* const wd[7] = {"Sun","Mon","Tue","Wed","Thr","Fri","Sat"};
|
||||
static auto last_t = time(nullptr) - 10;
|
||||
auto t = time(nullptr);
|
||||
if (t >= (last_t + 10)) {
|
||||
last_t = t;
|
||||
auto tm = localtime(&t);
|
||||
M5.Display.setCursor(0, M5.Display.height() / 3);
|
||||
M5.Display.setFont(&fonts::Orbitron_Light_24);
|
||||
|
@ -77,7 +80,7 @@ public:
|
|||
, tm->tm_hour
|
||||
, tm->tm_min
|
||||
);
|
||||
delay(10000);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -91,7 +94,7 @@ void setup(void) {
|
|||
M5.Display.init();
|
||||
M5.Display.setTextSize(3);
|
||||
M5.Display.setCursor(0, M5.Display.height() / 4);
|
||||
M5.Display.printf("Starting up...");
|
||||
M5.Display.println("Starting up...");
|
||||
|
||||
M5.Display.print("Connecting to WiFi");
|
||||
WiFi.mode(WIFI_STA);
|
||||
|
|
Loading…
Reference in a new issue