Merge branch 'main' into New_Model_DP_666

This commit is contained in:
Leon
2024-06-01 10:04:55 +08:00
5 changed files with 69 additions and 33 deletions
+23 -18
View File
@@ -670,7 +670,7 @@ void setup() {
if (rotarymode == 0) rotarymode = 1; else rotarymode = 0; if (rotarymode == 0) rotarymode = 1; else rotarymode = 0;
EEPROM.writeByte(EE_BYTE_ROTARYMODE, rotarymode); EEPROM.writeByte(EE_BYTE_ROTARYMODE, rotarymode);
EEPROM.commit(); EEPROM.commit();
analogWrite(CONTRASTPIN, ContrastSet * 2 + 27); analogWrite(CONTRASTPIN, map(ContrastSet, 0, 100, 15, 255));
tftPrint(0, myLanguage[language][1], 155, 70, ActiveColor, ActiveColorSmooth, 28); tftPrint(0, myLanguage[language][1], 155, 70, ActiveColor, ActiveColorSmooth, 28);
tftPrint(0, myLanguage[language][2], 155, 130, ActiveColor, ActiveColorSmooth, 28); tftPrint(0, myLanguage[language][2], 155, 130, ActiveColor, ActiveColorSmooth, 28);
while (digitalRead(BWBUTTON) == LOW) delay(50); while (digitalRead(BWBUTTON) == LOW) delay(50);
@@ -686,7 +686,7 @@ void setup() {
} }
EEPROM.writeByte(EE_BYTE_DISPLAYFLIP, displayflip); EEPROM.writeByte(EE_BYTE_DISPLAYFLIP, displayflip);
EEPROM.commit(); EEPROM.commit();
analogWrite(CONTRASTPIN, ContrastSet * 2 + 27); analogWrite(CONTRASTPIN, map(ContrastSet, 0, 100, 15, 255));
tftPrint(0, myLanguage[language][3], 155, 70, ActiveColor, ActiveColorSmooth, 28); tftPrint(0, myLanguage[language][3], 155, 70, ActiveColor, ActiveColorSmooth, 28);
tftPrint(0, myLanguage[language][2], 155, 130, ActiveColor, ActiveColorSmooth, 28); tftPrint(0, myLanguage[language][2], 155, 130, ActiveColor, ActiveColorSmooth, 28);
while (digitalRead(MODEBUTTON) == LOW) delay(50); while (digitalRead(MODEBUTTON) == LOW) delay(50);
@@ -694,7 +694,7 @@ void setup() {
if (digitalRead(BANDBUTTON) == LOW) { if (digitalRead(BANDBUTTON) == LOW) {
analogWrite(SMETERPIN, 511); analogWrite(SMETERPIN, 511);
analogWrite(CONTRASTPIN, ContrastSet * 2 + 27); analogWrite(CONTRASTPIN, map(ContrastSet, 0, 100, 15, 255));
tftPrint(0, myLanguage[language][4], 155, 70, ActiveColor, ActiveColorSmooth, 28); tftPrint(0, myLanguage[language][4], 155, 70, ActiveColor, ActiveColorSmooth, 28);
tftPrint(0, myLanguage[language][5], 155, 130, ActiveColor, ActiveColorSmooth, 28); tftPrint(0, myLanguage[language][5], 155, 130, ActiveColor, ActiveColorSmooth, 28);
while (digitalRead(BANDBUTTON) == LOW) delay(50); while (digitalRead(BANDBUTTON) == LOW) delay(50);
@@ -702,7 +702,7 @@ void setup() {
} }
if (digitalRead(ROTARY_BUTTON) == LOW && digitalRead(BWBUTTON) == HIGH) { if (digitalRead(ROTARY_BUTTON) == LOW && digitalRead(BWBUTTON) == HIGH) {
analogWrite(CONTRASTPIN, ContrastSet * 2 + 27); analogWrite(CONTRASTPIN, map(ContrastSet, 0, 100, 15, 255));
if (optenc == 0) { if (optenc == 0) {
optenc = 1; optenc = 1;
tftPrint(0, myLanguage[language][6], 155, 70, ActiveColor, ActiveColorSmooth, 28); tftPrint(0, myLanguage[language][6], 155, 70, ActiveColor, ActiveColorSmooth, 28);
@@ -717,7 +717,7 @@ void setup() {
} }
if (digitalRead(ROTARY_BUTTON) == LOW && digitalRead(BWBUTTON) == LOW) { if (digitalRead(ROTARY_BUTTON) == LOW && digitalRead(BWBUTTON) == LOW) {
analogWrite(CONTRASTPIN, ContrastSet * 2 + 27); analogWrite(CONTRASTPIN, map(ContrastSet, 0, 100, 15, 255));
DefaultSettings(hardwaremodel); DefaultSettings(hardwaremodel);
tftPrint(0, myLanguage[language][66], 155, 70, ActiveColor, ActiveColorSmooth, 28); tftPrint(0, myLanguage[language][66], 155, 70, ActiveColor, ActiveColorSmooth, 28);
tftPrint(0, myLanguage[language][2], 155, 130, ActiveColor, ActiveColorSmooth, 28); tftPrint(0, myLanguage[language][2], 155, 130, ActiveColor, ActiveColorSmooth, 28);
@@ -744,7 +744,7 @@ void setup() {
tft.drawBitmap(130, 124, TEFLogo, 59, 23, ActiveColor); tft.drawBitmap(130, 124, TEFLogo, 59, 23, ActiveColor);
for (int x = 0; x <= ContrastSet; x++) { for (int x = 0; x <= ContrastSet; x++) {
analogWrite(CONTRASTPIN, x * 2 + 27); analogWrite(CONTRASTPIN, map(x, 0, 100, 15, 255));
delay(30); delay(30);
} }
@@ -1212,19 +1212,18 @@ void WakeToSleep(bool yes) {
StoreFrequency(); StoreFrequency();
break; break;
case LCD_BRIGHTNESS_1_PERCENT: case LCD_BRIGHTNESS_1_PERCENT:
analogWrite(CONTRASTPIN, 1 * 2 + 27); analogWrite(CONTRASTPIN, map(ContrastSet / 100, 0, 100, 15, 255));
break; break;
case LCD_BRIGHTNESS_A_QUARTER: case LCD_BRIGHTNESS_A_QUARTER:
analogWrite(CONTRASTPIN, MIN(ContrastSet, 25) * 2 + 27); analogWrite(CONTRASTPIN, map(ContrastSet / 4, 0, 100, 15, 255));
break; break;
case LCD_BRIGHTNESS_HALF: case LCD_BRIGHTNESS_HALF:
analogWrite(CONTRASTPIN, MIN(ContrastSet, 50) * 2 + 27); analogWrite(CONTRASTPIN, map(ContrastSet / 2, 0, 100, 15, 255));
break; break;
} }
} else { } else {
switch (poweroptions) { switch (poweroptions) {
case LCD_OFF: case LCD_OFF:
analogWrite(CONTRASTPIN, ContrastSet * 2 + 27);
MuteScreen(0); MuteScreen(0);
screensavertriggered = false; screensavertriggered = false;
screensaver_IRQ = OFF; screensaver_IRQ = OFF;
@@ -1233,13 +1232,13 @@ void WakeToSleep(bool yes) {
case LCD_BRIGHTNESS_1_PERCENT: case LCD_BRIGHTNESS_1_PERCENT:
case LCD_BRIGHTNESS_A_QUARTER: case LCD_BRIGHTNESS_A_QUARTER:
case LCD_BRIGHTNESS_HALF: case LCD_BRIGHTNESS_HALF:
analogWrite(CONTRASTPIN, ContrastSet * 2 + 27);
MuteScreen(0); MuteScreen(0);
screensavertriggered = false; screensavertriggered = false;
screensaver_IRQ = OFF; screensaver_IRQ = OFF;
ScreensaverTimerReopen(); ScreensaverTimerReopen();
break; break;
} }
analogWrite(CONTRASTPIN, map(ContrastSet, 0, 100, 15, 255));
} }
} }
@@ -2316,7 +2315,7 @@ void ModeButtonPress() {
menuoption = ITEM1; menuoption = ITEM1;
menupage = INDEX; menupage = INDEX;
menuitem = 0; menuitem = 0;
if (spispeed == 7) tft.setSPISpeed(30); if (spispeed == 7) tft.setSPISpeed(40);
BuildMenu(); BuildMenu();
menu = true; menu = true;
ScreensaverTimerSet(OFF); ScreensaverTimerSet(OFF);
@@ -2362,7 +2361,6 @@ void ModeButtonPress() {
menuoption = ITEM1; menuoption = ITEM1;
menupage = INDEX; menupage = INDEX;
menuitem = 0; menuitem = 0;
if (spispeed == 7) tft.setSPISpeed(30);
BuildMenu(); BuildMenu();
} }
} }
@@ -2821,6 +2819,8 @@ void ShowMemoryPos() {
} }
void DoMemoryPosTune() { void DoMemoryPosTune() {
if (spispeed == 7) tft.setSPISpeed(50);
// Process empty stations // Process empty stations
if (IsStationEmpty()) { if (IsStationEmpty()) {
memoryposstatus = MEM_DARK; memoryposstatus = MEM_DARK;
@@ -2866,8 +2866,6 @@ void DoMemoryPosTune() {
#endif #endif
} }
ShowFreq(0);
if (band == BAND_FM || band == BAND_OIRT) { if (band == BAND_FM || band == BAND_OIRT) {
StereoToggle = presets[memorypos].ms; StereoToggle = presets[memorypos].ms;
if (!StereoToggle) { if (!StereoToggle) {
@@ -2921,6 +2919,7 @@ void DoMemoryPosTune() {
BWtune = true; BWtune = true;
memtune = true; memtune = true;
memreset = true; memreset = true;
ShowFreq(0);
} }
void ShowFreq(int mode) { void ShowFreq(int mode) {
@@ -3339,7 +3338,8 @@ void showAutoSquelch(bool mode) {
} }
void doSquelch() { void doSquelch() {
if (!XDRGTKUSB && !XDRGTKTCP && usesquelch && !autosquelch) Squelch = analogRead(PIN_POT) / 4 - 100; if (!XDRGTKUSB && !XDRGTKTCP && usesquelch && !autosquelch) Squelch = map(analogRead(PIN_POT), 0, 4095, -100, 920);
if (unit == 0) SquelchShow = Squelch / 10; if (unit == 0) SquelchShow = Squelch / 10;
if (unit == 1) SquelchShow = ((Squelch * 100) + 10875) / 1000; if (unit == 1) SquelchShow = ((Squelch * 100) + 10875) / 1000;
if (unit == 2) SquelchShow = round((float(Squelch) / 10.0 - 10.0 * log10(75) - 90.0) * 10.0) / 10; if (unit == 2) SquelchShow = round((float(Squelch) / 10.0 - 10.0 * log10(75) - 90.0) * 10.0) / 10;
@@ -4105,7 +4105,7 @@ void SetTunerPatch() {
radio.getIdentification(device, hw, sw); radio.getIdentification(device, hw, sw);
TEF = highByte(hw) * 100 + highByte(sw); TEF = highByte(hw) * 100 + highByte(sw);
tft.fillScreen(BackgroundColor); tft.fillScreen(BackgroundColor);
analogWrite(CONTRASTPIN, ContrastSet * 2 + 27); analogWrite(CONTRASTPIN, map(ContrastSet, 0, 100, 15, 255));
if (TEF != 102 && TEF != 205) { if (TEF != 102 && TEF != 205) {
tftPrint(0, myLanguage[language][35], 150, 78, ActiveColor, ActiveColorSmooth, 28); tftPrint(0, myLanguage[language][35], 150, 78, ActiveColor, ActiveColorSmooth, 28);
@@ -4153,7 +4153,7 @@ void MuteScreen(bool setting) {
screenmute = false; screenmute = false;
setupmode = true; setupmode = true;
tft.writecommand(0x11); tft.writecommand(0x11);
analogWrite(CONTRASTPIN, ContrastSet * 2 + 27); analogWrite(CONTRASTPIN, map(ContrastSet, 0, 100, 15, 255));
if (band < BAND_GAP) { if (band < BAND_GAP) {
if (afscreen) { if (afscreen) {
BuildAFScreen(); BuildAFScreen();
@@ -4421,6 +4421,7 @@ void cancelDXScan() {
ShowTuneMode(); ShowTuneMode();
ShowMemoryPos(); ShowMemoryPos();
if (XDRGTKUSB || XDRGTKTCP) DataPrint("J0\n");
} }
void endMenu() { void endMenu() {
@@ -4518,8 +4519,11 @@ void endMenu() {
} }
void startFMDXScan() { void startFMDXScan() {
if (afscreen || advancedRDS) BuildDisplay();
if (memorypos > scanstop || memorypos < scanstart) memorypos = scanstart; if (memorypos > scanstop || memorypos < scanstart) memorypos = scanstart;
scanmodeold = tunemode; scanmodeold = tunemode;
if (scanmem) { if (scanmem) {
tunemode = TUNE_MEM; tunemode = TUNE_MEM;
if (band != presets[memorypos].band) { if (band != presets[memorypos].band) {
@@ -4546,6 +4550,7 @@ void startFMDXScan() {
} }
scantimer = millis(); scantimer = millis();
scandxmode = true; scandxmode = true;
if (XDRGTKUSB || XDRGTKTCP) DataPrint("J1\n");
} }
void setAutoSpeedSPI() { void setAutoSpeedSPI() {
+33 -8
View File
@@ -374,6 +374,14 @@ void XDRGTKRoutine() {
} }
break; break;
case 'B':
byte stmo;
stmo = atol(buff + 1);
DataPrint("B" + String(stmo) + "\n");
if (stmo == 0) StereoToggle = false; else StereoToggle = true;
doStereoToggle();
break;
case 'C': case 'C':
if (afscreen || advancedRDS) { if (afscreen || advancedRDS) {
BuildDisplay(); BuildDisplay();
@@ -381,6 +389,12 @@ void XDRGTKRoutine() {
} }
byte scanmethod; byte scanmethod;
scanmethod = atol(buff + 1); scanmethod = atol(buff + 1);
if (band < BAND_GAP) {
stepsize = 0;
ShowStepSize();
}
if (scanmethod == 1) { if (scanmethod == 1) {
DataPrint("C1\n"); DataPrint("C1\n");
direction = false; direction = false;
@@ -396,14 +410,6 @@ void XDRGTKRoutine() {
DataPrint("C0\n"); DataPrint("C0\n");
break; break;
case 'B':
byte stmo;
stmo = atol(buff + 1);
DataPrint("B" + String(stmo) + "\n");
if (stmo == 0) StereoToggle = false; else StereoToggle = true;
doStereoToggle();
break;
case 'D': case 'D':
byte demp; byte demp;
demp = atol(buff + 1); demp = atol(buff + 1);
@@ -482,6 +488,25 @@ void XDRGTKRoutine() {
} }
break; break;
case 'I':
byte fmscansenstemp;
fmscansenstemp = atol(buff + 1);
if (fmscansenstemp > 0 && fmscansenstemp < 31) {
fmscansens = fmscansenstemp;
EEPROM.writeByte(EE_BYTE_FMSCANSENS, fmscansens);
EEPROM.commit();
}
DataPrint("I" + String(fmscansens) + "\n");
break;
case 'J':
byte scandxtemp;
scandxtemp = atol(buff + 1);
if (scandxtemp == 0 && scandxmode) cancelDXScan();
if (scandxtemp == 1 && !scandxmode) startFMDXScan();
DataPrint("J" + String(scandxtemp) + "\n");
break;
case 'M': case 'M':
byte XDRband; byte XDRband;
XDRband = atol(buff + 1); XDRband = atol(buff + 1);
+6
View File
@@ -22,6 +22,7 @@ extern bool menu;
extern bool RDSSPYTCP; extern bool RDSSPYTCP;
extern bool RDSSPYUSB; extern bool RDSSPYUSB;
extern bool RDSstatus; extern bool RDSstatus;
extern bool scandxmode;
extern bool screenmute; extern bool screenmute;
extern bool seek; extern bool seek;
extern bool setupmode; extern bool setupmode;
@@ -41,10 +42,12 @@ extern bool XDRMute;
extern byte band; extern byte band;
extern byte BWset; extern byte BWset;
extern byte EQset; extern byte EQset;
extern byte fmscansens;
extern byte iMSEQ; extern byte iMSEQ;
extern byte iMSset; extern byte iMSset;
extern byte language; extern byte language;
extern byte memorypos; extern byte memorypos;
extern byte stepsize;
extern byte subnetclient; extern byte subnetclient;
extern byte TEF; extern byte TEF;
extern char buff[16]; extern char buff[16];
@@ -135,5 +138,8 @@ extern void updateiMS();
extern void updateEQ(); extern void updateEQ();
extern void tftPrint(int8_t offset, const String & text, int16_t x, int16_t y, int color, int smoothcolor, uint8_t fontsize); extern void tftPrint(int8_t offset, const String & text, int16_t x, int16_t y, int color, int smoothcolor, uint8_t fontsize);
extern void showAutoSquelch(bool mode); extern void showAutoSquelch(bool mode);
extern void ShowStepSize();
extern void startFMDXScan();
extern void cancelDXScan();
#endif #endif
+6 -6
View File
@@ -2022,7 +2022,7 @@ void MenuUp() {
OneBigLineSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false); OneBigLineSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
OneBigLineSprite.drawString(String(ContrastSet, DEC), 135, 0); OneBigLineSprite.drawString(String(ContrastSet, DEC), 135, 0);
OneBigLineSprite.pushSprite(24, 118); OneBigLineSprite.pushSprite(24, 118);
analogWrite(CONTRASTPIN, ContrastSet * 2 + 27); analogWrite(CONTRASTPIN, map(ContrastSet, 0, 100, 15, 255));
break; break;
case ITEM3: case ITEM3:
@@ -2339,7 +2339,7 @@ void MenuUp() {
case ITEM10: case ITEM10:
fmscansens++; fmscansens++;
if (fmscansens > 15) fmscansens = 1; if (fmscansens > 30) fmscansens = 1;
OneBigLineSprite.drawString(String(fmscansens), 135, 0); OneBigLineSprite.drawString(String(fmscansens), 135, 0);
OneBigLineSprite.pushSprite(24, 118); OneBigLineSprite.pushSprite(24, 118);
@@ -2447,7 +2447,7 @@ void MenuUp() {
case ITEM9: case ITEM9:
amscansens++; amscansens++;
if (amscansens > 15) amscansens = 1; if (amscansens > 30) amscansens = 1;
OneBigLineSprite.drawString(String(amscansens, DEC), 135, 0); OneBigLineSprite.drawString(String(amscansens, DEC), 135, 0);
OneBigLineSprite.pushSprite(24, 118); OneBigLineSprite.pushSprite(24, 118);
@@ -2882,7 +2882,7 @@ void MenuDown() {
OneBigLineSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false); OneBigLineSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
OneBigLineSprite.drawString(String(ContrastSet, DEC), 135, 0); OneBigLineSprite.drawString(String(ContrastSet, DEC), 135, 0);
OneBigLineSprite.pushSprite(24, 118); OneBigLineSprite.pushSprite(24, 118);
analogWrite(CONTRASTPIN, ContrastSet * 2 + 27); analogWrite(CONTRASTPIN, map(ContrastSet, 0, 100, 15, 255));
break; break;
case ITEM3: case ITEM3:
@@ -3201,7 +3201,7 @@ void MenuDown() {
case ITEM10: case ITEM10:
fmscansens--; fmscansens--;
if (fmscansens == 0) fmscansens = 15; if (fmscansens == 0) fmscansens = 30;
OneBigLineSprite.drawString(String(fmscansens), 135, 0); OneBigLineSprite.drawString(String(fmscansens), 135, 0);
OneBigLineSprite.pushSprite(24, 118); OneBigLineSprite.pushSprite(24, 118);
@@ -3310,7 +3310,7 @@ void MenuDown() {
case ITEM9: case ITEM9:
amscansens--; amscansens--;
if (amscansens == 0) amscansens = 15; if (amscansens == 0) amscansens = 30;
OneBigLineSprite.drawString(String(amscansens, DEC), 135, 0); OneBigLineSprite.drawString(String(amscansens, DEC), 135, 0);
OneBigLineSprite.pushSprite(24, 118); OneBigLineSprite.pushSprite(24, 118);
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef LANGUAGE_H #ifndef LANGUAGE_H
#define LANGUAGE_H #define LANGUAGE_H
#define VERSION "v2.10 RC11" #define VERSION "v2.10 RC12"
// [number of languages][number of texts] // [number of languages][number of texts]