1st Test new CW Keyer and add cat message processing
This commit is contained in:
parent
cc7dd752e6
commit
8d4c788e11
@ -597,8 +597,13 @@ applied Threshold for reduct errors, dial Lock, dynamic Step
|
||||
byte threshold = 2; //noe action for count
|
||||
unsigned long lastEncInputtime = 0;
|
||||
int encodedSumValue = 0;
|
||||
unsigned long lastTunetime = 0; //if continous moving, skip threshold processing
|
||||
byte lastMovedirection = 0; //0 : stop, 1 : cw, 2 : ccw
|
||||
|
||||
#define skipThresholdTime 100
|
||||
#define encodeTimeOut 1000
|
||||
void doTuning(){
|
||||
|
||||
void doTuningWithThresHold(){
|
||||
int s = 0;
|
||||
unsigned long prev_freq;
|
||||
long incdecValue = 0;
|
||||
@ -615,6 +620,8 @@ void doTuning(){
|
||||
if (s == 0) {
|
||||
if (encodedSumValue != 0 && (millis() - encodeTimeOut) > lastEncInputtime)
|
||||
encodedSumValue = 0;
|
||||
|
||||
lastMovedirection = 0;
|
||||
return;
|
||||
}
|
||||
lastEncInputtime = millis();
|
||||
@ -622,16 +629,18 @@ void doTuning(){
|
||||
//for check moving direction
|
||||
encodedSumValue += (s > 0 ? 1 : -1);
|
||||
|
||||
//check threshold
|
||||
if ((encodedSumValue * encodedSumValue) <= (threshold * threshold))
|
||||
//check threshold and operator actions (hold dial speed = continous moving, skip threshold check)
|
||||
if ((lastTunetime < millis() - skipThresholdTime) && ((encodedSumValue * encodedSumValue) <= (threshold * threshold)))
|
||||
return;
|
||||
|
||||
lastTunetime = millis();
|
||||
|
||||
//Valid Action without noise
|
||||
encodedSumValue = 0;
|
||||
|
||||
prev_freq = frequency;
|
||||
//incdecValue = tuningStep * s;
|
||||
frequency += (arTuneStep[tuneStepIndex -1] * s);
|
||||
frequency += (arTuneStep[tuneStepIndex -1] * s * (s * s < 10 ? 1 : 3)); //appield weight (s is speed)
|
||||
|
||||
if (prev_freq < 10000000l && frequency > 10000000l)
|
||||
isUSB = true;
|
||||
@ -1036,7 +1045,7 @@ void loop(){
|
||||
if (ritOn)
|
||||
doRIT();
|
||||
else
|
||||
doTuning();
|
||||
doTuningWithThresHold();
|
||||
}
|
||||
|
||||
//we check CAT after the encoder as it might put the radio into TX
|
||||
|
@ -133,8 +133,8 @@ void cwKeyer(void){
|
||||
int dot,dash;
|
||||
bool continue_loop = true;
|
||||
unsigned tmpKeyControl = 0;
|
||||
if( Iambic_Key ){
|
||||
|
||||
if( Iambic_Key ) {
|
||||
while(continue_loop) {
|
||||
switch (keyerState) {
|
||||
case IDLE:
|
||||
@ -207,11 +207,12 @@ while(continue_loop){
|
||||
}
|
||||
break;
|
||||
}
|
||||
} //end of while
|
||||
|
||||
}else{
|
||||
Check_Cat(3);
|
||||
} //end of while
|
||||
}
|
||||
else{
|
||||
while(1){
|
||||
//if (analogRead(ANALOG_DOT) < 600){
|
||||
if (update_PaddleLatch(0) == DIT_L) {
|
||||
// if we are here, it is only because the key is pressed
|
||||
if (!inTx){
|
||||
@ -219,12 +220,14 @@ while(continue_loop){
|
||||
cwTimeout = millis() + cwDelayTime * 10; //+ CW_TIMEOUT;
|
||||
startTx(TX_CW, 1);
|
||||
}
|
||||
// start the transmission)
|
||||
cwKeydown();
|
||||
//while ( analogRead(ANALOG_DOT) < 600 ) delay(1);
|
||||
while ( update_PaddleLatch(0) == DIT_L ) delay(1);
|
||||
|
||||
while ( update_PaddleLatch(0) == DIT_L )
|
||||
delay_background(1, 3);
|
||||
|
||||
cwKeyUp();
|
||||
}else{
|
||||
}
|
||||
else{
|
||||
if (0 < cwTimeout && cwTimeout < millis()){
|
||||
cwTimeout = 0;
|
||||
keyDown = 0;
|
||||
@ -234,11 +237,14 @@ while(continue_loop){
|
||||
return;
|
||||
// got back to the beginning of the loop, if no further activity happens on straight key
|
||||
// we will time out, and return out of this routine
|
||||
delay(5);
|
||||
//delay(5);
|
||||
delay_background(5, 3);
|
||||
continue;
|
||||
}
|
||||
} //end of else
|
||||
}
|
||||
|
||||
Check_Cat(2);
|
||||
} //end of while
|
||||
} //end of elese
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user