From a6274f159fe06541d9ce55746a3e5fe99d42bfbf Mon Sep 17 00:00:00 2001 From: Carson Holgate Date: Tue, 29 Oct 2024 18:35:40 -0700 Subject: [PATCH] Only init on left turn mark if headed to the right --- src/ayab/encoders.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ayab/encoders.cpp b/src/ayab/encoders.cpp index 478a24b8..c5c63043 100644 --- a/src/ayab/encoders.cpp +++ b/src/ayab/encoders.cpp @@ -144,10 +144,10 @@ void Encoders::encA_rising() { } } - // In front of Left Hall Sensor? + // In front of Left Hall Sensor and headed to the right? uint16_t hallValue = analogRead(EOL_PIN_L); - if ((hallValue < FILTER_L_MIN[static_cast(m_machineType)]) || - (hallValue > FILTER_L_MAX[static_cast(m_machineType)])) { + if (Direction_t::Right == m_direction && ((hallValue < FILTER_L_MIN[static_cast(m_machineType)]) || + (hallValue > FILTER_L_MAX[static_cast(m_machineType)]))) { m_hallActive = Direction_t::Left; // Only set the belt shift the first time a magnet passes the turn mark.