Added mono/stereo toggle to touch

This commit is contained in:
Sjef Verhoeven PE5PVB
2024-10-25 13:05:15 +02:00
parent 6d7cdeb9ae
commit c26e71c61e
4 changed files with 41 additions and 27 deletions
+4 -7
View File
@@ -627,21 +627,19 @@ void setup() {
if (displayflip == 0) { if (displayflip == 0) {
#ifdef ARS #ifdef ARS
tft.setRotation(0); tft.setRotation(0);
#elif defined(DEEPELEC_DP_66X)
tft.setRotation(1);
#else #else
tft.setRotation(3); tft.setRotation(3);
#endif #endif
} else { } else {
#ifdef ARS #ifdef ARS
tft.setRotation(2); tft.setRotation(2);
#elif defined(DEEPELEC_DP_66X)
tft.setRotation(3);
#else #else
tft.setRotation(1); tft.setRotation(1);
#endif #endif
} }
tft.invertDisplay(!invertdisplay);
pinMode(BANDBUTTON, INPUT); pinMode(BANDBUTTON, INPUT);
pinMode(MODEBUTTON, INPUT); pinMode(MODEBUTTON, INPUT);
pinMode(BWBUTTON, INPUT); pinMode(BWBUTTON, INPUT);
@@ -778,7 +776,6 @@ void setup() {
EEPROM.commit(); EEPROM.commit();
} }
tft.invertDisplay(!invertdisplay);
tft.setTouch(TouchCalData); tft.setTouch(TouchCalData);
tft.fillScreen(BackgroundColor); tft.fillScreen(BackgroundColor);
tftPrint(0, myLanguage[language][8], 160, 3, PrimaryColor, PrimaryColorSmooth, 28); tftPrint(0, myLanguage[language][8], 160, 3, PrimaryColor, PrimaryColorSmooth, 28);
@@ -4452,12 +4449,12 @@ void DefaultSettings() {
#ifdef DEEPELEC_DP_66X #ifdef DEEPELEC_DP_66X
EEPROM.writeByte(EE_BYTE_ROTARYMODE, 1); EEPROM.writeByte(EE_BYTE_ROTARYMODE, 1);
EEPROM.writeByte(EE_BYTE_INVERTDISPLAY, 0); EEPROM.writeByte(EE_BYTE_INVERTDISPLAY, 0);
EEPROM.writeByte(EE_BYTE_DISPLAYFLIP, 0); EEPROM.writeByte(EE_BYTE_DISPLAYFLIP, 1);
EEPROM.writeByte(EE_BYTE_HARDWARE_MODEL, PORTABLE_TOUCH_ILI9341); EEPROM.writeByte(EE_BYTE_HARDWARE_MODEL, PORTABLE_TOUCH_ILI9341);
#else #else
EEPROM.writeByte(EE_BYTE_ROTARYMODE, 0); EEPROM.writeByte(EE_BYTE_ROTARYMODE, 0);
EEPROM.writeByte(EE_BYTE_INVERTDISPLAY, 1); EEPROM.writeByte(EE_BYTE_INVERTDISPLAY, 1);
EEPROM.writeByte(EE_BYTE_DISPLAYFLIP, 1); EEPROM.writeByte(EE_BYTE_DISPLAYFLIP, 0);
EEPROM.writeByte(EE_BYTE_HARDWARE_MODEL, BASE_ILI9341); EEPROM.writeByte(EE_BYTE_HARDWARE_MODEL, BASE_ILI9341);
#endif #endif
+1 -1
View File
@@ -5,6 +5,6 @@
// #define HAS_AIR_BAND // uncomment to enable Air Band(Make sure you have Air Band extend board) // #define HAS_AIR_BAND // uncomment to enable Air Band(Make sure you have Air Band extend board)
// #define CHINA_PORTABLE // uncomment for China Portable build (Simplified Chinese) // #define CHINA_PORTABLE // uncomment for China Portable build (Simplified Chinese)
#define DEEPELEC_DP_66X // uncomment for DEEPELEC Portable DP-66X build (Simplified Chinese) // #define DEEPELEC_DP_66X // uncomment for DEEPELEC Portable DP-66X build (Simplified Chinese)
#endif #endif
+31 -19
View File
@@ -4,27 +4,39 @@
#include "config.h" #include "config.h"
void doTouchEvent(uint16_t x, uint16_t y) { void doTouchEvent(uint16_t x, uint16_t y) {
if (!menu && !advancedRDS && !seek && !afscreen) { // Normal radio mode if (seek) radio.setUnMute();
if (x > 0 && x < 320 && y > 180 && y < 240 && band < BAND_GAP) { // ----------------- seek = false;
leave = true; if (scandxmode) {
BuildAdvancedRDS(); // Switch to Advanced RDS View cancelDXScan();
return; } else {
} else if (x > 60 && x < 240 && y > 40 && y < 100) { if (!menu) { // All pages except menu
doBandToggle(); // Toggle bands if (x > 40 && x < 80 && y > 0 && y < 25 && band < BAND_GAP) { // ---------------------
return; doStereoToggle();
} else if (x > 0 && x < 30 && y > 25 && y < 90) { } // Stereo toggle
doTuneMode(); // Toggle tune mode
return;
} }
}
if (!menu && advancedRDS && !seek && !afscreen) { // Advanced RDS mode if (!menu && !advancedRDS && !seek && !afscreen) { // Normal radio mode
if (x > 0 && x < 320 && y > 180 && y < 240) { // ----------------- if (x > 0 && x < 320 && y > 180 && y < 240 && band < BAND_GAP) { // -----------------
leave = true; leave = true;
BuildDisplay(); BuildAdvancedRDS(); // Switch to Advanced RDS View
SelectBand(); return;
ScreensaverTimerReopen(); // Switch to normal radio view } else if (x > 60 && x < 240 && y > 40 && y < 100) {
return; doBandToggle(); // Toggle bands
return;
} else if (x > 0 && x < 30 && y > 25 && y < 90) {
doTuneMode(); // Toggle tune mode
return;
}
}
if (!menu && advancedRDS && !seek && !afscreen) { // Advanced RDS mode
if (x > 0 && x < 320 && y > 180 && y < 240) { // -----------------
leave = true;
BuildDisplay();
SelectBand();
ScreensaverTimerReopen(); // Switch to normal radio view
return;
}
} }
} }
} }
+5
View File
@@ -3,13 +3,16 @@
#include <Arduino.h> #include <Arduino.h>
#include <TFT_eSPI.h> #include <TFT_eSPI.h>
#include "TEF6686.h"
extern TFT_eSPI tft; extern TFT_eSPI tft;
extern TEF6686 radio;
extern bool advancedRDS; extern bool advancedRDS;
extern bool afscreen; extern bool afscreen;
extern bool leave; extern bool leave;
extern bool menu; extern bool menu;
extern bool scandxmode;
extern bool seek; extern bool seek;
extern byte band; extern byte band;
@@ -21,4 +24,6 @@ extern void SelectBand();
extern void BuildAdvancedRDS(); extern void BuildAdvancedRDS();
extern void doBandToggle(); extern void doBandToggle();
extern void doTuneMode(); extern void doTuneMode();
extern void doStereoToggle();
extern void cancelDXScan();
#endif #endif