mirror of
https://codeberg.org/mclemens/ubitxv6.git
synced 2024-06-13 04:30:53 +00:00
Change decision making in main menu loop to ensure display consistency when CAT changes
This commit is contained in:
parent
4cf8f7a840
commit
a138490dcc
|
@ -46,35 +46,62 @@ void drawMainMenu(void)
|
||||||
morseText(b);
|
morseText(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void drawMainMenuIncrement()
|
||||||
|
{
|
||||||
|
//State variables
|
||||||
|
static uint32_t last_freq = 0;
|
||||||
|
static Vfo_e last_vfo = Vfo_e::VFO_A;
|
||||||
|
static VfoMode_e last_mode = VfoMode_e::VFO_MODE_LSB;
|
||||||
|
static bool last_split = false;
|
||||||
|
static bool last_rit = false;
|
||||||
|
static TuningMode_e last_tuning = TuningMode_e::TUNE_SSB;
|
||||||
|
|
||||||
|
Button button;
|
||||||
|
|
||||||
|
if((last_freq != GetActiveVfoFreq())
|
||||||
|
||(last_vfo != globalSettings.activeVfo)){
|
||||||
|
extractAndDrawButton(&button,&bVfoA);
|
||||||
|
extractAndDrawButton(&button,&bVfoB);
|
||||||
|
updateBandButtons(last_freq);
|
||||||
|
last_freq = GetActiveVfoFreq();
|
||||||
|
last_vfo = globalSettings.activeVfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(last_mode != GetActiveVfoMode()){
|
||||||
|
updateSidebandButtons();
|
||||||
|
last_mode = GetActiveVfoMode();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(last_split != globalSettings.splitOn){
|
||||||
|
extractAndDrawButton(&button,&bVfoA);
|
||||||
|
extractAndDrawButton(&button,&bVfoB);
|
||||||
|
extractAndDrawButton(&button,&bSpl);
|
||||||
|
last_split = globalSettings.splitOn;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(last_rit != globalSettings.ritOn){
|
||||||
|
extractAndDrawButton(&button,&bRit);
|
||||||
|
last_rit = globalSettings.ritOn;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(last_tuning != globalSettings.tuningMode){
|
||||||
|
extractAndDrawButton(&button,&bCw);
|
||||||
|
last_tuning = globalSettings.tuningMode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void mainMenuTune(int16_t knob)
|
void mainMenuTune(int16_t knob)
|
||||||
{
|
{
|
||||||
static uint32_t current_freq = 0;
|
if(0 == knob){
|
||||||
|
|
||||||
if((0 == knob) && (GetActiveVfoFreq() == current_freq)){
|
|
||||||
//Nothing to do - we're already set!
|
//Nothing to do - we're already set!
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
current_freq = GetActiveVfoFreq();
|
const uint32_t current_freq = GetActiveVfoFreq();
|
||||||
const uint32_t new_freq = current_freq + (50 * knob);
|
const uint32_t new_freq = current_freq + (50 * knob);
|
||||||
|
|
||||||
setFrequency(new_freq);
|
setFrequency(new_freq);
|
||||||
|
autoSelectSidebandChanged(current_freq);
|
||||||
if(autoSelectSidebandChanged(current_freq)){
|
|
||||||
updateSidebandButtons();
|
|
||||||
}
|
|
||||||
|
|
||||||
const uint32_t old_freq = current_freq;
|
|
||||||
current_freq = new_freq;
|
|
||||||
|
|
||||||
Button button;
|
|
||||||
if(Vfo_e::VFO_A == globalSettings.activeVfo){
|
|
||||||
extractAndDrawButton(&button,&bVfoA);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
extractAndDrawButton(&button,&bVfoB);
|
|
||||||
}
|
|
||||||
updateBandButtons(old_freq);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MenuReturn_e runMainMenu(const ButtonPress_e tuner_button,
|
MenuReturn_e runMainMenu(const ButtonPress_e tuner_button,
|
||||||
|
@ -156,7 +183,7 @@ MenuReturn_e runMainMenu(const ButtonPress_e tuner_button,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
drawMainMenuIncrement();
|
||||||
|
|
||||||
return MenuReturn_e::StillActive;//main menu always returns StillActive
|
return MenuReturn_e::StillActive;//main menu always returns StillActive
|
||||||
}
|
}
|
|
@ -9,6 +9,9 @@ extern const uint8_t MAIN_MENU_NUM_BUTTONS;
|
||||||
|
|
||||||
extern const Button bVfoA;
|
extern const Button bVfoA;
|
||||||
extern const Button bVfoB;
|
extern const Button bVfoB;
|
||||||
|
extern const Button bRit;
|
||||||
|
extern const Button bCw;
|
||||||
|
extern const Button bSpl;
|
||||||
void updateBandButtons(const uint32_t old_freq);
|
void updateBandButtons(const uint32_t old_freq);
|
||||||
void updateSidebandButtons();
|
void updateSidebandButtons();
|
||||||
void drawTx();
|
void drawTx();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user