From 7719984a6e83ccf9b060540923247ba8c9a83f29 Mon Sep 17 00:00:00 2001 From: jixishi Date: Fri, 5 Jul 2024 23:15:10 +0800 Subject: [PATCH] =?UTF-8?q?UP=20=E6=94=AF=E6=8C=81=E7=9B=B4=E6=8E=A5?= =?UTF-8?q?=E5=AD=97=E7=AC=A6=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- demo/oled/test.c | 2 +- lib/src/oled/oled.cpp | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/demo/oled/test.c b/demo/oled/test.c index 018ca13..69b440c 100644 --- a/demo/oled/test.c +++ b/demo/oled/test.c @@ -126,7 +126,7 @@ void Test_OLED() { uint8_t bufx[8] = {0x5F, 0x53, 0x52, 0x4D, 0x6D, 0xB2, 0x4F, 0x4D}; sprintf(sbuf, "%s: 13.4271m\0", bufx); // OLED_ShowCHString(&oled, 1, 24, sbuf); - OLED_ShowCHString(&oled, 1, 24, "姓名学号班级"); + OLED_ShowCHString(&oled, 1, 24, "姓名学号:2233"); OLED_DrawRect(&oled, 0, 0, 127, 63); // };// diff --git a/lib/src/oled/oled.cpp b/lib/src/oled/oled.cpp index 4b2c9ea..d51b2d9 100644 --- a/lib/src/oled/oled.cpp +++ b/lib/src/oled/oled.cpp @@ -272,10 +272,12 @@ void OLED_ShowCHString(OLED_T *dev, uint8_t x, uint8_t y, uint8_t *str) { step = Font_utf8_to_unicode(str, &unicode_letter); if (step != 0) { Chinese_t *hzk = find_chinese_data(GET_LOW_BYTE1(unicode_letter), GET_LOW_BYTE0(unicode_letter)); - OLED_ShowCHChr(dev, x, y, hzk); - x += Hzk_size; - str += step; - found = true; + if(hzk!=NULL){ + OLED_ShowCHChr(dev, x, y, hzk); + x += Hzk_size; + str += step; + found = true; + } } if (!found) { OLED_ShowChar(dev, x, y, *str, Hzk_size);