2026-10-13 00:56:32 +02:00
|
|
|
#include "display/frames.h"
|
|
|
|
|
|
|
|
|
|
#include <stdio.h>
|
2026-10-13 01:52:34 +02:00
|
|
|
#include <string.h>
|
2026-10-13 00:56:32 +02:00
|
|
|
|
|
|
|
|
#include "display/bitmaps.h"
|
2026-10-13 01:34:04 +02:00
|
|
|
#include "display/text.h"
|
2026-10-13 00:56:32 +02:00
|
|
|
|
|
|
|
|
// 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)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2026-10-13 01:52:34 +02:00
|
|
|
void FlipdotFrames::clock(int hour, int minute, bool evening)
|
2026-10-13 00:56:32 +02:00
|
|
|
{
|
|
|
|
|
char time[6];
|
|
|
|
|
snprintf(time, sizeof(time), "%02d:%02d", hour, minute);
|
|
|
|
|
|
|
|
|
|
_display.fillScreen(0);
|
2026-10-13 01:52:34 +02:00
|
|
|
if (evening)
|
2026-10-13 00:56:32 +02:00
|
|
|
_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();
|
|
|
|
|
}
|
|
|
|
|
|
2026-10-13 01:34:04 +02:00
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
|
2026-10-13 01:52:34 +02:00
|
|
|
void FlipdotFrames::page()
|
|
|
|
|
{
|
|
|
|
|
_drawFullScreen(_page);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FlipdotFrames::live()
|
|
|
|
|
{
|
|
|
|
|
_drawFullScreen(_live);
|
|
|
|
|
}
|
|
|
|
|
|
2026-10-15 01:29:01 +02:00
|
|
|
void FlipdotFrames::off()
|
2026-10-13 00:56:32 +02:00
|
|
|
{
|
2026-10-15 01:29:01 +02:00
|
|
|
_drawFullScreen(_off);
|
2026-10-13 00:56:32 +02:00
|
|
|
}
|
2026-10-13 01:52:34 +02:00
|
|
|
|
|
|
|
|
void FlipdotFrames::setPageBitmap(const uint8_t *bitmap)
|
|
|
|
|
{
|
|
|
|
|
memcpy(_page, bitmap, BITMAP_BYTES);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FlipdotFrames::setLiveBitmap(const uint8_t *bitmap)
|
|
|
|
|
{
|
|
|
|
|
memcpy(_live, bitmap, BITMAP_BYTES);
|
|
|
|
|
}
|
|
|
|
|
|
2026-10-15 01:29:01 +02:00
|
|
|
void FlipdotFrames::setOffBitmap(const uint8_t *bitmap)
|
|
|
|
|
{
|
|
|
|
|
if (bitmap)
|
|
|
|
|
memcpy(_off, bitmap, BITMAP_BYTES);
|
|
|
|
|
else
|
|
|
|
|
memset(_off, 0, BITMAP_BYTES);
|
|
|
|
|
}
|
|
|
|
|
|
2026-10-13 01:52:34 +02:00
|
|
|
void FlipdotFrames::_drawFullScreen(const uint8_t *bitmap)
|
|
|
|
|
{
|
|
|
|
|
_display.fillScreen(0);
|
|
|
|
|
_display.drawBitmap(0, 0, bitmap, BITMAP_WIDTH, BITMAP_HEIGHT, 1);
|
|
|
|
|
_display.display();
|
|
|
|
|
}
|