🐛 Fix XATC divide-by-zero (#23743)

This commit is contained in:
Giuseppe499 2022-02-15 20:21:05 +01:00 committed by Scott Lahteine
parent bf067738f2
commit bfdb7c7135

View File

@ -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);