Skip to content

Commit

Permalink
Only init on left turn mark if headed to the right
Browse files Browse the repository at this point in the history
  • Loading branch information
clholgat authored and dl1com committed Oct 31, 2024
1 parent fbc015c commit a6274f1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/ayab/encoders.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint8_t>(m_machineType)]) ||
(hallValue > FILTER_L_MAX[static_cast<uint8_t>(m_machineType)])) {
if (Direction_t::Right == m_direction && ((hallValue < FILTER_L_MIN[static_cast<uint8_t>(m_machineType)]) ||
(hallValue > FILTER_L_MAX[static_cast<uint8_t>(m_machineType)]))) {
m_hallActive = Direction_t::Left;

// Only set the belt shift the first time a magnet passes the turn mark.
Expand Down

0 comments on commit a6274f1

Please sign in to comment.