mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-07-27 07:18:11 +00:00
refactor: clean up SH1106Display and CharTestScreen
- Remove redundant translateUTF8ToBlocks override (now same as base class) - Remove cp437/setTextColor/setTextSize calls from startFrame (unused since print() is overridden) - Simplify setTextSize (both branches were identical) - CharTestScreen: update comment, use UTF-8 literals for Greek, fix refresh rate 500→2000ms Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
// Test screen that displays sample characters from various alphabets/scripts.
|
||||
// Useful for verifying transliteration and font coverage on experimental fonts.
|
||||
// Test screen that displays sample characters from various alphabets/scripts
|
||||
// to verify native font coverage (no transliteration — Lemon renders natively).
|
||||
|
||||
class CharTestScreen : public UIScreen {
|
||||
UITask* _task;
|
||||
@@ -41,7 +41,7 @@ public:
|
||||
display.setCursor(display.width() - 6, startY + (_visible - 1) * lineH);
|
||||
display.print("v");
|
||||
}
|
||||
return 500;
|
||||
return 2000;
|
||||
}
|
||||
|
||||
bool handleInput(char c) override {
|
||||
@@ -52,7 +52,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
// Sample strings are printed as raw UTF-8 (no transliteration) to test native font coverage.
|
||||
// Lemon font covers U+0020–U+04FF: Latin, Greek and Cyrillic all render natively.
|
||||
const CharTestScreen::TestLine CharTestScreen::LINES[CharTestScreen::LINE_COUNT] = {
|
||||
{ "PL", "ąćęłńóśźżĄĆĘŁŃ" }, // Polish
|
||||
@@ -65,5 +64,5 @@ const CharTestScreen::TestLine CharTestScreen::LINES[CharTestScreen::LINE_COUNT]
|
||||
{ "TR", "çğışöüİŞĞ" }, // Turkish
|
||||
{ "LT", "āēīūģķļņŗėįų" }, // Baltic (Latvian/Lithuanian)
|
||||
{ "RU", "АБВГДЕЖЗабвгдеж" }, // Cyrillic
|
||||
{ "GR", "\xCE\xB1\xCE\xB2\xCE\xB3\xCE\xB4\xCE\xB5\xCE\xB6\xCE\xB7\xCE\xB8\xCE\xB9\xCE\xBA" }, // Greek αβγδεζηθικ
|
||||
{ "GR", "αβγδεζηθικλμ" }, // Greek
|
||||
};
|
||||
|
||||
@@ -41,21 +41,13 @@ void SH1106Display::startFrame(Color bkg)
|
||||
{
|
||||
display.clearDisplay(); // TODO: apply 'bkg'
|
||||
_color = SH110X_WHITE;
|
||||
display.setTextColor(_color);
|
||||
display.setTextSize(1);
|
||||
display.cp437(true); // Use full 256 char 'Code Page 437' font
|
||||
}
|
||||
|
||||
void SH1106Display::setTextSize(int sz)
|
||||
{
|
||||
_text_size = (uint8_t)sz;
|
||||
if (sz == 1) {
|
||||
display.setFont(nullptr); // use default font path; we override print() ourselves
|
||||
display.setTextSize(1);
|
||||
} else {
|
||||
display.setFont(nullptr);
|
||||
display.setTextSize(sz);
|
||||
}
|
||||
display.setFont(nullptr);
|
||||
display.setTextSize(sz);
|
||||
}
|
||||
|
||||
void SH1106Display::setColor(Color c)
|
||||
|
||||
@@ -50,11 +50,4 @@ public:
|
||||
void setBrightness(uint8_t level) override;
|
||||
void endFrame() override;
|
||||
|
||||
// UTF-8 is handled natively in print() — no substitution needed
|
||||
void translateUTF8ToBlocks(char* dest, const char* src, size_t dest_size) override {
|
||||
size_t len = strlen(src);
|
||||
if (len >= dest_size) len = dest_size - 1;
|
||||
memcpy(dest, src, len);
|
||||
dest[len] = '\0';
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user