Merge branch 'main' into New_Model_DP_666

This commit is contained in:
Leon
2024-05-11 11:12:41 +08:00
9 changed files with 16756 additions and 16592 deletions
+58 -3
View File
@@ -66,6 +66,7 @@ bool afpage;
bool afscreen; bool afscreen;
bool aftest; bool aftest;
bool artheadold; bool artheadold;
bool autosquelch = true;
bool batterydetect = true; bool batterydetect = true;
bool beepresetstart; bool beepresetstart;
bool beepresetstop; bool beepresetstop;
@@ -374,6 +375,7 @@ unsigned int SWLowEdgeSet;
unsigned long afticker; unsigned long afticker;
unsigned long aftickerhold; unsigned long aftickerhold;
unsigned long aftimer; unsigned long aftimer;
unsigned long autosquelchtimer;
unsigned long eonticker; unsigned long eonticker;
unsigned long eontickerhold; unsigned long eontickerhold;
unsigned long flashingtimer; unsigned long flashingtimer;
@@ -515,6 +517,7 @@ void setup() {
scanmem = EEPROM.readByte(EE_BYTE_SCANMEM); scanmem = EEPROM.readByte(EE_BYTE_SCANMEM);
scancancel = EEPROM.readByte(EE_BYTE_SCANCANCEL); scancancel = EEPROM.readByte(EE_BYTE_SCANCANCEL);
scanmute = EEPROM.readByte(EE_BYTE_SCANMUTE); scanmute = EEPROM.readByte(EE_BYTE_SCANMUTE);
autosquelch = EEPROM.readByte(EE_BYTE_AUTOSQUELCH);
if (spispeed == SPI_SPEED_DEFAULT) { if (spispeed == SPI_SPEED_DEFAULT) {
tft.setSPISpeed(SPI_FREQUENCY / 1000000); tft.setSPISpeed(SPI_FREQUENCY / 1000000);
@@ -3219,13 +3222,62 @@ void ShowModLevel() {
} }
} }
void showAutoSquelch(bool mode) {
if (language == LANGUAGE_CHS) SquelchSprite.loadFont(FONT16_CHS); else SquelchSprite.loadFont(FONT16);
if (mode) {
SquelchSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
} else {
SquelchSprite.setTextColor(BackgroundColor, BackgroundColor, false);
}
SquelchSprite.fillSprite(BackgroundColor);
SquelchSprite.drawString(String(myLanguage[language][86]), 0, 0);
SquelchSprite.pushSprite(235, 145);
}
void doSquelch() { void doSquelch() {
if (!XDRGTKUSB && !XDRGTKTCP && usesquelch) Squelch = analogRead(PIN_POT) / 4 - 100; if (!XDRGTKUSB && !XDRGTKTCP && usesquelch && !autosquelch) Squelch = analogRead(PIN_POT) / 4 - 100;
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;
if (Squelch > 920) Squelch = 920; if (Squelch > 920) Squelch = 920;
if (autosquelch) {
if (band < BAND_GAP) {
if ((USN < fmscansens * 30) && (WAM < 230) && (OStatus < 100 && OStatus > -100) && (!scandxmode || (scandxmode && !scanmute))) {
if (SQ || BWreset) {
if (!seek) radio.setUnMute();
if (!screenmute && !seek) {
tft.drawBitmap(92, 4, Speaker, 26, 22, GreyoutColor);
}
autosquelchtimer = millis();
SQ = false;
}
} else {
if ((!SQ || BWreset) && (millis() >= autosquelchtimer + 1000)) {
radio.setMute();
if (!screenmute && !seek) {
tft.drawBitmap(92, 4, Speaker, 26, 22, PrimaryColor);
}
autosquelchtimer = millis();
SQ = true;
}
}
} else {
if ((USN < amscansens * 30) && (OStatus < 2 && OStatus > -2) && (!scandxmode || (scandxmode && !scanmute))) {
if (!seek) radio.setUnMute();
if (!screenmute && !seek) {
tft.drawBitmap(92, 4, Speaker, 26, 22, GreyoutColor);
}
SQ = false;
} else {
radio.setMute();
if (!screenmute && !seek) {
tft.drawBitmap(92, 4, Speaker, 26, 22, PrimaryColor);
}
SQ = true;
}
}
} else {
if (language == LANGUAGE_CHS) SquelchSprite.loadFont(FONT16_CHS); else SquelchSprite.loadFont(FONT16); if (language == LANGUAGE_CHS) SquelchSprite.loadFont(FONT16_CHS); else SquelchSprite.loadFont(FONT16);
if (!XDRGTKUSB && !XDRGTKTCP && usesquelch && (!scandxmode || (scandxmode && !scanmute))) { if (!XDRGTKUSB && !XDRGTKTCP && usesquelch && (!scandxmode || (scandxmode && !scanmute))) {
@@ -3329,6 +3381,7 @@ void doSquelch() {
} }
} }
} }
}
SquelchSprite.unloadFont(); SquelchSprite.unloadFont();
} }
@@ -3684,7 +3737,7 @@ void TuneUp() {
unsigned int temp = 0; unsigned int temp = 0;
if (stepsize == 0) { if (stepsize == 0) {
if (band > BAND_GAP) { if (band > BAND_GAP) {
if (frequency_AM < MWHighEdgeSet && frequency_AM > MWLowEdgeSet) { if (frequency_AM <= MWHighEdgeSet && frequency_AM >= MWLowEdgeSet) {
if (!mwstepsize) { if (!mwstepsize) {
temp = FREQ_MW_STEP_9K; temp = FREQ_MW_STEP_9K;
frequency_AM = (frequency_AM / FREQ_MW_STEP_9K) * FREQ_MW_STEP_9K; frequency_AM = (frequency_AM / FREQ_MW_STEP_9K) * FREQ_MW_STEP_9K;
@@ -4021,7 +4074,7 @@ void DefaultSettings(byte userhardwaremodel) {
EEPROM.writeByte(EE_BYTE_SOFTMUTEAM, 0); EEPROM.writeByte(EE_BYTE_SOFTMUTEAM, 0);
EEPROM.writeByte(EE_BYTE_SOFTMUTEFM, 0); EEPROM.writeByte(EE_BYTE_SOFTMUTEFM, 0);
EEPROM.writeUInt(EE_UINT16_FREQUENCY_AM, 828); EEPROM.writeUInt(EE_UINT16_FREQUENCY_AM, 828);
if (userhardwaremodel == BASE_ILI9341) EEPROM.writeByte(EE_BYTE_LANGUAGE, 0); else EEPROM.writeByte(EE_BYTE_LANGUAGE, LANGUAGE_CHS); EEPROM.writeByte(EE_BYTE_LANGUAGE, 0);
EEPROM.writeByte(EE_BYTE_SHOWRDSERRORS, 1); EEPROM.writeByte(EE_BYTE_SHOWRDSERRORS, 1);
EEPROM.writeByte(EE_BYTE_TEF, 0); EEPROM.writeByte(EE_BYTE_TEF, 0);
if (userhardwaremodel == BASE_ILI9341) EEPROM.writeByte(EE_BYTE_DISPLAYFLIP, 0); else EEPROM.writeByte(EE_BYTE_DISPLAYFLIP, 1); if (userhardwaremodel == BASE_ILI9341) EEPROM.writeByte(EE_BYTE_DISPLAYFLIP, 0); else EEPROM.writeByte(EE_BYTE_DISPLAYFLIP, 1);
@@ -4101,6 +4154,7 @@ void DefaultSettings(byte userhardwaremodel) {
EEPROM.writeByte(EE_BYTE_SCANMEM, 1); EEPROM.writeByte(EE_BYTE_SCANMEM, 1);
EEPROM.writeByte(EE_BYTE_SCANCANCEL, 0); EEPROM.writeByte(EE_BYTE_SCANCANCEL, 0);
EEPROM.writeByte(EE_BYTE_SCANMUTE, 0); EEPROM.writeByte(EE_BYTE_SCANMUTE, 0);
EEPROM.writeByte(EE_BYTE_AUTOSQUELCH, 0);
for (int i = 0; i < EE_PRESETS_CNT; i++) { for (int i = 0; i < EE_PRESETS_CNT; i++) {
EEPROM.writeByte(i + EE_PRESETS_BAND_START, BAND_FM); EEPROM.writeByte(i + EE_PRESETS_BAND_START, BAND_FM);
@@ -4330,6 +4384,7 @@ void endMenu() {
EEPROM.writeByte(EE_BYTE_SCANMEM, scanmem); EEPROM.writeByte(EE_BYTE_SCANMEM, scanmem);
EEPROM.writeByte(EE_BYTE_SCANCANCEL, scancancel); EEPROM.writeByte(EE_BYTE_SCANCANCEL, scancancel);
EEPROM.writeByte(EE_BYTE_SCANMUTE, scanmute); EEPROM.writeByte(EE_BYTE_SCANMUTE, scanmute);
EEPROM.writeByte(EE_BYTE_AUTOSQUELCH, autosquelch);
EEPROM.commit(); EEPROM.commit();
if (af == 2) radio.rds.afreg = true; else radio.rds.afreg = false; if (af == 2) radio.rds.afreg = true; else radio.rds.afreg = false;
Serial.end(); Serial.end();
+4521 -4503
View File
File diff suppressed because it is too large Load Diff
+12035 -11989
View File
File diff suppressed because it is too large Load Diff
+24
View File
@@ -444,6 +444,30 @@ void XDRGTKRoutine() {
updateEQ(); updateEQ();
break; break;
case 'H':
byte autosq_read;
autosq_read = atol(buff + 1);
if (autosq_read == 0) {
autosquelch = false;
DataPrint("H0\n");
if (!screenmute) {
if (!usesquelch) {
tftPrint(-1, "SQ:", 212, 145, BackgroundColor, BackgroundColor, 16);
showAutoSquelch(0);
} else {
Squelch = -150;
}
}
} else {
autosquelch = true;
DataPrint("H1\n");
if (!screenmute) {
tftPrint(-1, "SQ:", 212, 145, ActiveColor, ActiveColorSmooth, 16);
showAutoSquelch(1);
}
}
break;
case 'M': case 'M':
byte XDRband; byte XDRband;
XDRband = atol(buff + 1); XDRband = atol(buff + 1);
+2
View File
@@ -13,6 +13,7 @@
extern bool advancedRDS; extern bool advancedRDS;
extern bool afscreen; extern bool afscreen;
extern bool aftest; extern bool aftest;
extern bool autosquelch;
extern bool BWreset; extern bool BWreset;
extern bool direction; extern bool direction;
extern bool externaltune; extern bool externaltune;
@@ -132,5 +133,6 @@ extern void MuteScreen(bool setting);
extern void updateiMS(); 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);
#endif #endif
+5 -4
View File
@@ -209,9 +209,9 @@
#define EE_CHECKBYTE_VALUE 10 // 0 ~ 255,add new entry, change for new value #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! #define EE_PRESETS_FREQUENCY 0 // Default value when memory channel should be skipped!
#ifdef HAS_AIR_BAND #ifdef HAS_AIR_BAND
#define EE_TOTAL_CNT 2219 // Total occupied eeprom bytes #define EE_TOTAL_CNT 2220 // Total occupied eeprom bytes
#else #else
#define EE_TOTAL_CNT 2214 // Total occupied eeprom bytes #define EE_TOTAL_CNT 2215 // Total occupied eeprom bytes
#endif #endif
#define EE_PRESETS_BAND_START 0 // 99 * 1 byte #define EE_PRESETS_BAND_START 0 // 99 * 1 byte
@@ -310,9 +310,10 @@
#define EE_BYTE_SCANMEM 2211 #define EE_BYTE_SCANMEM 2211
#define EE_BYTE_SCANCANCEL 2212 #define EE_BYTE_SCANCANCEL 2212
#define EE_BYTE_SCANMUTE 2213 #define EE_BYTE_SCANMUTE 2213
#define EE_BYTE_AUTOSQUELCH 2214
#ifdef HAS_AIR_BAND #ifdef HAS_AIR_BAND
#define EE_BYTE_AIRSTEPSIZE 2114 #define EE_BYTE_AIRSTEPSIZE 2115
#define EE_UINT16_FREQUENCY_AIR 2215 #define EE_UINT16_FREQUENCY_AIR 2216
#endif #endif
// End of EEPROM index defines // End of EEPROM index defines
+24 -8
View File
@@ -792,7 +792,7 @@ void ShowOneLine(byte position, byte item, bool selected) {
FullLineSprite.setTextDatum(TR_DATUM); FullLineSprite.setTextDatum(TR_DATUM);
FullLineSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false); FullLineSprite.setTextColor(PrimaryColor, PrimaryColorSmooth, false);
FullLineSprite.drawString((usesquelch ? myLanguage[language][42] : myLanguage[language][30]), 298, 3); if (autosquelch) FullLineSprite.drawString(myLanguage[language][86], 298, 3); else FullLineSprite.drawString((usesquelch ? myLanguage[language][42] : myLanguage[language][30]), 298, 3);
break; break;
case AUDIOSETTINGS: case AUDIOSETTINGS:
@@ -1576,7 +1576,7 @@ void BuildDisplay() {
} }
} }
} }
if (usesquelch) tftPrint(-1, "SQ:", 212, 145, ActiveColor, ActiveColorSmooth, 16); if (usesquelch || autosquelch) tftPrint(-1, "SQ:", 212, 145, ActiveColor, ActiveColorSmooth, 16);
tftPrint(1, "C/N", 270, 163, ActiveColor, ActiveColorSmooth, 16); tftPrint(1, "C/N", 270, 163, ActiveColor, ActiveColorSmooth, 16);
tftPrint(-1, "dB", 300, 163, ActiveColor, ActiveColorSmooth, 16); tftPrint(-1, "dB", 300, 163, ActiveColor, ActiveColorSmooth, 16);
if (region == REGION_EU) tftPrint(-1, "PI:", 212, 193, ActiveColor, ActiveColorSmooth, 16); if (region == REGION_EU) tftPrint(-1, "PI:", 212, 193, ActiveColor, ActiveColorSmooth, 16);
@@ -1656,6 +1656,8 @@ void BuildDisplay() {
#endif #endif
} }
if (autosquelch) showAutoSquelch(1);
RDSstatusold = false; RDSstatusold = false;
Stereostatusold = false; Stereostatusold = false;
LowLevelInit = true; LowLevelInit = true;
@@ -1771,8 +1773,16 @@ void MenuUp() {
break; break;
case ITEM4: case ITEM4:
usesquelch = !usesquelch; if (autosquelch && !usesquelch) {
OneBigLineSprite.drawString((usesquelch ? myLanguage[language][42] : myLanguage[language][30]), 135, 0); usesquelch = true;
autosquelch = false;
} else if (usesquelch && !autosquelch) {
usesquelch = false;
} else {
autosquelch = true;
}
if (autosquelch) OneBigLineSprite.drawString(myLanguage[language][86], 135, 0); else OneBigLineSprite.drawString((usesquelch ? myLanguage[language][42] : myLanguage[language][30]), 135, 0);
OneBigLineSprite.pushSprite(24, 118); OneBigLineSprite.pushSprite(24, 118);
break; break;
@@ -2592,9 +2602,16 @@ void MenuDown() {
break; break;
case ITEM4: case ITEM4:
usesquelch = !usesquelch; if (autosquelch && !usesquelch) {
usesquelch = true;
autosquelch = false;
} else if (usesquelch && !autosquelch) {
usesquelch = false;
} else {
autosquelch = true;
}
OneBigLineSprite.drawString((usesquelch ? myLanguage[language][42] : myLanguage[language][30]), 135, 0); if (autosquelch) OneBigLineSprite.drawString(myLanguage[language][86], 135, 0); else OneBigLineSprite.drawString((usesquelch ? myLanguage[language][42] : myLanguage[language][30]), 135, 0);
OneBigLineSprite.pushSprite(24, 118); OneBigLineSprite.pushSprite(24, 118);
break; break;
@@ -3486,8 +3503,7 @@ void DoMenu() {
case ITEM4: case ITEM4:
Infoboxprint(myLanguage[language][62]); Infoboxprint(myLanguage[language][62]);
if (autosquelch) OneBigLineSprite.drawString(myLanguage[language][86], 135, 0); else OneBigLineSprite.drawString((usesquelch ? myLanguage[language][42] : myLanguage[language][30]), 135, 0);
OneBigLineSprite.drawString((usesquelch ? myLanguage[language][42] : myLanguage[language][30]), 135, 0);
OneBigLineSprite.pushSprite(24, 118); OneBigLineSprite.pushSprite(24, 118);
break; break;
+2
View File
@@ -32,6 +32,7 @@ extern bool afmethodBold;
extern bool afpage; extern bool afpage;
extern bool afscreen; extern bool afscreen;
extern bool artheadold; extern bool artheadold;
extern bool autosquelch;
extern bool BWreset; extern bool BWreset;
extern bool change; extern bool change;
extern bool compressedold; extern bool compressedold;
@@ -230,4 +231,5 @@ extern void DoMemoryPosTune();
extern void UpdateFonts(bool mode); extern void UpdateFonts(bool mode);
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 setAutoSpeedSPI(); extern void setAutoSpeedSPI();
extern void showAutoSquelch(bool mode);
#endif #endif
+3 -3
View File
@@ -3232,7 +3232,7 @@ static const char* const myLanguage[18][224] PROGMEM = {
"显示短波米波段", // 59 "显示短波米波段", // 59
"RDS 过滤器", // 60 "RDS 过滤器", // 60
"显示 PI errors", // 61 "显示 PI errors", // 61
"主画面显示SQ", // 62 NEEDS NEW TRANSLATION, ENGLISH: USE SQUELCH "SQ静噪等级", // 62
"主画面显示M表", // 63 "主画面显示M表", // 63
"AM 噪声消除", // 64 "AM 噪声消除", // 64
"FM 噪声消除", // 65 "FM 噪声消除", // 65
@@ -3256,7 +3256,7 @@ static const char* const myLanguage[18][224] PROGMEM = {
"不可用", // 83 "不可用", // 83
"固件版本", // 84 "固件版本", // 84
"频率字体", // 85 *** "频率字体", // 85 ***
"Auto", // 86 "自动", // 86
"AF 不可用", // 87 "AF 不可用", // 87
"EON 不可用", // 88 "EON 不可用", // 88
"RT+ 不可用", // 89 "RT+ 不可用", // 89
@@ -3366,7 +3366,7 @@ static const char* const myLanguage[18][224] PROGMEM = {
"FM 设置", // 193 "FM 设置", // 193
"AM 设置", // 194 "AM 设置", // 194
"连机模式", // 195 "连机模式", // 195
"DX MODE", // 196 "FMDX 选项", // 196
"Stationlist ID", // 197 *** "Stationlist ID", // 197 ***
"AM天线衰减", // 198 "AM天线衰减", // 198
"FM去加重", // 199 "FM去加重", // 199