Public Access
Home Assistant: remove the Clock switch (its entity is deleted on connect), add an IP sensor and Mode / Off image dropdowns whose options follow the saved bitmaps. Remove the built-in "Nintendo border" bitmap. Off image: a bitmap (or blank) left on the dots when the display switches off. Nano: pause after each flip pulse and repeat pulses for changed dots, both stored in EEPROM (G/N commands). Refresh effects (E command): instant, sparkle, wipe, rain, from the middle out, diagonal, spiral, flip all then reveal, push and random, optionally only for small changes. Effects run in steps from loop() so serial input keeps flowing. Web UI: flip settings, refresh effect and test patterns under Settings; the System tab shows why the ESP32 last restarted. Settings records from versions 1 and 2 are migrated. Firmware 2.3.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
57 lines
1.4 KiB
C++
57 lines
1.4 KiB
C++
#include "display/status_screen.h"
|
|
|
|
#include <Arduino.h>
|
|
|
|
#include "config.h"
|
|
#include "display/text.h"
|
|
|
|
StatusScreen::StatusScreen(BROSE9323 &display, NanoLink &nano) : _display(display), _nano(nano), _flip_time(FLIP_TIME)
|
|
{
|
|
}
|
|
|
|
void StatusScreen::setDrive(uint16_t flip_time, const DriveSettings &drive)
|
|
{
|
|
_flip_time = flip_time;
|
|
_drive = drive;
|
|
}
|
|
|
|
void StatusScreen::sendDrive()
|
|
{
|
|
// Not sent right away: the Nano could be in its bootloader (flashing)
|
|
_drive_pending = true;
|
|
}
|
|
|
|
void StatusScreen::loop()
|
|
{
|
|
if (!_drive_pending || !_started || !_nano.isOn())
|
|
return;
|
|
_drive_pending = false;
|
|
_display.setTiming(_flip_time);
|
|
_display.setGap(_drive.flip_gap);
|
|
_display.setPulses(_drive.pulses);
|
|
_display.setEffect(_drive.effect, _drive.effect_time, _drive.effect_small_only ? EFFECT_FLAG_SMALL_ONLY : 0);
|
|
}
|
|
|
|
void StatusScreen::show(const char *line1, const char *line2, bool keep_on)
|
|
{
|
|
Serial.printf("Display: %s / %s\n", line1, line2 ? line2 : "");
|
|
_nano.on();
|
|
if (!_started)
|
|
{
|
|
_display.begin(&_nano.stream());
|
|
_started = true;
|
|
_drive_pending = true;
|
|
loop();
|
|
}
|
|
drawTextLines(_display, line1, line2);
|
|
_display.display();
|
|
|
|
if (!keep_on)
|
|
{
|
|
// The first frame after power on flips every dot, give the Nano time for that
|
|
// (a push can take longer, but these messages are short: at worst it is cut off)
|
|
delay(STATUS_FLIP_TIME + (_drive.effect == DRIVE_EFFECT_INSTANT ? 0 : _drive.effect_time));
|
|
_nano.off();
|
|
}
|
|
}
|