more on poti speed

This commit is contained in:
Martin Brodbeck 2024-02-21 12:03:10 +01:00
parent c90100017a
commit 72a5f04ec6

View file

@ -167,8 +167,11 @@ int main()
multicore_launch_core1(core1_main); multicore_launch_core1(core1_main);
Settings settings {read_settings()}; 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) { if (settings.wpm == 0) {
currentWpm = calcWPM(potiRead(), settings.wpmPotiMin, settings.wpmPotiMax); currentWpm = calcWPM(potiRead(), settings.wpmPotiMin, settings.wpmPotiMax);
} else { } else {
@ -176,7 +179,6 @@ int main()
} }
lastWpm = currentWpm; lastWpm = currentWpm;
KeyerQueueData keyerQueueData {KeyerQueueCommand::Run, currentWpm, settings.mode}; KeyerQueueData keyerQueueData {KeyerQueueCommand::Run, currentWpm, settings.mode};
queue_add_blocking(&keyerQueue, &keyerQueueData); queue_add_blocking(&keyerQueue, &keyerQueueData);
@ -185,14 +187,16 @@ int main()
cdc_task(); cdc_task();
currentWpm = calcWPM(potiRead(), settings.wpmPotiMin, settings.wpmPotiMax); 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}; KeyerQueueData keyerQueueData {KeyerQueueCommand::Config, currentWpm, settings.mode};
queue_add_blocking(&keyerQueue, &keyerQueueData); queue_add_blocking(&keyerQueue, &keyerQueueData);
printf("WPM has changed to: %d\n", currentWpm); printf("WPM has changed to: %d\n", currentWpm);
lastWpm = currentWpm; lastWpm = currentWpm;
} }
busy_wait_ms(1000); //busy_wait_ms(1000);
} }
return 0; return 0;