From 9b4211a6d0056764bbbe7cc3b273ec8dc00241db Mon Sep 17 00:00:00 2001 From: Victor Oliveira Date: Tue, 17 Nov 2020 21:44:53 -0300 Subject: [PATCH] Prevent #div0 error (#20183) --- Marlin/src/feature/leds/printer_event_leds.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Marlin/src/feature/leds/printer_event_leds.cpp b/Marlin/src/feature/leds/printer_event_leds.cpp index 31c628c2816a2..3a6b91a258b92 100644 --- a/Marlin/src/feature/leds/printer_event_leds.cpp +++ b/Marlin/src/feature/leds/printer_event_leds.cpp @@ -41,6 +41,7 @@ PrinterEventLEDs printerEventLEDs; uint8_t PrinterEventLEDs::old_intensity = 0; inline uint8_t pel_intensity(const float &start, const float ¤t, const float &target) { + if (uint16_t(start) == uint16_t(target)) return 255; return (uint8_t)map(constrain(current, start, target), start, target, 0.f, 255.f); }