Public Access
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>
37 lines
925 B
C++
37 lines
925 B
C++
#pragma once
|
|
|
|
#include <Arduino.h>
|
|
|
|
#include "logic/display_controller.h"
|
|
|
|
// The relay that powers the panels and the Nano, and the serial link to the Nano.
|
|
class NanoLink : public DisplayPower
|
|
{
|
|
public:
|
|
NanoLink(HardwareSerial &serial, int rx_pin, int tx_pin, int relay_pin, int reset_pin);
|
|
|
|
// Set up the pins; the display starts switched off
|
|
void begin();
|
|
|
|
// The serial port to the Nano (for the BROSE9323 driver)
|
|
Stream &stream();
|
|
|
|
bool isOn() override;
|
|
// Switch on, then wait for the Nano's READY (or NANO_BOOT_TIMEOUT)
|
|
void on() override;
|
|
// Switch off and release the TX pin
|
|
void off() override;
|
|
|
|
// For flashing: restart the Nano so its bootloader runs, and talk to it at `baud`
|
|
void startBootloader(uint32_t baud);
|
|
|
|
private:
|
|
HardwareSerial &_serial;
|
|
const int _rx_pin, _tx_pin, _relay_pin, _reset_pin;
|
|
bool _on = false;
|
|
|
|
void _beginSerial(uint32_t baud);
|
|
void _drain();
|
|
void _waitForReady();
|
|
};
|