for Reduce CW Keying error

This commit is contained in:
phdlee
2018-01-26 21:47:15 +09:00
parent db543c43e1
commit 4506ff1c1b
4 changed files with 190 additions and 22 deletions

View File

@@ -83,41 +83,45 @@ void cwKeyUp(){
cwTimeout = millis() + cwDelayTime * 10;
}
/*****************************************************************************
// New logic, by RON
// modified by KD8CEC
******************************************************************************/
//Variables for Ron's new logic
#define DIT_L 0x01 // DIT latch
#define DAH_L 0x02 // DAH latch
#define DIT_PROC 0x04 // DIT is being processed
#define PDLSWAP 0x08 // 0 for normal, 1 for swap
#define IAMBICB 0x10 // 0 for Iambic A, 1 for Iambic B
enum KSTYPE {IDLE, CHK_DIT, CHK_DAH, KEYED_PREP, KEYED, INTER_ELEMENT };
static long ktimer;
bool Iambic_Key = true;
unsigned char keyerControl = IAMBICB;
unsigned char keyerState = IDLE;
//Below is a test to reduce the keying error.
/*
//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) {
int paddle = analogRead(ANALOG_KEYER);
unsigned char tmpKeyerControl;
if (paddle > 800) // above 4v is up
tmpKeyerControl = 0;
//if (paddle > 800) // above 4v is up
// tmpKeyerControl = 0;
//else if (paddle > 600) // 4-3v is DASH
else if (paddle > 693 && paddle < 700) // 4-3v is DASH
if (paddle > cwAdcDashtFrom && cwAdcDashTo < 700) // 4-3v is DASH
tmpKeyerControl |= DAH_L;
//else if (paddle > 300) //1-2v is DOT
else if (paddle > 323 && paddle < 328) //1-2v is DOT
else if (paddle > cwAdcDotFrom && paddle < cwAdcDotTo) //1-2v is DOT
tmpKeyerControl |= DIT_L;
//else if (paddle > 50)
else if (paddle > 280 && paddle < 290)
else if (paddle > cwAdcBothFrom && paddle < cwAdcBothTo)
tmpKeyerControl |= (DAH_L | DIT_L) ; //both are between 1 and 2v
else
else
{
if (Iambic_Key)
tmpKeyerControl = 0 ;
else if (paddle > cwAdcSTFrom && paddle < cwAdcSTTo)
tmpKeyerControl = DIT_L ;
else
tmpKeyerControl = 0 ;
}
tmpKeyerControl = 0 ; //STRAIGHT KEY in original code
//keyerControl |= (DAH_L | DIT_L) ; //STRAIGHT KEY in original code
@@ -135,8 +139,8 @@ char update_PaddleLatch(byte isUpdateKeyState) {
//if (analogRead(ANALOG_DOT) < 600 ) keyerControl |= DIT_L;
//if (analogRead(ANALOG_DASH) < 600 ) keyerControl |= DAH_L;
}
*/
/*
//create by KD8CEC for compatible with new CW Logic
char update_PaddleLatch(byte isUpdateKeyState) {
int paddle = analogRead(ANALOG_KEYER);
@@ -163,8 +167,12 @@ char update_PaddleLatch(byte isUpdateKeyState) {
return tmpKeyerControl;
}
*/
//This function is Ron's Logic.
/*****************************************************************************
// New logic, by RON
// modified by KD8CEC
******************************************************************************/
void cwKeyer(void){
byte paddle;
lastPaddle = 0;