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 690fb56..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 @@ -379,7 +378,6 @@ void saveBandFreqByIndex(unsigned long f, unsigned long mode, char bandIndex) { EEPROM.put(HAM_BAND_FREQS + 4 * bandIndex, (f & 0x3FFFFFFF) | (mode << 30) ); } - /* KD8CEC When using the basic delay of the Arduino, the program freezes. @@ -508,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 @@ -536,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); @@ -824,7 +851,7 @@ void initSettings(){ hamBandRange[0][0] = 1810; hamBandRange[0][1] = 2000; hamBandRange[1][0] = 3500; hamBandRange[1][1] = 3800; hamBandRange[2][0] = 5351; hamBandRange[2][1] = 5367; - hamBandRange[3][0] = 7000; hamBandRange[3][1] = 7200; + hamBandRange[3][0] = 7000; hamBandRange[3][1] = 7300; //region 1 hamBandRange[4][0] = 10100; hamBandRange[4][1] = 10150; hamBandRange[5][0] = 14000; hamBandRange[5][1] = 14350; hamBandRange[6][0] = 18068; hamBandRange[6][1] = 18168; @@ -993,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 @@ -1082,7 +1109,7 @@ void loop(){ else doTuningWithThresHold(); - if (isCWAutoMode == 0 && beforeIdle_ProcessTime < millis() - 200) { + if (isCWAutoMode == 0 && beforeIdle_ProcessTime < millis() - 500) { idle_process(); beforeIdle_ProcessTime = millis(); } diff --git a/ubitx_20/ubitx_idle.ino b/ubitx_20/ubitx_idle.ino index dff2aad..55f2fdf 100644 --- a/ubitx_20/ubitx_idle.ino +++ b/ubitx_20/ubitx_idle.ino @@ -17,7 +17,137 @@ along with this program. If not, see . **************************************************************************/ +byte line2Buffer[16]; +//KD8CEC 200Hz ST +//L14.150 200Hz ST +//U14.150 +150khz +int freqScrollPosition = 0; +//Example Line2 Optinal Display +void updateLine2Buffer() +{ + unsigned long tmpFreq = 0; + if (ritOn) + { + line2Buffer[0] = 'R'; + line2Buffer[1] = 'i'; + line2Buffer[2] = 't'; + line2Buffer[3] = 'T'; + line2Buffer[4] = 'X'; + line2Buffer[5] = ':'; + + //display frequency + tmpFreq = ritTxFrequency; + for (int i = 15; i >= 6; i--) { + if (tmpFreq > 0) { + if (i == 12 || i == 8) line2Buffer[i] = '.'; + else { + line2Buffer[i] = tmpFreq % 10 + 0x30; + tmpFreq /= 10; + } + } + else + line2Buffer[i] = ' '; + } + + return; + } + + if (vfoActive == VFO_B) + { + tmpFreq = vfoA; + //line2Buffer[0] = 'A'; + } + else + { + tmpFreq = vfoB; + //line2Buffer[0] = 'B'; + } + + // EXAMPLE 1 & 2 + //U14.150.100 + //display frequency + for (int i = 9; i >= 0; i--) { + if (tmpFreq > 0) { + if (i == 2 || i == 6) line2Buffer[i] = '.'; + else { + line2Buffer[i] = tmpFreq % 10 + 0x30; + tmpFreq /= 10; + } + } + else + line2Buffer[i] = ' '; + } + + //EXAMPLE #1 + if ((displayOption1 & 0x04) == 0x00) + line2Buffer[6] = 'k'; + else + { + //example #2 + if (freqScrollPosition++ > 18) + { + line2Buffer[6] = 'k'; + if (freqScrollPosition > 25) + freqScrollPosition = -1; + } + else + { + line2Buffer[10] = 'H'; + line2Buffer[11] = 'z'; + + if (freqScrollPosition < 7) + { + for (int i = 11; i >= 0; i--) + if (i - (7 - freqScrollPosition) >= 0) + line2Buffer[i] = line2Buffer[i - (7 - freqScrollPosition)]; + else + line2Buffer[i] = ' '; + } + else + { + for (int i = 0; i < 11; i++) + if (i + (freqScrollPosition - 7) <= 11) + line2Buffer[i] = line2Buffer[i + (freqScrollPosition - 7)]; + else + line2Buffer[i] = ' '; + } + } + } + line2Buffer[7] = ' '; + + //Step + byte tmpStep = arTuneStep[tuneStepIndex -1]; + for (int i = 10; i >= 8; i--) { + if (tmpStep > 0) { + line2Buffer[i] = tmpStep % 10 + 0x30; + tmpStep /= 10; + } + else + line2Buffer[i] = ' '; + } + line2Buffer[11] = 'H'; + line2Buffer[12] = 'z'; + + line2Buffer[13] = ' '; + //if ( + //Check CW Key cwKeyType = 0; //0: straight, 1 : iambica, 2: iambicb + if (cwKeyType == 0) + { + line2Buffer[14] = 'S'; + line2Buffer[15] = 'T'; + } + else if (cwKeyType == 1) + { + line2Buffer[14] = 'I'; + line2Buffer[15] = 'A'; + } + else + { + line2Buffer[14] = 'I'; + line2Buffer[15] = 'B'; + } +} void idle_process() { @@ -25,6 +155,11 @@ void idle_process() if (menuOn == 0) { //if line2DisplayStatus == 0 <-- this condition is clear Line, you can display any message + if (line2DisplayStatus == 0 || (((displayOption1 & 0x04) == 0x04) && line2DisplayStatus == 2)) { + updateLine2Buffer(); + printLine2(line2Buffer); + line2DisplayStatus = 2; + } } } 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