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(PopupType type, int32_t width, int32_t height, std::optional<int32_t> startX = std::nullopt,
56 std::optional<int32_t> startY = std::nullopt);
57 static void removePopup();
58 static void popupText(std::string_view text,
bool persistent =
false, PopupType type = PopupType::GENERAL);
59 static bool isPopupPresent();
60 static bool isPopupPresentOfType(PopupType type = PopupType::GENERAL);
61 static bool isPermanentPopupPresent();
63 static void displayWorkingAnimation(std::string_view word);
65 static int32_t setupConsole(int32_t height);
66 static void drawConsoleTopLine();
68 static void stopScrollingAnimation();
69 static void setupSideScroller(int32_t index, std::string_view text, int32_t startX, int32_t endX, int32_t startY,
70 int32_t endY, int32_t textSpacingX, int32_t textSizeY,
bool doHighlight);
71 static void drawPermanentPopupLookingText(std::string_view);
75 static void markChanged() {
78 D_PRINTLN(
"Fresh dirty mark");
84 void consoleTimerEvent();
85 static void scrollingAndBlinkingTimerEvent();
87 static void renderEmulated7Seg(
const std::array<uint8_t, kNumericDisplayLength>& display);
89 static oled_canvas::Canvas main;
90 static oled_canvas::Canvas popup;
91 static oled_canvas::Canvas console;
94 static uint8_t (*oledCurrentImage)[OLED_MAIN_WIDTH_PIXELS];
96 static const uint8_t folderIcon[];
97 static const uint8_t waveIcon[];
98 static const uint8_t songIcon[];
99 static const uint8_t synthIcon[];
100 static const uint8_t kitIcon[];
101 static const uint8_t midiIcon[];
102 static const uint8_t midiIconPt2[];
103 static const uint8_t downArrowIcon[];
104 static const uint8_t rightArrowIcon[];
105 static const uint8_t lockIcon[];
106 static const uint8_t checkedBoxIcon[];
107 static const uint8_t uncheckedBoxIcon[];
108 static const uint8_t submenuArrowIcon[];
109 static const uint8_t submenuArrowIconBold[];
110 static const uint8_t metronomeIcon[];
111 static const std::vector<uint8_t> lfoIconSine;
112 static const std::vector<uint8_t> lfoIconSquare;
113 static const std::vector<uint8_t> lfoIconSaw;
114 static const std::vector<uint8_t> lfoIconTriangle;
115 static const std::vector<uint8_t> lfoIconSampleHold;
116 static const std::vector<uint8_t> lfoIconRandomWalk;
117 static const std::vector<uint8_t> lfoIconWarbler;
118 static const std::vector<uint8_t> syncTypeEvenIcon;
119 static const std::vector<uint8_t> syncTypeDottedIcon;
120 static const std::vector<uint8_t> syncTypeTripletsIcon;
121 static const std::vector<uint8_t> switcherIconOff;
122 static const std::vector<uint8_t> switcherIconOn;
123 static const std::vector<uint8_t> arpModeIconUp;
124 static const std::vector<uint8_t> arpModeIconDown;
125 static const std::vector<uint8_t> arpModeIconWalk;
126 static const std::vector<uint8_t> arpModeIconCustom;
127 static const std::vector<uint8_t> diceIcon;
128 static const std::vector<uint8_t> stutterDirectionIcon;
129 static const std::vector<uint8_t> knobArcIcon;
130 static const std::vector<uint8_t> infinityIcon;
132 void removeWorkingAnimation()
override;
133 void timerRoutine()
override;
134 void consoleText(std::string_view text)
override;
135 void freezeWithError(std::string_view)
override;
139 constexpr size_t getNumBrowserAndMenuLines()
override {
return 3; }
141 void displayPopup(std::string_view newText, int8_t numFlashes = 3,
bool =
false, uint8_t = 255, int32_t = 1,
142 PopupType type = PopupType::GENERAL)
override {
143 popupText(newText, !numFlashes, type);
146 void popupText(std::string_view text, PopupType type = PopupType::GENERAL)
override { popupText(text,
true, type); }
147 void popupTextTemporary(std::string_view text, PopupType type = PopupType::GENERAL)
override {
148 popupText(text,
false, type);
151 void cancelPopup()
override { removePopup(); }
152 bool isLayerCurrentlyOnTop(NumericLayer* layer)
override {
return (!this->hasPopup()); }
153 void displayError(Error error)
override;
156 void displayLoadingAnimationText(std::string_view text,
bool delayed =
false,
bool transparent =
false)
override {
157 displayWorkingAnimation(text);
159 void removeLoadingAnimation()
override { removeWorkingAnimation(); }
161 bool hasPopup()
override {
return isPopupPresent(); }
162 bool hasPopupOfType(PopupType type)
override {
return isPopupPresentOfType(type); }
165 void displayHorizontalMenuPopup(std::string_view paramTitle, std::optional<std::string_view> paramValue)
override;
168 static bool needsSending;