Коррекция уровня оптики, вкл по умолчанию, выкл в сне
плюс коррекции по отображению
This commit is contained in:
@@ -53,8 +53,8 @@ void Display::setPower(bool enabled) {
|
||||
Log::printf("OLED", "display power %s", enabled ? "ON" : "OFF");
|
||||
}
|
||||
|
||||
void Display::drawTextLine(const char *text, int16_t y) {
|
||||
int16_t x = 0;
|
||||
void Display::drawTextLine(const char *text, int16_t y, int16_t startX) {
|
||||
int16_t x = startX;
|
||||
while (text && *text && x + CyrillicFont::WIDTH <= oled_.width()) {
|
||||
const uint32_t codepoint = nextUtf8Codepoint(text);
|
||||
const uint8_t *glyph = CyrillicFont::glyph(codepoint);
|
||||
@@ -75,7 +75,8 @@ void Display::drawTextLine(const char *text, int16_t y) {
|
||||
}
|
||||
}
|
||||
|
||||
void Display::show(const char *a, const char *b, uint32_t progress, uint32_t progressTotal) {
|
||||
void Display::show(const char *a, const char *b, uint32_t progress,
|
||||
uint32_t progressTotal, const char *topRight) {
|
||||
char one[64], two[64];
|
||||
snprintf(one, sizeof(one), "%s", a ? a : ""); snprintf(two, sizeof(two), "%s", b ? b : "");
|
||||
// Serial is the primary UI mirror and remains available when OLED is absent.
|
||||
@@ -85,6 +86,11 @@ void Display::show(const char *a, const char *b, uint32_t progress, uint32_t pro
|
||||
oled_.clearDisplay();
|
||||
drawTextLine(one, 3);
|
||||
drawTextLine(two, 19);
|
||||
if (topRight && *topRight) {
|
||||
oled_.fillRect(oled_.width() - CyrillicFont::ADVANCE, 0,
|
||||
CyrillicFont::ADVANCE, CyrillicFont::HEIGHT + 3, SSD1306_BLACK);
|
||||
drawTextLine(topRight, 3, oled_.width() - CyrillicFont::ADVANCE);
|
||||
}
|
||||
if (progressTotal) {
|
||||
if (progress > progressTotal) progress = progressTotal;
|
||||
const uint16_t width = static_cast<uint16_t>(
|
||||
|
||||
Reference in New Issue
Block a user