#if defined(SERVO_3_HIGH) // if there are 3 or more servos we dont need to slow it down
#if defined(SERVO_3_HIGH) // if there are 3 or more servos we dont need to slow it down
SERVO_CHANNEL+=(SERVO_1K_US>>3); // 0 would be better but it causes bad jitter
SERVO_CHANNEL+=(SERVO_1K_US>>3); // 0 would be better but it causes bad jitter
state=0;
state=0;
#else // if there are less then 3 servos we need to slow it to not go over 300Hz (the highest working refresh rate for the digital servos for what i know..)
#else // if there are less then 3 servos we need to slow it to not go over 300Hz (the highest working refresh rate for the digital servos for what i know..)
SERVO_CHANNEL+=SERVO_1K_US;
SERVO_CHANNEL+=SERVO_1K_US;
if(state<4){
if(state<4){
state+=2;
state+=2;
}else{
}else{
state=0;
state=0;
}
}
#endif
#endif
#endif
#endif
#if defined(SERVO_RFR_160HZ)
#if defined(SERVO_RFR_160HZ)
#if defined(SERVO_4_HIGH) // if there are 4 or more servos we dont need to slow it down
#if defined(SERVO_4_HIGH) // if there are 4 or more servos we dont need to slow it down
SERVO_CHANNEL+=(SERVO_1K_US>>3); // 0 would be better but it causes bad jitter
SERVO_CHANNEL+=(SERVO_1K_US>>3); // 0 would be better but it causes bad jitter
state=0;
state=0;
#else // if there are less then 4 servos we need to slow it to not go over ~170Hz (the highest working refresh rate for analog servos)
#else // if there are less then 4 servos we need to slow it to not go over ~170Hz (the highest working refresh rate for analog servos)
SERVO_CHANNEL+=SERVO_1K_US;
SERVO_CHANNEL+=SERVO_1K_US;
if(state<8){
if(state<8){
state+=2;
state+=2;
}else{
}else{
state=0;
state=0;
}
}
#endif
#endif
#endif
#endif
#if defined(SERVO_RFR_50HZ) // to have ~ 50Hz for all servos
#if defined(SERVO_RFR_50HZ) // to have ~ 50Hz for all servos