Add whole-degree accessors, simplify some temperature-related features (#21685)
This commit is contained in:
@@ -40,9 +40,9 @@ PrinterEventLEDs printerEventLEDs;
|
||||
|
||||
uint8_t PrinterEventLEDs::old_intensity = 0;
|
||||
|
||||
inline uint8_t pel_intensity(const_float_t start, const_float_t current, const_float_t target) {
|
||||
if (uint16_t(start) == uint16_t(target)) return 255;
|
||||
return (uint8_t)map(constrain(current, start, target), start, target, 0.f, 255.f);
|
||||
inline uint8_t pel_intensity(const celsius_t start, const celsius_t current, const celsius_t target) {
|
||||
if (start == target) return 255;
|
||||
return (uint8_t)map(constrain(current, start, target), start, target, 0, 255);
|
||||
}
|
||||
|
||||
inline void pel_set_rgb(const uint8_t r, const uint8_t g, const uint8_t b) {
|
||||
@@ -58,7 +58,7 @@ PrinterEventLEDs printerEventLEDs;
|
||||
|
||||
#if HAS_TEMP_HOTEND
|
||||
|
||||
void PrinterEventLEDs::onHotendHeating(const_float_t start, const_float_t current, const_float_t target) {
|
||||
void PrinterEventLEDs::onHotendHeating(const celsius_t start, const celsius_t current, const celsius_t target) {
|
||||
const uint8_t blue = pel_intensity(start, current, target);
|
||||
if (blue != old_intensity) {
|
||||
old_intensity = blue;
|
||||
@@ -70,7 +70,7 @@ PrinterEventLEDs printerEventLEDs;
|
||||
|
||||
#if HAS_HEATED_BED
|
||||
|
||||
void PrinterEventLEDs::onBedHeating(const_float_t start, const_float_t current, const_float_t target) {
|
||||
void PrinterEventLEDs::onBedHeating(const celsius_t start, const celsius_t current, const celsius_t target) {
|
||||
const uint8_t red = pel_intensity(start, current, target);
|
||||
if (red != old_intensity) {
|
||||
old_intensity = red;
|
||||
@@ -82,7 +82,7 @@ PrinterEventLEDs printerEventLEDs;
|
||||
|
||||
#if HAS_HEATED_CHAMBER
|
||||
|
||||
void PrinterEventLEDs::onChamberHeating(const_float_t start, const_float_t current, const_float_t target) {
|
||||
void PrinterEventLEDs::onChamberHeating(const celsius_t start, const celsius_t current, const celsius_t target) {
|
||||
const uint8_t green = pel_intensity(start, current, target);
|
||||
if (green != old_intensity) {
|
||||
old_intensity = green;
|
||||
|
||||
Reference in New Issue
Block a user