Das Probem mit dem Iambic Mode lag bei der Funktion der Entprellung der

Tasteneingänge. Muss ein > 100€ Keyer überhaupt eine Entprellung haben?

Überlegung, ob es nicht sinnvoller ist, die Tasteneingänge per Interrupt
abzufragen. Das würde den Code auch noch erheblich vereinfachen, da
nicht ständig an allen möglichen Stellen die Paddle abgefragt werden
müssten.
main
Tom 9 months ago
parent da9d6dd4d0
commit 463869f62f

1
.gitignore vendored

@ -1,2 +1,3 @@
*~
.*.swp
Scratch

@ -141,7 +141,7 @@ void SetEEprom(void)
bConfig.Memory = 0;
bConfig.RiseTime = 5;
bConfig.RiseTimeCounter = 5;
bConfig.DebounceTime = 10;
bConfig.DebounceTime = 5;
WriteEEprom();
}
/** @brief EEprom lesen
@ -314,7 +314,7 @@ void TXKey(uint8_t State)
{
if((State) && (bState.KeyState == 0))
{
if(KeyTX)
if(bState.KeyTX)
{
SidetoneOn();
sbi(PORTC,MORSE_LED);
@ -325,7 +325,7 @@ void TXKey(uint8_t State)
{
if((State == 0) && (bState.KeyState))
{
if(KeyTX)
if(bState.KeyTX)
{
SidetoneOff();
cbi(PORTC,MORSE_LED);
@ -451,7 +451,7 @@ void CheckPaddles(void)
*/
void CheckDitPaddle(void)
{
static uint8_t pinvalue = 0;
uint8_t pinvalue = 0;
if(PaddleMode == PADDLE_NORMAL) // no reverse paddle
pinvalue = PIND & (1<<LEFT_PADDLE);
@ -460,17 +460,7 @@ void CheckDitPaddle(void)
if(pinvalue == 0) // DitPaddle betätigt
{
if(StatePaddleKeyPressed == NO_KEY_PRESSED) // Entprellen
{
StatePaddleKeyPressed = KEY_PRESSED_DEBOUNCE;
TimerPaddleKeyPressed = 0;
}
if(StatePaddleKeyPressed == KEY_PRESSED) // Debounce ok
{
SerialWriteString("470:DitBuffer == 1\r\n");
DitBuffer = 1;
StatePaddleKeyPressed = NO_KEY_PRESSED;
}
DitBuffer = 1;
}
}
/*
@ -478,7 +468,7 @@ void CheckDitPaddle(void)
*/
void CheckDahPaddle(void)
{
static uint8_t pinvalue = 0;
uint8_t pinvalue = 0;
if(PaddleMode == PADDLE_NORMAL) // no reverse paddle
pinvalue = PIND & (1<<RIGHT_PADDLE);
@ -487,17 +477,7 @@ void CheckDahPaddle(void)
if(pinvalue == 0)
{
if(StatePaddleKeyPressed == NO_KEY_PRESSED)
{
StatePaddleKeyPressed = KEY_PRESSED_DEBOUNCE;
TimerPaddleKeyPressed = 0;
}
if(StatePaddleKeyPressed == KEY_PRESSED) // Debounce ok
{
SerialWriteString("496:DahBuffer == 1\r\n");
DahBuffer = 1;
StatePaddleKeyPressed = NO_KEY_PRESSED;
}
DahBuffer = 1;
}
}

@ -132,6 +132,7 @@ struct State
uint8_t SidetoneEnabled: 1; // Mithörton ein- oder ausgeschaltet
uint8_t SendStatus; //
uint8_t KeyState:1; //
uint8_t KeyTX:1;
};
struct MenuCtrl
@ -206,11 +207,13 @@ volatile uint16_t t_wait_led;
volatile uint8_t lastButton; // Wert der letzten Buttonabfrage
volatile uint16_t DitMillis;
volatile uint16_t DahMillis;
// Zähler und Status für Tasten und Mithörton
// Zähler und Status für Entprellung der Tasteneingänge und Mithörton
volatile uint8_t StateStraightKeyPressed; // Merker für StraightKey betätigt
volatile uint8_t TimerStraightKeyPressed; // Timer Variable für Entprellung
volatile uint8_t StatePaddleKeyPressed; // Merker für Paddle betätigt
volatile uint8_t TimerPaddleKeyPressed; // Timer Variable für Entprellung
volatile uint8_t StatePaddleDitKeyPressed; // Merker für Paddle betätigt
volatile uint8_t TimerPaddleDitKeyPressed; // Timer Variable für Entprellung
volatile uint8_t StatePaddleDahKeyPressed; // Merker für Paddle betätigt
volatile uint8_t TimerPaddleDahKeyPressed; // Timer Variable für Entprellung
volatile uint8_t StateRiseTimeCounter; // Zähler für Anstieg des Mithörtons
volatile uint8_t StateRiseTime;
volatile uint8_t StateRiseTimeCounter;

@ -183,6 +183,7 @@ void Init()
bMenuCtrl.Config = 0;
bMenuCtrl.buttonPressed = 0;
bMenuCtrl.buttonPressedLong = 0;
bMenuCtrl.WriteEEprom = 0;
sei(); // enable all interrupts
}
@ -277,12 +278,20 @@ ISR(TIMER0_COMPA_vect)
StateStraightKeyPressed = KEY_PRESSED;
}
// Softwarentprellung für Paddle
TimerPaddleKeyPressed++;
if(StatePaddleKeyPressed == KEY_PRESSED_DEBOUNCE)
TimerPaddleDitKeyPressed++;
if(StatePaddleDitKeyPressed == KEY_PRESSED_DEBOUNCE)
{
if(TimerPaddleKeyPressed > bConfig.DebounceTime)
StatePaddleKeyPressed = KEY_PRESSED;
if(TimerPaddleDitKeyPressed > bConfig.DebounceTime)
StatePaddleDitKeyPressed = KEY_PRESSED;
}
// Softwarentprellung für Paddle
TimerPaddleDahKeyPressed++;
if(StatePaddleDahKeyPressed == KEY_PRESSED_DEBOUNCE)
{
if(TimerPaddleDahKeyPressed > bConfig.DebounceTime)
StatePaddleDahKeyPressed = KEY_PRESSED;
}
}
/** \brief 8 Bit Timer 2
@ -328,7 +337,7 @@ void ReStart(void)
SetRatio(0);
KeyerMode = bConfig.KeyerMode;
PaddleMode = bConfig.Reverse;
KeyTX = 1;
bState.KeyTX = 1;
bState.KeyState = 0;
if(bConfig.SidetoneEnabled)
SidetoneEnable();

Loading…
Cancel
Save