Add Chinese display support

This commit is contained in:
kevin
2023-07-25 09:17:23 +08:00
parent 26a71fa3a5
commit d6a913e1ac
2 changed files with 14 additions and 0 deletions
+12
View File
@@ -10,7 +10,9 @@
#include "src/WiFiConnect.h" #include "src/WiFiConnect.h"
#include "src/WiFiConnectParam.h" #include "src/WiFiConnectParam.h"
#include "src/FONT16.h" #include "src/FONT16.h"
#include "src/FONT16_CHS.h"
#include "src/FONT28.h" #include "src/FONT28.h"
#include "src/FONT28_CHS.h"
#include "src/FONT48DEC.h" #include "src/FONT48DEC.h"
#include "src/TEF6686.h" #include "src/TEF6686.h"
#include "src/constants.h" #include "src/constants.h"
@@ -5927,6 +5929,11 @@ void DefaultSettings() {
} }
void tftPrint(int8_t offset, const String & text, int16_t x, int16_t y, int color, int smoothcolor, const uint8_t* font) { void tftPrint(int8_t offset, const String & text, int16_t x, int16_t y, int color, int smoothcolor, const uint8_t* font) {
if (language == LANGUAGE_CHS) {
if (font == FONT16) font = FONT16_CHS;
else if (font == FONT28) font = FONT28_CHS;
}
if (currentFont != font || resetFontOnNextCall) { if (currentFont != font || resetFontOnNextCall) {
if (currentFont != nullptr) tft.unloadFont(); if (currentFont != nullptr) tft.unloadFont();
tft.loadFont(font); tft.loadFont(font);
@@ -5946,6 +5953,11 @@ void tftPrint(int8_t offset, const String & text, int16_t x, int16_t y, int colo
} }
void tftReplace(int8_t offset, const String & textold, const String & text, int16_t x, int16_t y, int color, int smoothcolor, const uint8_t* font) { void tftReplace(int8_t offset, const String & textold, const String & text, int16_t x, int16_t y, int color, int smoothcolor, const uint8_t* font) {
if (language == LANGUAGE_CHS) {
if (font == FONT16) font = FONT16_CHS;
else if (font == FONT28) font = FONT28_CHS;
}
if (currentFont != font || resetFontOnNextCall) { if (currentFont != font || resetFontOnNextCall) {
if (currentFont != nullptr) tft.unloadFont(); if (currentFont != nullptr) tft.unloadFont();
+2
View File
@@ -20,6 +20,8 @@
#define BAT_LEVEL_FULL 2270 #define BAT_LEVEL_FULL 2270
#define BAT_LEVEL_STAGE 4 #define BAT_LEVEL_STAGE 4
#define LANGUAGE_CHS 14
#define FREQ_MW_STEP_9K 9 #define FREQ_MW_STEP_9K 9
#define FREQ_MW_STEP_10K 10 #define FREQ_MW_STEP_10K 10
#define FREQ_SW_STEP_5K 5 #define FREQ_SW_STEP_5K 5