Closed andreas-seiderer closed 6 years ago
Indeed, I missed that.. the shorter version would be:
bool VarSpeedServo::isMoving() {
byte channel = this->servoIndex;
int value = servos[channel].value;
if (value < MIN_PULSE_WIDTH) {
return (read() != value);
} else {
return (readMicroseconds() != value);
}
}
I went with the original suggested fix for clarity. Thanks @andreas-seiderer
The "isMoving" function misses a return "false" if the conditions for "true" are not met.
"Flowing off the end of a value-returning function (except main) without a return statement is undefined behavior." source
Please add "return false;" at the end of the function and it should work like expected.