From d3dd8913bdf41e38bbc75b1f5dbe7159650ba80b Mon Sep 17 00:00:00 2001 From: manuel Date: Sat, 16 Jan 2021 21:47:38 +0100 Subject: glasslathe: update acceleration curve --- linz/glasslathe/src/main.cpp | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'linz/glasslathe/src/main.cpp') diff --git a/linz/glasslathe/src/main.cpp b/linz/glasslathe/src/main.cpp index ee1e8d4..801d02e 100644 --- a/linz/glasslathe/src/main.cpp +++ b/linz/glasslathe/src/main.cpp @@ -80,7 +80,7 @@ void loop() Serial.println(target.frequency, DEC); } - const int step_delay = 300; + const int step_delay = 200; if (current.frequency != target.frequency || current.direction != target.direction) { if (!timer_enabled && target.frequency != 0) @@ -91,18 +91,12 @@ void loop() delay(step_delay); } - /*int step = (current.potValue < 20) ? 1 - : (current.potValue < 100) ? 2 - : (current.potValue < 300) ? 3 - : (current.potValue < 400) ? 5 - : (current.potValue < 500) ? 10 - : 20;*/ - int step = (current.frequency > 5000) ? 1 - : (current.frequency > 4500) ? 2 - : (current.frequency > 4000) ? 5 - : (current.frequency > 3000) ? 10 - : (current.frequency > 1000) ? 25 - : 50; + int step = (current.frequency > 5000) ? 100 + : (current.frequency > 4000) ? 100 + : (current.frequency > 3000) ? 150 + : (current.frequency > 2000) ? 150 + : (current.frequency > 1000) ? 120 + : 200; int frequency = (current.direction == target.direction) ? target.frequency : 0; step = min(abs(frequency - current.frequency), step); if (frequency < current.frequency) -- cgit v1.2.3