use simple fix
This commit is contained in:
@@ -70,8 +70,8 @@ static inline void handle_interrupts(const timer16_Sequence_t timer, volatile ui
|
||||
const bool good_servo = SERVO_INDEX(timer, Channel[timer]) < ServoCount;
|
||||
if (Channel[timer] < 0)
|
||||
*TCNTn = 0; // channel set to -1 indicated that refresh interval completed so reset the timer
|
||||
else if (good_servo && SERVO(timer, Channel[timer]).Pin.isActive)
|
||||
extDigitalWrite(SERVO(timer, Channel[timer]).Pin.nbr, LOW); // pulse this channel low if activated
|
||||
else if (good_servo)
|
||||
extDigitalWrite(SERVO(timer, Channel[timer]).Pin.nbr, LOW); // always pulse the channel LOW
|
||||
|
||||
Channel[timer]++; // increment to the next channel
|
||||
if (good_servo && Channel[timer] < SERVOS_PER_TIMER) {
|
||||
|
||||
@@ -74,8 +74,8 @@ void Servo_Handler(const timer16_Sequence_t timer, Tc *tc, const uint8_t channel
|
||||
const bool good_servo = SERVO_INDEX(timer, Channel[timer]) < ServoCount;
|
||||
if (Channel[timer] < 0)
|
||||
tc->TC_CHANNEL[channel].TC_CCR |= TC_CCR_SWTRG; // channel set to -1 indicated that refresh interval completed so reset the timer
|
||||
else if (good_servo && SERVO(timer, Channel[timer]).Pin.isActive)
|
||||
extDigitalWrite(SERVO(timer, Channel[timer]).Pin.nbr, LOW); // pulse this channel low if activated
|
||||
else if (good_servo)
|
||||
extDigitalWrite(SERVO(timer, Channel[timer]).Pin.nbr, LOW); // always pulse the channel low
|
||||
|
||||
tc->TC_CHANNEL[channel].TC_SR; // clear interrupt
|
||||
|
||||
|
||||
@@ -109,10 +109,10 @@ int8_t Servo::attach(const int inPin, const int inMin, const int inMax) {
|
||||
}
|
||||
|
||||
void Servo::detach() {
|
||||
servo_info[servoIndex].Pin.isActive = false;
|
||||
const timer16_Sequence_t timer = SERVO_INDEX_TO_TIMER(servoIndex);
|
||||
if (anyTimerChannelActive(timer)) finISR(timer);
|
||||
servo_info[servoIndex].Pin.isActive = false;
|
||||
//extDigitalWrite(servo_info[servoIndex].Pin.nbr, LOW); // The ISR won't be called, so set the pin LOW here
|
||||
pinMode(servo_info[servoIndex].Pin.nbr, INPUT); // set servo pin to input
|
||||
}
|
||||
|
||||
void Servo::write(int value) {
|
||||
|
||||
Reference in New Issue
Block a user