From 72a5f04ec6975dcc2dccd90be6f9be0d1bcf26c1 Mon Sep 17 00:00:00 2001 From: Martin Brodbeck Date: Wed, 21 Feb 2024 12:03:10 +0100 Subject: [PATCH] more on poti speed --- src/raspi_keyer.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/raspi_keyer.cpp b/src/raspi_keyer.cpp index 202cee5..4b68c10 100644 --- a/src/raspi_keyer.cpp +++ b/src/raspi_keyer.cpp @@ -167,8 +167,11 @@ int main() multicore_launch_core1(core1_main); Settings settings {read_settings()}; - //Settings settings; - uint8_t currentWpm, lastWpm {0}; + + uint8_t currentWpm {0}; + uint8_t lastWpm {0}; + + // If WPM in settings is set to 0 -> take speed from poti if (settings.wpm == 0) { currentWpm = calcWPM(potiRead(), settings.wpmPotiMin, settings.wpmPotiMax); } else { @@ -176,7 +179,6 @@ int main() } lastWpm = currentWpm; - KeyerQueueData keyerQueueData {KeyerQueueCommand::Run, currentWpm, settings.mode}; queue_add_blocking(&keyerQueue, &keyerQueueData); @@ -185,14 +187,16 @@ int main() cdc_task(); currentWpm = calcWPM(potiRead(), settings.wpmPotiMin, settings.wpmPotiMax); - if (currentWpm != lastWpm) { + + // If WPM in settings is set to 0 -> take speed from poti + if (settings.wpm == 0 && (currentWpm != lastWpm)) { KeyerQueueData keyerQueueData {KeyerQueueCommand::Config, currentWpm, settings.mode}; queue_add_blocking(&keyerQueue, &keyerQueueData); printf("WPM has changed to: %d\n", currentWpm); lastWpm = currentWpm; } - busy_wait_ms(1000); + //busy_wait_ms(1000); } return 0;