20#include "gui/l10n/language.h"
23#include "definitions_cxx.hpp"
25#include "oled_canvas/canvas.h"
28#define OLED_LOG_TIMING (0 && ENABLE_TEXT_OUTPUT)
31#include "io/debug/log.h"
34namespace deluge::hid::display {
35class OLED :
public Display {
37 OLED() : Display(DisplayType::OLED) {
38 if (l10n::chosenLanguage ==
nullptr || l10n::chosenLanguage == &l10n::built_in::seven_segment) {
39 l10n::chosenLanguage = &l10n::built_in::english;
48 static void clearMainImage();
50 static void setupBlink(int32_t minX, int32_t width, int32_t minY, int32_t maxY,
bool shouldBlinkImmediately);
51 static void stopBlink();
53 static void sendMainImage();
55 static void setupPopup(int32_t width, int32_t height);
56 static void removePopup();
57 static void popupText(std::string_view text,
bool persistent =
false, PopupType type = PopupType::GENERAL);
58 static bool isPopupPresent();
59 static bool isPopupPresentOfType(PopupType type = PopupType::GENERAL);
60 static bool isPermanentPopupPresent();
62 static void displayWorkingAnimation(std::string_view word);
64 static int32_t setupConsole(int32_t height);
65 static void drawConsoleTopLine();
67 static void stopScrollingAnimation();
68 static void setupSideScroller(int32_t index, std::string_view text, int32_t startX, int32_t endX, int32_t startY,
69 int32_t endY, int32_t textSpacingX, int32_t textSizeY,
bool doHighlight);
70 static void drawPermanentPopupLookingText(std::string_view);
74 static void markChanged() {
77 D_PRINTLN(
"Fresh dirty mark");
83 void consoleTimerEvent();
84 static void scrollingAndBlinkingTimerEvent();
86 static void renderEmulated7Seg(
const std::array<uint8_t, kNumericDisplayLength>& display);
88 static oled_canvas::Canvas main;
89 static oled_canvas::Canvas popup;
90 static oled_canvas::Canvas console;
93 static uint8_t (*oledCurrentImage)[OLED_MAIN_WIDTH_PIXELS];
95 static const uint8_t folderIcon[];
96 static const uint8_t waveIcon[];
97 static const uint8_t songIcon[];
98 static const uint8_t synthIcon[];
99 static const uint8_t kitIcon[];
100 static const uint8_t midiIcon[];
101 static const uint8_t midiIconPt2[];
102 static const uint8_t downArrowIcon[];
103 static const uint8_t rightArrowIcon[];
104 static const uint8_t lockIcon[];
105 static const uint8_t checkedBoxIcon[];
106 static const uint8_t uncheckedBoxIcon[];
107 static const uint8_t submenuArrowIcon[];
108 static const uint8_t submenuArrowIconBold[];
109 static const uint8_t metronomeIcon[];
110 static const std::vector<uint8_t> lfoIconSine;
111 static const std::vector<uint8_t> lfoIconSquare;
112 static const std::vector<uint8_t> lfoIconSaw;
113 static const std::vector<uint8_t> lfoIconTriangle;
114 static const std::vector<uint8_t> lfoIconSampleHold;
115 static const std::vector<uint8_t> lfoIconRandomWalk;
116 static const std::vector<uint8_t> lfoIconWarbler;
117 static const std::vector<uint8_t> syncTypeEvenIcon;
118 static const std::vector<uint8_t> syncTypeDottedIcon;
119 static const std::vector<uint8_t> syncTypeTripletsIcon;
121 void removeWorkingAnimation()
override;
122 void timerRoutine()
override;
123 void consoleText(std::string_view text)
override;
124 void freezeWithError(std::string_view)
override;
128 constexpr size_t getNumBrowserAndMenuLines()
override {
return 3; }
130 void displayPopup(std::string_view newText, int8_t numFlashes = 3,
bool =
false, uint8_t = 255, int32_t = 1,
131 PopupType type = PopupType::GENERAL)
override {
132 popupText(newText, !numFlashes, type);
135 void popupText(std::string_view text, PopupType type = PopupType::GENERAL)
override { popupText(text,
true, type); }
136 void popupTextTemporary(std::string_view text, PopupType type = PopupType::GENERAL)
override {
137 popupText(text,
false, type);
140 void cancelPopup()
override { removePopup(); }
141 bool isLayerCurrentlyOnTop(NumericLayer* layer)
override {
return (!this->hasPopup()); }
142 void displayError(Error error)
override;
145 void displayLoadingAnimationText(std::string_view text,
bool delayed =
false,
bool transparent =
false)
override {
146 displayWorkingAnimation(text);
148 void removeLoadingAnimation()
override { removeWorkingAnimation(); }
150 bool hasPopup()
override {
return isPopupPresent(); }
151 bool hasPopupOfType(PopupType type)
override {
return isPopupPresentOfType(type); }
154 static bool needsSending;