Files
Flipdot-display/src/esp32/display/frames.h
T

47 lines
1.7 KiB
C++
Raw Normal View History

#pragma once
#include "BROSE9323.h"
2026-10-13 01:52:34 +02:00
#include "logic/bitmap_format.h"
#include "logic/display_controller.h"
#include "logic/page_render.h"
#include "logic/settings.h"
// Draws the screens on the flipdot display. Each method sends one complete frame.
class FlipdotFrames : public Frames
{
public:
FlipdotFrames(BROSE9323 &display, PageResources &resources);
// The page set with setDynamicPage(), drawn for this time. Only the changed dots are
// sent (nothing when it looks the same), unless redraw. Moving pages are sent without
// the refresh effect, and not faster than the Nano can receive and flip them.
uint32_t dynamicPage(const LocalTime &time, uint32_t now, bool redraw) override;
2026-10-13 01:34:04 +02:00
// "No WiFi" with the time below it
void noWifi(int hour, int minute) override;
2026-10-13 01:52:34 +02:00
// The bitmap set with setPageBitmap()
void page() override;
// The image set with setLiveBitmap()
void live() override;
// Blank, or the bitmap set with setOffBitmap()
void off() override;
void setDynamicPage(const DynamicPage &page);
// How the Nano flips the dots: for the time a frame takes
void setDrive(uint16_t flip_time, const DriveSettings &drive);
2026-10-13 01:52:34 +02:00
void setPageBitmap(const uint8_t *bitmap);
void setLiveBitmap(const uint8_t *bitmap);
// nullptr: blank
void setOffBitmap(const uint8_t *bitmap);
2026-10-13 01:52:34 +02:00
private:
BROSE9323 &_display;
PageResources &_resources;
DynamicPage _dynamic;
uint32_t _dot_us = 1000; // per changed dot: pulses x (flip time + gap)
2026-10-13 01:52:34 +02:00
uint8_t _page[BITMAP_BYTES] = {};
uint8_t _live[BITMAP_BYTES] = {};
uint8_t _off[BITMAP_BYTES] = {}; // all zero: blank
2026-10-13 01:52:34 +02:00
void _drawFullScreen(const uint8_t *bitmap);
uint32_t _show(const uint8_t *bitmap, bool changes_only, bool instant);
};