Optimised manual frequency input on DP-666. Added a time out and some small improvements.
This commit is contained in:
+42
-6
@@ -250,6 +250,7 @@ int ForceMono;
|
|||||||
int FrameColor;
|
int FrameColor;
|
||||||
int FreqColor;
|
int FreqColor;
|
||||||
int FreqColorSmooth;
|
int FreqColorSmooth;
|
||||||
|
int freq_in = 0;
|
||||||
int freqold;
|
int freqold;
|
||||||
int GreyoutColor;
|
int GreyoutColor;
|
||||||
int InsignificantColor;
|
int InsignificantColor;
|
||||||
@@ -398,6 +399,7 @@ unsigned long autosquelchtimer;
|
|||||||
unsigned long eonticker;
|
unsigned long eonticker;
|
||||||
unsigned long eontickerhold;
|
unsigned long eontickerhold;
|
||||||
unsigned long flashingtimer;
|
unsigned long flashingtimer;
|
||||||
|
unsigned long keypadtimer;
|
||||||
unsigned long lowsignaltimer;
|
unsigned long lowsignaltimer;
|
||||||
unsigned long ModulationpreviousMillis;
|
unsigned long ModulationpreviousMillis;
|
||||||
unsigned long ModulationpeakPreviousMillis;
|
unsigned long ModulationpeakPreviousMillis;
|
||||||
@@ -923,6 +925,11 @@ void loop() {
|
|||||||
if (millis() >= tottimer + totprobe) deepSleep();
|
if (millis() >= tottimer + totprobe) deepSleep();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (freq_in != 0 && millis() >= keypadtimer + 2000) {
|
||||||
|
freq_in = 0;
|
||||||
|
ShowFreq(0);
|
||||||
|
}
|
||||||
|
|
||||||
if (scandxmode) {
|
if (scandxmode) {
|
||||||
unsigned long waitTime = (scanhold == 0) ? 500 : (scanhold * 1000);
|
unsigned long waitTime = (scanhold == 0) ? 500 : (scanhold * 1000);
|
||||||
if (!scanholdflag) scanholdflag = (USN < fmscansens * 30) && (WAM < 230) && (OStatus < 80) && (OStatus > -80);
|
if (!scanholdflag) scanholdflag = (USN < fmscansens * 30) && (WAM < 230) && (OStatus < 80) && (OStatus > -80);
|
||||||
@@ -1054,6 +1061,7 @@ void loop() {
|
|||||||
if (advancedRDS) {
|
if (advancedRDS) {
|
||||||
leave = true;
|
leave = true;
|
||||||
BuildAdvancedRDS();
|
BuildAdvancedRDS();
|
||||||
|
freq_in = 0;
|
||||||
} else {
|
} else {
|
||||||
ShowFreq(0);
|
ShowFreq(0);
|
||||||
}
|
}
|
||||||
@@ -1845,9 +1853,11 @@ void BANDBUTTONPress() {
|
|||||||
if (afscreen) {
|
if (afscreen) {
|
||||||
leave = true;
|
leave = true;
|
||||||
BuildAdvancedRDS();
|
BuildAdvancedRDS();
|
||||||
|
freq_in = 0;
|
||||||
} else if (advancedRDS) {
|
} else if (advancedRDS) {
|
||||||
leave = true;
|
leave = true;
|
||||||
BuildDisplay();
|
BuildDisplay();
|
||||||
|
freq_in = 0;
|
||||||
SelectBand();
|
SelectBand();
|
||||||
ScreensaverTimerReopen();
|
ScreensaverTimerReopen();
|
||||||
} else {
|
} else {
|
||||||
@@ -1855,8 +1865,13 @@ void BANDBUTTONPress() {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (band < BAND_GAP) {
|
if (band < BAND_GAP) {
|
||||||
if (advancedRDS && !seek) BuildAFScreen();
|
if (advancedRDS && !seek) {
|
||||||
else BuildAdvancedRDS();
|
BuildAFScreen();
|
||||||
|
freq_in = 0;
|
||||||
|
} else {
|
||||||
|
BuildAdvancedRDS();
|
||||||
|
freq_in = 0;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
WakeToSleep(true);
|
WakeToSleep(true);
|
||||||
}
|
}
|
||||||
@@ -2271,7 +2286,10 @@ void ToggleSWMIBand(bool frequencyup) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SelectBand() {
|
void SelectBand() {
|
||||||
if (afscreen || advancedRDS) BuildDisplay();
|
if (afscreen || advancedRDS) {
|
||||||
|
BuildDisplay();
|
||||||
|
freq_in = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (band > BAND_GAP) {
|
if (band > BAND_GAP) {
|
||||||
if (!screenmute) tft.drawBitmap(92, 4, Speaker, 26, 22, GreyoutColor);
|
if (!screenmute) tft.drawBitmap(92, 4, Speaker, 26, 22, GreyoutColor);
|
||||||
@@ -2404,10 +2422,12 @@ void BWButtonPress() {
|
|||||||
doStereoToggle();
|
doStereoToggle();
|
||||||
} else {
|
} else {
|
||||||
BuildBWSelector();
|
BuildBWSelector();
|
||||||
|
freq_in = 0;
|
||||||
BWtune = true;
|
BWtune = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
BuildBWSelector();
|
BuildBWSelector();
|
||||||
|
freq_in = 0;
|
||||||
BWtune = true;
|
BWtune = true;
|
||||||
}
|
}
|
||||||
delay(100);
|
delay(100);
|
||||||
@@ -2453,11 +2473,13 @@ void ModeButtonPress() {
|
|||||||
if (!usesquelch) radio.setUnMute();
|
if (!usesquelch) radio.setUnMute();
|
||||||
if (advancedRDS) {
|
if (advancedRDS) {
|
||||||
BuildDisplay();
|
BuildDisplay();
|
||||||
|
freq_in = 0;
|
||||||
SelectBand();
|
SelectBand();
|
||||||
ScreensaverTimerReopen();
|
ScreensaverTimerReopen();
|
||||||
} else if (afscreen) {
|
} else if (afscreen) {
|
||||||
if (afpagenr == 1) afpagenr = 2; else if (afpagenr == 2 && afpage) afpagenr = 3; else afpagenr = 1;
|
if (afpagenr == 1) afpagenr = 2; else if (afpagenr == 2 && afpage) afpagenr = 3; else afpagenr = 1;
|
||||||
BuildAFScreen();
|
BuildAFScreen();
|
||||||
|
freq_in = 0;
|
||||||
} else {
|
} else {
|
||||||
if (!BWtune && !menu) {
|
if (!BWtune && !menu) {
|
||||||
if (!screenmute) {
|
if (!screenmute) {
|
||||||
@@ -2477,6 +2499,7 @@ void ModeButtonPress() {
|
|||||||
menuitem = 0;
|
menuitem = 0;
|
||||||
if (spispeed == 7) tft.setSPISpeed(40);
|
if (spispeed == 7) tft.setSPISpeed(40);
|
||||||
BuildMenu();
|
BuildMenu();
|
||||||
|
freq_in = 0;
|
||||||
menu = true;
|
menu = true;
|
||||||
ScreensaverTimerSet(OFF);
|
ScreensaverTimerSet(OFF);
|
||||||
}
|
}
|
||||||
@@ -2522,6 +2545,7 @@ void ModeButtonPress() {
|
|||||||
menupage = INDEX;
|
menupage = INDEX;
|
||||||
menuitem = 0;
|
menuitem = 0;
|
||||||
BuildMenu();
|
BuildMenu();
|
||||||
|
freq_in = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2637,6 +2661,7 @@ void ButtonPress() {
|
|||||||
if (!usesquelch) radio.setUnMute();
|
if (!usesquelch) radio.setUnMute();
|
||||||
if (advancedRDS) {
|
if (advancedRDS) {
|
||||||
BuildDisplay();
|
BuildDisplay();
|
||||||
|
freq_in = 0;
|
||||||
SelectBand();
|
SelectBand();
|
||||||
}
|
}
|
||||||
if (!BWtune && !menu) {
|
if (!BWtune && !menu) {
|
||||||
@@ -2741,6 +2766,7 @@ void ButtonPress() {
|
|||||||
if (menu) DoMenu();
|
if (menu) DoMenu();
|
||||||
if (BWtune) {
|
if (BWtune) {
|
||||||
BuildDisplay();
|
BuildDisplay();
|
||||||
|
freq_in = 0;
|
||||||
SelectBand();
|
SelectBand();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4327,14 +4353,18 @@ void MuteScreen(bool setting) {
|
|||||||
if (band < BAND_GAP) {
|
if (band < BAND_GAP) {
|
||||||
if (afscreen) {
|
if (afscreen) {
|
||||||
BuildAFScreen();
|
BuildAFScreen();
|
||||||
|
freq_in = 0;
|
||||||
} else if (advancedRDS) {
|
} else if (advancedRDS) {
|
||||||
BuildAdvancedRDS();
|
BuildAdvancedRDS();
|
||||||
|
freq_in = 0;
|
||||||
} else {
|
} else {
|
||||||
BuildDisplay();
|
BuildDisplay();
|
||||||
|
freq_in = 0;
|
||||||
SelectBand();
|
SelectBand();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
BuildDisplay();
|
BuildDisplay();
|
||||||
|
freq_in = 0;
|
||||||
SelectBand();
|
SelectBand();
|
||||||
}
|
}
|
||||||
setupmode = false;
|
setupmode = false;
|
||||||
@@ -4726,7 +4756,10 @@ void startFMDXScan() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (menu) endMenu();
|
if (menu) endMenu();
|
||||||
if (afscreen || advancedRDS) BuildDisplay();
|
if (afscreen || advancedRDS) {
|
||||||
|
BuildDisplay();
|
||||||
|
freq_in = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (memorypos > scanstop || memorypos < scanstart) memorypos = scanstart;
|
if (memorypos > scanstop || memorypos < scanstart) memorypos = scanstart;
|
||||||
scanmodeold = tunemode;
|
scanmodeold = tunemode;
|
||||||
@@ -5068,6 +5101,7 @@ int GetNum(void) {
|
|||||||
Wire.requestFrom(0x20, 2);
|
Wire.requestFrom(0x20, 2);
|
||||||
|
|
||||||
if (Wire.available() == 2) {
|
if (Wire.available() == 2) {
|
||||||
|
keypadtimer = millis();
|
||||||
temp = Wire.read() & 0xFF;
|
temp = Wire.read() & 0xFF;
|
||||||
temp |= (Wire.read() & 0xFF) * 256;
|
temp |= (Wire.read() & 0xFF) * 256;
|
||||||
for (int i = 0; i < 16; i++) {
|
for (int i = 0; i < 16; i++) {
|
||||||
@@ -5097,7 +5131,7 @@ void ShowNum(int val) {
|
|||||||
FrequencySprite.setTextDatum(TR_DATUM);
|
FrequencySprite.setTextDatum(TR_DATUM);
|
||||||
|
|
||||||
FrequencySprite.fillSprite(BackgroundColor);
|
FrequencySprite.fillSprite(BackgroundColor);
|
||||||
FrequencySprite.setTextColor(FreqColor, FreqColorSmooth, false);
|
FrequencySprite.setTextColor(SecondaryColor, SecondaryColorSmooth, false);
|
||||||
FrequencySprite.drawString(String(val) + " ", 218, -6);
|
FrequencySprite.drawString(String(val) + " ", 218, -6);
|
||||||
FrequencySprite.pushSprite(46, 46);
|
FrequencySprite.pushSprite(46, 46);
|
||||||
|
|
||||||
@@ -5160,12 +5194,12 @@ void TuneFreq(int temp) {
|
|||||||
|
|
||||||
void NumpadProcess(int num) {
|
void NumpadProcess(int num) {
|
||||||
static bool input_mode = false;
|
static bool input_mode = false;
|
||||||
static int freq_in = 0;
|
|
||||||
|
|
||||||
if (scandxmode) {
|
if (scandxmode) {
|
||||||
if (num == 127) cancelDXScan();
|
if (num == 127) cancelDXScan();
|
||||||
} else {
|
} else {
|
||||||
if (num == 127) {
|
if (num == 127) {
|
||||||
|
freq_in = 0;
|
||||||
menuoption = ITEM1;
|
menuoption = ITEM1;
|
||||||
menupage = DXMODE;
|
menupage = DXMODE;
|
||||||
menuitem = 0;
|
menuitem = 0;
|
||||||
@@ -5186,6 +5220,8 @@ void NumpadProcess(int num) {
|
|||||||
ShowFreq(0);
|
ShowFreq(0);
|
||||||
store = true;
|
store = true;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
ShowFreq(0);
|
||||||
}
|
}
|
||||||
freq_in = 0;
|
freq_in = 0;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user