Mods on Chinese display with external .cpp
This commit is contained in:
+5
-10
@@ -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) {
|
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 (language == LANGUAGE_CHS) {
|
||||||
if (memcmp(font, FONT16, sizeof(FONT16)) == 0) {
|
if (font == FONT16) font = FONT16_CHS;
|
||||||
font = FONT16_CHS;
|
else if (font == FONT28) font = FONT28_CHS;
|
||||||
} else if (memcmp(font, FONT28, sizeof(FONT28)) == 0) {
|
|
||||||
font = FONT28_CHS;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentFont != font || resetFontOnNextCall) {
|
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) {
|
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 (language == LANGUAGE_CHS) {
|
||||||
if (memcmp(font, FONT16, sizeof(FONT16)) == 0) {
|
if (font == FONT16) font = FONT16_CHS;
|
||||||
font = FONT16_CHS;
|
if (font == FONT28) font = FONT28_CHS;
|
||||||
} else if (memcmp(font, FONT28, sizeof(FONT28)) == 0) {
|
|
||||||
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);
|
||||||
currentFont = font;
|
currentFont = font;
|
||||||
resetFontOnNextCall = false;
|
resetFontOnNextCall = false;
|
||||||
|
|||||||
+24
@@ -9,6 +9,30 @@
|
|||||||
#include <Wire.h>
|
#include <Wire.h>
|
||||||
#include <EEPROM.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() {
|
void BuildAFScreen() {
|
||||||
if (!afscreen && RDSstatus) {
|
if (!afscreen && RDSstatus) {
|
||||||
tft.drawRoundRect(20, 30, 274, 170, 5, ActiveColor);
|
tft.drawRoundRect(20, 30, 274, 170, 5, ActiveColor);
|
||||||
|
|||||||
@@ -120,6 +120,8 @@ extern unsigned int ConverterSet;
|
|||||||
extern unsigned int HighEdgeSet;
|
extern unsigned int HighEdgeSet;
|
||||||
extern unsigned int LowEdgeSet;
|
extern unsigned int LowEdgeSet;
|
||||||
extern unsigned int mappedfreqold[20];
|
extern unsigned int mappedfreqold[20];
|
||||||
|
extern bool resetFontOnNextCall;
|
||||||
|
extern const uint8_t* currentFont;
|
||||||
|
|
||||||
extern TFT_eSPI tft;
|
extern TFT_eSPI tft;
|
||||||
extern TEF6686 radio;
|
extern TEF6686 radio;
|
||||||
@@ -134,7 +136,7 @@ void MenuDown();
|
|||||||
void DoMenu();
|
void DoMenu();
|
||||||
|
|
||||||
// Extern:
|
// 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 ShowFreq(int mode);
|
||||||
void ShowBandSelectionFM(bool notglanceview, bool normaldisplay);
|
void ShowBandSelectionFM(bool notglanceview, bool normaldisplay);
|
||||||
void ShowBandSelectionAM(bool notglanceview, bool normaldisplay);
|
void ShowBandSelectionAM(bool notglanceview, bool normaldisplay);
|
||||||
|
|||||||
Reference in New Issue
Block a user