From ebe8f2c605b6d07d067db3e013cb26741bf1e207 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0t=C4=9Bp=C3=A1n=20Daleck=C3=BD?= <36531759+daleckystepan@users.noreply.github.com> Date: Mon, 4 May 2020 21:39:51 +0200 Subject: [PATCH] Fix acosx condition (#17846) --- Marlin/src/module/planner.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index 54714715f2..bb9e7b92fe 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -2311,7 +2311,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move, t = neg * junction_cos_theta; // If angle is greater than 135 degrees (octagon), find speed for approximate arc - if (t < -0.7071067812f) { + if (t > 0.7071067812f) { #if ENABLED(JD_USE_MATH_ACOS) @@ -2358,7 +2358,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move, 4.85301876f, 6.77019119f, 9.50873947f, 13.4009094f, 18.9188652f, 26.7320709f, 37.7884521f, 53.4292908f, 75.5522461f, 0.0f }; - const int16_t idx = (t == 0.0f) ? 0 : __builtin_clz(int16_t((1.0f - t) * jd_lut_tll)) - jd_lut_tll0; + const int16_t idx = (t == 0.0f) ? 0 : __builtin_clz(uint16_t((1.0f - t) * jd_lut_tll)) - jd_lut_tll0; float junction_theta = t * pgm_read_float(&jd_lut_k[idx]) + pgm_read_float(&jd_lut_b[idx]); if (neg > 0) junction_theta = RADIANS(180) - junction_theta;