Add Cyrillic/UTF-8 text support to SH1106Display - #3175
Closed
strasharo wants to merge 1 commit into
Closed
Conversation
Switches SH1106Display from Adafruit_SH110X/GFX to U8g2 so it can render Cyrillic (and other non-Latin UTF-8) text instead of falling back to block characters. Continues the still-open meshcore-dev#1439, where the author got SSD1306 working but had no SH1106 hardware to test against. Also fixes drawXbm(): icon/logo bitmaps in this codebase are packed MSB-first (Adafruit_GFX::drawBitmap() convention), but U8g2's own drawXBM() expects LSB-first, so icons came out garbled until switched to U8g2's u8glib-compatible drawBitmap(), which uses the same MSB-first order. SH1106Display is shared by 7 boards; swapped their SH110X/GFX lib_deps for U8g2. Flash-tested on Wio Tracker L1 Pro and T-Beam Supreme.
Author
|
Closing this for now - found a cleaner way to do this (wrapping the existing Adafruit_GFX driver with U8g2_for_Adafruit_GFX instead of swapping the whole rendering backend), going to rework it that way instead. Will open a new PR once it's ready. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Switches
SH1106Displayfrom Adafruit_SH110X/GFX to U8g2 so it can actually render Cyrillic (and other non-Latin UTF-8) text instead of falling back to block characters. Picks up on #1930 and the still-open #1439, where the author got SSD1306 working but didn't have SH1106 hardware to test against - I do, so this covers that gap.What changed:
print()/getTextWidth()now use U8g2's UTF-8-awaredrawUTF8()/getUTF8Width()instead of the old byte-per-char pathtranslateUTF8ToBlocks()to just pass the string through unchanged, since the display can render it properly now and doesn't need the block-character fallbackdrawXbm()along the way - the icon/logo bitmaps in this codebase are packed MSB-first (Adafruit_GFX::drawBitmap() convention), but U8g2's own drawXBM() expects LSB-first, so icons came out completely garbled until I switched to U8g2's u8glib-compatible drawBitmap() instead, which uses the same MSB-first orderSH1106Display is shared by 7 boards (nano_g2_ultra, thinknode_m2, station_g2, wio-tracker-l1, lilygo_tbeam_1w, station_g3_esp32, lilygo_tbeam_supreme_SX1262), swapped the SH110X/GFX lib_deps for U8g2 on all of them. Built all 7 clean. Actually flash-tested on Wio Tracker L1 Pro and T-Beam Supreme since that's what I have on hand - confirmed Cyrillic text renders correctly (including a real message received over a channel), icons render correctly, and existing Latin-script screens still look right.
Not in scope here: long messages still don't wrap or scroll on this display, that's a separate thing I'll follow up with once this lands.