From 463869f62f0f3f75cc017ebbdfa257e4e19c1877 Mon Sep 17 00:00:00 2001 From: "Tom, DL7BJ" Date: Mon, 21 Aug 2023 22:40:04 +0200 Subject: [PATCH] =?UTF-8?q?Das=20Probem=20mit=20dem=20Iambic=20Mode=20lag?= =?UTF-8?q?=20bei=20der=20Funktion=20der=20Entprellung=20der=20Tasteneing?= =?UTF-8?q?=C3=A4nge.=20Muss=20ein=20>=20100=E2=82=AC=20Keyer=20=C3=BCberh?= =?UTF-8?q?aupt=20eine=20Entprellung=20haben=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ü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. --- .gitignore | 1 + Source/functions.c | 34 +++++++--------------------------- Source/globals.h | 9 ++++++--- Source/main.c | 19 ++++++++++++++----- 4 files changed, 28 insertions(+), 35 deletions(-) diff --git a/.gitignore b/.gitignore index 4c5f88a..cc19069 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *~ .*.swp +Scratch diff --git a/Source/functions.c b/Source/functions.c index 7a9d374..9cfe4a9 100644 --- a/Source/functions.c +++ b/Source/functions.c @@ -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< 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();