Added IF Tune, ATT, SDR Functions
This commit is contained in:
parent
d4ed0589e5
commit
23f1b7cd5c
@ -5,11 +5,12 @@
|
|||||||
//Depending on the type of LCD mounted on the uBITX, uncomment one of the options below.
|
//Depending on the type of LCD mounted on the uBITX, uncomment one of the options below.
|
||||||
//You must select only one.
|
//You must select only one.
|
||||||
|
|
||||||
//#define UBITX_DISPLAY_LCD1602P //LCD mounted on unmodified uBITX
|
#define UBITX_DISPLAY_LCD1602P //LCD mounted on unmodified uBITX
|
||||||
#define UBITX_DISPLAY_LCD1602I //I2C type 16 x 02 LCD
|
//#define UBITX_DISPLAY_LCD1602I //I2C type 16 x 02 LCD
|
||||||
//#define UBITX_DISPLAY_LCD2404P //24 x 04 LCD
|
//#define UBITX_DISPLAY_LCD2404P //24 x 04 LCD
|
||||||
//#define UBITX_DISPLAY_LCD2404I //I2C type 24 x 04 LCD
|
//#define UBITX_DISPLAY_LCD2404I //I2C type 24 x 04 LCD
|
||||||
|
|
||||||
|
//#define ENABLE_FACTORYALIGN
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -326,6 +327,11 @@ unsigned char txFilter = 0; //which of the four transmit filters are in use
|
|||||||
boolean modeCalibrate = false;//this mode of menus shows extended menus to calibrate the oscillators and choose the proper
|
boolean modeCalibrate = false;//this mode of menus shows extended menus to calibrate the oscillators and choose the proper
|
||||||
//beat frequency
|
//beat frequency
|
||||||
|
|
||||||
|
byte attLevel = 0; //ATT : RF Gain Control (Receive) <-- IF1 Shift, 0 : Off, ShiftValue is attLevel * 100; attLevel 150 = 15K
|
||||||
|
char if1TuneValue = 0; //0 : OFF, IF1 + if1TuneValue * 100; // + - 12500;
|
||||||
|
byte sdrModeOn = 0; //SDR MODE ON / OFF
|
||||||
|
unsigned long SDR_Center_Freq = 32000000;
|
||||||
|
|
||||||
unsigned long beforeIdle_ProcessTime = 0; //for check Idle time
|
unsigned long beforeIdle_ProcessTime = 0; //for check Idle time
|
||||||
byte line2DisplayStatus = 0; //0:Clear, 1 : menu, 1: DisplayFrom Idle,
|
byte line2DisplayStatus = 0; //0:Clear, 1 : menu, 1: DisplayFrom Idle,
|
||||||
char lcdMeter[17];
|
char lcdMeter[17];
|
||||||
@ -495,7 +501,32 @@ void setFrequency(unsigned long f){
|
|||||||
setTXFilters(f);
|
setTXFilters(f);
|
||||||
|
|
||||||
unsigned long appliedCarrier = ((cwMode == 0 ? usbCarrier : cwmCarrier) + (isIFShift && (inTx == 0) ? ifShiftValue : 0));
|
unsigned long appliedCarrier = ((cwMode == 0 ? usbCarrier : cwmCarrier) + (isIFShift && (inTx == 0) ? ifShiftValue : 0));
|
||||||
|
long if1AdjustValue = ((inTx == 0) ? (attLevel * 200) : 0) + (if1TuneValue * 50); //if1Tune RX, TX Enabled, ATT : only RX Mode
|
||||||
|
|
||||||
|
if (sdrModeOn && (inTx == 0)) //IF SDR
|
||||||
|
{
|
||||||
|
si5351bx_setfreq(2, 44999500 + if1AdjustValue + f);
|
||||||
|
si5351bx_setfreq(1, 44999500 + if1AdjustValue + SDR_Center_Freq + 2390);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (cwMode == 1 || (cwMode == 0 && (!isUSB)))
|
||||||
|
{
|
||||||
|
//CWL(cwMode == 1) or LSB (cwMode == 0 && (!isUSB))
|
||||||
|
si5351bx_setfreq(2, SECOND_OSC_LSB + if1AdjustValue + appliedCarrier + f);
|
||||||
|
//si5351bx_setfreq(1, SECOND_OSC_LSB + if1AdjustValue - (sdrModeOn ? (SDR_Center_Freq- usbCarrier) : 0));
|
||||||
|
si5351bx_setfreq(1, SECOND_OSC_LSB + if1AdjustValue);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//CWU (cwMode == 2) or LSB (cwMode == 0 and isUSB)
|
||||||
|
si5351bx_setfreq(2, SECOND_OSC_USB + if1AdjustValue - appliedCarrier + f);
|
||||||
|
//si5351bx_setfreq(1, SECOND_OSC_USB + if1AdjustValue + (sdrModeOn ? (SDR_Center_Freq- usbCarrier) : 0)); //Increase LO Frequency => 1198500 -> 32Mhz
|
||||||
|
si5351bx_setfreq(1, SECOND_OSC_USB + if1AdjustValue); //Increase LO Frequency => 1198500 -> 32Mhz
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
if (cwMode == 0)
|
if (cwMode == 0)
|
||||||
{
|
{
|
||||||
if (isUSB){
|
if (isUSB){
|
||||||
@ -518,6 +549,7 @@ void setFrequency(unsigned long f){
|
|||||||
si5351bx_setfreq(1, SECOND_OSC_USB);
|
si5351bx_setfreq(1, SECOND_OSC_USB);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
frequency = f;
|
frequency = f;
|
||||||
}
|
}
|
||||||
@ -1150,8 +1182,10 @@ void setup()
|
|||||||
setFrequency(vfoA);
|
setFrequency(vfoA);
|
||||||
updateDisplay();
|
updateDisplay();
|
||||||
|
|
||||||
|
#ifdef ENABLE_FACTORYALIGN
|
||||||
if (btnDown())
|
if (btnDown())
|
||||||
factory_alignment();
|
factory_alignment();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//Auto save Frequency and Mode with Protected eeprom life by KD8CEC
|
//Auto save Frequency and Mode with Protected eeprom life by KD8CEC
|
||||||
|
@ -441,6 +441,37 @@ void menuTxOnOff(int btn, byte optionType){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Toggle SDR MODE
|
||||||
|
void menuSDROnOff(int btn)
|
||||||
|
{
|
||||||
|
if (!btn){
|
||||||
|
if (sdrModeOn == 0)
|
||||||
|
printLineF2(F("SDR Mode On?"));
|
||||||
|
else
|
||||||
|
printLineF2(F("SDR Mode Off?"));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (sdrModeOn == 1){
|
||||||
|
sdrModeOn = 0;
|
||||||
|
printLineF2(F("[OFF]"));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
sdrModeOn = 1;
|
||||||
|
|
||||||
|
if (ritOn == 1)
|
||||||
|
ritOn = 0;
|
||||||
|
|
||||||
|
if (splitOn == 1)
|
||||||
|
splitOn = 0;
|
||||||
|
|
||||||
|
printLineF2(F("[ON]"));
|
||||||
|
}
|
||||||
|
|
||||||
|
setFrequency(frequency);
|
||||||
|
menuClearExit(500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void displayEmptyData(void){
|
void displayEmptyData(void){
|
||||||
printLineF2(F("Empty data"));
|
printLineF2(F("Empty data"));
|
||||||
delay_background(2000, 0);
|
delay_background(2000, 0);
|
||||||
@ -548,9 +579,10 @@ void menuSetupCWCarrier(int btn){
|
|||||||
//valueType 0 : Normal
|
//valueType 0 : Normal
|
||||||
// 1 : CW Change -> Generate Tone
|
// 1 : CW Change -> Generate Tone
|
||||||
// 2 : IF Shift Setup -> SetFrequency, Set SideTone
|
// 2 : IF Shift Setup -> SetFrequency, Set SideTone
|
||||||
// 3 : Select Mode (different display type)
|
// 5 : ATT
|
||||||
|
// 11 : Select Mode (different display type)
|
||||||
//knobSensitivity : 1 ~
|
//knobSensitivity : 1 ~
|
||||||
int getValueByKnob(int valueType, int targetValue, int minKnobValue, int maxKnobValue, int incStep, char* displayTitle, int knobSensitivity)
|
int getValueByKnob(int valueType, int targetValue, int minKnobValue, int maxKnobValue, int incStep, const char* displayTitle, int knobSensitivity)
|
||||||
{
|
{
|
||||||
int knob;
|
int knob;
|
||||||
int moveDetectStep = 0;
|
int moveDetectStep = 0;
|
||||||
@ -558,7 +590,7 @@ int getValueByKnob(int valueType, int targetValue, int minKnobValue, int maxKnob
|
|||||||
char isInitDisplay = 1;
|
char isInitDisplay = 1;
|
||||||
delay_background(300, 0); //Default Delay
|
delay_background(300, 0); //Default Delay
|
||||||
|
|
||||||
if (valueType < 3)
|
if (valueType < 10)
|
||||||
{
|
{
|
||||||
strcpy(b, "Press, set ");
|
strcpy(b, "Press, set ");
|
||||||
strcat(b, displayTitle);
|
strcat(b, displayTitle);
|
||||||
@ -597,7 +629,7 @@ int getValueByKnob(int valueType, int targetValue, int minKnobValue, int maxKnob
|
|||||||
|
|
||||||
strcpy(b, displayTitle);
|
strcpy(b, displayTitle);
|
||||||
|
|
||||||
if (valueType == 3) //Mode Select
|
if (valueType == 11) //Mode Select
|
||||||
{
|
{
|
||||||
b[targetValue * 4] = '>';
|
b[targetValue * 4] = '>';
|
||||||
}
|
}
|
||||||
@ -625,9 +657,13 @@ int getValueByKnob(int valueType, int targetValue, int minKnobValue, int maxKnob
|
|||||||
{
|
{
|
||||||
tone(CW_TONE, targetValue);
|
tone(CW_TONE, targetValue);
|
||||||
}
|
}
|
||||||
else if (valueType == 2)
|
else if (valueType == 2 || valueType == 5 ) // 2:IFS, 5:ATT
|
||||||
{
|
{
|
||||||
ifShiftValue = targetValue;
|
if (valueType == 2)
|
||||||
|
ifShiftValue = targetValue;
|
||||||
|
else
|
||||||
|
attLevel = targetValue;
|
||||||
|
|
||||||
setFrequency(frequency);
|
setFrequency(frequency);
|
||||||
SetCarrierFreq();
|
SetCarrierFreq();
|
||||||
}
|
}
|
||||||
@ -912,6 +948,31 @@ void menuIFSSetup(int btn){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//ATT SETUP (IF1(45MHZ) SHIFT), by KD8CEC
|
||||||
|
void menuATTSetup(int btn){
|
||||||
|
int knob = 0;
|
||||||
|
char needApplyChangeValue = 1;
|
||||||
|
|
||||||
|
if (!btn){
|
||||||
|
if (isIFShift == 1)
|
||||||
|
printLineF2(F("ATT Change?"));
|
||||||
|
else
|
||||||
|
printLineF2(F("ATT On?"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
attLevel = getValueByKnob(5, attLevel, 0, 200, 5, "ATT", 2); //2 : (SetFrequency), targetValue, minKnobValue, maxKnobValue, stepSize
|
||||||
|
delay_background(500, 0); //for check Long Press function key
|
||||||
|
|
||||||
|
if (btnDown() || attLevel == 0)
|
||||||
|
{
|
||||||
|
attLevel = 0;
|
||||||
|
setFrequency(frequency);
|
||||||
|
//SetCarrierFreq();
|
||||||
|
}
|
||||||
|
menuClearExit(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//Functions for CWL and CWU by KD8CEC
|
//Functions for CWL and CWU by KD8CEC
|
||||||
void menuSelectMode(int btn){
|
void menuSelectMode(int btn){
|
||||||
@ -939,7 +1000,7 @@ void menuSelectMode(int btn){
|
|||||||
|
|
||||||
//delay_background(500, 0);
|
//delay_background(500, 0);
|
||||||
|
|
||||||
selectModeType = getValueByKnob(3, selectModeType, 0, 3, 1, " LSB USB CWL CWU", 4); //3 : Select Mode, targetValue, minKnobValue, maxKnobValue, stepSize
|
selectModeType = getValueByKnob(11, selectModeType, 0, 3, 1, " LSB USB CWL CWU", 4); //3 : Select Mode, targetValue, minKnobValue, maxKnobValue, stepSize
|
||||||
|
|
||||||
/*
|
/*
|
||||||
while(!btnDown()){
|
while(!btnDown()){
|
||||||
@ -1011,8 +1072,8 @@ void menuSetupKeyType(int btn){
|
|||||||
//delay_background(500, 0);
|
//delay_background(500, 0);
|
||||||
selectedKeyType = cwKeyType;
|
selectedKeyType = cwKeyType;
|
||||||
|
|
||||||
//selectedKeyType = getValueByKnob(4, selectedKeyType, 0, 2, 1, " KEY:", 5); //4 : Select Key Type, targetValue, minKnobValue, maxKnobValue, stepSize
|
//selectedKeyType = getValueByKnob(12, selectedKeyType, 0, 2, 1, " KEY:", 5); //4 : Select Key Type, targetValue, minKnobValue, maxKnobValue, stepSize
|
||||||
selectedKeyType = getValueByKnob(3, selectedKeyType, 0, 2, 1, " ST IA IB", 5); //4 : Select Key Type, targetValue, minKnobValue, maxKnobValue, stepSize
|
selectedKeyType = getValueByKnob(11, selectedKeyType, 0, 2, 1, " ST IA IB", 5); //4 : Select Key Type, targetValue, minKnobValue, maxKnobValue, stepSize
|
||||||
|
|
||||||
/*
|
/*
|
||||||
while(!btnDown()){
|
while(!btnDown()){
|
||||||
@ -1170,14 +1231,13 @@ void doMenu(){
|
|||||||
if (i > 0){
|
if (i > 0){
|
||||||
if (modeCalibrate && select + i < 240)
|
if (modeCalibrate && select + i < 240)
|
||||||
select += i;
|
select += i;
|
||||||
if (!modeCalibrate && select + i < 130)
|
else if (!modeCalibrate && select + i < 150)
|
||||||
select += i;
|
select += i;
|
||||||
}
|
}
|
||||||
|
else if (i < 0 && select - i >= -10)
|
||||||
|
select += i;
|
||||||
|
|
||||||
if (i < 0 && select - i >= -10)
|
//if -> switch : reduce program memory 200byte
|
||||||
select += i; //caught ya, i is already -ve here, so you add it
|
|
||||||
|
|
||||||
//if -> switch reduce program memory 200byte
|
|
||||||
switch (select / 10)
|
switch (select / 10)
|
||||||
{
|
{
|
||||||
case 0 :
|
case 0 :
|
||||||
@ -1196,60 +1256,65 @@ void doMenu(){
|
|||||||
menuIFSSetup(btnState);
|
menuIFSSetup(btnState);
|
||||||
break;
|
break;
|
||||||
case 5 :
|
case 5 :
|
||||||
menuCWSpeed(btnState);
|
menuATTSetup(btnState);
|
||||||
break;
|
break;
|
||||||
case 6 :
|
case 6 :
|
||||||
menuSplitOnOff(btnState); //SplitOn / off
|
menuCWSpeed(btnState);
|
||||||
break;
|
break;
|
||||||
case 7 :
|
case 7 :
|
||||||
menuCHMemory(btnState, 0); //VFO to Memroy
|
menuSplitOnOff(btnState); //SplitOn / off
|
||||||
break;
|
break;
|
||||||
case 8 :
|
case 8 :
|
||||||
menuCHMemory(btnState, 1); //Memory to VFO
|
menuCHMemory(btnState, 0); //VFO to Memroy
|
||||||
break;
|
break;
|
||||||
case 9 :
|
case 9 :
|
||||||
menuCWAutoKey(btnState);
|
menuCHMemory(btnState, 1); //Memory to VFO
|
||||||
break;
|
break;
|
||||||
case 10 :
|
case 10 :
|
||||||
menuWSPRSend(btnState);
|
menuCWAutoKey(btnState);
|
||||||
break;
|
break;
|
||||||
case 11 :
|
case 11 :
|
||||||
menuSetup(btnState);
|
menuWSPRSend(btnState);
|
||||||
break;
|
break;
|
||||||
case 12 :
|
case 12 :
|
||||||
menuExit(btnState);
|
menuSDROnOff(btnState);
|
||||||
break;
|
break;
|
||||||
case 13 :
|
case 13 :
|
||||||
menuSetupCalibration(btnState); //crystal
|
menuSetup(btnState);
|
||||||
break;
|
break;
|
||||||
case 14 :
|
case 14 :
|
||||||
menuSetupCarrier(btnState); //lsb
|
menuExit(btnState);
|
||||||
break;
|
break;
|
||||||
case 15 :
|
case 15 :
|
||||||
menuSetupCWCarrier(btnState); //lsb
|
menuSetupCalibration(btnState); //crystal
|
||||||
break;
|
break;
|
||||||
case 16 :
|
case 16 :
|
||||||
menuSetupCwTone(btnState);
|
menuSetupCarrier(btnState); //ssb
|
||||||
break;
|
break;
|
||||||
case 17 :
|
case 17 :
|
||||||
menuSetupCwDelay(btnState);
|
menuSetupCWCarrier(btnState); //cw
|
||||||
break;
|
break;
|
||||||
case 18 :
|
case 18 :
|
||||||
menuSetupTXCWInterval(btnState);
|
menuSetupCwTone(btnState);
|
||||||
break;
|
break;
|
||||||
case 19 :
|
case 19 :
|
||||||
menuSetupKeyType(btnState);
|
menuSetupCwDelay(btnState);
|
||||||
break;
|
break;
|
||||||
case 20 :
|
case 20 :
|
||||||
menuADCMonitor(btnState);
|
menuSetupTXCWInterval(btnState);
|
||||||
break;
|
break;
|
||||||
case 21 :
|
case 21 :
|
||||||
|
menuSetupKeyType(btnState);
|
||||||
|
break;
|
||||||
|
case 22 :
|
||||||
|
menuADCMonitor(btnState);
|
||||||
|
break;
|
||||||
|
case 23 :
|
||||||
menuTxOnOff(btnState, 0x01); //TX OFF / ON
|
menuTxOnOff(btnState, 0x01); //TX OFF / ON
|
||||||
break;
|
break;
|
||||||
default :
|
default :
|
||||||
menuExit(btnState); break;
|
menuExit(btnState); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Check_Cat(0); //To prevent disconnections
|
Check_Cat(0); //To prevent disconnections
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -127,7 +127,7 @@ void si5351_set_calibration(int32_t cal){
|
|||||||
void SetCarrierFreq()
|
void SetCarrierFreq()
|
||||||
{
|
{
|
||||||
unsigned long appliedCarrier = ((cwMode == 0 ? usbCarrier : cwmCarrier) + (isIFShift && (inTx == 0) ? ifShiftValue : 0));
|
unsigned long appliedCarrier = ((cwMode == 0 ? usbCarrier : cwmCarrier) + (isIFShift && (inTx == 0) ? ifShiftValue : 0));
|
||||||
si5351bx_setfreq(0, appliedCarrier);
|
si5351bx_setfreq(0, (sdrModeOn ? 0 : appliedCarrier));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if (cwMode == 0)
|
if (cwMode == 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user