Mods on Chinese display with external .cpp

This commit is contained in:
Sjef Verhoeven PE5PVB
2023-08-04 14:18:14 +02:00
parent 1135242056
commit 0362fd38b0
3 changed files with 32 additions and 11 deletions
+5 -10
View File
@@ -4768,11 +4768,8 @@ void DefaultSettings(byte userhardwaremodel) {
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 (memcmp(font, FONT16, sizeof(FONT16)) == 0) {
font = FONT16_CHS;
} else if (memcmp(font, FONT28, sizeof(FONT28)) == 0) {
font = FONT28_CHS;
}
if (font == FONT16) font = FONT16_CHS;
else if (font == FONT28) font = FONT28_CHS;
}
if (currentFont != font || resetFontOnNextCall) {
@@ -4795,15 +4792,13 @@ 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) {
if (language == LANGUAGE_CHS) {
if (memcmp(font, FONT16, sizeof(FONT16)) == 0) {
font = FONT16_CHS;
} else if (memcmp(font, FONT28, sizeof(FONT28)) == 0) {
font = FONT28_CHS;
}
if (font == FONT16) font = FONT16_CHS;
if (font == FONT28) font = FONT28_CHS;
}
if (currentFont != font || resetFontOnNextCall) {
if (currentFont != nullptr) tft.unloadFont();
tft.loadFont(font);
currentFont = font;
resetFontOnNextCall = false;
+24
View File
@@ -9,6 +9,30 @@
#include <Wire.h>
#include <EEPROM.h>
static 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 != nullptr) tft.unloadFont();
tft.loadFont(font);
currentFont = font;
resetFontOnNextCall = false;
}
tft.setTextColor(color, smoothcolor, false);
switch (offset) {
case -1: tft.setTextDatum(TL_DATUM); break;
case 0: tft.setTextDatum(TC_DATUM); break;
case 1: tft.setTextDatum(TR_DATUM); break;
}
tft.drawString(text, x, y, 1);
}
void BuildAFScreen() {
if (!afscreen && RDSstatus) {
tft.drawRoundRect(20, 30, 274, 170, 5, ActiveColor);
+3 -1
View File
@@ -120,6 +120,8 @@ extern unsigned int ConverterSet;
extern unsigned int HighEdgeSet;
extern unsigned int LowEdgeSet;
extern unsigned int mappedfreqold[20];
extern bool resetFontOnNextCall;
extern const uint8_t* currentFont;
extern TFT_eSPI tft;
extern TEF6686 radio;
@@ -134,7 +136,7 @@ void MenuDown();
void DoMenu();
// Extern:
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);
void ShowFreq(int mode);
void ShowBandSelectionFM(bool notglanceview, bool normaldisplay);
void ShowBandSelectionAM(bool notglanceview, bool normaldisplay);