Added 200kHz stepsize for FM

This commit is contained in:
Sjef Verhoeven PE5PVB
2023-10-23 20:44:56 +02:00
parent 6175976359
commit 4f73645364
3 changed files with 66 additions and 18 deletions
+23 -3
View File
@@ -1946,6 +1946,14 @@ void Round100K(unsigned int freq) {
}
}
void Round200K(unsigned int freq) {
if (freq % 10 < 5) {
frequency = (freq - freq % 10);
} else {
frequency = (freq - (freq % 10) + 10);
if ((freq % 10) % 2 != 0) frequency += 10;
}
}
void Round5K(unsigned int freqAM) {
if (freqAM % 10 < 3) {
frequency_AM = (freqAM - freqAM % 10);
@@ -1959,7 +1967,11 @@ void Round5K(unsigned int freqAM) {
void RoundStep() {
if (band == BAND_FM) {
unsigned int freq = frequency;
if (fmdefaultstepsize == 1) Round100K(freq); else Round50K(freq);
switch (fmdefaultstepsize) {
case 0: Round50K(freq); break;
case 1: Round100K(freq); break;
case 2: Round200K(freq); break;
}
radio.SetFreq(frequency);
} else if (band == BAND_OIRT) {
Round30K(frequency_OIRT);
@@ -3035,7 +3047,11 @@ void TuneUp() {
if (band == BAND_OIRT) {
temp = FREQ_OIRT_STEP_30K;
} else {
if (fmdefaultstepsize == 1) temp = FREQ_FM_STEP_100K; else temp = FREQ_FM_STEP_50K;
switch (fmdefaultstepsize) {
case 0: temp = FREQ_FM_STEP_50K; break;
case 1: temp = FREQ_FM_STEP_100K; break;
case 2: temp = FREQ_FM_STEP_200K; break;
}
}
}
}
@@ -3110,7 +3126,11 @@ void TuneDown() {
if (band == BAND_OIRT) {
temp = FREQ_OIRT_STEP_30K;
} else {
if (fmdefaultstepsize == 1) temp = FREQ_FM_STEP_100K; else temp = FREQ_FM_STEP_50K;
switch (fmdefaultstepsize) {
case 0: temp = FREQ_FM_STEP_50K; break;
case 1: temp = FREQ_FM_STEP_100K; break;
case 2: temp = FREQ_FM_STEP_200K; break;
}
}
}
}
+1
View File
@@ -32,6 +32,7 @@
#define FREQ_OIRT_STEP_30K 3
#define FREQ_FM_STEP_50K 5
#define FREQ_FM_STEP_100K 10
#define FREQ_FM_STEP_200K 20
#define FREQ_LW_LOW_EDGE_MIN 144
#define FREQ_LW_HIGH_EDGE_MAX 519
+35 -8
View File
@@ -518,7 +518,12 @@ void BuildMenu() {
if (fmnb != 0) tftPrint(1, "%", 310, ITEM7 + 6, ActiveColor, ActiveColorSmooth, 16); else tftPrint(1, myLanguage[language][30], 310, ITEM7 + 6, ActiveColor, ActiveColorSmooth, 16);
if (fmnb != 0) tftPrint(1, String(fmnb, DEC), 270, ITEM7 + 6, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(1, myLanguage[language][30], 310, ITEM7 + 6, PrimaryColor, PrimaryColorSmooth, 16);
tftPrint(1, "KHz", 310, ITEM8 + 6, ActiveColor, ActiveColorSmooth, 16);
if (fmdefaultstepsize) tftPrint(1, String(FREQ_FM_STEP_100K * 10, DEC), 270, ITEM8 + 6, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(1, String(FREQ_FM_STEP_50K * 10, DEC), 270, ITEM8 + 6, PrimaryColor, PrimaryColorSmooth, 16);
switch (fmdefaultstepsize) {
case 0: tftPrint(1, String(FREQ_FM_STEP_50K * 10, DEC), 270, ITEM8 + 6, PrimaryColor, PrimaryColorSmooth, 16); break;
case 1: tftPrint(1, String(FREQ_FM_STEP_100K * 10, DEC), 270, ITEM8 + 6, PrimaryColor, PrimaryColorSmooth, 16); break;
case 2: tftPrint(1, String(FREQ_FM_STEP_200K * 10, DEC), 270, ITEM8 + 6, PrimaryColor, PrimaryColorSmooth, 16); break;
}
switch (bandFM) {
case FM_BAND_ALL: tftPrint(1, myLanguage[language][105] + String(",") + myLanguage[language][106], 310, ITEM9 + 6, PrimaryColor, PrimaryColorSmooth, 16); break;
@@ -1225,9 +1230,18 @@ void MenuUp() {
break;
case ITEM8:
if (fmdefaultstepsize) tftPrint(1, String(FREQ_FM_STEP_100K * 10, DEC), 155, 118, BackgroundColor, BackgroundColor, 28); else tftPrint(1, String(FREQ_FM_STEP_50K * 10, DEC), 155, 118, BackgroundColor, BackgroundColor, 28);
if (fmdefaultstepsize) fmdefaultstepsize = 0; else fmdefaultstepsize = 1;
if (fmdefaultstepsize) tftPrint(1, String(FREQ_FM_STEP_100K * 10, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(1, String(FREQ_FM_STEP_50K * 10, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28);
switch (fmdefaultstepsize) {
case 0: tftPrint(1, String(FREQ_FM_STEP_50K * 10, DEC), 155, 118, BackgroundColor, BackgroundColor, 28); break;
case 1: tftPrint(1, String(FREQ_FM_STEP_100K * 10, DEC), 155, 118, BackgroundColor, BackgroundColor, 28); break;
case 2: tftPrint(1, String(FREQ_FM_STEP_200K * 10, DEC), 155, 118, BackgroundColor, BackgroundColor, 28); break;
}
fmdefaultstepsize++;
if (fmdefaultstepsize > 2) fmdefaultstepsize = 0;
switch (fmdefaultstepsize) {
case 0: tftPrint(1, String(FREQ_FM_STEP_50K * 10, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break;
case 1: tftPrint(1, String(FREQ_FM_STEP_100K * 10, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break;
case 2: tftPrint(1, String(FREQ_FM_STEP_200K * 10, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break;
}
break;
case ITEM9:
@@ -1776,9 +1790,18 @@ void MenuDown() {
break;
case ITEM8:
if (fmdefaultstepsize) tftPrint(1, String(FREQ_FM_STEP_100K * 10, DEC), 155, 118, BackgroundColor, BackgroundColor, 28); else tftPrint(1, String(FREQ_FM_STEP_50K * 10, DEC), 155, 118, BackgroundColor, BackgroundColor, 28);
if (fmdefaultstepsize) fmdefaultstepsize = 0; else fmdefaultstepsize = 1;
if (fmdefaultstepsize) tftPrint(1, String(FREQ_FM_STEP_100K * 10, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(1, String(FREQ_FM_STEP_50K * 10, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28);
switch (fmdefaultstepsize) {
case 0: tftPrint(1, String(FREQ_FM_STEP_50K * 10, DEC), 155, 118, BackgroundColor, BackgroundColor, 28); break;
case 1: tftPrint(1, String(FREQ_FM_STEP_100K * 10, DEC), 155, 118, BackgroundColor, BackgroundColor, 28); break;
case 2: tftPrint(1, String(FREQ_FM_STEP_200K * 10, DEC), 155, 118, BackgroundColor, BackgroundColor, 28); break;
}
fmdefaultstepsize--;
if (fmdefaultstepsize > 2) fmdefaultstepsize = 2;
switch (fmdefaultstepsize) {
case 0: tftPrint(1, String(FREQ_FM_STEP_50K * 10, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break;
case 1: tftPrint(1, String(FREQ_FM_STEP_100K * 10, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break;
case 2: tftPrint(1, String(FREQ_FM_STEP_200K * 10, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break;
}
break;
case ITEM9:
@@ -2267,7 +2290,11 @@ void DoMenu() {
case ITEM8:
tftPrint(-1, "KHz", 170, 118, ActiveColor, ActiveColorSmooth, 28);
tftPrint(0, myLanguage[language][90], 155, 78, ActiveColor, ActiveColorSmooth, 28);
if (fmdefaultstepsize) tftPrint(1, String(FREQ_FM_STEP_100K * 10, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); else tftPrint(1, String(FREQ_FM_STEP_50K * 10, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28);
switch (fmdefaultstepsize) {
case 0: tftPrint(1, String(FREQ_FM_STEP_50K * 10, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break;
case 1: tftPrint(1, String(FREQ_FM_STEP_100K * 10, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break;
case 2: tftPrint(1, String(FREQ_FM_STEP_200K * 10, DEC), 155, 118, PrimaryColor, PrimaryColorSmooth, 28); break;
}
break;
case ITEM9: