mirror of
https://codeberg.org/mclemens/ubitxv6.git
synced 2024-09-29 23:15:57 -04:00
Fix auto-selection of sideband mode when tuning
This commit is contained in:
parent
0f45a2fc43
commit
fdd2afce98
@ -56,19 +56,12 @@ void mainMenuTune(int16_t knob)
|
|||||||
current_freq = GetActiveVfoFreq();
|
current_freq = GetActiveVfoFreq();
|
||||||
const uint32_t new_freq = current_freq + (50 * knob);
|
const uint32_t new_freq = current_freq + (50 * knob);
|
||||||
|
|
||||||
//Transition from below to above the traditional threshold for USB
|
setFrequency(new_freq);
|
||||||
if(current_freq < THRESHOLD_USB_LSB && new_freq >= THRESHOLD_USB_LSB){
|
|
||||||
SetActiveVfoMode(VfoMode_e::VFO_MODE_USB);
|
if(autoSelectSidebandChanged(current_freq)){
|
||||||
updateSidebandButtons();
|
|
||||||
}
|
|
||||||
|
|
||||||
//Transition from above to below the traditional threshold for USB
|
|
||||||
if(current_freq >= THRESHOLD_USB_LSB && new_freq < THRESHOLD_USB_LSB){
|
|
||||||
SetActiveVfoMode(VfoMode_e::VFO_MODE_LSB);
|
|
||||||
updateSidebandButtons();
|
updateSidebandButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
setFrequency(new_freq);
|
|
||||||
const uint32_t old_freq = current_freq;
|
const uint32_t old_freq = current_freq;
|
||||||
current_freq = new_freq;
|
current_freq = new_freq;
|
||||||
|
|
||||||
|
@ -514,6 +514,9 @@ ButtonStatus_e bsBand(const uint8_t band){
|
|||||||
void osBand(const uint8_t band){
|
void osBand(const uint8_t band){
|
||||||
const uint32_t old_freq = GetActiveVfoFreq();
|
const uint32_t old_freq = GetActiveVfoFreq();
|
||||||
SetActiveVfoFreq(getFreqInBand(old_freq,band));
|
SetActiveVfoFreq(getFreqInBand(old_freq,band));
|
||||||
|
if(autoSelectSidebandChanged(old_freq)){
|
||||||
|
updateSidebandButtons();
|
||||||
|
}
|
||||||
|
|
||||||
Button button;
|
Button button;
|
||||||
if(Vfo_e::VFO_A == globalSettings.activeVfo){
|
if(Vfo_e::VFO_A == globalSettings.activeVfo){
|
||||||
|
27
tuner.cpp
27
tuner.cpp
@ -5,10 +5,7 @@
|
|||||||
#include "nano_gui.h"
|
#include "nano_gui.h"
|
||||||
#include "pin_definitions.h"
|
#include "pin_definitions.h"
|
||||||
|
|
||||||
/**
|
static const uint32_t THRESHOLD_USB_LSB = 10000000L;
|
||||||
* Below are the basic functions that control the uBitx. Understanding the functions before
|
|
||||||
* you start hacking around
|
|
||||||
*/
|
|
||||||
|
|
||||||
void saveVFOs()
|
void saveVFOs()
|
||||||
{
|
{
|
||||||
@ -198,4 +195,24 @@ void ritDisable(){
|
|||||||
setFrequency(globalSettings.ritFrequency);
|
setFrequency(globalSettings.ritFrequency);
|
||||||
updateDisplay();
|
updateDisplay();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool autoSelectSidebandChanged(const uint32_t old_frequency)
|
||||||
|
{
|
||||||
|
const uint32_t new_freq = GetActiveVfoFreq();
|
||||||
|
//Transition from below to above the traditional threshold for USB
|
||||||
|
if(old_frequency < THRESHOLD_USB_LSB && new_freq >= THRESHOLD_USB_LSB){
|
||||||
|
SetActiveVfoMode(VfoMode_e::VFO_MODE_USB);
|
||||||
|
setFrequency(new_freq);//Refresh tuning to activate the new sideband mode
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Transition from above to below the traditional threshold for USB
|
||||||
|
if(old_frequency >= THRESHOLD_USB_LSB && new_freq < THRESHOLD_USB_LSB){
|
||||||
|
SetActiveVfoMode(VfoMode_e::VFO_MODE_LSB);
|
||||||
|
setFrequency(new_freq);//Refresh tuning to activate the new sideband mode
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
3
tuner.h
3
tuner.h
@ -18,5 +18,4 @@ void si5351bx_setfreq(uint8_t clknum, uint32_t fout);
|
|||||||
void initOscillators();
|
void initOscillators();
|
||||||
void si5351_set_calibration(int32_t cal); //calibration is a small value that is nudged to make up for the inaccuracies of the reference 25 MHz crystal frequency
|
void si5351_set_calibration(int32_t cal); //calibration is a small value that is nudged to make up for the inaccuracies of the reference 25 MHz crystal frequency
|
||||||
|
|
||||||
// limits the tuning and working range of the ubitx between 3 MHz and 30 MHz
|
bool autoSelectSidebandChanged(const uint32_t old_frequency); //if the current frequency defaults to a different sideband mode, updates to that sideband mode and returns true. Else, returns false
|
||||||
static const uint32_t THRESHOLD_USB_LSB = 10000000L;
|
|
||||||
|
Loading…
Reference in New Issue
Block a user