Added 200kHz stepsize for FM
This commit is contained in:
+23
-3
@@ -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) {
|
void Round5K(unsigned int freqAM) {
|
||||||
if (freqAM % 10 < 3) {
|
if (freqAM % 10 < 3) {
|
||||||
frequency_AM = (freqAM - freqAM % 10);
|
frequency_AM = (freqAM - freqAM % 10);
|
||||||
@@ -1959,7 +1967,11 @@ void Round5K(unsigned int freqAM) {
|
|||||||
void RoundStep() {
|
void RoundStep() {
|
||||||
if (band == BAND_FM) {
|
if (band == BAND_FM) {
|
||||||
unsigned int freq = frequency;
|
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);
|
radio.SetFreq(frequency);
|
||||||
} else if (band == BAND_OIRT) {
|
} else if (band == BAND_OIRT) {
|
||||||
Round30K(frequency_OIRT);
|
Round30K(frequency_OIRT);
|
||||||
@@ -3035,7 +3047,11 @@ void TuneUp() {
|
|||||||
if (band == BAND_OIRT) {
|
if (band == BAND_OIRT) {
|
||||||
temp = FREQ_OIRT_STEP_30K;
|
temp = FREQ_OIRT_STEP_30K;
|
||||||
} else {
|
} 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) {
|
if (band == BAND_OIRT) {
|
||||||
temp = FREQ_OIRT_STEP_30K;
|
temp = FREQ_OIRT_STEP_30K;
|
||||||
} else {
|
} 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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
#define FREQ_OIRT_STEP_30K 3
|
#define FREQ_OIRT_STEP_30K 3
|
||||||
#define FREQ_FM_STEP_50K 5
|
#define FREQ_FM_STEP_50K 5
|
||||||
#define FREQ_FM_STEP_100K 10
|
#define FREQ_FM_STEP_100K 10
|
||||||
|
#define FREQ_FM_STEP_200K 20
|
||||||
|
|
||||||
#define FREQ_LW_LOW_EDGE_MIN 144
|
#define FREQ_LW_LOW_EDGE_MIN 144
|
||||||
#define FREQ_LW_HIGH_EDGE_MAX 519
|
#define FREQ_LW_HIGH_EDGE_MAX 519
|
||||||
|
|||||||
+42
-15
@@ -384,7 +384,7 @@ void BuildMenu() {
|
|||||||
tftPrint(-1, myLanguage[language][68], 8, ITEM2 + 6, ActiveColor, ActiveColorSmooth, 16);
|
tftPrint(-1, myLanguage[language][68], 8, ITEM2 + 6, ActiveColor, ActiveColorSmooth, 16);
|
||||||
tftPrint(-1, myLanguage[language][206], 8, ITEM3 + 6, ActiveColor, ActiveColorSmooth, 16);
|
tftPrint(-1, myLanguage[language][206], 8, ITEM3 + 6, ActiveColor, ActiveColorSmooth, 16);
|
||||||
|
|
||||||
tftPrint(1, "Mhz", 310, ITEM3 + 6, ActiveColor, ActiveColorSmooth, 16);
|
tftPrint(1, "Mhz", 310, ITEM3 + 6, ActiveColor, ActiveColorSmooth, 16);
|
||||||
|
|
||||||
switch (hardwaremodel) {
|
switch (hardwaremodel) {
|
||||||
case BASE_ILI9341: tftPrint(1, myLanguage[language][109], 310, ITEM1 + 6, PrimaryColor, PrimaryColorSmooth, 16); break;
|
case BASE_ILI9341: tftPrint(1, myLanguage[language][109], 310, ITEM1 + 6, PrimaryColor, PrimaryColorSmooth, 16); break;
|
||||||
@@ -393,7 +393,7 @@ void BuildMenu() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (spispeed == SPI_SPEED_DEFAULT) tftPrint(1, myLanguage[language][78] + String(SPI_FREQUENCY / 1000000, DEC), 270, ITEM3 + 6, PrimaryColor, PrimaryColorSmooth, 16);
|
if (spispeed == SPI_SPEED_DEFAULT) tftPrint(1, myLanguage[language][78] + String(SPI_FREQUENCY / 1000000, DEC), 270, ITEM3 + 6, PrimaryColor, PrimaryColorSmooth, 16);
|
||||||
else tftPrint(1, String(spispeed * 10 ,DEC), 270, ITEM3 + 6, PrimaryColor, PrimaryColorSmooth, 16);
|
else tftPrint(1, String(spispeed * 10 , DEC), 270, ITEM3 + 6, PrimaryColor, PrimaryColorSmooth, 16);
|
||||||
|
|
||||||
if (touchrotating) tftPrint(1, myLanguage[language][42], 310, ITEM2 + 6, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(1, myLanguage[language][30], 310, ITEM2 + 6, PrimaryColor, PrimaryColorSmooth, 16);
|
if (touchrotating) tftPrint(1, myLanguage[language][42], 310, ITEM2 + 6, PrimaryColor, PrimaryColorSmooth, 16); else tftPrint(1, myLanguage[language][30], 310, ITEM2 + 6, PrimaryColor, PrimaryColorSmooth, 16);
|
||||||
break;
|
break;
|
||||||
@@ -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, "%", 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);
|
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);
|
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) {
|
switch (bandFM) {
|
||||||
case FM_BAND_ALL: tftPrint(1, myLanguage[language][105] + String(",") + myLanguage[language][106], 310, ITEM9 + 6, PrimaryColor, PrimaryColorSmooth, 16); break;
|
case FM_BAND_ALL: tftPrint(1, myLanguage[language][105] + String(",") + myLanguage[language][106], 310, ITEM9 + 6, PrimaryColor, PrimaryColorSmooth, 16); break;
|
||||||
@@ -888,13 +893,13 @@ void MenuUp() {
|
|||||||
|
|
||||||
case ITEM3:
|
case ITEM3:
|
||||||
if (spispeed == SPI_SPEED_DEFAULT) tftPrint(0, myLanguage[language][78] + String(SPI_FREQUENCY / 1000000, DEC) + " Mhz", 155, 118, BackgroundColor, BackgroundColor, 28);
|
if (spispeed == SPI_SPEED_DEFAULT) tftPrint(0, myLanguage[language][78] + String(SPI_FREQUENCY / 1000000, DEC) + " Mhz", 155, 118, BackgroundColor, BackgroundColor, 28);
|
||||||
else tftPrint(0, String(spispeed * 10 ,DEC) + " Mhz", 155, 118, BackgroundColor, BackgroundColor, 28);
|
else tftPrint(0, String(spispeed * 10 , DEC) + " Mhz", 155, 118, BackgroundColor, BackgroundColor, 28);
|
||||||
|
|
||||||
spispeed++;
|
spispeed++;
|
||||||
if (spispeed > SPI_SPEED_COUNT - 1) spispeed = 0;
|
if (spispeed > SPI_SPEED_COUNT - 1) spispeed = 0;
|
||||||
|
|
||||||
if (spispeed == SPI_SPEED_DEFAULT) tftPrint(0, myLanguage[language][78] + String(SPI_FREQUENCY / 1000000, DEC) + " Mhz", 155, 118, PrimaryColor, PrimaryColorSmooth, 28);
|
if (spispeed == SPI_SPEED_DEFAULT) tftPrint(0, myLanguage[language][78] + String(SPI_FREQUENCY / 1000000, DEC) + " Mhz", 155, 118, PrimaryColor, PrimaryColorSmooth, 28);
|
||||||
else tftPrint(0, String(spispeed * 10 ,DEC) + " Mhz", 155, 118, PrimaryColor, PrimaryColorSmooth, 28);
|
else tftPrint(0, String(spispeed * 10 , DEC) + " Mhz", 155, 118, PrimaryColor, PrimaryColorSmooth, 28);
|
||||||
|
|
||||||
if (spispeed == SPI_SPEED_DEFAULT) SPI.setFrequency(SPI_FREQUENCY); else SPI.setFrequency(spispeed * 1000000);
|
if (spispeed == SPI_SPEED_DEFAULT) SPI.setFrequency(SPI_FREQUENCY); else SPI.setFrequency(spispeed * 1000000);
|
||||||
spispeedold = spispeed;
|
spispeedold = spispeed;
|
||||||
@@ -1225,9 +1230,18 @@ void MenuUp() {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case ITEM8:
|
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);
|
switch (fmdefaultstepsize) {
|
||||||
if (fmdefaultstepsize) fmdefaultstepsize = 0; else fmdefaultstepsize = 1;
|
case 0: tftPrint(1, String(FREQ_FM_STEP_50K * 10, DEC), 155, 118, BackgroundColor, BackgroundColor, 28); break;
|
||||||
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);
|
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;
|
break;
|
||||||
|
|
||||||
case ITEM9:
|
case ITEM9:
|
||||||
@@ -1438,13 +1452,13 @@ void MenuDown() {
|
|||||||
break;
|
break;
|
||||||
case ITEM3:
|
case ITEM3:
|
||||||
if (spispeed == SPI_SPEED_DEFAULT) tftPrint(0, myLanguage[language][78] + String(SPI_FREQUENCY / 1000000, DEC) + " Mhz", 155, 118, BackgroundColor, BackgroundColor, 28);
|
if (spispeed == SPI_SPEED_DEFAULT) tftPrint(0, myLanguage[language][78] + String(SPI_FREQUENCY / 1000000, DEC) + " Mhz", 155, 118, BackgroundColor, BackgroundColor, 28);
|
||||||
else tftPrint(0, String(spispeed * 10 ,DEC) + " Mhz", 155, 118, BackgroundColor, BackgroundColor, 28);
|
else tftPrint(0, String(spispeed * 10 , DEC) + " Mhz", 155, 118, BackgroundColor, BackgroundColor, 28);
|
||||||
|
|
||||||
spispeed--;
|
spispeed--;
|
||||||
if (spispeed > SPI_SPEED_COUNT - 1) spispeed = SPI_SPEED_COUNT - 1;
|
if (spispeed > SPI_SPEED_COUNT - 1) spispeed = SPI_SPEED_COUNT - 1;
|
||||||
|
|
||||||
if (spispeed == SPI_SPEED_DEFAULT) tftPrint(0, myLanguage[language][78] + String(SPI_FREQUENCY / 1000000, DEC) + " Mhz", 155, 118, PrimaryColor, PrimaryColorSmooth, 28);
|
if (spispeed == SPI_SPEED_DEFAULT) tftPrint(0, myLanguage[language][78] + String(SPI_FREQUENCY / 1000000, DEC) + " Mhz", 155, 118, PrimaryColor, PrimaryColorSmooth, 28);
|
||||||
else tftPrint(0, String(spispeed * 10 ,DEC) + " Mhz", 155, 118, PrimaryColor, PrimaryColorSmooth, 28);
|
else tftPrint(0, String(spispeed * 10 , DEC) + " Mhz", 155, 118, PrimaryColor, PrimaryColorSmooth, 28);
|
||||||
|
|
||||||
if (spispeed == SPI_SPEED_DEFAULT) SPI.setFrequency(SPI_FREQUENCY); else SPI.setFrequency(spispeed * 1000000);
|
if (spispeed == SPI_SPEED_DEFAULT) SPI.setFrequency(SPI_FREQUENCY); else SPI.setFrequency(spispeed * 1000000);
|
||||||
spispeedold = spispeed;
|
spispeedold = spispeed;
|
||||||
@@ -1776,9 +1790,18 @@ void MenuDown() {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case ITEM8:
|
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);
|
switch (fmdefaultstepsize) {
|
||||||
if (fmdefaultstepsize) fmdefaultstepsize = 0; else fmdefaultstepsize = 1;
|
case 0: tftPrint(1, String(FREQ_FM_STEP_50K * 10, DEC), 155, 118, BackgroundColor, BackgroundColor, 28); break;
|
||||||
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);
|
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;
|
break;
|
||||||
|
|
||||||
case ITEM9:
|
case ITEM9:
|
||||||
@@ -2048,7 +2071,7 @@ void DoMenu() {
|
|||||||
case ITEM3:
|
case ITEM3:
|
||||||
tftPrint(0, myLanguage[language][206], 155, 78, ActiveColor, ActiveColorSmooth, 28);
|
tftPrint(0, myLanguage[language][206], 155, 78, ActiveColor, ActiveColorSmooth, 28);
|
||||||
if (spispeed == SPI_SPEED_DEFAULT) tftPrint(0, myLanguage[language][78] + String(SPI_FREQUENCY / 1000000, DEC) + " Mhz", 155, 118, PrimaryColor, PrimaryColorSmooth, 28);
|
if (spispeed == SPI_SPEED_DEFAULT) tftPrint(0, myLanguage[language][78] + String(SPI_FREQUENCY / 1000000, DEC) + " Mhz", 155, 118, PrimaryColor, PrimaryColorSmooth, 28);
|
||||||
else tftPrint(0, String(spispeed * 10 ,DEC) + " Mhz", 155, 118, PrimaryColor, PrimaryColorSmooth, 28);
|
else tftPrint(0, String(spispeed * 10 , DEC) + " Mhz", 155, 118, PrimaryColor, PrimaryColorSmooth, 28);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -2267,7 +2290,11 @@ void DoMenu() {
|
|||||||
case ITEM8:
|
case ITEM8:
|
||||||
tftPrint(-1, "KHz", 170, 118, ActiveColor, ActiveColorSmooth, 28);
|
tftPrint(-1, "KHz", 170, 118, ActiveColor, ActiveColorSmooth, 28);
|
||||||
tftPrint(0, myLanguage[language][90], 155, 78, 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;
|
break;
|
||||||
|
|
||||||
case ITEM9:
|
case ITEM9:
|
||||||
|
|||||||
Reference in New Issue
Block a user