This commit is contained in:
J. Nick Koston 2023-06-07 19:20:54 -05:00
parent 1db1934b98
commit 99a0fcdbbd
No known key found for this signature in database
1 changed files with 2 additions and 2 deletions

View File

@ -349,13 +349,13 @@ namespace ratgdo {
// check to see if we got between 3 and 8 low pulses on the line
if (this->store_.obstructionLowCount >= 3 && this->store_.obstructionLowCount <= 8) {
// obstructionCleared();
this->store_.obstructionState = ObstructionState::OBSTRUCTION_STATE_CLEAR;
this->obstructionState = ObstructionState::OBSTRUCTION_STATE_CLEAR;
// if there have been no pulses the line is steady high or low
} else if (this->store_.obstructionLowCount == 0) {
// if the line is high and the last high pulse was more than 70ms ago, then there is an obstruction present
if (this->input_obst_pin_->digital_read() && currentMillis - this->store_.lastObstructionHigh > 70) {
this->store_.obstructionState = ObstructionState::OBSTRUCTION_STATE_OBSTRUCTED;
this->obstructionState = ObstructionState::OBSTRUCTION_STATE_OBSTRUCTED;
// obstructionDetected();
} else {
// asleep