Non-blocking state machine (IDLE, HOMING, MOVING, STOPPED, ERROR)
* - Endstop (D7) with debounce via IS...
// Servo microseconds for FS90R
const int SERVO_STOP_US = 1500;
const int SERVO_CW_US = 1000; // adj... machine
enum class State { IDLE, HOMING, MOVING, STOPPED, ERROR };
volatile State state = State::IDLE;
... small delay, then detach
servoWriteMicro(SERVO_STOP_US);
delay(5);
servoDetachIfNeeded();
Seria