Skip to content

Commit

Permalink
Prevent #div0 error (MarlinFirmware#20183)
Browse files Browse the repository at this point in the history
  • Loading branch information
rhapsodyv authored and FhlostonParadise committed Nov 21, 2020
1 parent 10d1791 commit 5730569
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions Marlin/src/feature/leds/printer_event_leds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ PrinterEventLEDs printerEventLEDs;
uint8_t PrinterEventLEDs::old_intensity = 0;

inline uint8_t pel_intensity(const float &start, const float &current, 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);
}

Expand Down

0 comments on commit 5730569

Please sign in to comment.