You've already forked TEF6686_ESP32
Added FM scan sensitivity option.
This commit is contained in:
@@ -142,6 +142,7 @@ byte displayflip;
|
||||
byte ECCold;
|
||||
byte eonptyold[20];
|
||||
byte EQset;
|
||||
byte fmscansens;
|
||||
byte fmdefaultstepsize;
|
||||
byte fmnb;
|
||||
byte fmdeemphasis;
|
||||
@@ -450,6 +451,7 @@ void setup() {
|
||||
mwstepsize = EEPROM.readByte(EE_BYTE_MWREGION);
|
||||
spispeed = EEPROM.readByte(EE_BYTE_SPISPEED);
|
||||
amscansens = EEPROM.readByte(EE_BYTE_AMSCANSENS);
|
||||
fmscansens = EEPROM.readByte(EE_BYTE_FMSCANSENS);
|
||||
|
||||
if (spispeed == SPI_SPEED_DEFAULT) tft.setSPISpeed(SPI_FREQUENCY / 1000000); else tft.setSPISpeed(spispeed * 10);
|
||||
LWLowEdgeSet = FREQ_LW_LOW_EDGE_MIN;
|
||||
@@ -1884,6 +1886,7 @@ void ModeButtonPress() {
|
||||
EEPROM.writeByte(EE_BYTE_MWREGION, mwstepsize);
|
||||
EEPROM.writeByte(EE_BYTE_SPISPEED, spispeed);
|
||||
EEPROM.writeByte(EE_BYTE_AMSCANSENS, amscansens);
|
||||
EEPROM.writeByte(EE_BYTE_FMSCANSENS, fmscansens);
|
||||
EEPROM.commit();
|
||||
if (af == 2) radio.rds.afreg = true; else radio.rds.afreg = false;
|
||||
Serial.end();
|
||||
@@ -3263,7 +3266,7 @@ void Seek(bool mode) {
|
||||
|
||||
if (band < BAND_GAP) {
|
||||
radio.getStatus(SStatus, USN, WAM, OStatus, BW, MStatus, CN);
|
||||
if ((USN < 200) && (WAM < 230) && (OStatus < 80 && OStatus > -80) && (Squelch < SStatus || Squelch == 920)) {
|
||||
if ((USN < fmscansens * 30) && (WAM < 230) && (OStatus < 80 && OStatus > -80) && (Squelch < SStatus || Squelch == 920)) {
|
||||
seek = false;
|
||||
radio.setUnMute();
|
||||
if (!screenmute) tft.drawBitmap(92, 4, Speaker, 26, 22, GreyoutColor);
|
||||
@@ -3432,6 +3435,7 @@ void DefaultSettings(byte userhardwaremodel) {
|
||||
EEPROM.writeByte(EE_BYTE_MWREGION, 0);
|
||||
EEPROM.writeByte(EE_BYTE_SPISPEED, 3);
|
||||
EEPROM.writeByte(EE_BYTE_AMSCANSENS, 4);
|
||||
EEPROM.writeByte(EE_BYTE_FMSCANSENS, 4);
|
||||
EEPROM.commit();
|
||||
}
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@
|
||||
|
||||
// EEPROM index defines
|
||||
#define EE_PRESETS_CNT 99
|
||||
#define EE_CHECKBYTE_VALUE 41 // 0 ~ 255,add new entry, change for new value
|
||||
#define EE_CHECKBYTE_VALUE 42 // 0 ~ 255,add new entry, change for new value
|
||||
|
||||
#define EE_TOTAL_CNT 819
|
||||
#define EE_UINT16_FREQUENCY_FM 0
|
||||
@@ -186,10 +186,11 @@
|
||||
#define EE_BYTE_MWREGION 120
|
||||
#define EE_BYTE_SPISPEED 121
|
||||
#define EE_BYTE_AMSCANSENS 122
|
||||
#define EE_PRESETS_BAND_START 123
|
||||
#define EE_PRESET_BW_START 223
|
||||
#define EE_PRESET_MS_START 323
|
||||
#define EE_PRESETS_START 423
|
||||
#define EE_BYTE_FMSCANSENS 123
|
||||
#define EE_PRESETS_BAND_START 124
|
||||
#define EE_PRESET_BW_START 224
|
||||
#define EE_PRESET_MS_START 324
|
||||
#define EE_PRESETS_START 424
|
||||
#define EE_PRESETS_FREQUENCY 8750
|
||||
|
||||
// End of EEPROM index defines
|
||||
|
||||
74
src/gui.cpp
74
src/gui.cpp
@@ -7,7 +7,7 @@
|
||||
#include <cstring>
|
||||
|
||||
byte menuitem;
|
||||
byte items[8] = {8, static_cast<byte>(dynamicspi ? 3 : 2), 6, 10, 9, 10, 10, 5};
|
||||
byte items[8] = {8, static_cast<byte>(dynamicspi ? 3 : 2), 7, 10, 9, 10, 10, 5};
|
||||
|
||||
void doTheme() { // Use this to put your own colors in: http://www.barth-dev.de/online/rgb565-color-picker/
|
||||
switch (CurrentTheme) {
|
||||
@@ -408,6 +408,7 @@ void BuildMenu() {
|
||||
tftPrint(-1, myLanguage[language][25], 8, ITEM4 + 6, ActiveColor, ActiveColorSmooth, 16);
|
||||
tftPrint(-1, myLanguage[language][26], 8, ITEM5 + 6, ActiveColor, ActiveColorSmooth, 16);
|
||||
tftPrint(-1, myLanguage[language][27], 8, ITEM6 + 6, ActiveColor, ActiveColorSmooth, 16);
|
||||
tftPrint(-1, myLanguage[language][199], 8, ITEM7 + 6, ActiveColor, ActiveColorSmooth, 16);
|
||||
|
||||
tftPrint(1, "dB", 310, ITEM1 + 6, ActiveColor, ActiveColorSmooth, 16);
|
||||
if (VolSet > 0) tftPrint(1, "+" + String(VolSet, DEC), 270, ITEM1 + 6, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(1, String(VolSet, DEC), 270, ITEM1 + 6, PrimaryColor, PrimaryColorSmooth, 16);
|
||||
@@ -419,6 +420,8 @@ void BuildMenu() {
|
||||
if (HighCutLevel != 0) tftPrint(1, String(HighCutLevel * 100, DEC), 270, ITEM5 + 6, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(1, myLanguage[language][30], 310, ITEM5 + 6, PrimaryColor, PrimaryColorSmooth, 16);
|
||||
if (HighCutOffset != 0) tftPrint(1, "dBμV", 310, ITEM6 + 6, ActiveColor, ActiveColorSmooth, 16);
|
||||
if (HighCutOffset != 0) tftPrint(1, String(HighCutOffset, DEC), 270, ITEM6 + 6, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(1, myLanguage[language][30], 310, ITEM6 + 6, PrimaryColor, PrimaryColorSmooth, 16);
|
||||
if (fmdeemphasis != DEEMPHASIS_NONE) tftPrint(1, String((fmdeemphasis == DEEMPHASIS_50 ? FM_DEEMPHASIS_50 : FM_DEEMPHASIS_75), DEC), 270, ITEM10 + 6, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(1, myLanguage[language][30], 310, ITEM7 + 6, PrimaryColor, PrimaryColorSmooth, 16);
|
||||
if (fmdeemphasis != DEEMPHASIS_NONE) tftPrint(1, "μs", 310, ITEM7 + 6, ActiveColor, ActiveColorSmooth, 16);
|
||||
break;
|
||||
|
||||
case DISPLAYSETTINGS:
|
||||
@@ -505,7 +508,7 @@ void BuildMenu() {
|
||||
tftPrint(-1, myLanguage[language][65], 8, ITEM7 + 6, ActiveColor, ActiveColorSmooth, 16);
|
||||
tftPrint(-1, myLanguage[language][90], 8, ITEM8 + 6, ActiveColor, ActiveColorSmooth, 16);
|
||||
tftPrint(-1, myLanguage[language][100], 8, ITEM9 + 6, ActiveColor, ActiveColorSmooth, 16);
|
||||
tftPrint(-1, myLanguage[language][199], 8, ITEM10 + 6, ActiveColor, ActiveColorSmooth, 16);
|
||||
tftPrint(-1, myLanguage[language][207], 8, ITEM10 + 6, ActiveColor, ActiveColorSmooth, 16);
|
||||
|
||||
tftPrint(1, "MHz", 310, ITEM1 + 6, ActiveColor, ActiveColorSmooth, 16);
|
||||
tftPrint(1, String(ConverterSet, DEC), 270, ITEM1 + 6, PrimaryColor, PrimaryColorSmooth, 16);
|
||||
@@ -533,8 +536,7 @@ void BuildMenu() {
|
||||
case FM_BAND_OIRT: tftPrint(1, myLanguage[language][106], 310, ITEM9 + 6, PrimaryColor, PrimaryColorSmooth, 16); break;
|
||||
case FM_BAND_FM: tftPrint(1, myLanguage[language][105], 310, ITEM9 + 6, PrimaryColor, PrimaryColorSmooth, 16); break;
|
||||
}
|
||||
if (fmdeemphasis != DEEMPHASIS_NONE) tftPrint(1, String((fmdeemphasis == DEEMPHASIS_50 ? FM_DEEMPHASIS_50 : FM_DEEMPHASIS_75), DEC), 270, ITEM10 + 6, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(1, myLanguage[language][30], 310, ITEM10 + 6, PrimaryColor, PrimaryColorSmooth, 16);
|
||||
if (fmdeemphasis != DEEMPHASIS_NONE) tftPrint(1, "μs", 310, ITEM10 + 6, ActiveColor, ActiveColorSmooth, 16);
|
||||
tftPrint(1, String(fmscansens), 310, ITEM10 + 6, PrimaryColor, PrimaryColorSmooth, 16);
|
||||
break;
|
||||
|
||||
case AMSETTINGS:
|
||||
@@ -971,6 +973,18 @@ void MenuUp() {
|
||||
if (HighCutOffset != 0) tftPrint(1, String(HighCutOffset, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28);
|
||||
radio.setHighCutOffset(HighCutOffset);
|
||||
break;
|
||||
|
||||
case ITEM7:
|
||||
tftPrint(0, myLanguage[language][199], 155, 78, ActiveColor, ActiveColorSmooth, 28);
|
||||
if (fmdeemphasis != DEEMPHASIS_NONE) tftPrint(1, String((fmdeemphasis == DEEMPHASIS_50 ? FM_DEEMPHASIS_50 : FM_DEEMPHASIS_75), DEC), 155, 118, BackgroundColor, BackgroundColor, 28); else tftPrint(1, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, 28);
|
||||
if (fmnb != 0) tftPrint(-1, "μs", 170, 118, ActiveColor, ActiveColor, 28);
|
||||
if (fmdeemphasis != DEEMPHASIS_NONE) tftPrint(-1, "μs", 170, 118, BackgroundColor, BackgroundColor, 28);
|
||||
fmdeemphasis++;
|
||||
if (fmdeemphasis > DEEMPHASIS_COUNT - 1) fmdeemphasis = DEEMPHASIS_NONE;
|
||||
if (fmdeemphasis != DEEMPHASIS_NONE) tftPrint(1, String((fmdeemphasis == DEEMPHASIS_50 ? FM_DEEMPHASIS_50 : FM_DEEMPHASIS_75), DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(1, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28);
|
||||
if (fmdeemphasis != DEEMPHASIS_NONE) tftPrint(-1, "μs", 170, 118, ActiveColor, PrimaryColorSmooth, 28);
|
||||
radio.setDeemphasis(fmdeemphasis);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1265,17 +1279,11 @@ void MenuUp() {
|
||||
break;
|
||||
|
||||
case ITEM10:
|
||||
tftPrint(0, myLanguage[language][199], 155, 78, ActiveColor, ActiveColorSmooth, 28);
|
||||
if (fmdeemphasis != DEEMPHASIS_NONE) tftPrint(1, String((fmdeemphasis == DEEMPHASIS_50 ? FM_DEEMPHASIS_50 : FM_DEEMPHASIS_75), DEC), 155, 118, BackgroundColor, BackgroundColor, 28); else tftPrint(1, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, 28);
|
||||
if (fmnb != 0) tftPrint(-1, "μs", 170, 118, ActiveColor, ActiveColor, 28);
|
||||
if (fmdeemphasis != DEEMPHASIS_NONE) tftPrint(-1, "μs", 170, 118, BackgroundColor, BackgroundColor, 28);
|
||||
fmdeemphasis++;
|
||||
if (fmdeemphasis > DEEMPHASIS_COUNT - 1) fmdeemphasis = DEEMPHASIS_NONE;
|
||||
if (fmdeemphasis != DEEMPHASIS_NONE) tftPrint(1, String((fmdeemphasis == DEEMPHASIS_50 ? FM_DEEMPHASIS_50 : FM_DEEMPHASIS_75), DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(1, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28);
|
||||
if (fmdeemphasis != DEEMPHASIS_NONE) tftPrint(-1, "μs", 170, 118, ActiveColor, PrimaryColorSmooth, 28);
|
||||
radio.setDeemphasis(fmdeemphasis);
|
||||
tftPrint(1, String(fmscansens), 155, 118, BackgroundColor, BackgroundColor, 28);
|
||||
fmscansens++;
|
||||
if (fmscansens > 10) fmscansens = 1;
|
||||
tftPrint(1, String(fmscansens), 155, 118, PrimaryColor, PrimaryColorSmooth, 28);
|
||||
break;
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1539,6 +1547,17 @@ void MenuDown() {
|
||||
if (HighCutOffset != 0) tftPrint(1, String(HighCutOffset, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28);
|
||||
radio.setHighCutOffset(HighCutOffset);
|
||||
break;
|
||||
|
||||
case ITEM7:
|
||||
tftPrint(0, myLanguage[language][199], 155, 78, ActiveColor, ActiveColorSmooth, 28);
|
||||
if (fmdeemphasis != DEEMPHASIS_NONE) tftPrint(1, String((fmdeemphasis == DEEMPHASIS_50 ? FM_DEEMPHASIS_50 : FM_DEEMPHASIS_75), DEC), 155, 118, BackgroundColor, BackgroundColor, 28); else tftPrint(1, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, 28);
|
||||
if (fmdeemphasis != DEEMPHASIS_NONE) tftPrint(-1, "μs", 170, 118, BackgroundColor, BackgroundColor, 28);
|
||||
fmdeemphasis--;
|
||||
if (fmdeemphasis > DEEMPHASIS_COUNT - 1) fmdeemphasis = DEEMPHASIS_COUNT - 1;
|
||||
if (fmdeemphasis != DEEMPHASIS_NONE) tftPrint(1, String((fmdeemphasis == DEEMPHASIS_50 ? FM_DEEMPHASIS_50 : FM_DEEMPHASIS_75), DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(1, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28);
|
||||
if (fmdeemphasis != DEEMPHASIS_NONE) tftPrint(-1, "μs", 170, 118, ActiveColor, PrimaryColorSmooth, 28);
|
||||
radio.setDeemphasis(fmdeemphasis);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1832,16 +1851,11 @@ void MenuDown() {
|
||||
break;
|
||||
|
||||
case ITEM10:
|
||||
tftPrint(0, myLanguage[language][199], 155, 78, ActiveColor, ActiveColorSmooth, 28);
|
||||
if (fmdeemphasis != DEEMPHASIS_NONE) tftPrint(1, String((fmdeemphasis == DEEMPHASIS_50 ? FM_DEEMPHASIS_50 : FM_DEEMPHASIS_75), DEC), 155, 118, BackgroundColor, BackgroundColor, 28); else tftPrint(1, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, 28);
|
||||
if (fmdeemphasis != DEEMPHASIS_NONE) tftPrint(-1, "μs", 170, 118, BackgroundColor, BackgroundColor, 28);
|
||||
fmdeemphasis--;
|
||||
if (fmdeemphasis > DEEMPHASIS_COUNT - 1) fmdeemphasis = DEEMPHASIS_COUNT - 1;
|
||||
if (fmdeemphasis != DEEMPHASIS_NONE) tftPrint(1, String((fmdeemphasis == DEEMPHASIS_50 ? FM_DEEMPHASIS_50 : FM_DEEMPHASIS_75), DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(1, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28);
|
||||
if (fmdeemphasis != DEEMPHASIS_NONE) tftPrint(-1, "μs", 170, 118, ActiveColor, PrimaryColorSmooth, 28);
|
||||
radio.setDeemphasis(fmdeemphasis);
|
||||
tftPrint(1, String(fmscansens), 155, 118, BackgroundColor, BackgroundColor, 28);
|
||||
fmscansens--;
|
||||
if (fmscansens == 0) fmscansens = 10;
|
||||
tftPrint(1, String(fmscansens), 155, 118, PrimaryColor, PrimaryColorSmooth, 28);
|
||||
break;
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -2135,6 +2149,12 @@ void DoMenu() {
|
||||
if (HighCutOffset != 0) tftPrint(-1, "dBμV", 170, 118, ActiveColor, ActiveColorSmooth, 28);
|
||||
if (HighCutOffset != 0) tftPrint(1, String(HighCutOffset, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(0, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28);
|
||||
break;
|
||||
|
||||
case ITEM7:
|
||||
Infoboxprint(myLanguage[language][199]);
|
||||
if (fmdeemphasis != DEEMPHASIS_NONE) tftPrint(1, String((fmdeemphasis == DEEMPHASIS_50 ? FM_DEEMPHASIS_50 : FM_DEEMPHASIS_75), DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(1, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28);
|
||||
if (fmdeemphasis != DEEMPHASIS_NONE) tftPrint(-1, "μs", 170, 118, ActiveColor, PrimaryColorSmooth, 28);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -2331,11 +2351,9 @@ void DoMenu() {
|
||||
break;
|
||||
|
||||
case ITEM10:
|
||||
Infoboxprint(myLanguage[language][199]);
|
||||
if (fmdeemphasis != DEEMPHASIS_NONE) tftPrint(1, String((fmdeemphasis == DEEMPHASIS_50 ? FM_DEEMPHASIS_50 : FM_DEEMPHASIS_75), DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(1, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28);
|
||||
if (fmdeemphasis != DEEMPHASIS_NONE) tftPrint(-1, "μs", 170, 118, ActiveColor, PrimaryColorSmooth, 28);
|
||||
Infoboxprint(myLanguage[language][207]);
|
||||
tftPrint (1, String(fmscansens), 155, 118, PrimaryColor, PrimaryColorSmooth, 28);
|
||||
break;
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -2496,4 +2514,4 @@ void Infoboxprint(const char* input) {
|
||||
} else {
|
||||
tftPrint(0, input, 155, 78, ActiveColor, ActiveColorSmooth, 28);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user