From 490e2939cf31e8b24465df76a10bc265280acbe6 Mon Sep 17 00:00:00 2001 From: Jochen Kiemes Date: Sat, 15 Jun 2024 16:13:33 +0200 Subject: [PATCH] Fix missing initialization in getCurrentSpeedInTicks() from issue #262 --- CHANGELOG.md | 3 +++ extras/tests/simavr_based/test_issue208/expect.txt | 14 +++++++------- .../simavr_based/test_sd_04_timing_2560/expect.txt | 14 +++++++------- .../simavr_based/test_sd_04_timing_328p/expect.txt | 10 +++++----- .../test_sd_04_timing_328p_37k/expect.txt | 6 +++--- library.properties | 2 +- src/FastAccelStepper.cpp | 3 +++ 7 files changed, 29 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 66f4328..47aa818 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ TODO: - rename RampConstAcceleration to e.g. RampControl - merge the two esp32 rmt drivers as soon as esp32c3 works +0.30.15: +- Fix missing initialization in `getCurrentSpeedInTicks()` (#262) + 0.30.14: - Fix typo in library.properties. No functional changes diff --git a/extras/tests/simavr_based/test_issue208/expect.txt b/extras/tests/simavr_based/test_issue208/expect.txt index 6cd81db..a4f0087 100644 --- a/extras/tests/simavr_based/test_issue208/expect.txt +++ b/extras/tests/simavr_based/test_issue208/expect.txt @@ -2,17 +2,17 @@ DirB: 1*L->H, 0*H->L EnableA: 0*L->H, 0*H->L EnableB: 0*L->H, 0*H->L - StepA: 235908*L->H, 235908*H->L, Max High=11us Total High=927312us - StepB: 2*L->H, 2*H->L, Max High=12us Total High=17us -Position[A]=37462 + StepA: 235907*L->H, 235907*H->L, Max High=11us Total High=927410us + StepB: 2*L->H, 2*H->L, Max High=14us Total High=19us +Position[A]=37463 Position[B]=2 -Time in FillISR max=767 us, total=1211908 us +Time in FillISR max=772 us, total=1218907 us -Time in StepA max=11 us, total=927312 us +Time in StepA max=11 us, total=927410 us -Time in StepB max=12 us, total=17 us +Time in StepB max=14 us, total=19 us -Time in StepISR max=6 us, total=897842 us +Time in StepISR max=6 us, total=897838 us diff --git a/extras/tests/simavr_based/test_sd_04_timing_2560/expect.txt b/extras/tests/simavr_based/test_sd_04_timing_2560/expect.txt index 9c2057f..5b3b8ae 100644 --- a/extras/tests/simavr_based/test_sd_04_timing_2560/expect.txt +++ b/extras/tests/simavr_based/test_sd_04_timing_2560/expect.txt @@ -4,9 +4,9 @@ EnableA: 1*L->H, 1*H->L EnableB: 2*L->H, 1*H->L EnableC: 2*L->H, 1*H->L - StepA: 64000*L->H, 64000*H->L, Max High=25us Total High=311049us - StepB: 64000*L->H, 64000*H->L, Max High=31us Total High=364986us - StepC: 64000*L->H, 64000*H->L, Max High=38us Total High=530547us + StepA: 64000*L->H, 64000*H->L, Max High=23us Total High=310838us + StepB: 64000*L->H, 64000*H->L, Max High=30us Total High=364986us + StepC: 64000*L->H, 64000*H->L, Max High=38us Total High=533749us Position[A]=64000 Position[B]=64000 @@ -19,11 +19,11 @@ Time in EnableB max=246080 us, total=246080 us Time in EnableC max=254243 us, total=254243 us -Time in FillISR max=2740 us, total=2116523 us +Time in FillISR max=2740 us, total=2116404 us -Time in StepA max=25 us, total=311049 us +Time in StepA max=23 us, total=310838 us -Time in StepB max=31 us, total=364986 us +Time in StepB max=30 us, total=364986 us -Time in StepC max=38 us, total=530547 us +Time in StepC max=38 us, total=533749 us diff --git a/extras/tests/simavr_based/test_sd_04_timing_328p/expect.txt b/extras/tests/simavr_based/test_sd_04_timing_328p/expect.txt index f0433a5..41fc2e2 100644 --- a/extras/tests/simavr_based/test_sd_04_timing_328p/expect.txt +++ b/extras/tests/simavr_based/test_sd_04_timing_328p/expect.txt @@ -2,8 +2,8 @@ DirB: 1*L->H, 0*H->L EnableA: 1*L->H, 1*H->L EnableB: 2*L->H, 1*H->L - StepA: 1000*L->H, 1000*H->L, Max High=13us Total High=4231us - StepB: 1000*L->H, 1000*H->L, Max High=15us Total High=5045us + StepA: 1000*L->H, 1000*H->L, Max High=13us Total High=4221us + StepB: 1000*L->H, 1000*H->L, Max High=15us Total High=5050us Position[A]=1000 Position[B]=1000 @@ -12,11 +12,11 @@ Time in EnableA max=225398 us, total=225398 us Time in EnableB max=238118 us, total=238118 us -Time in FillISR max=2651 us, total=47806 us +Time in FillISR max=2651 us, total=47814 us -Time in StepA max=13 us, total=4231 us +Time in StepA max=13 us, total=4221 us -Time in StepB max=15 us, total=5045 us +Time in StepB max=15 us, total=5050 us Time in StepISR max=6 us, total=8566 us diff --git a/extras/tests/simavr_based/test_sd_04_timing_328p_37k/expect.txt b/extras/tests/simavr_based/test_sd_04_timing_328p_37k/expect.txt index e3fcffa..08cff14 100644 --- a/extras/tests/simavr_based/test_sd_04_timing_328p_37k/expect.txt +++ b/extras/tests/simavr_based/test_sd_04_timing_328p_37k/expect.txt @@ -2,15 +2,15 @@ DirB: 1*L->H, 0*H->L EnableA: 1*L->H, 1*H->L EnableB: 1*L->H, 0*H->L - StepA: 1000*L->H, 1000*H->L, Max High=10us Total High=3948us + StepA: 1000*L->H, 1000*H->L, Max High=9us Total High=3944us StepB: 0*L->H, 0*H->L, Max High=0us Total High=0us Position[A]=1000 Time in EnableA max=225399 us, total=225399 us -Time in FillISR max=2023 us, total=27615 us +Time in FillISR max=2023 us, total=27600 us -Time in StepA max=10 us, total=3948 us +Time in StepA max=9 us, total=3944 us Time in StepISR max=5 us, total=3975 us diff --git a/library.properties b/library.properties index 6fb8949..b378703 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=FastAccelStepper -version=0.30.14 +version=0.30.15 license=MIT author=Jochen Kiemes maintainer=Jochen Kiemes diff --git a/src/FastAccelStepper.cpp b/src/FastAccelStepper.cpp index a995bb9..6208e85 100644 --- a/src/FastAccelStepper.cpp +++ b/src/FastAccelStepper.cpp @@ -765,6 +765,9 @@ void FastAccelStepper::getCurrentSpeedInTicks(struct actual_ticks_s* speed, if (_rg.isRampGeneratorActive()) { _rg.getCurrentSpeedInTicks(speed); } + else { + speed->ticks = 0; + } } } int32_t FastAccelStepper::getCurrentSpeedInUs(bool realtime) {