tidy up
This commit is contained in:
parent
1db1934b98
commit
99a0fcdbbd
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue