Show status messages on the display

- Clock firmware: 'Connecting to WiFi...' and 'Getting the time...' at
  boot, 'Crashed!' in the OTA-only modes, and 'No WiFi' with the time
  when WiFi is down for over a minute (new DisplayController screen)
- Recovery app: shows its reason, the setup WiFi name, or its IP address,
  then powers the display off (flipdots keep the image)
- StatusScreen and drawTextLines shared by both apps
- Driver: ESP begin() no longer draws 'ESP Connected'
- Tests: No WiFi screen, short reason texts (70 total)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mangavalkandClaude Opus 5.5 committed 2026-10-13 01:34:04 +02:00
1 parent 4749f9e596
commit c9e0800e36
19 files changed
+332 -48

No files matched your search

+9 -10
View File
@@ -3,6 +3,7 @@
#include <stdio.h>
#include "display/bitmaps.h"
#include "display/text.h"
#include "logic/schedule.h"
// Horizontal offset that centers the 81 pixel wide clock on the 84 pixel display
@@ -31,6 +32,14 @@ void FlipdotFrames::clock(int hour, int minute)
_display.display();
}
void FlipdotFrames::noWifi(int hour, int minute)
{
char time[6];
snprintf(time, sizeof(time), "%02d:%02d", hour, minute);
drawTextLines(_display, "No WiFi", time);
_display.display();
}
void FlipdotFrames::logo()
{
_display.fillScreen(0);
@@ -43,13 +52,3 @@ 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();
}
+2 -2
View File
@@ -11,11 +11,11 @@ public:
// Pikachu with a thought bubble showing HH:MM (yawning in the evening)
void clock(int hour, int minute) override;
// "No WiFi" with the time below it
void noWifi(int hour, int minute) override;
// Nintendo logo
void logo() override;
void blank() override;
// A line of text, e.g. while connecting
void message(const char *text);
private:
BROSE9323 &_display;
+31
View File
@@ -0,0 +1,31 @@
#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)
{
}
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());
_display.setTiming(FLIP_TIME);
_started = true;
}
drawTextLines(_display, line1, line2);
_display.display();
if (!keep_on)
{
// The first frame after power on flips every dot, give the Nano time for that
delay(STATUS_FLIP_TIME);
_nano.off();
}
}
+21
View File
@@ -0,0 +1,21 @@
#pragma once
#include "BROSE9323.h"
#include "nano_link/nano_link.h"
// Short messages for situations outside the normal clock: booting, crashes, recovery app.
// Used by both the clock firmware and the recovery app.
class StatusScreen
{
public:
StatusScreen(BROSE9323 &display, NanoLink &nano);
// Power the display on, show up to two lines (TEXT_LINE_CHARS each). Unless keep_on,
// power off again once the dots have flipped: flipdots keep their image without power.
void show(const char *line1, const char *line2, bool keep_on = false);
private:
BROSE9323 &_display;
NanoLink &_nano;
bool _started = false;
};
+33
View File
@@ -0,0 +1,33 @@
#include "display/text.h"
#include <string.h>
static const int CHAR_WIDTH = 6;
static void drawCentered(BROSE9323 &display, const char *text, int y)
{
int len = strlen(text);
if (len > TEXT_LINE_CHARS)
len = TEXT_LINE_CHARS;
char line[TEXT_LINE_CHARS + 1];
memcpy(line, text, len);
line[len] = '\0';
display.setCursor((display.width() - len * CHAR_WIDTH) / 2, y);
display.print(line);
}
void drawTextLines(BROSE9323 &display, const char *line1, const char *line2)
{
display.fillScreen(0);
display.setTextSize(1);
display.setTextWrap(false);
display.setTextColor(1);
if (line2 == nullptr || line2[0] == '\0')
{
drawCentered(display, line1, 6); // one line: vertically centered
return;
}
drawCentered(display, line1, 1);
drawCentered(display, line2, 10);
}
+10
View File
@@ -0,0 +1,10 @@
#pragma once
#include "BROSE9323.h"
// Characters per line with the built-in 6x8 font on the 84 pixel wide display
const int TEXT_LINE_CHARS = 14;
// Clear the screen and draw up to two centered lines of text (line2 may be empty).
// Does not call display().
void drawTextLines(BROSE9323 &display, const char *line1, const char *line2);