diff --git a/nullf.c b/nullf.c index 5512837..9a40d07 100644 --- a/nullf.c +++ b/nullf.c @@ -44,8 +44,8 @@ static double nullf_sample(struct servo *servo, int64_t offset, } if ((servo->first_update && servo->first_step_threshold && - servo->first_step_threshold < fabs(offset)) || - (servo->step_threshold && servo->step_threshold < fabs(offset))) { + servo->first_step_threshold < llabs(offset)) || + (servo->step_threshold && servo->step_threshold < llabs(offset))) { *state = SERVO_JUMP; } else { *state = SERVO_UNLOCKED; diff --git a/pi.c b/pi.c index 35556e1..bfe5022 100644 --- a/pi.c +++ b/pi.c @@ -112,9 +112,9 @@ static double pi_sample(struct servo *servo, if ((servo->first_update && servo->first_step_threshold && - servo->first_step_threshold < fabs(offset)) || + servo->first_step_threshold < llabs(offset)) || (servo->step_threshold && - servo->step_threshold < fabs(offset))) + servo->step_threshold < llabs(offset))) *state = SERVO_JUMP; else *state = SERVO_LOCKED; @@ -131,7 +131,7 @@ static double pi_sample(struct servo *servo, * clock startup. */ if (servo->step_threshold && - servo->step_threshold < fabs(offset)) { + servo->step_threshold < llabs(offset)) { *state = SERVO_UNLOCKED; s->count = 0; break;