You've already forked TEF6686_ESP32
redo spi freq stuff
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
|
||||
bool RDSstatus;
|
||||
bool RDSstatusold;
|
||||
TFT_eSPI tft = TFT_eSPI();
|
||||
|
||||
bool Data_Accelerator = false;
|
||||
|
||||
@@ -327,6 +326,7 @@ const size_t language_entrynumber = sizeof(myLanguage[0]) / sizeof(myLanguage[0]
|
||||
|
||||
mem presets[EE_PRESETS_CNT];
|
||||
TEF6686 radio;
|
||||
TFT_eSPI tft = TFT_eSPI();
|
||||
|
||||
// FrequencySprite.createSprite(200, 50);
|
||||
// PSSprite.createSprite(150, 32);
|
||||
|
||||
86
src/gui.cpp
86
src/gui.cpp
@@ -1635,14 +1635,14 @@ void ShowOneLine(byte position, byte item, bool selected) {
|
||||
|
||||
FullLineSprite.setTextDatum(TR_DATUM);
|
||||
|
||||
if (spispeed == 7) {
|
||||
if (spispeed == 0) {
|
||||
FullLineSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
|
||||
FullLineSprite.drawString(textUI(83), 298, 2);
|
||||
} else {
|
||||
FullLineSprite.setTextColor(ActiveColor, ActiveColorSmooth, false);
|
||||
FullLineSprite.drawString("MHz", 298, 2);
|
||||
FullLineSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
|
||||
FullLineSprite.drawString((spispeed == SPI_SPEED_DEFAULT ? String(textUI(201)) + " " + String(SPI_FREQUENCY / 1000000, DEC) : String(spispeed * 10, DEC)), 258, 2);
|
||||
FullLineSprite.drawString(String(spispeed), 258, 2);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -2723,7 +2723,7 @@ void ShowOneButton(byte position, byte item, bool selected) {
|
||||
PSSprite.setTextColor(ActiveColor, ActiveColorSmooth, false);
|
||||
PSSprite.drawString(shortLine(removeNewline(textUI(78))), 75, 1);
|
||||
|
||||
if (spispeed == 7) {
|
||||
if (spispeed == 0) {
|
||||
PSSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
|
||||
PSSprite.drawString(textUI(83), 75, 15);
|
||||
} else {
|
||||
@@ -2732,7 +2732,7 @@ void ShowOneButton(byte position, byte item, bool selected) {
|
||||
PSSprite.drawString("MHz", 77, 15);
|
||||
PSSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
|
||||
PSSprite.setTextDatum(TR_DATUM);
|
||||
PSSprite.drawString((spispeed == SPI_SPEED_DEFAULT ? String(textUI(201)) + " " + String(SPI_FREQUENCY / 1000000, DEC) : String(spispeed * 10, DEC)), 73, 15);
|
||||
PSSprite.drawString(String(spispeed), 73, 15);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -2836,9 +2836,8 @@ void BuildMenu() {
|
||||
default: tft.pushImage (0, 0, 320, 240, configurationbackground); break;
|
||||
}
|
||||
|
||||
if (!submenu) {
|
||||
tftPrint(ACENTER, textUI(29), 160, 6, PrimaryColor, PrimaryColorSmooth, 16);
|
||||
} else {
|
||||
if (!submenu) tftPrint(ACENTER, textUI(29), 160, 6, PrimaryColor, PrimaryColorSmooth, 16);
|
||||
else {
|
||||
tftPrint(ALEFT, textUI(181), (hardwaremodel == PORTABLE_TOUCH_ILI9341 ? 20 : 8), 6, PrimaryColor, PrimaryColorSmooth, 16);
|
||||
tftPrint(ARIGHT, textUI(186 + menupage - 1), 312, 6, ActiveColor, ActiveColorSmooth, 16);
|
||||
}
|
||||
@@ -3351,32 +3350,46 @@ void MenuUpDown(bool dir) {
|
||||
|
||||
case ITEM10:
|
||||
if (dir) {
|
||||
spispeed++;
|
||||
if (spispeed > SPI_SPEED_COUNT - 1) spispeed = 0;
|
||||
if (spispeed == 0) {
|
||||
spispeed = 4;
|
||||
} else if (spispeed < 10) {
|
||||
spispeed += 1;
|
||||
if (spispeed == 10) spispeed = 10;
|
||||
} else {
|
||||
spispeed += 10;
|
||||
if (spispeed > 80) spispeed = 0;
|
||||
}
|
||||
} else {
|
||||
spispeed--;
|
||||
if (spispeed > SPI_SPEED_COUNT - 1) spispeed = SPI_SPEED_COUNT - 1;
|
||||
if (spispeed == 0) {
|
||||
spispeed = 80;
|
||||
} else if (spispeed <= 10) {
|
||||
spispeed -= 1;
|
||||
if (spispeed < 4) spispeed = 0;
|
||||
} else {
|
||||
spispeed -= 10;
|
||||
if (spispeed < 10) spispeed = 9;
|
||||
}
|
||||
}
|
||||
|
||||
OneBigLineSprite.setTextDatum(TL_DATUM);
|
||||
OneBigLineSprite.setTextColor(ActiveColor, ActiveColorSmooth, false);
|
||||
if (spispeed != 7) {
|
||||
|
||||
if (spispeed == 0) {
|
||||
// Auto mode
|
||||
OneBigLineSprite.setTextDatum(TC_DATUM);
|
||||
OneBigLineSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
|
||||
OneBigLineSprite.drawString(textUI(83), 135, 0);
|
||||
setAutoSpeedSPI();
|
||||
} else {
|
||||
// Manual speed mode
|
||||
OneBigLineSprite.drawString("MHz", 175, 0);
|
||||
OneBigLineSprite.setTextDatum(TR_DATUM);
|
||||
} else {
|
||||
OneBigLineSprite.setTextDatum(TC_DATUM);
|
||||
}
|
||||
|
||||
OneBigLineSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
|
||||
if (spispeed == 7) {
|
||||
OneBigLineSprite.drawString(textUI(83), 135, 0);
|
||||
} else {
|
||||
OneBigLineSprite.drawString((spispeed == SPI_SPEED_DEFAULT ? String(textUI(201)) + " " + String(SPI_FREQUENCY / 1000000, DEC) : String(spispeed * 10, DEC)), 160, 0);
|
||||
OneBigLineSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
|
||||
OneBigLineSprite.drawString(String(spispeed), 160, 0);
|
||||
tft.setSPISpeed(spispeed);
|
||||
}
|
||||
|
||||
OneBigLineSprite.pushSprite(24, 118);
|
||||
if (spispeed == SPI_SPEED_DEFAULT) tft.setSPISpeed(SPI_FREQUENCY / 1000000);
|
||||
else if (spispeed == 7) setAutoSpeedSPI();
|
||||
else tft.setSPISpeed(spispeed * 10);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -3633,11 +3646,11 @@ void MenuUpDown(bool dir) {
|
||||
switch (CurrentTheme) {
|
||||
case 7:
|
||||
OneBigLineSprite.pushImage(-11, -88, 292, 170, popupbackground_wo);
|
||||
tft.pushImage (13, 30, 292, 170, popupbackground_wo);
|
||||
tft.pushImage(13, 30, 292, 170, popupbackground_wo);
|
||||
break;
|
||||
default:
|
||||
OneBigLineSprite.pushImage(-11, -88, 292, 170, popupbackground);
|
||||
tft.pushImage (13, 30, 292, 170, popupbackground);
|
||||
tft.pushImage(13, 30, 292, 170, popupbackground);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -4443,15 +4456,15 @@ void DoMenu() {
|
||||
if (menupage != INDEX) {
|
||||
menuopen = true;
|
||||
switch (CurrentTheme) {
|
||||
case 7: tft.pushImage (13, 30, 292, 170, popupbackground_wo); break;
|
||||
default: tft.pushImage (13, 30, 292, 170, popupbackground); break;
|
||||
case 7: tft.pushImage(13, 30, 292, 170, popupbackground_wo); break;
|
||||
default: tft.pushImage(13, 30, 292, 170, popupbackground); break;
|
||||
}
|
||||
showMenuOpenTouchButtons();
|
||||
|
||||
if (menupage == CONNECTIVITY && menuoption == ITEM3) {
|
||||
switch (CurrentTheme) {
|
||||
case 7: tft.pushImage (0, 0, 320, 240, configurationbackground_wo); break;
|
||||
default: tft.pushImage (0, 0, 320, 240, configurationbackground); break;
|
||||
case 7: tft.pushImage(0, 0, 320, 240, configurationbackground_wo); break;
|
||||
default: tft.pushImage(0, 0, 320, 240, configurationbackground); break;
|
||||
}
|
||||
tftPrint(ACENTER, textUI(189 + menupage - 1), 160, 6, ActiveColor, ActiveColorSmooth, 16);
|
||||
}
|
||||
@@ -4546,7 +4559,7 @@ void DoMenu() {
|
||||
tft.fillRoundRect(12, 8, 296, 226, 5, BackgroundColor);
|
||||
tftPrint(ACENTER, textUI(68), 155, 13, ActiveColor, ActiveColorSmooth, 28);
|
||||
tftPrint(ACENTER, textUI(69), 155, 55, ActiveColor, ActiveColorSmooth, 28);
|
||||
tftPrint(ACENTER, "PE5PVB", 155, 38, PrimaryColor, PrimaryColorSmooth, 16);
|
||||
tftPrint(ACENTER, "KubaPro010", 155, 38, PrimaryColor, PrimaryColorSmooth, 16);
|
||||
tftPrint(ARIGHT, "ohmytime", 145, 80, PrimaryColor, PrimaryColorSmooth, 16);
|
||||
tftPrint(ARIGHT, "HyperDX", 145, 95, PrimaryColor, PrimaryColorSmooth, 16);
|
||||
tftPrint(ALEFT, "MCelliotG", 155, 80, PrimaryColor, PrimaryColorSmooth, 16);
|
||||
@@ -4564,7 +4577,7 @@ void DoMenu() {
|
||||
tftPrint(ARIGHT, "marsel90-1", 145, 185, PrimaryColor, PrimaryColorSmooth, 16);
|
||||
tftPrint(ALEFT, "lawendel", 155, 185, PrimaryColor, PrimaryColorSmooth, 16);
|
||||
tftPrint(ARIGHT, "KB8U", 145, 200, PrimaryColor, PrimaryColorSmooth, 16);
|
||||
tftPrint(ALEFT, "KubaPro010", 155, 200, PrimaryColor, PrimaryColorSmooth, 16);
|
||||
tftPrint(ALEFT, "PE5PVB", 155, 200, PrimaryColor, PrimaryColorSmooth, 16);
|
||||
tftPrint(ACENTER, "github.com/KubaPro010/TEF6686_ESP32", 155, 215, ActiveColor, ActiveColorSmooth, 16);
|
||||
if (hardwaremodel == PORTABLE_TOUCH_ILI9341) {
|
||||
tft.fillRoundRect(240, 36, 60, 40, 6, FrameColor);
|
||||
@@ -4690,18 +4703,15 @@ void DoMenu() {
|
||||
|
||||
OneBigLineSprite.setTextDatum(TL_DATUM);
|
||||
OneBigLineSprite.setTextColor(ActiveColor, ActiveColorSmooth, false);
|
||||
if (spispeed != 7) {
|
||||
if (spispeed != 0) {
|
||||
OneBigLineSprite.drawString("MHz", 175, 0);
|
||||
OneBigLineSprite.setTextDatum(TR_DATUM);
|
||||
} else {
|
||||
OneBigLineSprite.setTextDatum(TC_DATUM);
|
||||
}
|
||||
OneBigLineSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
|
||||
if (spispeed == 7) {
|
||||
OneBigLineSprite.drawString(textUI(83), 135, 0);
|
||||
} else {
|
||||
OneBigLineSprite.drawString((spispeed == SPI_SPEED_DEFAULT ? String(textUI(201)) + " " + String(SPI_FREQUENCY / 1000000, DEC) : String(spispeed * 10, DEC)), 160, 0);
|
||||
}
|
||||
if (spispeed == 0) OneBigLineSprite.drawString(textUI(83), 135, 0);
|
||||
else OneBigLineSprite.drawString(String(spispeed), 160, 0);
|
||||
OneBigLineSprite.pushSprite(24, 118);
|
||||
break;
|
||||
}
|
||||
|
||||
17
src/main.cpp
17
src/main.cpp
@@ -1042,7 +1042,6 @@ void NumpadProcess(int num) {
|
||||
menuoption = ITEM1;
|
||||
menupage = DXMODE;
|
||||
menuitem = 0;
|
||||
if (spispeed == 7) tft.setSPISpeed(40);
|
||||
submenu = true;
|
||||
menu = true;
|
||||
if (language == LANGUAGE_CHS) PSSprite.setTextFont(1); else PSSprite.setTextFont(0);
|
||||
@@ -1111,7 +1110,7 @@ void setAutoSpeedSPI() {
|
||||
case 1069 ... 1074: tft.setSPISpeed(14); break;
|
||||
case 1075: tft.setSPISpeed(17); break;
|
||||
case 1076 ... 1080: tft.setSPISpeed(15); break;
|
||||
default: tft.setSPISpeed(30); break;
|
||||
default: tft.setSPISpeed(35); break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1326,9 +1325,8 @@ void setup() {
|
||||
|
||||
loadData();
|
||||
|
||||
if (spispeed == SPI_SPEED_DEFAULT) tft.setSPISpeed(SPI_FREQUENCY / 1000000);
|
||||
else if (spispeed == 7) setAutoSpeedSPI();
|
||||
else tft.setSPISpeed(spispeed * 10);
|
||||
if (spispeed == 0) setAutoSpeedSPI();
|
||||
else tft.setSPISpeed(spispeed);
|
||||
|
||||
if(esp_reset_reason() != ESP_RST_DEEPSLEEP) setup_periph();
|
||||
|
||||
@@ -1509,7 +1507,7 @@ void setup() {
|
||||
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
|
||||
tft.pushImage((tft.width() - 163) / 2, (tft.height() - 84) / 2, 163, 84, radiologo, TFT_BLACK);
|
||||
tft.pushImage((tft.width() - 163) / 2, (tft.height() - 84) / 2, 163, 84, (uint16_t*)radiologo, TFT_BLACK);
|
||||
tft.drawBitmap((tft.width() - 59) / 2, 24, TEFLogo, 59, 23, ActiveColor);
|
||||
|
||||
for (int x = 0; x <= ContrastSet; x++) {
|
||||
@@ -2455,9 +2453,7 @@ void ModeButtonPress() {
|
||||
freq_in = 0;
|
||||
} else {
|
||||
if (!BWtune && !menu) {
|
||||
if (!screenmute) {
|
||||
tft.drawBitmap(249, 4, Speaker, 28, 24, GreyoutColor);
|
||||
}
|
||||
if (!screenmute) tft.drawBitmap(249, 4, Speaker, 28, 24, GreyoutColor);
|
||||
memorystore = false;
|
||||
unsigned long counterold = millis();
|
||||
unsigned long counter = millis();
|
||||
@@ -2470,7 +2466,6 @@ void ModeButtonPress() {
|
||||
menuoption = ITEM1;
|
||||
menupage = INDEX;
|
||||
menuitem = 0;
|
||||
if (spispeed == 7) tft.setSPISpeed(40);
|
||||
if (language == LANGUAGE_CHS) PSSprite.setTextFont(1); else PSSprite.setTextFont(0);
|
||||
BuildMenu();
|
||||
freq_in = 0;
|
||||
@@ -2831,7 +2826,6 @@ void ShowMemoryPos() {
|
||||
}
|
||||
|
||||
void DoMemoryPosTune() {
|
||||
if (spispeed == 7) tft.setSPISpeed(50);
|
||||
radio.clearRDS();
|
||||
|
||||
if (IsStationEmpty()) {
|
||||
@@ -2984,7 +2978,6 @@ void ShowFreq(int mode) {
|
||||
}
|
||||
}
|
||||
|
||||
if (spispeed == 7) setAutoSpeedSPI();
|
||||
rdsreset = true;
|
||||
afmethodBold = false;
|
||||
aid_counterold = 0;
|
||||
|
||||
@@ -344,7 +344,7 @@ void DefaultSettings() {
|
||||
EEPROM.writeByte(EE_BYTE_CLOCKAMPM, 0);
|
||||
EEPROM.writeUInt(EE_UINT16_PICTLOCK, 0);
|
||||
|
||||
EEPROM.writeByte(EE_BYTE_SPISPEED, 7);
|
||||
EEPROM.writeByte(EE_BYTE_SPISPEED, 0);
|
||||
|
||||
#ifdef DEEPELEC_DP_66X
|
||||
EEPROM.writeByte(EE_BYTE_ROTARYMODE, 1);
|
||||
|
||||
Reference in New Issue
Block a user