From 3858ac4a162ab166c96580f413ec4e0a637b3994 Mon Sep 17 00:00:00 2001 From: "Ben V. Brown" Date: Tue, 16 Mar 2021 20:42:47 +1100 Subject: [PATCH] Rough pass expanding print --- source/Core/Drivers/OLED.cpp | 15 ++++++++++++--- source/build.sh | 1 + 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/source/Core/Drivers/OLED.cpp b/source/Core/Drivers/OLED.cpp index df06b3b1..9bd49e13 100644 --- a/source/Core/Drivers/OLED.cpp +++ b/source/Core/Drivers/OLED.cpp @@ -122,11 +122,11 @@ void OLED::drawChar(const uint16_t charCode) { cursor_x = 0; cursor_y = 8; return; - } else if (charCode <=0x01) { + } else if (charCode <= 0x01) { return; } // First index is \x02 - uint16_t index = charCode-2; + uint16_t index = charCode - 2; uint8_t *charPointer; charPointer = ((uint8_t *)currentFont) + ((fontWidth * (fontHeight / 8)) * index); drawArea(cursor_x, cursor_y, fontWidth, fontHeight, charPointer); @@ -236,8 +236,17 @@ void OLED::setRotation(bool leftHanded) { // print a string to the current cursor location void OLED::print(const char *str) { + uint16_t cache = 0; while (str[0]) { - drawChar(str[0]); + if (str[0] >= 0xF0) { + cache = static_cast(str[0] & 0x0F) << 8; + } else if (cache != 0) { + cache |= str[0]; + drawChar(cache); + cache = 0; + } else { + drawChar(str[0]); + } str++; } } diff --git a/source/build.sh b/source/build.sh index e07e102f..eaa2a1c2 100644 --- a/source/build.sh +++ b/source/build.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -x TRANSLATION_DIR="../Translations" TRANSLATION_SCRIPT="make_translation.py"