Updated Raduino code with some old code from the ubitx-v5d repository, in order to suppress the key line (prevent inadvertant transmitting when I first start working this).
This commit is contained in:
@@ -39,6 +39,22 @@ char lastPaddle = 0;
|
||||
|
||||
//reads the analog keyer pin and reports the paddle
|
||||
byte getPaddle(){
|
||||
/*
|
||||
* KC4UPR - IOP update, 2020-05-03
|
||||
*
|
||||
* Modifying this for the uBITX IOP. Big picture:
|
||||
*
|
||||
* (1) It uses the PTT input line.
|
||||
*
|
||||
* (2) It's always "straight key" mode (the IOP provides the keyer).
|
||||
*/
|
||||
|
||||
if (digitalRead(PTT) == 1) // key/PTT is up
|
||||
return 0;
|
||||
else
|
||||
return PADDLE_STRAIGHT;
|
||||
|
||||
/*
|
||||
int paddle = analogRead(ANALOG_KEYER);
|
||||
|
||||
if (paddle > 800) // above 4v is up
|
||||
@@ -52,6 +68,7 @@ byte getPaddle(){
|
||||
return PADDLE_BOTH; //both are between 1 and 2v
|
||||
else
|
||||
return PADDLE_STRAIGHT; //less than 1v is the straight key
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -96,9 +113,20 @@ unsigned char keyerState = IDLE;
|
||||
//Below is a test to reduce the keying error. do not delete lines
|
||||
//create by KD8CEC for compatible with new CW Logic
|
||||
char update_PaddleLatch(byte isUpdateKeyState) {
|
||||
/*
|
||||
* KC4UPR - IOP update, 2020-05-03
|
||||
*
|
||||
* Modifying this for the uBITX IOP. Big picture:
|
||||
*
|
||||
* No iambic keyer. It's always "straight key" based on the IOP.
|
||||
*
|
||||
* It uses the PTT line.
|
||||
*/
|
||||
return (digitalRead(PTT) ? 0 : DIT_L);
|
||||
/*
|
||||
unsigned char tmpKeyerControl = 0;
|
||||
int paddle = analogRead(ANALOG_KEYER);
|
||||
|
||||
|
||||
if (paddle >= cwAdcDashFrom && paddle <= cwAdcDashTo)
|
||||
tmpKeyerControl |= DAH_L;
|
||||
else if (paddle >= cwAdcDotFrom && paddle <= cwAdcDotTo)
|
||||
@@ -119,6 +147,7 @@ char update_PaddleLatch(byte isUpdateKeyState) {
|
||||
keyerControl |= tmpKeyerControl;
|
||||
|
||||
return tmpKeyerControl;
|
||||
*/
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
@@ -126,106 +155,113 @@ char update_PaddleLatch(byte isUpdateKeyState) {
|
||||
// modified by KD8CEC
|
||||
******************************************************************************/
|
||||
void cwKeyer(void){
|
||||
lastPaddle = 0;
|
||||
bool continue_loop = true;
|
||||
unsigned tmpKeyControl = 0;
|
||||
|
||||
if( Iambic_Key ) {
|
||||
while(continue_loop) {
|
||||
switch (keyerState) {
|
||||
case IDLE:
|
||||
tmpKeyControl = update_PaddleLatch(0);
|
||||
if ( tmpKeyControl == DAH_L || tmpKeyControl == DIT_L ||
|
||||
tmpKeyControl == (DAH_L | DIT_L) || (keyerControl & 0x03)) {
|
||||
update_PaddleLatch(1);
|
||||
keyerState = CHK_DIT;
|
||||
}else{
|
||||
if (0 < cwTimeout && cwTimeout < millis()){
|
||||
cwTimeout = 0;
|
||||
stopTx();
|
||||
}
|
||||
continue_loop = false;
|
||||
}
|
||||
break;
|
||||
|
||||
case CHK_DIT:
|
||||
if (keyerControl & DIT_L) {
|
||||
keyerControl |= DIT_PROC;
|
||||
ktimer = cwSpeed;
|
||||
keyerState = KEYED_PREP;
|
||||
}else{
|
||||
keyerState = CHK_DAH;
|
||||
}
|
||||
break;
|
||||
|
||||
case CHK_DAH:
|
||||
if (keyerControl & DAH_L) {
|
||||
ktimer = cwSpeed*3;
|
||||
keyerState = KEYED_PREP;
|
||||
}else{
|
||||
keyerState = IDLE;
|
||||
}
|
||||
break;
|
||||
|
||||
case KEYED_PREP:
|
||||
//modified KD8CEC
|
||||
/*
|
||||
ktimer += millis(); // set ktimer to interval end time
|
||||
keyerControl &= ~(DIT_L + DAH_L); // clear both paddle latch bits
|
||||
keyerState = KEYED; // next state
|
||||
if (!inTx){
|
||||
//DelayTime Option
|
||||
delay_background(delayBeforeCWStartTime * 2, 2);
|
||||
|
||||
keyDown = 0;
|
||||
cwTimeout = millis() + cwDelayTime * 10; //+ CW_TIMEOUT;
|
||||
startTx(TX_CW, 1);
|
||||
}
|
||||
*/
|
||||
if (!inTx){
|
||||
//DelayTime Option
|
||||
delay_background(delayBeforeCWStartTime * 2, 2);
|
||||
|
||||
keyDown = 0;
|
||||
cwTimeout = millis() + cwDelayTime * 10; //+ CW_TIMEOUT;
|
||||
startTx(TX_CW, 1);
|
||||
}
|
||||
ktimer += millis(); // set ktimer to interval end time
|
||||
keyerControl &= ~(DIT_L + DAH_L); // clear both paddle latch bits
|
||||
keyerState = KEYED; // next state
|
||||
|
||||
cwKeydown();
|
||||
break;
|
||||
|
||||
case KEYED:
|
||||
if (millis() > ktimer) { // are we at end of key down ?
|
||||
cwKeyUp();
|
||||
ktimer = millis() + cwSpeed; // inter-element time
|
||||
keyerState = INTER_ELEMENT; // next state
|
||||
}else if (keyerControl & IAMBICB) {
|
||||
update_PaddleLatch(1); // early paddle latch in Iambic B mode
|
||||
}
|
||||
break;
|
||||
|
||||
case INTER_ELEMENT:
|
||||
// Insert time between dits/dahs
|
||||
update_PaddleLatch(1); // latch paddle state
|
||||
if (millis() > ktimer) { // are we at end of inter-space ?
|
||||
if (keyerControl & DIT_PROC) { // was it a dit or dah ?
|
||||
keyerControl &= ~(DIT_L + DIT_PROC); // clear two bits
|
||||
keyerState = CHK_DAH; // dit done, check for dah
|
||||
}else{
|
||||
keyerControl &= ~(DAH_L); // clear dah latch
|
||||
keyerState = IDLE; // go idle
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
Check_Cat(2);
|
||||
} //end of while
|
||||
}
|
||||
else{
|
||||
/*
|
||||
* KC4UPR - IOP update, 2020-05-03
|
||||
*
|
||||
* Modifying this for the uBITX IOP. Big picture:
|
||||
*
|
||||
* No iambic keyer. It's always "straight key" based on the IOP.
|
||||
*/
|
||||
// lastPaddle = 0;
|
||||
// bool continue_loop = true;
|
||||
// unsigned tmpKeyControl = 0;
|
||||
//
|
||||
// if( Iambic_Key ) {
|
||||
// while(continue_loop) {
|
||||
// switch (keyerState) {
|
||||
// case IDLE:
|
||||
// tmpKeyControl = update_PaddleLatch(0);
|
||||
// if ( tmpKeyControl == DAH_L || tmpKeyControl == DIT_L ||
|
||||
// tmpKeyControl == (DAH_L | DIT_L) || (keyerControl & 0x03)) {
|
||||
// update_PaddleLatch(1);
|
||||
// keyerState = CHK_DIT;
|
||||
// }else{
|
||||
// if (0 < cwTimeout && cwTimeout < millis()){
|
||||
// cwTimeout = 0;
|
||||
// stopTx();
|
||||
// }
|
||||
// continue_loop = false;
|
||||
// }
|
||||
// break;
|
||||
//
|
||||
// case CHK_DIT:
|
||||
// if (keyerControl & DIT_L) {
|
||||
// keyerControl |= DIT_PROC;
|
||||
// ktimer = cwSpeed;
|
||||
// keyerState = KEYED_PREP;
|
||||
// }else{
|
||||
// keyerState = CHK_DAH;
|
||||
// }
|
||||
// break;
|
||||
//
|
||||
// case CHK_DAH:
|
||||
// if (keyerControl & DAH_L) {
|
||||
// ktimer = cwSpeed*3;
|
||||
// keyerState = KEYED_PREP;
|
||||
// }else{
|
||||
// keyerState = IDLE;
|
||||
// }
|
||||
// break;
|
||||
//
|
||||
// case KEYED_PREP:
|
||||
// //modified KD8CEC
|
||||
// /*
|
||||
// ktimer += millis(); // set ktimer to interval end time
|
||||
// keyerControl &= ~(DIT_L + DAH_L); // clear both paddle latch bits
|
||||
// keyerState = KEYED; // next state
|
||||
// if (!inTx){
|
||||
// //DelayTime Option
|
||||
// delay_background(delayBeforeCWStartTime * 2, 2);
|
||||
//
|
||||
// keyDown = 0;
|
||||
// cwTimeout = millis() + cwDelayTime * 10; //+ CW_TIMEOUT;
|
||||
// startTx(TX_CW, 1);
|
||||
// }
|
||||
// */
|
||||
// if (!inTx){
|
||||
// //DelayTime Option
|
||||
// delay_background(delayBeforeCWStartTime * 2, 2);
|
||||
//
|
||||
// keyDown = 0;
|
||||
// cwTimeout = millis() + cwDelayTime * 10; //+ CW_TIMEOUT;
|
||||
// startTx(TX_CW, 1);
|
||||
// }
|
||||
// ktimer += millis(); // set ktimer to interval end time
|
||||
// keyerControl &= ~(DIT_L + DAH_L); // clear both paddle latch bits
|
||||
// keyerState = KEYED; // next state
|
||||
//
|
||||
// cwKeydown();
|
||||
// break;
|
||||
//
|
||||
// case KEYED:
|
||||
// if (millis() > ktimer) { // are we at end of key down ?
|
||||
// cwKeyUp();
|
||||
// ktimer = millis() + cwSpeed; // inter-element time
|
||||
// keyerState = INTER_ELEMENT; // next state
|
||||
// }else if (keyerControl & IAMBICB) {
|
||||
// update_PaddleLatch(1); // early paddle latch in Iambic B mode
|
||||
// }
|
||||
// break;
|
||||
//
|
||||
// case INTER_ELEMENT:
|
||||
// // Insert time between dits/dahs
|
||||
// update_PaddleLatch(1); // latch paddle state
|
||||
// if (millis() > ktimer) { // are we at end of inter-space ?
|
||||
// if (keyerControl & DIT_PROC) { // was it a dit or dah ?
|
||||
// keyerControl &= ~(DIT_L + DIT_PROC); // clear two bits
|
||||
// keyerState = CHK_DAH; // dit done, check for dah
|
||||
// }else{
|
||||
// keyerControl &= ~(DAH_L); // clear dah latch
|
||||
// keyerState = IDLE; // go idle
|
||||
// }
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// Check_Cat(2);
|
||||
// } //end of while
|
||||
// }
|
||||
// else{
|
||||
while(1){
|
||||
if (update_PaddleLatch(0) == DIT_L) {
|
||||
// if we are here, it is only because the key is pressed
|
||||
@@ -262,7 +298,7 @@ void cwKeyer(void){
|
||||
|
||||
Check_Cat(2);
|
||||
} //end of while
|
||||
} //end of elese
|
||||
// } //end of elese
|
||||
}
|
||||
|
||||
|
||||
@@ -365,5 +401,3 @@ void cwKeyer(){
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user