Partially rework fonts (again)

This commit is contained in:
2026-02-13 23:57:42 +01:00
parent 2d03316910
commit 3668854cd4
12 changed files with 324 additions and 277 deletions
+24 -24
View File
@@ -104,10 +104,10 @@ static const char* const ECCtext[] {
"Kingdom of Morroco", // 2
"Republica Moldova", // 3
"People's Democratic Republic of Algeria", // 4
"Κυπριακή Δημοκρατία / (Republic of Cyprus)", // 5
"Κυπριακή Δημοκρατία [Republic of Cyprus]", // 5
"Česká republika", // 6
"Ireland", // 7
"Eesti Vabariik / (Republic of Estonia)", // 8
"Eesti Vabariik [Republic of Estonia]", // 8
"Principat d'Andorra", // 9
"Repubblica di San Marino", // 10
"Rzeczpospolita Polska", // 11
@@ -118,17 +118,17 @@ static const char* const ECCtext[] {
"The former Yugoslav Republic of Macedonia", // 16
"Repubblica Italiana", // 17
"Hashemite Kingdom of Jordan", // 18
"Slovenská republika", // 19
"Koninkrijk België / Royaume de Belgique", // 20
"Suomen tasavalta / (Republic of Finland)", // 21
"Slovenská republika [Republic of Slovakia]", // 19
"Koninkrijk België / Royaume de Belgique [Kingdom of Belgium]", // 20
"Suomen tasavalta [Republic of Finland]", // 21
"Syrian Arab Republic", // 22
"Republic of Serbia", // 23
"Україна / (Ukraine)", // 24
"Российская Федерация / (Russian Federation)", // 25
"Groussherzogtum Lëtzebuerg / (Grand Duchy of Luxembourg)", // 26
"Републике Србије [Republic of Serbia]", // 23
"Україна [Ukraine]", // 24
"Российская Федерация [Russian Federation]", // 25
"Groussherzogtum Lëtzebuerg [Grand Duchy of Luxembourg]", // 26
"Republic of Tunisia", // 27
"State of Palestine", // 28
"Република България / (Republic of Bulgaria)", // 29
"Република България [Republic of Bulgaria]", // 29
"Republic of Portugal (Madeira)", // 30
"Koninkrijk der Nederlanden", // 31
"Republic of Portugal", // 32
@@ -146,13 +146,13 @@ static const char* const ECCtext[] {
"Principality of Monaco", // 44
"Republic of Malta", // 45
"United Kingdom of Great Britain and Northern Ireland", // 46
"Lietuvos Respublika / (Republic of Lithuania)", // 47
"Republika Hrvatska / (Republic of Croatia)", // 48
"Lietuvos Respublika [Republic of Lithuania]", // 47
"Republika Hrvatska [Republic of Croatia]", // 48
"Libya", // 49
"Kingdom of Spain (Canary Islands)", // 50
"România", // 51
"Reino de España / (Kingdom of Spain)", // 52
"Konungariket Sverige / (Kingdom of Sweden)", // 53
"Reino de España [Kingdom of Spain]", // 52
"Konungariket Sverige [Kingdom of Sweden]", // 53
"Arab Republic of Egypt", // 54
"République de France", // 55
"Kongeriket Norge", // 56
@@ -239,7 +239,7 @@ static const char* const ECCtext[] {
"República Federativa do Brasil", // 137
"Canada", // 138
"United Kingdom of Great Britain and Northern Ireland (Cayman Islands)", // 139
"Republic of Chile", // 140
"República de Chile", // 140
"Republic of Colombia", // 141
"Republic of Costa Rica", // 142
"Republic of Cuba", // 143
@@ -250,20 +250,20 @@ static const char* const ECCtext[] {
"United Kingdom of Great Britain and Northern Ireland (Falkland Islands)", // 148
"Kingdom of Denmark (Greenland, NOT USA)", // 149
"Grenada", // 150
"Republic of France (Guadeloupe)", // 151
"République française (Guadeloupe)", // 151
"Republic of Guatemala", // 152
"Republic of Guyana", // 153
"Republic of Haiti", // 154
"Republic of Honduras", // 155
"Jamaica", // 156
"Republic of France (Martinique)", // 157
"République française (Martinique)", // 157
"Estados Unidos Mexicanos", // 158
"United Kingdom of Great Britain and Northern Ireland (Montserrat)", // 159
"Netherlands Antilles (does not exist)", // 160
"Netherlands Antilles", // 160
"Republic of Nicaragua", // 161
"Republic of Panama", // 162
"Republic of Paraguay", // 163
"Republic of Peru", // 164
"República del Paraguay", // 163
"República del Perú", // 164
"United States of America (Puerto Rico)", // 165
"Saint Kitts and Nevis", // 166
"Saint Lucia", // 167
@@ -289,9 +289,9 @@ static const char* const ECCtext[] {
"Kingdom of Bhutan", // 187
"Negara Brunei Darussalam", // 188
"Kingdom of Cambodia", // 189
"People's Republic of China", // 190
"中华人民共和国 [PRC]", // 190
"Republic of Fiji", // 191
"People's Republic of China (Hong Kong)", // 192
"中华人民共和国(香港 [PRC, HK]", // 192
"Republic of India", // 193
"Republic of Indonesia", // 194
"Islamic Republic of Iran", // 195
@@ -300,7 +300,7 @@ static const char* const ECCtext[] {
"Democratic People's Republic of Korea (North Korea)", // 198
"Republic of Korea (South Korea)", // 199
"Lao People's Democratic Republic", // 200
"People's Republic of China (Macao)", // 201
"中华人民共和国(澳门) [PRC, M]", // 201
"Malaysia", // 202
"Republic of Maldives", // 203
"United States of America (Marshall Islands)", // 204
@@ -324,7 +324,7 @@ static const char* const ECCtext[] {
"Commonwealth of the Bahamas", // 222
"United Kingdom of Great Britain and Northern Ireland (Bermuda) / Federative Republic of Brazil", // 223
"Federative Republic of Brazil / Republic of Ecuador", // 224
"Netherlands Antilles (does not exist) / Federative Republic of Brazil", // 225
"Netherlands Antilles / Federative Republic of Brazil", // 225
"United States of America", // 226
"People's Republic of Bangladesh", // 227
"Rzeczpospolita Zachodniej Polski" // 228 - doesn't exist, YET, we don't want a fucking pimp for president here
+1 -19
View File
@@ -3,36 +3,18 @@
#include "globals.h"
#include "nonvolatile.h"
#include <Hash.h>
#include "main.h"
void Communication();
void XDRGTKRoutine();
void passwordcrypt();
void tryWiFi();
extern void DataPrint(String string);
extern void ShowFreq(int mode);
extern void SelectBand();
extern void doBW();
extern void BuildDisplay();
extern void BuildAdvancedRDS();
extern void ModeButtonPress();
extern void Seek(bool mode);
extern void doStereoToggle();
extern void MuteScreen(bool setting);
extern void updateiMS();
extern void updateEQ();
extern void tftPrint(int8_t offset, const String & text, int16_t x, int16_t y, int color, int smoothcolor, uint8_t fontsize);
extern void showAutoSquelch(bool mode);
extern void ShowStepSize();
extern void startFMDXScan();
extern void cancelDXScan();
extern void printLogbookCSV();
extern void NTPupdate();
extern void handleRoot();
extern void handleDownloadCSV();
extern void handleLogo();
extern void Infoboxprint(const char* input);
extern void TuneUp();
extern void TuneDown();
extern void ShowTuneMode();
extern const char* textUI(uint16_t number);
+2 -18
View File
@@ -3,6 +3,7 @@
#include "globals.h"
#include "utils.h"
#include "menugraphics.h"
#include "main.h"
static const char* const unitString[] = {"dBμV", "dBf", "dBm"};
static const char* const FreqFont[] = {"Classic", "Roubenstil", "Motoya", "Aura2", "Comic", "Modern"};
@@ -25,27 +26,10 @@ String shortLine(String text);
void showMenuOpenTouchButtons();
void showBWSelector();
extern void ShowFreq(int mode);
extern void ShowBandSelectionFM(bool notglanceview, bool normaldisplay);
extern void ShowBandSelectionAM(bool notglanceview, bool normaldisplay);
extern void ScreensaverTimerSet(byte value);
extern void ShowMemoryPos();
extern void ShowTuneMode();
extern void updateBW();
extern void ShowStepSize();
extern void updateiMS();
extern void updateEQ();
extern void doTheme();
extern void tryWiFi();
extern void TuneUp();
extern void endMenu();
extern void startFMDXScan();
extern void DoMemoryPosTune();
extern void UpdateFonts();
extern void tftPrint(int8_t offset, const String & text, int16_t x, int16_t y, int color, int smoothcolor, uint8_t fontsize);
extern void setAutoSpeedSPI();
extern void showAutoSquelch(bool mode);
extern uint8_t doAutoMemory(uint16_t startfreq, uint16_t stopfreq, uint8_t startmem, uint8_t stopmem, bool rdsonly, uint8_t doublepi);
extern void ClearMemoryRange(uint8_t start, uint8_t stop);
extern bool handleCreateNewLogbook();
extern const char* textUI(uint16_t number);
extern bool handleCreateNewLogbook();
+2 -3
View File
@@ -6,6 +6,7 @@ using fs::FS;
#include <SPIFFS.h>
#include "globals.h"
#include "rtc.hpp"
#include "main.h"
void handleRoot();
void handleDownloadCSV();
@@ -16,6 +17,4 @@ bool isDST(time_t t);
void handleLogo();
void printLogbookCSV();
void sendUDPlog();
IPAddress makeBroadcastAddress(IPAddress ip);
extern const char* textUI(uint16_t number);
IPAddress makeBroadcastAddress(IPAddress ip);
+33
View File
@@ -0,0 +1,33 @@
#pragma once
#include <stdint.h>
#include <Arduino.h>
void tftPrint(int8_t offset, const String & text, int16_t x, int16_t y, int color, int smoothcolor, uint8_t fontsize);
void tftPrint16(int8_t offset, const String & text, int16_t x, int16_t y, int color, int smoothcolor, bool force_font = true, bool font = false);
void tftReplace(int8_t offset, const String & textold, const String & text, int16_t x, int16_t y, int color, int smoothcolor, int background, uint8_t fontsize);
const char* textUI(uint16_t number);
uint8_t doAutoMemory(uint16_t startfreq, uint16_t stopfreq, uint8_t startmem, uint8_t stopmem, bool rdsonly, uint8_t doublepi);
void showAutoSquelch(bool mode);
void UpdateFonts();
void setAutoSpeedSPI();
void DoMemoryPosTune();
void startFMDXScan();
void endMenu();
void TuneUp();
void ShowStepSize();
void ShowFreq(int mode);
void ShowMemoryPos();
void TuneDown();
void ShowTuneMode();
void SelectBand();
void doBW();
void ModeButtonPress();
void updateEQ();
void updateiMS();
void Seek(bool mode);
void MuteScreen(bool setting);
void cancelDXScan();
void doStereoToggle();
void updateBW();
void ShowRDSLogo(bool RDSstatus);
void DataPrint(String string);
+1 -5
View File
@@ -9,6 +9,7 @@
#include "globals.h"
#include "NTPupdate.h"
#include "rtc.hpp"
#include "main.h"
void ShowAdvancedRDS();
void readRds();
@@ -22,9 +23,4 @@ void showCT();
void ShowErrors();
void ShowRDSStatistics();
extern void ShowRDSLogo(bool RDSstatus);
extern void DataPrint(String string);
extern void tftPrint(int8_t offset, const String & text, int16_t x, int16_t y, int color, int smoothcolor, uint8_t fontsize);
extern void tftReplace(int8_t offset, const String & textold, const String & text, int16_t x, int16_t y, int color, int smoothcolor, int background, uint8_t fontsize);
extern bool isDST(time_t t);
extern const char* textUI(uint16_t number);
+13 -11
View File
@@ -13,7 +13,7 @@ private:
unsigned long lastTick;
unsigned long holdTick;
bool isScrolling;
std::function<void(TFT_eSprite*, bool)> postDrawCallback;
std::function<void(TFT_eSprite*)> postDrawCallback;
int usedH;
bool hold;
int xOffset;
@@ -26,17 +26,17 @@ public:
ScrollingTextDisplay(TFT_eSprite* spr, int y, int maxW, int x = 35, int inuseH = -1 ) :
sprite(spr), yPos(y), maxWidth(maxW), xPos(0), textWidth(0), lastTick(0), holdTick(0), isScrolling(false), postDrawCallback(nullptr), usedH(inuseH), hold(false), xOffset(x) {}
void setPostDrawCallback(std::function<void(TFT_eSprite*, bool)> callback) {
void setPostDrawCallback(std::function<void(TFT_eSprite*)> callback) {
postDrawCallback = callback;
}
void update(const String& text, bool status, uint16_t activeColor, uint16_t activeSmooth, uint16_t dropoutColor, uint16_t dropoutSmooth, uint16_t backgroundColor) {
void update(const String& text, bool status, uint16_t activeColor, uint16_t activeSmooth, uint16_t dropoutColor, uint16_t dropoutSmooth, uint16_t backgroundColor, uint8_t font = 255) {
textWidth = sprite->textWidth(text);
if(textWidth < maxWidth) {
xPos = 0;
isScrolling = false;
drawText(text, status, activeColor, activeSmooth, dropoutColor, dropoutSmooth, backgroundColor);
drawText(text, status, activeColor, activeSmooth, dropoutColor, dropoutSmooth, backgroundColor, font);
} else {
if(!isScrolling) holdTick = millis();
isScrolling = true;
@@ -54,7 +54,7 @@ public:
holdTick = millis();
}
drawText(text, status, activeColor, activeSmooth, dropoutColor, dropoutSmooth, backgroundColor);
drawText(text, status, activeColor, activeSmooth, dropoutColor, dropoutSmooth, backgroundColor, font);
lastTick = millis();
}
}
@@ -75,7 +75,9 @@ public:
}
private:
void drawText(const String& text, bool status, uint16_t activeColor, uint16_t activeSmooth, uint16_t dropoutColor, uint16_t dropoutSmooth, uint16_t backgroundColor) {
void drawText(const String& text, bool status, uint16_t activeColor, uint16_t activeSmooth, uint16_t dropoutColor, uint16_t dropoutSmooth, uint16_t backgroundColor, uint8_t font) {
if(font > FONT_COUNT) font = sprite->textfont;
if(usedH > 0) {
sprite->fillSprite(TFT_TRANSPARENT);
sprite->fillRect(0, 0, maxWidth, usedH, backgroundColor);
@@ -85,8 +87,8 @@ private:
if(status) sprite->setTextColor(activeColor, activeSmooth, false);
else sprite->setTextColor(dropoutColor, dropoutSmooth, false);
sprite->drawString(text, xPos, 0);
if(isScrolling) sprite->drawString(text, xPos + textWidth + SCROLL_GAP, 0);
sprite->drawString(text, xPos, 0, font);
if(isScrolling) sprite->drawString(text, xPos + textWidth + SCROLL_GAP, 0, font);
sprite->resetViewport();
} else {
@@ -95,11 +97,11 @@ private:
if(status) sprite->setTextColor(activeColor, activeSmooth, false);
else sprite->setTextColor(dropoutColor, dropoutSmooth, false);
sprite->drawString(text, xPos, 0);
if(isScrolling) sprite->drawString(text, xPos + textWidth + SCROLL_GAP, 0);
sprite->drawString(text, xPos, 0, font);
if(isScrolling) sprite->drawString(text, xPos + textWidth + SCROLL_GAP, 0, font);
}
if(postDrawCallback) postDrawCallback(sprite, false);
if(postDrawCallback) postDrawCallback(sprite);
if(yPos != 0) sprite->pushSprite(xOffset, yPos, TFT_TRANSPARENT);
}
};