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;
EEPROM.writeByte(EE_BYTE_ROTARYMODE, rotarymode);
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][2], 155, 130, ActiveColor, ActiveColorSmooth, 28);
while (digitalRead(BWBUTTON) == LOW) delay(50);
@@ -686,7 +686,7 @@ void setup() {
}
EEPROM.writeByte(EE_BYTE_DISPLAYFLIP, displayflip);
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][2], 155, 130, ActiveColor, ActiveColorSmooth, 28);
while (digitalRead(MODEBUTTON) == LOW) delay(50);
@@ -694,7 +694,7 @@ void setup() {
if (digitalRead(BANDBUTTON) == LOW) {
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][5], 155, 130, ActiveColor, ActiveColorSmooth, 28);
while (digitalRead(BANDBUTTON) == LOW) delay(50);
@@ -702,7 +702,7 @@ void setup() {
}
if (digitalRead(ROTARY_BUTTON) == LOW && digitalRead(BWBUTTON) == HIGH) {
analogWrite(CONTRASTPIN, ContrastSet * 2 + 27);
analogWrite(CONTRASTPIN, map(ContrastSet, 0, 100, 15, 255));
if (optenc == 0) {
optenc = 1;
tftPrint(0, myLanguage[language][6], 155, 70, ActiveColor, ActiveColorSmooth, 28);
@@ -717,7 +717,7 @@ void setup() {
}
if (digitalRead(ROTARY_BUTTON) == LOW && digitalRead(BWBUTTON) == LOW) {
analogWrite(CONTRASTPIN, ContrastSet * 2 + 27);
analogWrite(CONTRASTPIN, map(ContrastSet, 0, 100, 15, 255));
DefaultSettings(hardwaremodel);
tftPrint(0, myLanguage[language][66], 155, 70, 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);
for (int x = 0; x <= ContrastSet; x++) {
analogWrite(CONTRASTPIN, x * 2 + 27);
analogWrite(CONTRASTPIN, map(x, 0, 100, 15, 255));
delay(30);
}
@@ -1212,19 +1212,18 @@ void WakeToSleep(bool yes) {
StoreFrequency();
break;
case LCD_BRIGHTNESS_1_PERCENT:
analogWrite(CONTRASTPIN, 1 * 2 + 27);
analogWrite(CONTRASTPIN, map(ContrastSet / 100, 0, 100, 15, 255));
break;
case LCD_BRIGHTNESS_A_QUARTER:
analogWrite(CONTRASTPIN, MIN(ContrastSet, 25) * 2 + 27);
analogWrite(CONTRASTPIN, map(ContrastSet / 4, 0, 100, 15, 255));
break;
case LCD_BRIGHTNESS_HALF:
analogWrite(CONTRASTPIN, MIN(ContrastSet, 50) * 2 + 27);
analogWrite(CONTRASTPIN, map(ContrastSet / 2, 0, 100, 15, 255));
break;
}
} else {
switch (poweroptions) {
case LCD_OFF:
analogWrite(CONTRASTPIN, ContrastSet * 2 + 27);
MuteScreen(0);
screensavertriggered = false;
screensaver_IRQ = OFF;
@@ -1233,13 +1232,13 @@ void WakeToSleep(bool yes) {
case LCD_BRIGHTNESS_1_PERCENT:
case LCD_BRIGHTNESS_A_QUARTER:
case LCD_BRIGHTNESS_HALF:
analogWrite(CONTRASTPIN, ContrastSet * 2 + 27);
MuteScreen(0);
screensavertriggered = false;
screensaver_IRQ = OFF;
ScreensaverTimerReopen();
break;
}
analogWrite(CONTRASTPIN, map(ContrastSet, 0, 100, 15, 255));
}
}
@@ -2316,7 +2315,7 @@ void ModeButtonPress() {
menuoption = ITEM1;
menupage = INDEX;
menuitem = 0;
if (spispeed == 7) tft.setSPISpeed(30);
if (spispeed == 7) tft.setSPISpeed(40);
BuildMenu();
menu = true;
ScreensaverTimerSet(OFF);
@@ -2362,7 +2361,6 @@ void ModeButtonPress() {
menuoption = ITEM1;
menupage = INDEX;
menuitem = 0;
if (spispeed == 7) tft.setSPISpeed(30);
BuildMenu();
}
}
@@ -2821,6 +2819,8 @@ void ShowMemoryPos() {
}
void DoMemoryPosTune() {
if (spispeed == 7) tft.setSPISpeed(50);
// Process empty stations
if (IsStationEmpty()) {
memoryposstatus = MEM_DARK;
@@ -2866,8 +2866,6 @@ void DoMemoryPosTune() {
#endif
}
ShowFreq(0);
if (band == BAND_FM || band == BAND_OIRT) {
StereoToggle = presets[memorypos].ms;
if (!StereoToggle) {
@@ -2921,6 +2919,7 @@ void DoMemoryPosTune() {
BWtune = true;
memtune = true;
memreset = true;
ShowFreq(0);
}
void ShowFreq(int mode) {
@@ -3339,7 +3338,8 @@ void showAutoSquelch(bool mode) {
}
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 == 1) SquelchShow = ((Squelch * 100) + 10875) / 1000;
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);
TEF = highByte(hw) * 100 + highByte(sw);
tft.fillScreen(BackgroundColor);
analogWrite(CONTRASTPIN, ContrastSet * 2 + 27);
analogWrite(CONTRASTPIN, map(ContrastSet, 0, 100, 15, 255));
if (TEF != 102 && TEF != 205) {
tftPrint(0, myLanguage[language][35], 150, 78, ActiveColor, ActiveColorSmooth, 28);
@@ -4153,7 +4153,7 @@ void MuteScreen(bool setting) {
screenmute = false;
setupmode = true;
tft.writecommand(0x11);
analogWrite(CONTRASTPIN, ContrastSet * 2 + 27);
analogWrite(CONTRASTPIN, map(ContrastSet, 0, 100, 15, 255));
if (band < BAND_GAP) {
if (afscreen) {
BuildAFScreen();
@@ -4421,6 +4421,7 @@ void cancelDXScan() {
ShowTuneMode();
ShowMemoryPos();
if (XDRGTKUSB || XDRGTKTCP) DataPrint("J0\n");
}
void endMenu() {
@@ -4518,8 +4519,11 @@ void endMenu() {
}
void startFMDXScan() {
if (afscreen || advancedRDS) BuildDisplay();
if (memorypos > scanstop || memorypos < scanstart) memorypos = scanstart;
scanmodeold = tunemode;
if (scanmem) {
tunemode = TUNE_MEM;
if (band != presets[memorypos].band) {
@@ -4546,6 +4550,7 @@ void startFMDXScan() {
}
scantimer = millis();
scandxmode = true;
if (XDRGTKUSB || XDRGTKTCP) DataPrint("J1\n");
}
void setAutoSpeedSPI() {
+33 -8
View File
@@ -374,6 +374,14 @@ void XDRGTKRoutine() {
}
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':
if (afscreen || advancedRDS) {
BuildDisplay();
@@ -381,6 +389,12 @@ void XDRGTKRoutine() {
}
byte scanmethod;
scanmethod = atol(buff + 1);
if (band < BAND_GAP) {
stepsize = 0;
ShowStepSize();
}
if (scanmethod == 1) {
DataPrint("C1\n");
direction = false;
@@ -396,14 +410,6 @@ void XDRGTKRoutine() {
DataPrint("C0\n");
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':
byte demp;
demp = atol(buff + 1);
@@ -482,6 +488,25 @@ void XDRGTKRoutine() {
}
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':
byte XDRband;
XDRband = atol(buff + 1);
+6
View File
@@ -22,6 +22,7 @@ extern bool menu;
extern bool RDSSPYTCP;
extern bool RDSSPYUSB;
extern bool RDSstatus;
extern bool scandxmode;
extern bool screenmute;
extern bool seek;
extern bool setupmode;
@@ -41,10 +42,12 @@ extern bool XDRMute;
extern byte band;
extern byte BWset;
extern byte EQset;
extern byte fmscansens;
extern byte iMSEQ;
extern byte iMSset;
extern byte language;
extern byte memorypos;
extern byte stepsize;
extern byte subnetclient;
extern byte TEF;
extern char buff[16];
@@ -135,5 +138,8 @@ extern void updateiMS();
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 showAutoSquelch(bool mode);
extern void ShowStepSize();
extern void startFMDXScan();
extern void cancelDXScan();
#endif
+6 -6
View File
@@ -2022,7 +2022,7 @@ void MenuUp() {
OneBigLineSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
OneBigLineSprite.drawString(String(ContrastSet, DEC), 135, 0);
OneBigLineSprite.pushSprite(24, 118);
analogWrite(CONTRASTPIN, ContrastSet * 2 + 27);
analogWrite(CONTRASTPIN, map(ContrastSet, 0, 100, 15, 255));
break;
case ITEM3:
@@ -2339,7 +2339,7 @@ void MenuUp() {
case ITEM10:
fmscansens++;
if (fmscansens > 15) fmscansens = 1;
if (fmscansens > 30) fmscansens = 1;
OneBigLineSprite.drawString(String(fmscansens), 135, 0);
OneBigLineSprite.pushSprite(24, 118);
@@ -2447,7 +2447,7 @@ void MenuUp() {
case ITEM9:
amscansens++;
if (amscansens > 15) amscansens = 1;
if (amscansens > 30) amscansens = 1;
OneBigLineSprite.drawString(String(amscansens, DEC), 135, 0);
OneBigLineSprite.pushSprite(24, 118);
@@ -2882,7 +2882,7 @@ void MenuDown() {
OneBigLineSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
OneBigLineSprite.drawString(String(ContrastSet, DEC), 135, 0);
OneBigLineSprite.pushSprite(24, 118);
analogWrite(CONTRASTPIN, ContrastSet * 2 + 27);
analogWrite(CONTRASTPIN, map(ContrastSet, 0, 100, 15, 255));
break;
case ITEM3:
@@ -3201,7 +3201,7 @@ void MenuDown() {
case ITEM10:
fmscansens--;
if (fmscansens == 0) fmscansens = 15;
if (fmscansens == 0) fmscansens = 30;
OneBigLineSprite.drawString(String(fmscansens), 135, 0);
OneBigLineSprite.pushSprite(24, 118);
@@ -3310,7 +3310,7 @@ void MenuDown() {
case ITEM9:
amscansens--;
if (amscansens == 0) amscansens = 15;
if (amscansens == 0) amscansens = 30;
OneBigLineSprite.drawString(String(amscansens, DEC), 135, 0);
OneBigLineSprite.pushSprite(24, 118);
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef LANGUAGE_H
#define LANGUAGE_H
#define VERSION "v2.10 RC11"
#define VERSION "v2.10 RC12"
// [number of languages][number of texts]