From 462bd9fbc253ac7bdf35a52c61fd03cbd979b556 Mon Sep 17 00:00:00 2001 From: GOROman Date: Mon, 19 May 2025 17:04:55 +0900 Subject: [PATCH] Optimize character rendering --- src/main.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 87869ec..8904841 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -199,16 +199,13 @@ void task_print(void *pvParameters) String buffer = answer; answer = ""; int count = 0; + const char *cstr = buffer.c_str(); for (int i = 0; i < len; i++) { - // 1文字づつ表示 - String str = buffer.substring(i, i + 1); + char ch = cstr[i]; - if (str == " " || str == "?") - { - } - else + if (ch != ' ' && ch != '?') { count++; if (count % 2 == 1) @@ -221,7 +218,7 @@ void task_print(void *pvParameters) portENTER_CRITICAL_ISR(&display_mutex); canvas.setTextColor(GREEN); - canvas.printf("%s", str.c_str()); + canvas.write(ch); canvas.pushSprite(4, 4); portEXIT_CRITICAL_ISR(&display_mutex); }