Merge pull request #374 from ohmytime/Fix_SPI_Speed

Fix SPI speed by mod tft_eSpi library
This commit is contained in:
Sjef Verhoeven PE5PVB
2023-11-01 21:28:39 +01:00
committed by GitHub
2 changed files with 12 additions and 8 deletions
+1
View File
@@ -35,6 +35,7 @@
#define SMETERPIN 27 #define SMETERPIN 27
// #define ARS // uncomment for BGR type display (ARS version) // #define ARS // uncomment for BGR type display (ARS version)
// #define CHINA_PORTABLE // uncomment for China Portable build (Simplified Chinese) // #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
#ifdef ARS #ifdef ARS
#define VERSION "v2.00ARS" #define VERSION "v2.00ARS"
+6 -3
View File
@@ -904,8 +904,9 @@ void MenuUp() {
if (spispeed == SPI_SPEED_DEFAULT) tftPrint(1, String(myLanguage[language][78]) + " " + String(SPI_FREQUENCY / 1000000, DEC), 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); else tftPrint(1, String(spispeed * 10, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28);
#ifdef DYNAMIC_SPI_SPEED
if (spispeed == SPI_SPEED_DEFAULT) SPI.setFrequency(SPI_FREQUENCY); else SPI.setFrequency(spispeed * 1000000); if (spispeed == SPI_SPEED_DEFAULT) tft.setSPISpeed(SPI_FREQUENCY / 1000000); else tft.setSPISpeed(spispeed * 10);
#endif
spispeedold = spispeed; spispeedold = spispeed;
break; break;
} }
@@ -1464,7 +1465,9 @@ void MenuDown() {
if (spispeed == SPI_SPEED_DEFAULT) tftPrint(1, String(myLanguage[language][78]) + " " + String(SPI_FREQUENCY / 1000000, DEC), 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); else tftPrint(1, String(spispeed * 10, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28);
if (spispeed == SPI_SPEED_DEFAULT) SPI.setFrequency(SPI_FREQUENCY); else SPI.setFrequency(spispeed * 1000000); #ifdef DYNAMIC_SPI_SPEED
if (spispeed == SPI_SPEED_DEFAULT) tft.setSPISpeed(SPI_FREQUENCY / 1000000); else tft.setSPISpeed(spispeed * 10);
#endif
spispeedold = spispeed; spispeedold = spispeed;
break; break;