🐛 Fix XATC divide-by-zero (#23743)
This commit is contained in:
parent
bf067738f2
commit
bfdb7c7135
@ -49,6 +49,7 @@ void XATC::print_points() {
|
|||||||
float lerp(const_float_t t, const_float_t a, const_float_t b) { return a + t * (b - a); }
|
float lerp(const_float_t t, const_float_t a, const_float_t b) { return a + t * (b - a); }
|
||||||
|
|
||||||
float XATC::compensation(const xy_pos_t &raw) {
|
float XATC::compensation(const xy_pos_t &raw) {
|
||||||
|
if (NEAR_ZERO(spacing)) return 0;
|
||||||
float t = (raw.x - start) / spacing;
|
float t = (raw.x - start) / spacing;
|
||||||
int i = FLOOR(t);
|
int i = FLOOR(t);
|
||||||
LIMIT(i, 0, XATC_MAX_POINTS - 2);
|
LIMIT(i, 0, XATC_MAX_POINTS - 2);
|
||||||
|
Loading…
Reference in New Issue
Block a user