use simple fix

This commit is contained in:
Scott Lahteine
2022-06-07 22:28:44 -05:00
parent 7f6622e6ac
commit dbd9321380
3 changed files with 6 additions and 6 deletions
+2 -2
View File
@@ -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) {
+2 -2
View File
@@ -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
+2 -2
View File
@@ -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) {