Encapsulate Temperature items
This commit is contained in:
parent
011ecc341a
commit
3d45a4bd23
@ -945,7 +945,6 @@ namespace ExtUI {
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#if HAS_HOTEND
|
#if HAS_HOTEND
|
||||||
static constexpr int16_t heater_maxtemp[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP, HEATER_4_MAXTEMP, HEATER_5_MAXTEMP, HEATER_6_MAXTEMP, HEATER_7_MAXTEMP);
|
|
||||||
const int16_t e = heater - H0;
|
const int16_t e = heater - H0;
|
||||||
thermalManager.setTargetHotend(LROUND(constrain(value, 0, heater_maxtemp[e] - 15)), e);
|
thermalManager.setTargetHotend(LROUND(constrain(value, 0, heater_maxtemp[e] - 15)), e);
|
||||||
#endif
|
#endif
|
||||||
@ -957,7 +956,6 @@ namespace ExtUI {
|
|||||||
value *= TOUCH_UI_LCD_TEMP_SCALING;
|
value *= TOUCH_UI_LCD_TEMP_SCALING;
|
||||||
#endif
|
#endif
|
||||||
#if HAS_HOTEND
|
#if HAS_HOTEND
|
||||||
constexpr int16_t heater_maxtemp[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP, HEATER_4_MAXTEMP, HEATER_5_MAXTEMP, HEATER_6_MAXTEMP, HEATER_7_MAXTEMP);
|
|
||||||
const int16_t e = extruder - E0;
|
const int16_t e = extruder - E0;
|
||||||
enableHeater(extruder);
|
enableHeater(extruder);
|
||||||
thermalManager.setTargetHotend(LROUND(constrain(value, 0, heater_maxtemp[e] - 15)), e);
|
thermalManager.setTargetHotend(LROUND(constrain(value, 0, heater_maxtemp[e] - 15)), e);
|
||||||
|
@ -29,10 +29,6 @@
|
|||||||
|
|
||||||
extern int8_t encoderLine, encoderTopLine, screen_items;
|
extern int8_t encoderLine, encoderTopLine, screen_items;
|
||||||
|
|
||||||
#if HAS_HOTEND
|
|
||||||
constexpr int16_t heater_maxtemp[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP, HEATER_4_MAXTEMP, HEATER_5_MAXTEMP, HEATER_6_MAXTEMP, HEATER_7_MAXTEMP);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void scroll_screen(const uint8_t limit, const bool is_menu);
|
void scroll_screen(const uint8_t limit, const bool is_menu);
|
||||||
bool printer_busy();
|
bool printer_busy();
|
||||||
|
|
||||||
|
@ -47,21 +47,27 @@ uint8_t MarlinUI::preheat_fan_speed[2];
|
|||||||
// "Temperature" submenu items
|
// "Temperature" submenu items
|
||||||
//
|
//
|
||||||
|
|
||||||
void _lcd_preheat(const int16_t endnum, const int16_t temph, const int16_t tempb, const uint8_t fan) {
|
|
||||||
|
void Temperature::lcd_preheat(const int16_t e, const int8_t indh, const int8_t indb) {
|
||||||
#if HAS_HOTEND
|
#if HAS_HOTEND
|
||||||
if (temph > 0) thermalManager.setTargetHotend(_MIN(heater_maxtemp[endnum] - 15, temph), endnum);
|
if (indh >= 0 && ui.preheat_hotend_temp[indh] > 0)
|
||||||
|
setTargetHotend(_MIN(heater_maxtemp[e] - 15, ui.preheat_hotend_temp[indh]), e);
|
||||||
|
#else
|
||||||
|
UNUSED(temph);
|
||||||
#endif
|
#endif
|
||||||
#if HAS_HEATED_BED
|
#if HAS_HEATED_BED
|
||||||
if (tempb >= 0) thermalManager.setTargetBed(tempb);
|
if (indb >= 0 && ui.preheat_bed_temp[indb] >= 0) setTargetBed(ui.preheat_bed_temp[indb]);
|
||||||
#else
|
#else
|
||||||
UNUSED(tempb);
|
UNUSED(indb);
|
||||||
#endif
|
#endif
|
||||||
#if FAN_COUNT > 0
|
#if HAS_FAN
|
||||||
|
set_fan_speed((
|
||||||
#if FAN_COUNT > 1
|
#if FAN_COUNT > 1
|
||||||
thermalManager.set_fan_speed(active_extruder < FAN_COUNT ? active_extruder : 0, fan);
|
active_extruder < FAN_COUNT ? active_extruder : 0
|
||||||
#else
|
#else
|
||||||
thermalManager.set_fan_speed(0, fan);
|
0
|
||||||
#endif
|
#endif
|
||||||
|
), fan);
|
||||||
#else
|
#else
|
||||||
UNUSED(fan);
|
UNUSED(fan);
|
||||||
#endif
|
#endif
|
||||||
@ -70,17 +76,17 @@ void _lcd_preheat(const int16_t endnum, const int16_t temph, const int16_t tempb
|
|||||||
|
|
||||||
#if HAS_TEMP_HOTEND
|
#if HAS_TEMP_HOTEND
|
||||||
inline void _preheat_end(const uint8_t m, const uint8_t e) {
|
inline void _preheat_end(const uint8_t m, const uint8_t e) {
|
||||||
_lcd_preheat(e, ui.preheat_hotend_temp[m], -1, ui.preheat_fan_speed[m]);
|
thermalManager.lcd_preheat(e, m, -1);
|
||||||
}
|
}
|
||||||
#if HAS_HEATED_BED
|
#if HAS_HEATED_BED
|
||||||
inline void _preheat_both(const uint8_t m, const uint8_t e) {
|
inline void _preheat_both(const uint8_t m, const uint8_t e) {
|
||||||
_lcd_preheat(e, ui.preheat_hotend_temp[m], ui.preheat_bed_temp[m], ui.preheat_fan_speed[m]);
|
thermalManager.lcd_preheat(e, m, m);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#if HAS_HEATED_BED
|
#if HAS_HEATED_BED
|
||||||
inline void _preheat_bed(const uint8_t m) {
|
inline void _preheat_bed(const uint8_t m) {
|
||||||
_lcd_preheat(0, 0, ui.preheat_bed_temp[m], ui.preheat_fan_speed[m]);
|
thermalManager.lcd_preheat(-1, -1, m);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -28,9 +28,10 @@
|
|||||||
#include "endstops.h"
|
#include "endstops.h"
|
||||||
|
|
||||||
#include "../MarlinCore.h"
|
#include "../MarlinCore.h"
|
||||||
#include "../lcd/ultralcd.h"
|
|
||||||
#include "planner.h"
|
#include "planner.h"
|
||||||
#include "../HAL/shared/Delay.h"
|
#include "../HAL/shared/Delay.h"
|
||||||
|
|
||||||
|
#include "../lcd/ultralcd.h"
|
||||||
#if ENABLED(EXTENSIBLE_UI)
|
#if ENABLED(EXTENSIBLE_UI)
|
||||||
#include "../lcd/extui/ui_api.h"
|
#include "../lcd/extui/ui_api.h"
|
||||||
#endif
|
#endif
|
||||||
@ -2241,22 +2242,14 @@ void Temperature::readings_ready() {
|
|||||||
#if HAS_HOTEND
|
#if HAS_HOTEND
|
||||||
|
|
||||||
static constexpr int8_t temp_dir[] = {
|
static constexpr int8_t temp_dir[] = {
|
||||||
#if ENABLED(HEATER_0_USES_MAX6675)
|
TERN(HEATER_0_USES_MAX6675, 0, TEMPDIR(0))
|
||||||
0
|
|
||||||
#else
|
|
||||||
TEMPDIR(0)
|
|
||||||
#endif
|
|
||||||
#if HAS_MULTI_HOTEND
|
#if HAS_MULTI_HOTEND
|
||||||
#define _TEMPDIR(N) , TEMPDIR(N)
|
, TERN(HEATER_1_USES_MAX6675, 0, TEMPDIR(1))
|
||||||
#if ENABLED(HEATER_1_USES_MAX6675)
|
|
||||||
, 0
|
|
||||||
#else
|
|
||||||
_TEMPDIR(1)
|
|
||||||
#endif
|
|
||||||
#if HOTENDS > 2
|
#if HOTENDS > 2
|
||||||
|
#define _TEMPDIR(N) , TEMPDIR(N)
|
||||||
REPEAT_S(2, HOTENDS, _TEMPDIR)
|
REPEAT_S(2, HOTENDS, _TEMPDIR)
|
||||||
#endif // HOTENDS > 2
|
#endif
|
||||||
#endif // HAS_MULTI_HOTEND
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
LOOP_L_N(e, COUNT(temp_dir)) {
|
LOOP_L_N(e, COUNT(temp_dir)) {
|
||||||
|
@ -322,6 +322,7 @@ class Temperature {
|
|||||||
#if HAS_HOTEND
|
#if HAS_HOTEND
|
||||||
#define HOTEND_TEMPS (HOTENDS + ENABLED(TEMP_SENSOR_1_AS_REDUNDANT))
|
#define HOTEND_TEMPS (HOTENDS + ENABLED(TEMP_SENSOR_1_AS_REDUNDANT))
|
||||||
static hotend_info_t temp_hotend[HOTEND_TEMPS];
|
static hotend_info_t temp_hotend[HOTEND_TEMPS];
|
||||||
|
static constexpr int16_t heater_maxtemp[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP, HEATER_4_MAXTEMP, HEATER_5_MAXTEMP, HEATER_6_MAXTEMP, HEATER_7_MAXTEMP);
|
||||||
#endif
|
#endif
|
||||||
TERN_(HAS_HEATED_BED, static bed_info_t temp_bed);
|
TERN_(HAS_HEATED_BED, static bed_info_t temp_bed);
|
||||||
TERN_(HAS_TEMP_PROBE, static probe_info_t temp_probe);
|
TERN_(HAS_TEMP_PROBE, static probe_info_t temp_probe);
|
||||||
@ -779,6 +780,10 @@ class Temperature {
|
|||||||
|
|
||||||
TERN_(HAS_DISPLAY, static void set_heating_message(const uint8_t e));
|
TERN_(HAS_DISPLAY, static void set_heating_message(const uint8_t e));
|
||||||
|
|
||||||
|
#if HAS_LCD_MENU
|
||||||
|
static void lcd_preheat(const int16_t e, const int8_t indh, const int8_t indb);
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void update_raw_temperatures();
|
static void update_raw_temperatures();
|
||||||
static void updateTemperaturesFromRawValues();
|
static void updateTemperaturesFromRawValues();
|
||||||
|
Loading…
Reference in New Issue
Block a user