Browse Source

Prevent #div0 error (#20183)

Victor Oliveira 4 years ago
parent
commit
26ac992242
No account linked to committer's email address
1 changed files with 1 additions and 0 deletions
  1. 1
    0
      Marlin/src/feature/leds/printer_event_leds.cpp

+ 1
- 0
Marlin/src/feature/leds/printer_event_leds.cpp View File

41
   uint8_t PrinterEventLEDs::old_intensity = 0;
41
   uint8_t PrinterEventLEDs::old_intensity = 0;
42
 
42
 
43
   inline uint8_t pel_intensity(const float &start, const float &current, const float &target) {
43
   inline uint8_t pel_intensity(const float &start, const float &current, const float &target) {
44
+    if (uint16_t(start) == uint16_t(target)) return 255;
44
     return (uint8_t)map(constrain(current, start, target), start, target, 0.f, 255.f);
45
     return (uint8_t)map(constrain(current, start, target), start, target, 0.f, 255.f);
45
   }
46
   }
46
 
47
 

Loading…
Cancel
Save