SPI speed added to flash storage and menu cleanup

Moved ARS selection to tft_espi config
This commit is contained in:
Sjef Verhoeven PE5PVB
2023-11-01 22:22:46 +01:00
parent 838e4a2bdd
commit c64faf1df3
5 changed files with 30 additions and 32 deletions
+13 -5
View File
@@ -33,19 +33,23 @@
#define CONTRASTPIN 2
#define STANDBYLED 19
#define SMETERPIN 27
// #define ARS // uncomment for BGR type display (ARS version)
#define VERSION "v2.00 development beta"
// #define CHINA_PORTABLE // uncomment for China Portable build (Simplified Chinese)
// #define DYNAMIC_SPI_SPEED // uncomment to enable dynamic SPI Speed https://github.com/ohmytime/TFT_eSPI_DynamicSpeed
#define DYNAMIC_SPI_SPEED // uncomment to enable dynamic SPI Speed https://github.com/ohmytime/TFT_eSPI_DynamicSpeed
#ifdef ARS
#define VERSION "v2.00ARS"
#include "ARS_Colors.h"
TFT_eSPI tft = TFT_eSPI(320, 240);
#else
#define VERSION "v2.00 development beta"
TFT_eSPI tft = TFT_eSPI(240, 320);
#endif
#ifdef DYNAMIC_SPI_SPEED
bool dynamicspi = true;
#else
bool dynamicspi = false;
#endif
bool advancedRDS;
bool afmethodBold;
bool afpage;
@@ -442,7 +446,9 @@ void setup() {
radio.rds.fastps = EEPROM.readByte(EE_BYTE_FASTPS);
tot = EEPROM.readByte(EE_BYTE_TOT);
mwstepsize = EEPROM.readByte(EE_BYTE_MWREGION);
spispeed = EEPROM.readByte(EE_BYTE_SPISPEED);
if (spispeed == SPI_SPEED_DEFAULT) tft.setSPISpeed(SPI_FREQUENCY / 1000000); else tft.setSPISpeed(spispeed * 10);
LWLowEdgeSet = FREQ_LW_LOW_EDGE_MIN;
LWHighEdgeSet = FREQ_LW_HIGH_EDGE_MAX;
MWLowEdgeSet = mwstepsize == false ? FREQ_MW_LOW_EDGE_MIN_9K : FREQ_MW_LOW_EDGE_MIN_10K;
@@ -1876,6 +1882,7 @@ void ModeButtonPress() {
EEPROM.writeByte(EE_BYTE_FASTPS, radio.rds.fastps);
EEPROM.writeByte(EE_BYTE_TOT, tot);
EEPROM.writeByte(EE_BYTE_MWREGION, mwstepsize);
EEPROM.writeByte(EE_BYTE_SPISPEED, spispeed);
EEPROM.commit();
Serial.end();
if (wifi) remoteip = IPAddress (WiFi.localIP()[0], WiFi.localIP()[1], WiFi.localIP()[2], subnetclient);
@@ -3418,6 +3425,7 @@ void DefaultSettings(byte userhardwaremodel) {
EEPROM.writeByte(EE_BYTE_FASTPS, 1);
EEPROM.writeByte(EE_BYTE_TOT, 0);
EEPROM.writeByte(EE_BYTE_MWREGION, 0);
EEPROM.writeByte(EE_BYTE_SPISPEED, SPI_SPEED_DEFAULT);
EEPROM.commit();
}
-10
View File
@@ -1,10 +0,0 @@
#define TFT_BLACK 0x0000 /* 0, 0, 0 */
#define TFT_DARKGREY 0x7BEF /* 15, 31, 15 */
#define TFT_RED 0xF800 /* 31, 0, 0 */
#define TFT_GREEN 0x07E0 /* 0, 63, 0 */
#define TFT_BLUE 0x001F /* 0, 0, 31 */
#define TFT_YELLOW 0xFFE0 /* 31, 63, 0 */
#define TFT_CYAN 0x07FF /* 0, 63, 31 */
#define TFT_WHITE 0xFFFF /* 31, 63, 31 */
#define TFT_SKYBLUE 0x867D /* 16, 51, 29 */
#define TFT_ORANGE 0xFC00 /* 31, 32, 0 */
+6 -5
View File
@@ -107,7 +107,7 @@
// EEPROM index defines
#define EE_PRESETS_CNT 99
#define EE_CHECKBYTE_VALUE 39 // 0 ~ 255,add new entry, change for new value
#define EE_CHECKBYTE_VALUE 40 // 0 ~ 255,add new entry, change for new value
#define EE_TOTAL_CNT 819
#define EE_UINT16_FREQUENCY_FM 0
@@ -184,10 +184,11 @@
#define EE_BYTE_FASTPS 118
#define EE_BYTE_TOT 119
#define EE_BYTE_MWREGION 120
#define EE_PRESETS_BAND_START 121
#define EE_PRESET_BW_START 221
#define EE_PRESET_MS_START 321
#define EE_PRESETS_START 421
#define EE_BYTE_SPISPEED 121
#define EE_PRESETS_BAND_START 122
#define EE_PRESET_BW_START 222
#define EE_PRESET_MS_START 322
#define EE_PRESETS_START 422
#define EE_PRESETS_FREQUENCY 8750
// End of EEPROM index defines
+10 -12
View File
@@ -7,7 +7,7 @@
#include <cstring>
byte menuitem;
byte items[8] = {8, 3, 6, 10, 9, 10, 9, 5};
byte items[8] = {8, (dynamicspi ? 3 : 2), 6, 10, 9, 10, 9, 5};
void doTheme() { // Use this to put your own colors in: http://www.barth-dev.de/online/rgb565-color-picker/
switch (CurrentTheme) {
@@ -378,9 +378,6 @@ void BuildMenu() {
case MAINSETTINGS:
tftPrint(-1, myLanguage[language][108], 8, ITEM1 + 6, ActiveColor, ActiveColorSmooth, 16);
tftPrint(-1, myLanguage[language][107], 8, ITEM2 + 6, ActiveColor, ActiveColorSmooth, 16);
tftPrint(-1, myLanguage[language][206], 8, ITEM3 + 6, ActiveColor, ActiveColorSmooth, 16);
tftPrint(1, "Mhz", 310, ITEM3 + 6, ActiveColor, ActiveColorSmooth, 16);
switch (hardwaremodel) {
case BASE_ILI9341: tftPrint(1, myLanguage[language][109], 310, ITEM1 + 6, PrimaryColor, PrimaryColorSmooth, 16); break;
@@ -388,10 +385,14 @@ void BuildMenu() {
case PORTABLE_TOUCH_ILI9341: tftPrint(1, myLanguage[language][111], 310, ITEM1 + 6, PrimaryColor, PrimaryColorSmooth, 16); break;
}
if (spispeed == SPI_SPEED_DEFAULT) tftPrint(1, String(myLanguage[language][78]) + " " + String(SPI_FREQUENCY / 1000000, DEC), 270, ITEM3 + 6, PrimaryColor, PrimaryColorSmooth, 16);
else tftPrint(1, String(spispeed * 10, DEC), 270, ITEM3 + 6, PrimaryColor, PrimaryColorSmooth, 16);
if (touchrotating) tftPrint(1, myLanguage[language][42], 310, ITEM2 + 6, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(1, myLanguage[language][30], 310, ITEM2 + 6, PrimaryColor, PrimaryColorSmooth, 16);
if (dynamicspi) {
tftPrint(1, "MHz", 310, ITEM3 + 6, ActiveColor, ActiveColorSmooth, 16);
tftPrint(-1, myLanguage[language][206], 8, ITEM3 + 6, ActiveColor, ActiveColorSmooth, 16);
if (spispeed == SPI_SPEED_DEFAULT) tftPrint(1, String(myLanguage[language][78]) + " " + String(SPI_FREQUENCY / 1000000, DEC), 270, ITEM3 + 6, PrimaryColor, PrimaryColorSmooth, 16);
else tftPrint(1, String(spispeed * 10, DEC), 270, ITEM3 + 6, PrimaryColor, PrimaryColorSmooth, 16);
}
break;
case AUDIOSETTINGS:
@@ -904,9 +905,8 @@ void MenuUp() {
if (spispeed == SPI_SPEED_DEFAULT) tftPrint(1, String(myLanguage[language][78]) + " " + String(SPI_FREQUENCY / 1000000, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28);
else tftPrint(1, String(spispeed * 10, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28);
#ifdef DYNAMIC_SPI_SPEED
if (spispeed == SPI_SPEED_DEFAULT) tft.setSPISpeed(SPI_FREQUENCY / 1000000); else tft.setSPISpeed(spispeed * 10);
#endif
spispeedold = spispeed;
break;
}
@@ -1465,9 +1465,7 @@ void MenuDown() {
if (spispeed == SPI_SPEED_DEFAULT) tftPrint(1, String(myLanguage[language][78]) + " " + String(SPI_FREQUENCY / 1000000, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28);
else tftPrint(1, String(spispeed * 10, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28);
#ifdef DYNAMIC_SPI_SPEED
if (spispeed == SPI_SPEED_DEFAULT) tft.setSPISpeed(SPI_FREQUENCY / 1000000); else tft.setSPISpeed(spispeed * 10);
#endif
spispeedold = spispeed;
break;
@@ -2078,7 +2076,7 @@ void DoMenu() {
case ITEM3:
Infoboxprint(myLanguage[language][206]);
tftPrint(-1, "MHz", 170, 118, ActiveColor, ActiveColorSmooth, 28);
if (spispeed == SPI_SPEED_DEFAULT) tftPrint(1, String(myLanguage[language][78]) + " " + String(SPI_FREQUENCY / 1000000, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(1, String(spispeed * 10 , DEC) + " MHz", 155, 118, PrimaryColor, PrimaryColorSmooth, 28);
if (spispeed == SPI_SPEED_DEFAULT) tftPrint(1, String(myLanguage[language][78]) + " " + String(SPI_FREQUENCY / 1000000, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(1, String(spispeed * 10 , DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28);
break;
}
break;
+1
View File
@@ -36,6 +36,7 @@ extern bool BWreset;
extern bool change;
extern bool compressedold;
extern bool dynamicPTYold;
extern bool dynamicspi;
extern bool edgebeep;
extern bool hasafold;
extern bool haseonold;