add menu for new Keyer logic

This commit is contained in:
phdlee 2018-01-25 23:15:24 +09:00
parent c7be3dcd39
commit 020b34e504
2 changed files with 50 additions and 12 deletions

View File

@ -95,7 +95,7 @@ enum KSTYPE {IDLE, CHK_DIT, CHK_DAH, KEYED_PREP, KEYED, INTER_ELEMENT };
static long ktimer; static long ktimer;
bool Iambic_Key = true; bool Iambic_Key = false;
unsigned char keyerControl = IAMBICB; unsigned char keyerControl = IAMBICB;
unsigned char keyerState = IDLE; unsigned char keyerState = IDLE;
@ -150,16 +150,17 @@ char update_PaddleLatch(byte isUpdateKeyState) {
else if (paddle > 50) else if (paddle > 50)
tmpKeyerControl |= (DAH_L | DIT_L) ; //both are between 1 and 2v tmpKeyerControl |= (DAH_L | DIT_L) ; //both are between 1 and 2v
else else
tmpKeyerControl = 0 ; //STRAIGHT KEY in original code { //STRAIGHT KEY in original code
//keyerControl |= (DAH_L | DIT_L) ; //STRAIGHT KEY in original code if (Iambic_Key)
tmpKeyerControl = 0 ;
if (isUpdateKeyState == 1) { else
keyerControl |= tmpKeyerControl; tmpKeyerControl = DIT_L ;
} }
if (isUpdateKeyState == 1)
keyerControl |= tmpKeyerControl;
return tmpKeyerControl; return tmpKeyerControl;
//if (analogRead(ANALOG_DOT) < 600 ) keyerControl |= DIT_L;
//if (analogRead(ANALOG_DASH) < 600 ) keyerControl |= DAH_L;
} }
void cwKeyer(void){ void cwKeyer(void){
@ -217,7 +218,7 @@ while(continue_loop){
if (!inTx){ if (!inTx){
keyDown = 0; keyDown = 0;
cwTimeout = millis() + cwDelayTime * 10; //+ CW_TIMEOUT; cwTimeout = millis() + cwDelayTime * 10; //+ CW_TIMEOUT;
startTx(TX_CW, 0); startTx(TX_CW, 1);
} }
cwKeydown(); cwKeydown();
break; break;
@ -256,7 +257,7 @@ while(continue_loop){
if (!inTx){ if (!inTx){
keyDown = 0; keyDown = 0;
cwTimeout = millis() + cwDelayTime * 10; //+ CW_TIMEOUT; cwTimeout = millis() + cwDelayTime * 10; //+ CW_TIMEOUT;
startTx(TX_CW, 0); startTx(TX_CW, 1);
} }
// start the transmission) // start the transmission)
cwKeydown(); cwKeydown();

View File

@ -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){ void menuTxOnOff(int btn, byte optionType){
if (!btn){ if (!btn){
if ((isTxType & optionType) == 0) if ((isTxType & optionType) == 0)
@ -830,7 +865,7 @@ void doMenu(){
btnState = btnDown(); btnState = btnDown();
if (i > 0){ if (i > 0){
if (modeCalibrate && select + i < 150) if (modeCalibrate && select + i < 160)
select += i; select += i;
if (!modeCalibrate && select + i < 80) if (!modeCalibrate && select + i < 80)
select += i; select += i;
@ -868,8 +903,10 @@ void doMenu(){
else if (select < 130 && modeCalibrate) else if (select < 130 && modeCalibrate)
menuSetupTXCWInterval(btnState); menuSetupTXCWInterval(btnState);
else if (select < 140 && modeCalibrate) else if (select < 140 && modeCalibrate)
menuTxOnOff(btnState, 0x01); //TX OFF / ON menuSetupKeyType(btnState);
else if (select < 150 && modeCalibrate) else if (select < 150 && modeCalibrate)
menuTxOnOff(btnState, 0x01); //TX OFF / ON
else if (select < 160 && modeCalibrate)
menuExit(btnState); menuExit(btnState);
Check_Cat(0); //To prevent disconnections Check_Cat(0); //To prevent disconnections