Use lambdas in menus, where possible (#15452)

This commit is contained in:
Scott Lahteine
2019-10-07 19:44:33 -05:00
committed by GitHub
parent cd791f1cba
commit cc822c1a05
20 changed files with 396 additions and 968 deletions

View File

@ -103,8 +103,8 @@ Temperature thermalManager;
#else
#define _CHAMBER_PSTR(M,E)
#endif
#define _E_PSTR(M,E,N) ((HOTENDS) >= (N) && (E) == (N)-1) ? PSTR(MSG_E##N " " M) :
#define TEMP_ERR_PSTR(M,E) _BED_PSTR(M##_BED,E) _CHAMBER_PSTR(M##_CHAMBER,E) _E_PSTR(M,E,2) _E_PSTR(M,E,3) _E_PSTR(M,E,4) _E_PSTR(M,E,5) _E_PSTR(M,E,6) PSTR(MSG_E1 " " M)
#define _E_PSTR(M,E,N) ((HOTENDS) > (N) && (E) == (N)) ? PSTR(LCD_STR_E##N " " M) :
#define TEMP_ERR_PSTR(M,E) _BED_PSTR(M##_BED,E) _CHAMBER_PSTR(M##_CHAMBER,E) _E_PSTR(M,E,1) _E_PSTR(M,E,2) _E_PSTR(M,E,3) _E_PSTR(M,E,4) _E_PSTR(M,E,5) PSTR(LCD_STR_E0 " " M)
// public:
@ -157,18 +157,6 @@ Temperature thermalManager;
uint8_t Temperature::fan_speed_scaler[FAN_COUNT] = ARRAY_N(FAN_COUNT, 128, 128, 128, 128, 128, 128);
#endif
#if HAS_LCD_MENU
uint8_t Temperature::lcd_tmpfan_speed[
#if ENABLED(SINGLENOZZLE)
_MAX(EXTRUDERS, FAN_COUNT)
#else
FAN_COUNT
#endif
]; // = { 0 }
#endif
/**
* Set the print fan speed for a target extruder
*/
@ -187,9 +175,6 @@ Temperature thermalManager;
if (target >= FAN_COUNT) return;
fan_speed[target] = speed;
#if HAS_LCD_MENU
lcd_tmpfan_speed[target] = speed;
#endif
}
#if EITHER(PROBING_FANS_OFF, ADVANCED_PAUSE_FANS_PAUSE)

View File

@ -493,30 +493,6 @@ class Temperature {
static void set_temp_fan_speed(const uint8_t fan, const uint16_t tmp_temp);
#endif
#if HAS_LCD_MENU
static uint8_t lcd_tmpfan_speed[
#if ENABLED(SINGLENOZZLE)
_MAX(EXTRUDERS, FAN_COUNT)
#else
FAN_COUNT
#endif
];
static inline void lcd_setFanSpeed(const uint8_t target) { set_fan_speed(target, lcd_tmpfan_speed[target]); }
#if HAS_FAN0
FORCE_INLINE static void lcd_setFanSpeed0() { lcd_setFanSpeed(0); }
#endif
#if HAS_FAN1 || (ENABLED(SINGLENOZZLE) && EXTRUDERS > 1)
FORCE_INLINE static void lcd_setFanSpeed1() { lcd_setFanSpeed(1); }
#endif
#if HAS_FAN2 || (ENABLED(SINGLENOZZLE) && EXTRUDERS > 2)
FORCE_INLINE static void lcd_setFanSpeed2() { lcd_setFanSpeed(2); }
#endif
#endif // HAS_LCD_MENU
#if EITHER(PROBING_FANS_OFF, ADVANCED_PAUSE_FANS_PAUSE)
void set_fans_paused(const bool p);
#endif
@ -595,15 +571,6 @@ class Temperature {
#if HOTENDS
#if HAS_LCD_MENU
static inline void start_watching_E0() { start_watching_hotend(0); }
static inline void start_watching_E1() { start_watching_hotend(1); }
static inline void start_watching_E2() { start_watching_hotend(2); }
static inline void start_watching_E3() { start_watching_hotend(3); }
static inline void start_watching_E4() { start_watching_hotend(4); }
static inline void start_watching_E5() { start_watching_hotend(5); }
#endif
static void setTargetHotend(const int16_t celsius, const uint8_t E_NAME) {
const uint8_t ee = HOTEND_INDEX;
#ifdef MILLISECONDS_PREHEAT_TIME