Add AM antenna attenuation

This commit is contained in:
ohmytime
2023-08-15 20:32:17 +08:00
parent a2a67023b2
commit ea425c7417
7 changed files with 14896 additions and 14485 deletions
+9 -1
View File
@@ -133,6 +133,7 @@ byte fmdefaultstepsize;
byte fmnb;
byte amcodect;
byte amcodectcount;
byte amrfagc;
byte freqoldcount;
byte HighCutLevel;
byte HighCutOffset;
@@ -408,6 +409,7 @@ void setup() {
batteryoptions = EEPROM.readByte(EE_BYTE_BATTERY_OPTIONS);
amcodect = EEPROM.readByte(EE_BYTE_AM_CO_DECT);
amcodectcount = EEPROM.readByte(EE_BYTE_AM_CO_DECT_COUNT);
amrfagc = EEPROM.readByte(EE_BYTE_AM_RF_AGC);
radio.rds.sortaf = EEPROM.readByte(EE_BYTE_SORTAF);
stationlistid = EEPROM.readByte(EE_BYTE_STATIONLISTID);
@@ -631,7 +633,10 @@ void setup() {
radio.setVolume(VolSet);
radio.setOffset(LevelOffset);
radio.setAMOffset(AMLevelOffset);
radio.setAMCoChannel(amcodect, amcodectcount);
if (band > BAND_GAP) {
radio.setAMCoChannel(amcodect, amcodectcount);
radio.setAMAttenuation(amrfagc);
}
radio.setStereoLevel(StereoLevel);
radio.setHighCutLevel(HighCutLevel);
radio.setHighCutOffset(HighCutOffset);
@@ -1602,6 +1607,8 @@ void SelectBand() {
LimitAMFrequency();
CheckBandForbiddenAM();
radio.SetFreqAM(frequency_AM);
radio.setAMAttenuation(amrfagc);
radio.setAMCoChannel(amcodect, amcodectcount);
doBW();
if (!screenmute) {
BuildDisplay();
@@ -1789,6 +1796,7 @@ void ModeButtonPress() {
EEPROM.writeByte(EE_BYTE_BATTERY_OPTIONS, batteryoptions);
EEPROM.writeByte(EE_BYTE_AM_CO_DECT, amcodect);
EEPROM.writeByte(EE_BYTE_AM_CO_DECT_COUNT, amcodectcount);
EEPROM.writeByte(EE_BYTE_AM_RF_AGC, amrfagc);
EEPROM.writeByte(EE_BYTE_SORTAF, radio.rds.sortaf);
EEPROM.writeByte(EE_BYTE_STATIONLISTID, stationlistid);
EEPROM.commit();
+4108 -4011
View File
File diff suppressed because it is too large Load Diff
+10709 -10452
View File
File diff suppressed because it is too large Load Diff
+3 -2
View File
@@ -101,9 +101,9 @@
// EEPROM index defines
#define EE_PRESETS_CNT 30
#define EE_CHECKBYTE_VALUE 16 // 0 ~ 255,add new entry, change for new value
#define EE_CHECKBYTE_VALUE 18 // 0 ~ 255,add new entry, change for new value
#define EE_TOTAL_CNT 276
#define EE_TOTAL_CNT 277
#define EE_UINT16_FREQUENCY_FM 0
#define EE_BYTE_VOLSET 4
#define EE_BYTE_STEREO 5
@@ -174,6 +174,7 @@
#define EE_BYTE_BATTERY_OPTIONS 273
#define EE_BYTE_AM_CO_DECT 274
#define EE_BYTE_AM_CO_DECT_COUNT 275
#define EE_BYTE_AM_RF_AGC 276
// End of EEPROM index defines
static const char* const unitString[] = {"dBμV", "dBf", "dBm"};
+32 -1
View File
@@ -6,7 +6,7 @@
#include <EEPROM.h>
byte menuitem;
byte items[8] = {8, 2, 6, 9, 8, 9, 7, 5};
byte items[8] = {8, 2, 6, 9, 8, 9, 8, 5};
void doTheme() { // Use this to put your own colors in: http://www.barth-dev.de/online/rgb565-color-picker/
switch (CurrentTheme) {
@@ -511,6 +511,7 @@ void BuildMenu() {
tftPrint(-1, myLanguage[language][59], 8, ITEM5 + 6, ActiveColor, ActiveColorSmooth, 16);
tftPrint(-1, myLanguage[language][185], 8, ITEM6 + 6, ActiveColor, ActiveColorSmooth, 16);
tftPrint(-1, myLanguage[language][187], 8, ITEM7 + 6, ActiveColor, ActiveColorSmooth, 16);
tftPrint(-1, myLanguage[language][198], 8, ITEM8 + 6, ActiveColor, ActiveColorSmooth, 16);
if (softmuteam) tftPrint(1, myLanguage[language][42], 310, ITEM1 + 6, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(1, myLanguage[language][30], 310, ITEM1 + 6, PrimaryColor, PrimaryColorSmooth, 16);
@@ -518,6 +519,7 @@ void BuildMenu() {
if (amnb != 0) tftPrint(1, String(amnb, DEC), 270, ITEM2 + 6, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(1, myLanguage[language][30], 310, ITEM2 + 6, PrimaryColor, PrimaryColorSmooth, 16);
tftPrint(1, "dB", 310, ITEM3 + 6, ActiveColor, ActiveColorSmooth, 16);
if (AMLevelOffset > 0) tftPrint(1, "+" + String(AMLevelOffset, DEC), 270, ITEM3 + 6, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(1, String(AMLevelOffset, DEC), 270, ITEM3 + 6, PrimaryColor, PrimaryColorSmooth, 16);
if (amrfagc != 0) tftPrint(1, "dB", 310, ITEM8 + 6, ActiveColor, ActiveColorSmooth, 16); else tftPrint(1, myLanguage[language][30], 310, ITEM8 + 6, ActiveColor, ActiveColorSmooth, 16);
switch (bandAM) {
case AM_BAND_ALL: tftPrint(1, myLanguage[language][102] + String(",") + myLanguage[language][103] + String(",") + myLanguage[language][104], 310, ITEM4 + 6, PrimaryColor, PrimaryColorSmooth, 16); break;
@@ -533,6 +535,7 @@ void BuildMenu() {
if (amcodect != 0) tftPrint(1, "%", 310, ITEM6 + 6, ActiveColor, ActiveColorSmooth, 16); else tftPrint(1, myLanguage[language][30], 310, ITEM6 + 6, ActiveColor, ActiveColorSmooth, 16);
if (amcodect != 0) tftPrint(1, String(amcodect, DEC), 270, ITEM6 + 6, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(1, myLanguage[language][30], 310, ITEM6 + 6, PrimaryColor, PrimaryColorSmooth, 16);
tftPrint(1, String(amcodectcount, DEC), 310, ITEM7 + 6, PrimaryColor, PrimaryColorSmooth, 16);
if (amrfagc != 0) tftPrint(1, String(amrfagc, DEC), 270, ITEM8 + 6, PrimaryColor, PrimaryColorSmooth, 16);
break;
case CONNECTIVITY:
@@ -1233,6 +1236,17 @@ void MenuUp() {
tftPrint(0, String(amcodectcount, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28);
if (band > BAND_GAP) radio.setAMCoChannel(amcodect, amcodectcount);
break;
case ITEM8:
if (amrfagc != 0) tftPrint(1, String(amrfagc, DEC), 155, 118, BackgroundColor, BackgroundColor, 28); else tftPrint(1, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, 28);
if (amrfagc != 0) tftPrint(-1, "dB", 170, 118, BackgroundColor, BackgroundColor, 28);
amrfagc += 6;
if (amrfagc > 36) amrfagc = 0;
if (amrfagc != 0) tftPrint(1, String(amrfagc, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(1, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28);
if (amrfagc != 0) tftPrint(-1, "dB", 170, 118, PrimaryColor, PrimaryColorSmooth, 28);
if (band > BAND_GAP) radio.setAMAttenuation(amrfagc);
break;
}
break;
@@ -1702,6 +1716,17 @@ void MenuDown() {
tftPrint(0, String(amcodectcount, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28);
if (band > BAND_GAP) radio.setAMCoChannel(amcodect, amcodectcount);
break;
case ITEM8:
if (amrfagc != 0) tftPrint(1, String(amrfagc, DEC), 155, 118, BackgroundColor, BackgroundColor, 28); else tftPrint(1, myLanguage[language][30], 155, 118, BackgroundColor, BackgroundColor, 28);
if (amrfagc != 0) tftPrint(-1, "dB", 170, 118, BackgroundColor, BackgroundColor, 28);
amrfagc -= 6;
if (amrfagc > 36) amrfagc = 36;
if (amrfagc != 0) tftPrint(1, String(amrfagc, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(1, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28);
if (amrfagc != 0) tftPrint(-1, "dB", 170, 118, PrimaryColor, PrimaryColorSmooth, 28);
if (band > BAND_GAP) radio.setAMAttenuation(amrfagc);
break;
}
break;
@@ -2100,6 +2125,12 @@ void DoMenu() {
tftPrint(0, String(amcodectcount, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28);
break;
case ITEM8:
tftPrint(0, myLanguage[language][198], 155, 78, ActiveColor, ActiveColorSmooth, 28);
if (amrfagc != 0) tftPrint(-1, "dB", 170, 118, PrimaryColor, PrimaryColorSmooth, 28);
if (amrfagc != 0) tftPrint(1, String(amrfagc, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(1, myLanguage[language][30], 155, 118, PrimaryColor, PrimaryColorSmooth, 28);
break;
}
break;
+1
View File
@@ -78,6 +78,7 @@ extern byte fmdefaultstepsize;
extern byte fmnb;
extern byte amcodect;
extern byte amcodectcount;
extern byte amrfagc;
extern byte hardwaremodel;
extern byte hardwaremodelold;
extern byte HighCutLevel;
+34 -18
View File
@@ -1,6 +1,6 @@
// [number of languages][number of texts]
static const char* const myLanguage[16][198] = {
static const char* const myLanguage[16][199] = {
{ "English", // English
"Rotary direction changed", // 1
"Please release button", // 2
@@ -198,7 +198,8 @@ static const char* const myLanguage[16][198] = {
"AM", // 194
"CONNECT", // 195
"Auto sort AF", // 196
"Stationlist ID" // 197
"Stationlist ID", // 197
"AM antenna attenuation" // 198
},
{ "Nederlands", // Dutch
@@ -398,7 +399,8 @@ static const char* const myLanguage[16][198] = {
"AM", // 194
"VERBIND", // 195
"Auto AF sorteren", // 196
"Stationlist ID" // 197
"Stationlist ID", // 197
"AM antenna attenuation" // 198
},
{ "Polski", // Polish
@@ -598,7 +600,8 @@ static const char* const myLanguage[16][198] = {
"AM", // 194
"LACZNOSC", // 195
"Automat. sortowanie AF", // 196
"Stationlist ID" // 197
"Stationlist ID", // 197
"AM antenna attenuation" // 198
},
{ "Hrvatski", // Croatian
@@ -798,7 +801,8 @@ static const char* const myLanguage[16][198] = {
"AM", // 194
"CONNECT", // 195
"Auto sort AF", // 196
"Stationlist ID" // 197
"Stationlist ID", // 197
"AM antenna attenuation" // 198
},
{ "Ελληνικά", // Greek
@@ -998,7 +1002,8 @@ static const char* const myLanguage[16][198] = {
"AM", // 194
"ΣΥΝΔΕΣΗ", // 195
"Αυτόματη ταξινόμηση AF", // 196
"ID λίστας σταθμών" // 197
"ID λίστας σταθμών", // 197
"AM antenna attenuation" // 198
},
{ "Romana", // Romanian
@@ -1198,7 +1203,8 @@ static const char* const myLanguage[16][198] = {
"AM", // 194
"CONNECT", // 195
"Auto sort AF", // 196
"Stationlist ID" // 197
"Stationlist ID", // 197
"AM antenna attenuation" // 198
},
{ "Deutsch", // German
@@ -1398,7 +1404,8 @@ static const char* const myLanguage[16][198] = {
"AM", // 194
"CONNECT", // 195
"Auto sort AF", // 196
"Stationlist ID" // 197
"Stationlist ID", // 197
"AM antenna attenuation" // 198
},
{ "Czech", // Czech
@@ -1598,7 +1605,8 @@ static const char* const myLanguage[16][198] = {
"AM", // 194
"CONNECT", // 195
"Auto sort AF", // 196
"Stationlist ID" // 197
"Stationlist ID", // 197
"AM antenna attenuation" // 198
},
{ "Slovak", // Slovak
@@ -1798,7 +1806,8 @@ static const char* const myLanguage[16][198] = {
"AM", // 194
"CONNECT", // 195
"Auto sort AF", // 196
"Stationlist ID" // 197
"Stationlist ID", // 197
"AM antenna attenuation" // 198
},
{ "Français", // French
@@ -1998,7 +2007,8 @@ static const char* const myLanguage[16][198] = {
"AM", // 194
"CONNECT", // 195
"Auto sort AF", // 196
"Stationlist ID" // 197
"Stationlist ID", // 197
"AM antenna attenuation" // 198
},
{ "Български", // Bulgarian
@@ -2198,7 +2208,8 @@ static const char* const myLanguage[16][198] = {
"AM", // 194
"CONNECT", // 195
"Auto sort AF", // 196
"Stationlist ID" // 197
"Stationlist ID", // 197
"AM antenna attenuation" // 198
},
{ "Русский", // Russian
@@ -2398,7 +2409,8 @@ static const char* const myLanguage[16][198] = {
"AM", // 194
"ПОДКЛЮЧЕНИЕ", // 195
"Auto sort AF", // 196
"Stationlist ID" // 197
"Stationlist ID", // 197
"AM antenna attenuation" // 198
},
{ "Українська", // Ukranian
@@ -2598,7 +2610,8 @@ static const char* const myLanguage[16][198] = {
"AM", // 194
"ПІДКЛЮЧЕННЯ", // 195
"Auto sort AF", // 196
"Stationlist ID" // 197
"Stationlist ID", // 197
"AM antenna attenuation" // 198
},
{ "Italiano", // Italian
@@ -2798,7 +2811,8 @@ static const char* const myLanguage[16][198] = {
"AM", // 194
"CONNECT", // 195
"Auto sort AF", // 196
"Stationlist ID" // 197
"Stationlist ID", // 197
"AM antenna attenuation" // 198
},
{ "Simplified Chinese", // Simplified Chinese
@@ -2997,8 +3011,9 @@ static const char* const myLanguage[16][198] = {
"FM", // 193
"AM", // 194
"CONNECT", // 195
"Auto sort AF", // 196
"Stationlist ID" // 197
"自动排列AF", // 196
"Stationlist ID", // 197
"AM天线放大" // 198
},
{ "Norsk", // Norwegian
@@ -3198,7 +3213,8 @@ static const char* const myLanguage[16][198] = {
"AM", // 194
"TILKOBLE", // 195
"Auto sort AF", // 196
"Stationlist ID" // 197
"Stationlist ID", // 197
"AM antenna attenuation" // 198
}
};