20#include "gui/l10n/language.h"
23#include "definitions_cxx.hpp"
25#include "oled_canvas/canvas.h"
29#define OLED_LOG_TIMING (0 && ENABLE_TEXT_OUTPUT)
32#include "io/debug/log.h"
35namespace deluge::hid::display {
44class OLED :
public Display {
46 OLED() : Display(DisplayType::OLED) {
47 if (l10n::chosenLanguage ==
nullptr || l10n::chosenLanguage == &l10n::built_in::seven_segment) {
48 l10n::chosenLanguage = &l10n::built_in::english;
57 static void clearMainImage();
59 static void setupBlink(int32_t minX, int32_t width, int32_t minY, int32_t maxY,
bool shouldBlinkImmediately);
60 static void stopBlink();
62 static void sendMainImage();
64 static void setupPopup(PopupType type, int32_t width, int32_t height, std::optional<int32_t> startX = std::nullopt,
65 std::optional<int32_t> startY = std::nullopt);
66 static void removePopup();
67 static void popupText(std::string_view text,
bool persistent =
false, PopupType type = PopupType::GENERAL);
68 static bool isPopupPresent();
69 static bool isPopupPresentOfType(PopupType type = PopupType::GENERAL);
70 static bool isPermanentPopupPresent();
72 static void displayWorkingAnimation(std::string_view word);
74 static int32_t setupConsole(int32_t height);
75 static void drawConsoleTopLine();
77 static void stopScrollingAnimation();
78 static void setupSideScroller(int32_t index, std::string_view text, int32_t startX, int32_t endX, int32_t startY,
79 int32_t endY, int32_t textSpacingX, int32_t textSizeY,
bool doHighlight);
80 static void drawPermanentPopupLookingText(std::string_view);
84 static void markChanged() {
87 D_PRINTLN(
"Fresh dirty mark");
93 void consoleTimerEvent();
94 static void scrollingAndBlinkingTimerEvent();
96 static void renderEmulated7Seg(
const std::array<uint8_t, kNumericDisplayLength>& display);
98 static oled_canvas::Canvas main;
99 static oled_canvas::Canvas popup;
100 static oled_canvas::Canvas console;
103 static uint8_t (*oledCurrentImage)[OLED_MAIN_WIDTH_PIXELS];
105 static const uint8_t folderIcon[];
106 static const uint8_t waveIcon[];
107 static const uint8_t songIcon[];
108 static const uint8_t synthIcon[];
109 static const uint8_t kitIcon[];
110 static const uint8_t midiIcon[];
111 static const uint8_t midiIconPt2[];
112 static const uint8_t downArrowIcon[];
113 static const uint8_t rightArrowIcon[];
114 static const uint8_t lockIcon[];
115 static const uint8_t checkedBoxIcon[];
116 static const uint8_t uncheckedBoxIcon[];
117 static const uint8_t submenuArrowIcon[];
118 static const uint8_t submenuArrowIconBold[];
119 static const uint8_t metronomeIcon[];
120 static const Icon sineIcon;
121 static const Icon squareIcon;
122 static const Icon sawIcon;
123 static const Icon triangleIcon;
124 static const Icon sampleHoldIcon;
125 static const Icon randomWalkIcon;
126 static const Icon warblerIcon;
127 static const Icon syncTypeEvenIcon;
128 static const Icon syncTypeDottedIcon;
129 static const Icon syncTypeTripletsIcon;
130 static const Icon switcherIconOff;
131 static const Icon switcherIconOn;
132 static const Icon arpModeIconUp;
133 static const Icon arpModeIconUpDown;
134 static const Icon arpModeIconWalk;
135 static const Icon arpModeIconCustom;
136 static const Icon diceIcon;
137 static const Icon directionIcon;
138 static const Icon knobArcIcon;
139 static const Icon infinityIcon;
140 static const Icon sampleIcon;
141 static const Icon wavetableIcon;
142 static const Icon inputIcon;
143 static const Icon folderIconBig;
144 static const Icon recordIcon;
145 static const Icon loopPointIcon;
146 static const Icon sampleModeCutIcon;
147 static const Icon sampleModeOnceIcon;
148 static const Icon sampleModeLoopIcon;
149 static const Icon sampleModeStretchIcon;
150 static const Icon pitchSpeedLinkedIcon;
151 static const Icon pitchSpeedIndependentIcon;
153 void removeWorkingAnimation()
override;
154 void timerRoutine()
override;
155 void consoleText(std::string_view text)
override;
156 void freezeWithError(std::string_view)
override;
160 constexpr size_t getNumBrowserAndMenuLines()
override {
return 3; }
162 void displayPopup(std::string_view newText, int8_t numFlashes = 3,
bool =
false, uint8_t = 255, int32_t = 1,
163 PopupType type = PopupType::GENERAL)
override {
164 popupText(newText, !numFlashes, type);
167 void popupText(std::string_view text, PopupType type = PopupType::GENERAL)
override { popupText(text,
true, type); }
168 void popupTextTemporary(std::string_view text, PopupType type = PopupType::GENERAL)
override {
169 popupText(text,
false, type);
172 void cancelPopup()
override { removePopup(); }
173 bool isLayerCurrentlyOnTop(NumericLayer* layer)
override {
return (!this->hasPopup()); }
174 void displayError(Error error)
override;
177 void displayLoadingAnimationText(std::string_view text,
bool delayed =
false,
bool transparent =
false)
override {
178 displayWorkingAnimation(text);
180 void removeLoadingAnimation()
override { removeWorkingAnimation(); }
182 bool hasPopup()
override {
return isPopupPresent(); }
183 bool hasPopupOfType(PopupType type)
override {
return isPopupPresentOfType(type); }
186 void displayNotification(std::string_view paramTitle, std::optional<std::string_view> paramValue)
override;
189 static bool needsSending;