From 020b34e504db09d5dc83fee6b41ded35865ac853 Mon Sep 17 00:00:00 2001 From: phdlee Date: Thu, 25 Jan 2018 23:15:24 +0900 Subject: [PATCH 1/2] add menu for new Keyer logic --- ubitx_20/ubitx_keyer.ino | 21 ++++++++++---------- ubitx_20/ubitx_menu.ino | 41 ++++++++++++++++++++++++++++++++++++++-- 2 files changed, 50 insertions(+), 12 deletions(-) diff --git a/ubitx_20/ubitx_keyer.ino b/ubitx_20/ubitx_keyer.ino index cf950b8..d994315 100644 --- a/ubitx_20/ubitx_keyer.ino +++ b/ubitx_20/ubitx_keyer.ino @@ -95,7 +95,7 @@ enum KSTYPE {IDLE, CHK_DIT, CHK_DAH, KEYED_PREP, KEYED, INTER_ELEMENT }; static long ktimer; -bool Iambic_Key = true; +bool Iambic_Key = false; unsigned char keyerControl = IAMBICB; unsigned char keyerState = IDLE; @@ -150,16 +150,17 @@ char update_PaddleLatch(byte isUpdateKeyState) { else if (paddle > 50) tmpKeyerControl |= (DAH_L | DIT_L) ; //both are between 1 and 2v else - tmpKeyerControl = 0 ; //STRAIGHT KEY in original code - //keyerControl |= (DAH_L | DIT_L) ; //STRAIGHT KEY in original code - - if (isUpdateKeyState == 1) { - keyerControl |= tmpKeyerControl; + { //STRAIGHT KEY in original code + if (Iambic_Key) + tmpKeyerControl = 0 ; + else + tmpKeyerControl = DIT_L ; } + + if (isUpdateKeyState == 1) + keyerControl |= tmpKeyerControl; return tmpKeyerControl; - //if (analogRead(ANALOG_DOT) < 600 ) keyerControl |= DIT_L; - //if (analogRead(ANALOG_DASH) < 600 ) keyerControl |= DAH_L; } void cwKeyer(void){ @@ -217,7 +218,7 @@ while(continue_loop){ if (!inTx){ keyDown = 0; cwTimeout = millis() + cwDelayTime * 10; //+ CW_TIMEOUT; - startTx(TX_CW, 0); + startTx(TX_CW, 1); } cwKeydown(); break; @@ -256,7 +257,7 @@ while(continue_loop){ if (!inTx){ keyDown = 0; cwTimeout = millis() + cwDelayTime * 10; //+ CW_TIMEOUT; - startTx(TX_CW, 0); + startTx(TX_CW, 1); } // start the transmission) cwKeydown(); diff --git a/ubitx_20/ubitx_menu.ino b/ubitx_20/ubitx_menu.ino index 37165d9..117dca7 100644 --- a/ubitx_20/ubitx_menu.ino +++ b/ubitx_20/ubitx_menu.ino @@ -229,6 +229,41 @@ void menuSidebandToggle(int btn){ } } +void menuSetupKeyType(int btn){ + if (!btn && digitalRead(PTT) == HIGH){ + if (Iambic_Key) + printLineF2(F("Key: Straight?")); + else + printLineF2(F("Key: Fn=A, PTT=B")); + } + else { + if (Iambic_Key) + { + printLineF2(F("Straight Key!")); + Iambic_Key = false; + } + else + { + Iambic_Key = true; + if (btn) + { + keyerControl &= ~IAMBICB; + printLineF2(F("IAMBICA Key!")); + } + else + { + keyerControl |= IAMBICB; + printLineF2(F("IAMBICB Key!")); + } + } + + delay_background(500, 0); + printLine2ClearAndUpdate(); + menuOn = 0; + } +} + + void menuTxOnOff(int btn, byte optionType){ if (!btn){ if ((isTxType & optionType) == 0) @@ -830,7 +865,7 @@ void doMenu(){ btnState = btnDown(); if (i > 0){ - if (modeCalibrate && select + i < 150) + if (modeCalibrate && select + i < 160) select += i; if (!modeCalibrate && select + i < 80) select += i; @@ -868,8 +903,10 @@ void doMenu(){ else if (select < 130 && modeCalibrate) menuSetupTXCWInterval(btnState); else if (select < 140 && modeCalibrate) - menuTxOnOff(btnState, 0x01); //TX OFF / ON + menuSetupKeyType(btnState); else if (select < 150 && modeCalibrate) + menuTxOnOff(btnState, 0x01); //TX OFF / ON + else if (select < 160 && modeCalibrate) menuExit(btnState); Check_Cat(0); //To prevent disconnections From 981db341dbb8d3ae997f420903f5e1878dbc2e0b Mon Sep 17 00:00:00 2001 From: phdlee Date: Thu, 25 Jan 2018 23:31:47 +0900 Subject: [PATCH 2/2] change defautl key type --- ubitx_20/ubitx_keyer.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ubitx_20/ubitx_keyer.ino b/ubitx_20/ubitx_keyer.ino index d994315..99dd5af 100644 --- a/ubitx_20/ubitx_keyer.ino +++ b/ubitx_20/ubitx_keyer.ino @@ -95,7 +95,7 @@ enum KSTYPE {IDLE, CHK_DIT, CHK_DAH, KEYED_PREP, KEYED, INTER_ELEMENT }; static long ktimer; -bool Iambic_Key = false; +bool Iambic_Key = true; unsigned char keyerControl = IAMBICB; unsigned char keyerState = IDLE;