From 98c26730c6b64bc2b7b2991f5b9f41bc5a492c21 Mon Sep 17 00:00:00 2001 From: phdlee Date: Tue, 30 Jan 2018 12:13:52 +0900 Subject: [PATCH] display test and split TX/RX added --- ubitx_20/cat_libs.ino | 2 +- ubitx_20/ubitx_20.ino | 34 +++++++++++++++++++++++++++++++--- ubitx_20/ubitx_idle.ino | 2 +- ubitx_20/ubitx_menu.ino | 32 ++++++++++++++++++++++++++++++-- 4 files changed, 63 insertions(+), 7 deletions(-) diff --git a/ubitx_20/cat_libs.ino b/ubitx_20/cat_libs.ino index dec5998..b82f639 100644 --- a/ubitx_20/cat_libs.ino +++ b/ubitx_20/cat_libs.ino @@ -384,7 +384,7 @@ void ReadEEPRom_FT817(byte fromType) //7A 6 ? ? //7A 7 SPL On/Off 0 = Off, 1 = On - CAT_BUFF[0] = (isSplitOn ? 0xFF : 0x7F); + CAT_BUFF[0] = (splitOn ? 0xFF : 0x7F); break; case 0xB3 : // CAT_BUFF[0] = 0x00; diff --git a/ubitx_20/ubitx_20.ino b/ubitx_20/ubitx_20.ino index 4311683..cc5119a 100644 --- a/ubitx_20/ubitx_20.ino +++ b/ubitx_20/ubitx_20.ino @@ -249,7 +249,6 @@ byte saveIntervalSec = 10; //second unsigned long saveCheckTime = 0; unsigned long saveCheckFreq = 0; -bool isSplitOn = false; byte cwDelayTime = 60; byte delayBeforeCWStartTime = 50; @@ -298,7 +297,7 @@ byte userCallsignLength = 0; //7 : display callsign at system startup, 6~0 : */ boolean txCAT = false; //turned on if the transmitting due to a CAT command char inTx = 0; //it is set to 1 if in transmit mode (whatever the reason : cw, ptt or cat) -char splitOn = 0; //working split, uses VFO B as the transmit frequency, (NOT IMPLEMENTED YET) +char splitOn = 0; //working split, uses VFO B as the transmit frequency char keyDown = 0; //in cw mode, denotes the carrier is being transmitted char isUSB = 0; //upper sideband was selected, this is reset to the default for the //frequency when it crosses the frequency border of 10 MHz @@ -507,6 +506,21 @@ void startTx(byte txMode, byte isDisplayUpdate){ ritRxFrequency = frequency; setFrequency(ritTxFrequency); } + else if (splitOn == 1) { + if (vfoActive == VFO_B) { + vfoActive = VFO_A; + frequency = vfoA; + byteToMode(vfoA_mode); + } + else if (vfoActive == VFO_A){ + vfoActive = VFO_B; + frequency = vfoB; + byteToMode(vfoB_mode); + } + + setFrequency(frequency); + } //end of else + if (txMode == TX_CW){ //turn off the second local oscillator and the bfo @@ -535,6 +549,20 @@ void stopTx(){ if (ritOn) setFrequency(ritRxFrequency); + else if (splitOn == 1) { + //vfo Change + if (vfoActive == VFO_B){ + vfoActive = VFO_A; + frequency = vfoA; + byteToMode(vfoA_mode); + } + else if (vfoActive == VFO_A){ + vfoActive = VFO_B; + frequency = vfoB; + byteToMode(vfoB_mode); + } + setFrequency(frequency); + } //end of else else setFrequency(frequency); @@ -992,7 +1020,7 @@ void setup() //Serial.begin(9600); lcd.begin(16, 2); - printLineF(1, F("CECBT v0.31")); + printLineF(1, F("CECBT v0.32")); Init_Cat(38400, SERIAL_8N1); initMeter(); //not used in this build diff --git a/ubitx_20/ubitx_idle.ino b/ubitx_20/ubitx_idle.ino index f85ba52..55f2fdf 100644 --- a/ubitx_20/ubitx_idle.ino +++ b/ubitx_20/ubitx_idle.ino @@ -98,7 +98,7 @@ void updateLine2Buffer() if (freqScrollPosition < 7) { - for (int i = 11; i > 0; i--) + for (int i = 11; i >= 0; i--) if (i - (7 - freqScrollPosition) >= 0) line2Buffer[i] = line2Buffer[i - (7 - freqScrollPosition)]; else diff --git a/ubitx_20/ubitx_menu.ino b/ubitx_20/ubitx_menu.ino index 5fa1e5a..e7f5670 100644 --- a/ubitx_20/ubitx_menu.ino +++ b/ubitx_20/ubitx_menu.ino @@ -235,6 +235,32 @@ void menuSidebandToggle(int btn){ } } +void menuSplitOnOff(int btn){ + if (!btn){ + if (splitOn == 0) + printLineF2(F("Split On?")); + else + printLineF2(F("Split Off?")); + } + else { + if (splitOn == 1){ + splitOn = 0; + printLineF2(F("Split Off!")); + } + else { + splitOn = 1; + if (ritOn == 1) + ritOn = 0; + printLineF2(F("Split On!")); + } + delay_background(500, 0); + printLine2ClearAndUpdate(); + menuOn = 0; + } +} + + + /* //Select CW Key Type by KD8CEC void menuSetupKeyType(int btn){ @@ -1025,7 +1051,7 @@ void doMenu(){ btnState = btnDown(); if (i > 0){ - if (modeCalibrate && select + i < 170) + if (modeCalibrate && select + i < 180) select += i; if (!modeCalibrate && select + i < 80) select += i; @@ -1067,8 +1093,10 @@ void doMenu(){ else if (select < 150 && modeCalibrate) menuADCMonitor(btnState); else if (select < 160 && modeCalibrate) - menuTxOnOff(btnState, 0x01); //TX OFF / ON + menuSplitOnOff(btnState); //TX OFF / ON else if (select < 170 && modeCalibrate) + menuTxOnOff(btnState, 0x01); //TX OFF / ON + else if (select < 180 && modeCalibrate) menuExit(btnState); Check_Cat(0); //To prevent disconnections