Public Access
Restructure ESP32 firmware into modules, fix bugs, add tests
Structure (src/esp32/): - logic/: DisplayController, schedule, power timer, LED pattern; pure C++ - display/: FlipdotFrames and bitmaps - nano_link/: NanoLink (relay, serial, READY, bootloader) and flash bridge - net/: WiFi/OTA/panic window, Home Assistant - config.h with all settings; libs.h (globals in a header) removed Bug fixes: - Home Assistant switches now report their state back and start as ON - loop() no longer blocks: WiFi.waitForConnectResult() (up to 60 s without WiFi) and getLocalTime() (5 s before NTP sync) were called every iteration - Power switch off now powers off after 1 s even when a 30 s countdown is already running - millis() overflow safe power-off timer; no frame catch-up bursts - No garbage time string before NTP sync; 'Connecting...' stays instead - Frames are only sent when the screen changes instead of every second - Reset reasons are logged once instead of every 100 ms - Removed dead code (unused fonts, WiFiMulti, rotated bitmap, ...) Tests: new test_esp32 environment (26 tests); native renamed to test_nano Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
cefb76c1ad
commit
683a47c055
29 files changed
+1289
-755
No files matched your search
@@ -0,0 +1,55 @@
|
||||
#include "display/frames.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "display/bitmaps.h"
|
||||
#include "logic/schedule.h"
|
||||
|
||||
// Horizontal offset that centers the 81 pixel wide clock on the 84 pixel display
|
||||
static const int CLOCK_X = 3;
|
||||
|
||||
FlipdotFrames::FlipdotFrames(BROSE9323 &display) : _display(display)
|
||||
{
|
||||
}
|
||||
|
||||
void FlipdotFrames::clock(int hour, int minute)
|
||||
{
|
||||
char time[6];
|
||||
snprintf(time, sizeof(time), "%02d:%02d", hour, minute);
|
||||
|
||||
_display.fillScreen(0);
|
||||
if (isEvening(hour))
|
||||
_display.drawBitmap(CLOCK_X, 0, yawning_pikachu_bitmap_yawning_pikachu_black_border, 35, 19, 1);
|
||||
else
|
||||
_display.drawBitmap(CLOCK_X, 0, pikachu_bitmap_pikachu_black_border, 35, 19, 1);
|
||||
_display.drawBitmap(CLOCK_X + 35, 0, clock_thought_bubble_bitmap_clock_thought_bubble, 46, 19, 1);
|
||||
|
||||
_display.setTextSize(1);
|
||||
_display.setTextWrap(false);
|
||||
_display.setCursor(CLOCK_X + 43, 4);
|
||||
_display.print(time);
|
||||
_display.display();
|
||||
}
|
||||
|
||||
void FlipdotFrames::logo()
|
||||
{
|
||||
_display.fillScreen(0);
|
||||
_display.drawBitmap(0, 0, nintendo_bitmap_Nintendo_new, 84, 19, 1);
|
||||
_display.display();
|
||||
}
|
||||
|
||||
void FlipdotFrames::blank()
|
||||
{
|
||||
_display.fillScreen(0);
|
||||
_display.display();
|
||||
}
|
||||
|
||||
void FlipdotFrames::message(const char *text)
|
||||
{
|
||||
_display.fillScreen(0);
|
||||
_display.setTextSize(1);
|
||||
_display.setTextWrap(true);
|
||||
_display.setCursor(0, 0);
|
||||
_display.print(text);
|
||||
_display.display();
|
||||
}
|
||||
Reference in new issue
Block a user