Added tft print functions to make life easier
This commit is contained in:
+44
-6
@@ -148,6 +148,7 @@ char buff[16];
|
||||
char programTypePrevious[18];
|
||||
char radioIdPrevious[6];
|
||||
int ActiveColor;
|
||||
int ActiveColorSmooth;
|
||||
int AGC;
|
||||
int AMLevelOffset;
|
||||
int BackgroundColor;
|
||||
@@ -169,12 +170,14 @@ int OStatusold;
|
||||
int peakholdold;
|
||||
int peakholdtimer;
|
||||
int PrimaryColor;
|
||||
int PrimaryColorSmooth;
|
||||
int RDSColor;
|
||||
int rotary;
|
||||
int rssi;
|
||||
int rssiold = 200;
|
||||
int scanner_filter;
|
||||
int SecondaryColor;
|
||||
int SecondaryColorSmooth;
|
||||
int snrupdatetimer;
|
||||
int Sqstatusold;
|
||||
int Squelch;
|
||||
@@ -430,8 +433,10 @@ void setup() {
|
||||
tft.setFreeFont(FONT14);
|
||||
tft.fillScreen(BackgroundColor);
|
||||
tft.setTextColor(ActiveColor);
|
||||
tft.drawCentreString(myLanguage[language][1], 155, 77, GFXFF);
|
||||
tft.drawCentreString(myLanguage[language][2], 150, 107, GFXFF);
|
||||
tftPrint(0, myLanguage[language][1], 155, 85, ActiveColor, ActiveColorSmooth, FONT28);
|
||||
tftPrint(0, myLanguage[language][2], 155, 115, ActiveColor, ActiveColorSmooth, FONT28);
|
||||
//tft.drawCentreString(myLanguage[language][1], 155, 77, GFXFF);
|
||||
//tft.drawCentreString(myLanguage[language][2], 150, 107, GFXFF);
|
||||
while (digitalRead(BWBUTTON) == LOW) delay(50);
|
||||
}
|
||||
|
||||
@@ -500,7 +505,8 @@ void setup() {
|
||||
tft.fillScreen(BackgroundColor);
|
||||
tft.setTextColor(PrimaryColor);
|
||||
tft.setFreeFont(FONT14);
|
||||
tft.drawCentreString(myLanguage[language][8], 160, -5, GFXFF);
|
||||
//tft.drawCentreString(myLanguage[language][8], 160, -5, GFXFF);
|
||||
tftPrint(0, myLanguage[language][8], 160, 3, PrimaryColor, PrimaryColorSmooth, FONT28);
|
||||
tft.setFreeFont(FONT7);
|
||||
tft.setTextColor(PrimaryColor);
|
||||
tft.drawCentreString("Software " + String(VERSION), 160, 148, GFXFF);
|
||||
@@ -5829,13 +5835,16 @@ void SetTunerPatch() {
|
||||
void doTheme() { // Use this to put your own colors in: http://www.barth-dev.de/online/rgb565-color-picker/
|
||||
switch (CurrentTheme) {
|
||||
case 0: // Default PE5PVB theme
|
||||
PrimaryColor = TFT_YELLOW;
|
||||
SecondaryColor = TFT_SKYBLUE;
|
||||
PrimaryColor = 0xFFE0;
|
||||
PrimaryColorSmooth = 0x10A0;
|
||||
SecondaryColor = 0x867D;
|
||||
SecondaryColorSmooth = 0x53F1;
|
||||
FrequencyColor = TFT_YELLOW;
|
||||
FrameColor = TFT_BLUE;
|
||||
GreyoutColor = 0x38E7;
|
||||
BackgroundColor = TFT_BLACK;
|
||||
ActiveColor = TFT_WHITE;
|
||||
ActiveColor = 0xFFFF;
|
||||
ActiveColorSmooth = 0x4208;
|
||||
OptimizerColor = 1;
|
||||
StereoColor = TFT_RED;
|
||||
RDSColor = TFT_SKYBLUE;
|
||||
@@ -6065,3 +6074,32 @@ void DefaultSettings() {
|
||||
EEPROM.writeByte(EE_BYTE_STEREO, 1);
|
||||
EEPROM.commit();
|
||||
}
|
||||
|
||||
void tftPrint(int8_t offset, const String& text, int16_t x, int16_t y, int color, int smoothcolor, const uint8_t* font) {
|
||||
tft.loadFont(font);
|
||||
tft.setTextColor(color, smoothcolor, false);
|
||||
switch (offset) {
|
||||
case -1: tft.drawString(text, x, y, GFXFF); break;
|
||||
case 0: tft.drawCentreString(text, x, y, GFXFF); break;
|
||||
case 1: tft.drawRightString(text, x, y, GFXFF); break;
|
||||
}
|
||||
tft.unloadFont();
|
||||
}
|
||||
|
||||
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) {
|
||||
tft.loadFont(font);
|
||||
tft.loadFont(font);
|
||||
tft.setTextColor(BackgroundColor, BackgroundColor, false);
|
||||
switch (offset) {
|
||||
case -1: tft.drawString(textold, x, y, GFXFF); break;
|
||||
case 0: tft.drawCentreString(textold, x, y, GFXFF); break;
|
||||
case 1: tft.drawRightString(textold, x, y, GFXFF); break;
|
||||
}
|
||||
tft.setTextColor(color, smoothcolor, false);
|
||||
switch (offset) {
|
||||
case -1: tft.drawString(text, x, y, GFXFF); break;
|
||||
case 0: tft.drawCentreString(text, x, y, GFXFF); break;
|
||||
case 1: tft.drawRightString(text, x, y, GFXFF); break;
|
||||
}
|
||||
tft.unloadFont();
|
||||
}
|
||||
|
||||
+2288
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user