-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Open
Description
Adding the S-curve trajectory planner with jerk limiting (#3683) introduced a rather interesting warning that definitely points towards an error in the code.
In emc/tp/tp.c line 2475 there is a comparison like:
if (cos_theta > min_cos_theta && (maxjerk > 0 || maxjerk < 99999)) {
...
}Resulting in (using clang 21):
emc/tp/tp.c:2475 col 55: warning: overlapping comparisons always evaluate to true [-Wtautological-overlap-compare]
The problem is that the maxjerk comparison is always true. When it is less than 0, then it is also less than 99999. When it is more than 99999 then it is also larger than 0.
My guess is that it was meant to determine the condition 0 < maxjerk < 99999, but that is not what the code does. If so, then the || should be &&. However, that also begs the question what the real boundary values of maxjerk are and what happens when you are outside the seemingly arbitrary values of 0 and 99999.
smoe
Metadata
Metadata
Assignees
Type
Projects
Status
Todo