mirror of
https://codeberg.org/mclemens/ubitxv6.git
synced 2024-09-10 16:14:18 -04:00
Merge pull request #11 from reedbn/cw-transmit-at-displayed-freq
Display TX (not RX) frequency in CW mode
This commit is contained in:
commit
1c60b8b63f
@ -147,7 +147,6 @@ void ssLocalOscInitialize(long int* start_value_out){
|
|||||||
uint32_t freq = GetActiveVfoFreq();
|
uint32_t freq = GetActiveVfoFreq();
|
||||||
freq = (freq/1000L) * 1000L;//round off the current frequency the nearest kHz
|
freq = (freq/1000L) * 1000L;//round off the current frequency the nearest kHz
|
||||||
setFrequency(freq);
|
setFrequency(freq);
|
||||||
si5351bx_setfreq(0, globalSettings.usbCarrierFreq); //set back the carrier oscillator, cw tx switches it off
|
|
||||||
}
|
}
|
||||||
*start_value_out = globalSettings.oscillatorCal;
|
*start_value_out = globalSettings.oscillatorCal;
|
||||||
}
|
}
|
||||||
|
2
ubitx.h
2
ubitx.h
@ -95,7 +95,7 @@ static const uint32_t THRESHOLD_USB_LSB = 10000000L;
|
|||||||
/* these are functions implemented in the main file named as ubitx_xxx.ino */
|
/* these are functions implemented in the main file named as ubitx_xxx.ino */
|
||||||
void active_delay(int delay_by);
|
void active_delay(int delay_by);
|
||||||
void saveVFOs();
|
void saveVFOs();
|
||||||
void setFrequency(unsigned long f);
|
void setFrequency(const unsigned long freq, const bool transmit = false);
|
||||||
void startTx(TuningMode_e tx_mode);
|
void startTx(TuningMode_e tx_mode);
|
||||||
void stopTx();
|
void stopTx();
|
||||||
void ritEnable(unsigned long f);
|
void ritEnable(unsigned long f);
|
||||||
|
69
ubitxv6.ino
69
ubitxv6.ino
@ -154,29 +154,48 @@ void setTXFilters_v5(unsigned long freq){
|
|||||||
* through mixing of the second local oscillator.
|
* through mixing of the second local oscillator.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void setFrequency(unsigned long freq){
|
void setFrequency(const unsigned long freq,
|
||||||
static const unsigned long firstIF = 45005000L;
|
const bool transmit){
|
||||||
|
static const unsigned long FIRST_IF = 45005000UL;
|
||||||
|
|
||||||
setTXFilters(freq);
|
setTXFilters(freq);
|
||||||
|
|
||||||
uint32_t local_osc_freq;
|
//Nominal values for the oscillators
|
||||||
if(TuningMode_e::TUNE_CW == globalSettings.tuningMode){
|
uint32_t local_osc_freq = FIRST_IF + freq;
|
||||||
local_osc_freq = firstIF + freq + globalSettings.cwSideToneFreq;
|
uint32_t ssb_osc_freq = FIRST_IF;//will be changed depending on sideband
|
||||||
}
|
uint32_t bfo_osc_freq = globalSettings.usbCarrierFreq;
|
||||||
else{
|
|
||||||
local_osc_freq = firstIF + freq;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t ssb_osc_freq;
|
if(TuningMode_e::TUNE_CW == globalSettings.tuningMode){
|
||||||
if(VfoMode_e::VFO_MODE_USB == GetActiveVfoMode()){
|
if(transmit){
|
||||||
ssb_osc_freq = firstIF + globalSettings.usbCarrierFreq;
|
//We don't do any mixing or converting when transmitting
|
||||||
|
local_osc_freq = freq;
|
||||||
|
ssb_osc_freq = 0;
|
||||||
|
bfo_osc_freq = 0;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
ssb_osc_freq = firstIF - globalSettings.usbCarrierFreq;
|
//We offset when receiving CW so that it's audible
|
||||||
|
if(VfoMode_e::VFO_MODE_USB == GetActiveVfoMode()){
|
||||||
|
local_osc_freq -= globalSettings.cwSideToneFreq;
|
||||||
|
ssb_osc_freq += globalSettings.usbCarrierFreq;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
local_osc_freq += globalSettings.cwSideToneFreq;
|
||||||
|
ssb_osc_freq -= globalSettings.usbCarrierFreq;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{//SSB mode
|
||||||
|
if(VfoMode_e::VFO_MODE_USB == GetActiveVfoMode()){
|
||||||
|
ssb_osc_freq += globalSettings.usbCarrierFreq;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
ssb_osc_freq -= globalSettings.usbCarrierFreq;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
si5351bx_setfreq(2, local_osc_freq);
|
si5351bx_setfreq(2, local_osc_freq);
|
||||||
si5351bx_setfreq(1, ssb_osc_freq);
|
si5351bx_setfreq(1, ssb_osc_freq);
|
||||||
|
si5351bx_setfreq(0, bfo_osc_freq);
|
||||||
|
|
||||||
SetActiveVfoFreq(freq);
|
SetActiveVfoFreq(freq);
|
||||||
}
|
}
|
||||||
@ -195,7 +214,7 @@ void startTx(TuningMode_e tx_mode){
|
|||||||
//save the current as the rx frequency
|
//save the current as the rx frequency
|
||||||
uint32_t rit_tx_freq = globalSettings.ritFrequency;
|
uint32_t rit_tx_freq = globalSettings.ritFrequency;
|
||||||
globalSettings.ritFrequency = GetActiveVfoFreq();
|
globalSettings.ritFrequency = GetActiveVfoFreq();
|
||||||
setFrequency(rit_tx_freq);
|
setFrequency(rit_tx_freq,true);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
if(globalSettings.splitOn){
|
if(globalSettings.splitOn){
|
||||||
@ -206,26 +225,9 @@ void startTx(TuningMode_e tx_mode){
|
|||||||
globalSettings.activeVfo = Vfo_e::VFO_B;
|
globalSettings.activeVfo = Vfo_e::VFO_B;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setFrequency(GetActiveVfoFreq());
|
setFrequency(GetActiveVfoFreq(),true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(TuningMode_e::TUNE_CW == globalSettings.tuningMode){
|
|
||||||
//turn off the second local oscillator and the bfo
|
|
||||||
si5351bx_setfreq(0, 0);
|
|
||||||
si5351bx_setfreq(1, 0);
|
|
||||||
|
|
||||||
//shift the first oscillator to the tx frequency directly
|
|
||||||
//the key up and key down will toggle the carrier unbalancing
|
|
||||||
//the exact cw frequency is the tuned frequency + sidetone
|
|
||||||
if(VfoMode_e::VFO_MODE_USB == GetActiveVfoMode()){
|
|
||||||
si5351bx_setfreq(2, GetActiveVfoFreq() + globalSettings.cwSideToneFreq);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
si5351bx_setfreq(2, GetActiveVfoFreq() - globalSettings.cwSideToneFreq);
|
|
||||||
}
|
|
||||||
|
|
||||||
delay(20);
|
|
||||||
}
|
|
||||||
digitalWrite(TX_RX, 1);//turn on the tx
|
digitalWrite(TX_RX, 1);//turn on the tx
|
||||||
globalSettings.txActive = true;
|
globalSettings.txActive = true;
|
||||||
drawTx();
|
drawTx();
|
||||||
@ -235,9 +237,6 @@ void stopTx(){
|
|||||||
digitalWrite(TX_RX, 0);//turn off the tx
|
digitalWrite(TX_RX, 0);//turn off the tx
|
||||||
globalSettings.txActive = false;
|
globalSettings.txActive = false;
|
||||||
|
|
||||||
//set back the carrier oscillator - cw tx switches it off
|
|
||||||
si5351bx_setfreq(0, globalSettings.usbCarrierFreq);
|
|
||||||
|
|
||||||
if(globalSettings.ritOn){
|
if(globalSettings.ritOn){
|
||||||
uint32_t rit_rx_freq = globalSettings.ritFrequency;
|
uint32_t rit_rx_freq = globalSettings.ritFrequency;
|
||||||
globalSettings.ritFrequency = GetActiveVfoFreq();
|
globalSettings.ritFrequency = GetActiveVfoFreq();
|
||||||
|
Loading…
Reference in New Issue
Block a user