Added touch calibration routine (hold BW+MODE during boot)
This commit is contained in:
+30
-5
@@ -342,6 +342,7 @@ uint16_t MStatus;
|
||||
uint16_t rabbitearspi[100]; // first is for 88.1, 2nd 88.3, etc. to 107.9 MHz
|
||||
uint16_t SWMIBandPos;
|
||||
uint16_t SWMIBandPosold;
|
||||
uint16_t TouchCalData[5];
|
||||
uint16_t USN;
|
||||
uint16_t WAM;
|
||||
uint8_t buff_pos;
|
||||
@@ -555,6 +556,11 @@ void setup() {
|
||||
mempionly = EEPROM.readByte(EE_BYTE_MEMPIONLY);
|
||||
memdoublepi = EEPROM.readByte(EE_BYTE_MEMDOUBLEPI);
|
||||
scanholdonsignal = EEPROM.readByte(EE_BYTE_WAITONLYONSIGNAL);
|
||||
TouchCalData[0] = EEPROM.readUInt(EE_UINT16_CALTOUCH1);
|
||||
TouchCalData[1] = EEPROM.readUInt(EE_UINT16_CALTOUCH2);
|
||||
TouchCalData[2] = EEPROM.readUInt(EE_UINT16_CALTOUCH3);
|
||||
TouchCalData[3] = EEPROM.readUInt(EE_UINT16_CALTOUCH4);
|
||||
TouchCalData[4] = EEPROM.readUInt(EE_UINT16_CALTOUCH5);
|
||||
|
||||
if (spispeed == SPI_SPEED_DEFAULT) {
|
||||
tft.setSPISpeed(SPI_FREQUENCY / 1000000);
|
||||
@@ -682,7 +688,7 @@ void setup() {
|
||||
|
||||
UpdateFonts(0);
|
||||
|
||||
if (digitalRead(BWBUTTON) == LOW && digitalRead(ROTARY_BUTTON) == HIGH) {
|
||||
if (digitalRead(BWBUTTON) == LOW && digitalRead(ROTARY_BUTTON) == HIGH && digitalRead(MODEBUTTON) == HIGH && digitalRead(BANDBUTTON) == HIGH) {
|
||||
if (rotarymode == 0) rotarymode = 1; else rotarymode = 0;
|
||||
EEPROM.writeByte(EE_BYTE_ROTARYMODE, rotarymode);
|
||||
EEPROM.commit();
|
||||
@@ -692,7 +698,7 @@ void setup() {
|
||||
while (digitalRead(BWBUTTON) == LOW) delay(50);
|
||||
}
|
||||
|
||||
if (digitalRead(MODEBUTTON) == LOW) {
|
||||
if (digitalRead(BWBUTTON) == HIGH && digitalRead(ROTARY_BUTTON) == HIGH && digitalRead(MODEBUTTON) == LOW && digitalRead(BANDBUTTON) == HIGH) {
|
||||
if (displayflip == 0) {
|
||||
displayflip = 1;
|
||||
tft.setRotation(1);
|
||||
@@ -708,7 +714,7 @@ void setup() {
|
||||
while (digitalRead(MODEBUTTON) == LOW) delay(50);
|
||||
}
|
||||
|
||||
if (digitalRead(BANDBUTTON) == LOW) {
|
||||
if (digitalRead(BWBUTTON) == HIGH && digitalRead(ROTARY_BUTTON) == HIGH && digitalRead(MODEBUTTON) == HIGH && digitalRead(BANDBUTTON) == LOW) {
|
||||
analogWrite(SMETERPIN, 511);
|
||||
analogWrite(CONTRASTPIN, map(ContrastSet, 0, 100, 15, 255));
|
||||
tftPrint(0, myLanguage[language][4], 155, 70, ActiveColor, ActiveColorSmooth, 28);
|
||||
@@ -717,7 +723,7 @@ void setup() {
|
||||
analogWrite(SMETERPIN, 0);
|
||||
}
|
||||
|
||||
if (digitalRead(ROTARY_BUTTON) == LOW && digitalRead(BWBUTTON) == HIGH) {
|
||||
if (digitalRead(BWBUTTON) == HIGH && digitalRead(ROTARY_BUTTON) == LOW && digitalRead(MODEBUTTON) == HIGH && digitalRead(BANDBUTTON) == HIGH) {
|
||||
analogWrite(CONTRASTPIN, map(ContrastSet, 0, 100, 15, 255));
|
||||
if (optenc == 0) {
|
||||
optenc = 1;
|
||||
@@ -732,7 +738,7 @@ void setup() {
|
||||
while (digitalRead(ROTARY_BUTTON) == LOW) delay(50);
|
||||
}
|
||||
|
||||
if (digitalRead(ROTARY_BUTTON) == LOW && digitalRead(BWBUTTON) == LOW) {
|
||||
if (digitalRead(BWBUTTON) == LOW && digitalRead(ROTARY_BUTTON) == LOW && digitalRead(MODEBUTTON) == HIGH && digitalRead(BANDBUTTON) == HIGH) {
|
||||
analogWrite(CONTRASTPIN, map(ContrastSet, 0, 100, 15, 255));
|
||||
DefaultSettings(hardwaremodel);
|
||||
tftPrint(0, myLanguage[language][66], 155, 70, ActiveColor, ActiveColorSmooth, 28);
|
||||
@@ -741,6 +747,20 @@ void setup() {
|
||||
ESP.restart();
|
||||
}
|
||||
|
||||
if (digitalRead(BWBUTTON) == LOW && digitalRead(ROTARY_BUTTON) == HIGH && digitalRead(MODEBUTTON) == LOW && digitalRead(BANDBUTTON) == HIGH) {
|
||||
analogWrite(CONTRASTPIN, map(ContrastSet, 0, 100, 15, 255));
|
||||
tftPrint(0, myLanguage[language][282], 155, 70, ActiveColor, ActiveColorSmooth, 28);
|
||||
tftPrint(0, myLanguage[language][283], 155, 130, ActiveColor, ActiveColorSmooth, 28);
|
||||
tft.calibrateTouch(TouchCalData, PrimaryColor, BackgroundColor, 30);
|
||||
EEPROM.writeUInt(EE_UINT16_CALTOUCH1, TouchCalData[0]);
|
||||
EEPROM.writeUInt(EE_UINT16_CALTOUCH2, TouchCalData[1]);
|
||||
EEPROM.writeUInt(EE_UINT16_CALTOUCH3, TouchCalData[2]);
|
||||
EEPROM.writeUInt(EE_UINT16_CALTOUCH4, TouchCalData[3]);
|
||||
EEPROM.writeUInt(EE_UINT16_CALTOUCH5, TouchCalData[4]);
|
||||
EEPROM.commit();
|
||||
}
|
||||
|
||||
tft.setTouch(TouchCalData);
|
||||
tft.fillScreen(BackgroundColor);
|
||||
tftPrint(0, myLanguage[language][8], 160, 3, PrimaryColor, PrimaryColorSmooth, 28);
|
||||
tftPrint(0, "Software " + String(VERSION), 160, 152, PrimaryColor, PrimaryColorSmooth, 16);
|
||||
@@ -4424,6 +4444,11 @@ void DefaultSettings(byte userhardwaremodel) {
|
||||
EEPROM.writeByte(EE_BYTE_MEMPIONLY, 1);
|
||||
EEPROM.writeByte(EE_BYTE_MEMDOUBLEPI, 0);
|
||||
EEPROM.writeByte(EE_BYTE_WAITONLYONSIGNAL, 1);
|
||||
EEPROM.writeUInt(EE_UINT16_CALTOUCH1, 300);
|
||||
EEPROM.writeUInt(EE_UINT16_CALTOUCH2, 3450);
|
||||
EEPROM.writeUInt(EE_UINT16_CALTOUCH3, 300);
|
||||
EEPROM.writeUInt(EE_UINT16_CALTOUCH4, 3450);
|
||||
EEPROM.writeUInt(EE_UINT16_CALTOUCH5, 3);
|
||||
|
||||
for (int i = 0; i < EE_PRESETS_CNT; i++) {
|
||||
EEPROM.writeByte(i + EE_PRESETS_BAND_START, BAND_FM);
|
||||
|
||||
+9
-4
@@ -213,9 +213,9 @@
|
||||
#define EE_CHECKBYTE_VALUE 10 // 0 ~ 255,add new entry, change for new value
|
||||
#define EE_PRESETS_FREQUENCY 0 // Default value when memory channel should be skipped!
|
||||
#ifdef HAS_AIR_BAND
|
||||
#define EE_TOTAL_CNT 2259 // Total occupied eeprom bytes
|
||||
#define EE_TOTAL_CNT 2279 // Total occupied eeprom bytes
|
||||
#else
|
||||
#define EE_TOTAL_CNT 2254 // Total occupied eeprom bytes
|
||||
#define EE_TOTAL_CNT 2274 // Total occupied eeprom bytes
|
||||
#endif
|
||||
|
||||
#define EE_PRESETS_BAND_START 0 // 99 * 1 byte
|
||||
@@ -327,9 +327,14 @@
|
||||
#define EE_STRING_RABBITEARSUSER 2230
|
||||
#define EE_STRING_RABBITEARSPASSWORD 2241
|
||||
#define EE_BYTE_WAITONLYONSIGNAL 2253
|
||||
#define EE_UINT16_CALTOUCH1 2254
|
||||
#define EE_UINT16_CALTOUCH2 2258
|
||||
#define EE_UINT16_CALTOUCH3 2262
|
||||
#define EE_UINT16_CALTOUCH4 2266
|
||||
#define EE_UINT16_CALTOUCH5 2270
|
||||
#ifdef HAS_AIR_BAND
|
||||
#define EE_BYTE_AIRSTEPSIZE 2254
|
||||
#define EE_UINT16_FREQUENCY_AIR 2255
|
||||
#define EE_BYTE_AIRSTEPSIZE 2274
|
||||
#define EE_UINT16_FREQUENCY_AIR 2275
|
||||
#endif
|
||||
// End of EEPROM index defines
|
||||
|
||||
|
||||
+56
-20
@@ -5,7 +5,7 @@
|
||||
|
||||
// [number of languages][number of texts]
|
||||
|
||||
static const char* const myLanguage[18][282] PROGMEM = {
|
||||
static const char* const myLanguage[18][284] PROGMEM = {
|
||||
{ "English", // English
|
||||
"Rotary direction changed", // 1
|
||||
"Please release button", // 2
|
||||
@@ -287,7 +287,9 @@ static const char* const myLanguage[18][282] PROGMEM = {
|
||||
"Prevent double PI", // 278
|
||||
"Range", // 279
|
||||
"Full", // 280
|
||||
"Wait time on\nsignal only" // 281
|
||||
"Wait time on\nsignal only", // 281
|
||||
"Press highlighted corner", // 282
|
||||
"To calibrate touchscreen" // 283
|
||||
},
|
||||
|
||||
{ "Nederlands", // Dutch
|
||||
@@ -571,7 +573,9 @@ static const char* const myLanguage[18][282] PROGMEM = {
|
||||
"Voorkom dubbele PI", // 278
|
||||
"Bereik", // 279
|
||||
"Volledig", // 280
|
||||
"Wachttijd alleen\nbij signaal" // 281
|
||||
"Wachttijd alleen\nbij signaal", // 281
|
||||
"Druk op aangegeven hoeken", // 282
|
||||
"om scherm te calibreren" // 283
|
||||
},
|
||||
|
||||
{ "Polski", // Polish
|
||||
@@ -855,7 +859,9 @@ static const char* const myLanguage[18][282] PROGMEM = {
|
||||
"Unikaj podwójnego PI", // 278
|
||||
"Zakres", // 279
|
||||
"Pełne", // 280
|
||||
"Wait time on\nsignal only" // 281
|
||||
"Wait time on\nsignal only", // 281
|
||||
"Press highlighted corner", // 282
|
||||
"To calibrate touchscreen" // 283
|
||||
},
|
||||
|
||||
{ "Hrvatski", // Croatian
|
||||
@@ -1139,7 +1145,9 @@ static const char* const myLanguage[18][282] PROGMEM = {
|
||||
"Prevent double PI", // 278
|
||||
"Range", // 279
|
||||
"Full", // 280
|
||||
"Wait time on\nsignal only" // 281
|
||||
"Wait time on\nsignal only", // 281
|
||||
"Press highlighted corner", // 282
|
||||
"To calibrate touchscreen" // 283
|
||||
},
|
||||
|
||||
{ "Ελληνικά", // Greek
|
||||
@@ -1423,7 +1431,9 @@ static const char* const myLanguage[18][282] PROGMEM = {
|
||||
"Αποφυγή διπλού PI", // 278
|
||||
"Εύρος", // 279
|
||||
"Πλήρης", // 280
|
||||
"Αναμονή μόνο σε\nυπάρξη σήματος" // 281
|
||||
"Αναμονή μόνο σε\nυπάρξη σήματος", // 281
|
||||
"Press highlighted corner", // 282
|
||||
"To calibrate touchscreen" // 283
|
||||
},
|
||||
|
||||
{ "Română", // Romanian
|
||||
@@ -1707,7 +1717,9 @@ static const char* const myLanguage[18][282] PROGMEM = {
|
||||
"Prevent double PI", // 278
|
||||
"Range", // 279
|
||||
"Full", // 280
|
||||
"Wait time on\nsignal only" // 281
|
||||
"Wait time on\nsignal only", // 281
|
||||
"Press highlighted corner", // 282
|
||||
"To calibrate touchscreen" // 283
|
||||
},
|
||||
|
||||
{ "Deutsch", // German
|
||||
@@ -1991,7 +2003,9 @@ static const char* const myLanguage[18][282] PROGMEM = {
|
||||
"Doppelte PI verhindern", // 278
|
||||
"Bereich", // 279
|
||||
"Voll", // 280
|
||||
"Wartezeit nur wenn\nSignal vorhanden" // 281
|
||||
"Wartezeit nur wenn\nSignal vorhanden", // 281
|
||||
"Press highlighted corner", // 282
|
||||
"To calibrate touchscreen" // 283
|
||||
},
|
||||
|
||||
{ "Český", // Czech
|
||||
@@ -2275,7 +2289,9 @@ static const char* const myLanguage[18][282] PROGMEM = {
|
||||
"Prevent double PI", // 278
|
||||
"Range", // 279
|
||||
"Full", // 280
|
||||
"Wait time on\nsignal only" // 281
|
||||
"Wait time on\nsignal only", // 281
|
||||
"Press highlighted corner", // 282
|
||||
"To calibrate touchscreen" // 283
|
||||
},
|
||||
|
||||
{ "Magyar", // Hungarian
|
||||
@@ -2559,7 +2575,9 @@ static const char* const myLanguage[18][282] PROGMEM = {
|
||||
"Prevent double PI", // 278
|
||||
"Range", // 279
|
||||
"Full", // 280
|
||||
"Wait time on\nsignal only" // 281
|
||||
"Wait time on\nsignal only", // 281
|
||||
"Press highlighted corner", // 282
|
||||
"To calibrate touchscreen" // 283
|
||||
},
|
||||
|
||||
{ "Français", // French
|
||||
@@ -2843,7 +2861,9 @@ static const char* const myLanguage[18][282] PROGMEM = {
|
||||
"Prévenir double PI", // 278
|
||||
"Plage", // 279
|
||||
"Complet", // 280
|
||||
"Attendre que lorsque\nle signal existe" // 281
|
||||
"Attendre que lorsque\nle signal existe", // 281
|
||||
"Press highlighted corner", // 282
|
||||
"To calibrate touchscreen" // 283
|
||||
|
||||
},
|
||||
|
||||
@@ -3128,7 +3148,9 @@ static const char* const myLanguage[18][282] PROGMEM = {
|
||||
"Prevent double PI", // 278
|
||||
"Range", // 279
|
||||
"Full", // 280
|
||||
"Wait time on\nsignal only" // 281
|
||||
"Wait time on\nsignal only", // 281
|
||||
"Press highlighted corner", // 282
|
||||
"To calibrate touchscreen" // 283
|
||||
},
|
||||
|
||||
{ "Русский", // Russian
|
||||
@@ -3412,7 +3434,9 @@ static const char* const myLanguage[18][282] PROGMEM = {
|
||||
"Prevent double PI", // 278
|
||||
"Range", // 279
|
||||
"Full", // 280
|
||||
"Wait time on\nsignal only" // 281
|
||||
"Wait time on\nsignal only", // 281
|
||||
"Press highlighted corner", // 282
|
||||
"To calibrate touchscreen" // 283
|
||||
},
|
||||
|
||||
{ "Українська", // Ukranian
|
||||
@@ -3696,7 +3720,9 @@ static const char* const myLanguage[18][282] PROGMEM = {
|
||||
"Prevent double PI", // 278
|
||||
"Range", // 279
|
||||
"Full", // 280
|
||||
"Wait time on\nsignal only" // 281
|
||||
"Wait time on\nsignal only", // 281
|
||||
"Press highlighted corner", // 282
|
||||
"To calibrate touchscreen" // 283
|
||||
},
|
||||
|
||||
{ "Italiano", // Italian
|
||||
@@ -3980,7 +4006,9 @@ static const char* const myLanguage[18][282] PROGMEM = {
|
||||
"Evita PI duplicati", // 278
|
||||
"Intervallo", // 279
|
||||
"Piene", // 280
|
||||
"Wait time on\nsignal only" // 281
|
||||
"Wait time on\nsignal only", // 281
|
||||
"Press highlighted corner", // 282
|
||||
"To calibrate touchscreen" // 283
|
||||
},
|
||||
|
||||
{ "Simplified Chinese", // Simplified Chinese
|
||||
@@ -4264,7 +4292,9 @@ static const char* const myLanguage[18][282] PROGMEM = {
|
||||
"Prevent double PI", // 278
|
||||
"Range", // 279
|
||||
"Full", // 280
|
||||
"Wait time on\nsignal only" // 281
|
||||
"Wait time on\nsignal only", // 281
|
||||
"Press highlighted corner", // 282
|
||||
"To calibrate touchscreen" // 283
|
||||
},
|
||||
|
||||
{ "Norsk", // Norwegian
|
||||
@@ -4548,7 +4578,9 @@ static const char* const myLanguage[18][282] PROGMEM = {
|
||||
"Prevent double PI", // 278
|
||||
"Range", // 279
|
||||
"Full", // 280
|
||||
"Wait time on\nsignal only" // 281
|
||||
"Wait time on\nsignal only", // 281
|
||||
"Press highlighted corner", // 282
|
||||
"To calibrate touchscreen" // 283
|
||||
},
|
||||
|
||||
{ "Español", // Spanish
|
||||
@@ -4832,7 +4864,9 @@ static const char* const myLanguage[18][282] PROGMEM = {
|
||||
"Prevenir doble PI", // 278
|
||||
"Rango", // 279
|
||||
"Completo", // 280
|
||||
"Tiempo de espera\ncuando la señal" // 281
|
||||
"Tiempo de espera\ncuando la señal", // 281
|
||||
"Press highlighted corner", // 282
|
||||
"To calibrate touchscreen" // 283
|
||||
|
||||
},
|
||||
|
||||
@@ -5117,7 +5151,9 @@ static const char* const myLanguage[18][282] PROGMEM = {
|
||||
"Prevenir PI duplo", // 278
|
||||
"Intervalo", // 279
|
||||
"Completo", // 280
|
||||
"Espera tempo apenas\nquando sinal" // 281
|
||||
"Espera tempo apenas\nquando sinal", // 281
|
||||
"Press highlighted corner", // 282
|
||||
"To calibrate touchscreen" // 283
|
||||
}
|
||||
};
|
||||
#endif
|
||||
#endif
|
||||
Reference in New Issue
Block a user