🎨 Define HAS_PREHEAT conditional

This commit is contained in:
Scott Lahteine
2021-10-27 21:15:58 -05:00
committed by Scott Lahteine
parent 1fd4258423
commit 84f9490149
55 changed files with 183 additions and 182 deletions

View File

@ -165,14 +165,9 @@ typedef struct {
} select_t;
select_t select_page{0}, select_file{0}, select_print{0}, select_prepare{0}
, select_control{0}, select_axis{0}, select_temp{0}, select_motion{0}, select_tune{0}
, select_advset{0}, select_PLA{0}, select_ABS{0}
, select_speed{0}
, select_acc{0}
, select_jerk{0}
, select_step{0}
, select_item{0}
;
, select_control{0}, select_axis{0}, select_temp{0}, select_motion{0}, select_tune{0}
, select_advset{0}, select_PLA{0}, select_ABS{0}
, select_speed{0}, select_acc{0}, select_jerk{0}, select_step{0}, select_item{0};
uint8_t index_file = MROWS,
index_prepare = MROWS,
@ -700,7 +695,7 @@ void Item_Prepare_Home(const uint8_t row) {
#endif
#if HAS_HOTEND
#if HAS_PREHEAT
void Item_Prepare_PLA(const uint8_t row) {
if (HMI_IsChinese())
Item_AreaCopy(100, 89, 151, 101, row);
@ -715,22 +710,22 @@ void Item_Prepare_Home(const uint8_t row) {
Draw_Menu_Line(row, ICON_PLAPreheat);
}
void Item_Prepare_ABS(const uint8_t row) {
if (HMI_IsChinese())
Item_AreaCopy(180, 89, 233, 100, row);
else {
#ifdef USE_STRING_TITLES
DWIN_Draw_Label(row, F("Preheat " PREHEAT_2_LABEL));
#else
Item_AreaCopy(108, 76, 155, 87, row); // "Preheat"
say_abs_en(52, row); // "ABS"
#endif
#if PREHEAT_COUNT > 1
void Item_Prepare_ABS(const uint8_t row) {
if (HMI_IsChinese())
Item_AreaCopy(180, 89, 233, 100, row);
else {
#ifdef USE_STRING_TITLES
DWIN_Draw_Label(row, F("Preheat " PREHEAT_2_LABEL));
#else
Item_AreaCopy(108, 76, 155, 87, row); // "Preheat"
say_abs_en(52, row); // "ABS"
#endif
}
Draw_Menu_Line(row, ICON_ABSPreheat);
}
Draw_Menu_Line(row, ICON_ABSPreheat);
}
#endif
#endif
#if HAS_PREHEAT
void Item_Prepare_Cool(const uint8_t row) {
if (HMI_IsChinese())
Item_AreaCopy(1, 104, 56, 117, row);
@ -785,11 +780,11 @@ void Draw_Prepare_Menu() {
#if HAS_ZOFFSET_ITEM
if (PVISI(PREPARE_CASE_ZOFF)) Item_Prepare_Offset(PSCROL(PREPARE_CASE_ZOFF)); // Edit Z-Offset / Babystep / Set Home Offset
#endif
#if HAS_HOTEND
if (PVISI(PREPARE_CASE_PLA)) Item_Prepare_PLA(PSCROL(PREPARE_CASE_PLA)); // Preheat PLA
if (PVISI(PREPARE_CASE_ABS)) Item_Prepare_ABS(PSCROL(PREPARE_CASE_ABS)); // Preheat ABS
#endif
#if HAS_PREHEAT
if (PVISI(PREPARE_CASE_PLA)) Item_Prepare_PLA(PSCROL(PREPARE_CASE_PLA)); // Preheat PLA
#if PREHEAT_COUNT > 1
if (PVISI(PREPARE_CASE_ABS)) Item_Prepare_ABS(PSCROL(PREPARE_CASE_ABS)); // Preheat ABS
#endif
if (PVISI(PREPARE_CASE_COOL)) Item_Prepare_Cool(PSCROL(PREPARE_CASE_COOL)); // Cooldown
#endif
if (PVISI(PREPARE_CASE_LANG)) Item_Prepare_Lang(PSCROL(PREPARE_CASE_LANG)); // Language CN/EN
@ -1425,25 +1420,34 @@ void HMI_Move_Z() {
uint8_t temp_line;
switch (HMI_ValueStruct.show_mode) {
case -1: temp_line = TEMP_CASE_TEMP; break;
case -2: temp_line = PREHEAT_CASE_TEMP; break;
case -3: temp_line = PREHEAT_CASE_TEMP; break;
#if HAS_PREHEAT
case -2: temp_line = PREHEAT_CASE_TEMP; break;
#if PREHEAT_COUNT > 1
case -3: temp_line = PREHEAT_CASE_TEMP; break;
#endif
#endif
default: temp_line = TUNE_CASE_TEMP + MROWS - index_tune;
}
if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.E_Temp)) {
EncoderRate.enabled = false;
if (HMI_ValueStruct.show_mode == -2) {
checkkey = PLAPreheat;
ui.material_preset[0].hotend_temp = HMI_ValueStruct.E_Temp;
Draw_Edit_Integer3(temp_line, ui.material_preset[0].hotend_temp);
return;
}
else if (HMI_ValueStruct.show_mode == -3) {
checkkey = ABSPreheat;
ui.material_preset[1].hotend_temp = HMI_ValueStruct.E_Temp;
Draw_Edit_Integer3(temp_line, ui.material_preset[1].hotend_temp);
return;
}
else if (HMI_ValueStruct.show_mode == -1) // Temperature
#if HAS_PREHEAT
if (HMI_ValueStruct.show_mode == -2) {
checkkey = PLAPreheat;
ui.material_preset[0].hotend_temp = HMI_ValueStruct.E_Temp;
Draw_Edit_Integer3(temp_line, ui.material_preset[0].hotend_temp);
return;
}
#if PREHEAT_COUNT > 1
if (HMI_ValueStruct.show_mode == -3) {
checkkey = ABSPreheat;
ui.material_preset[1].hotend_temp = HMI_ValueStruct.E_Temp;
Draw_Edit_Integer3(temp_line, ui.material_preset[1].hotend_temp);
return;
}
#endif
#endif
if (HMI_ValueStruct.show_mode == -1) // Temperature
checkkey = TemperatureID;
else
checkkey = Tune;
@ -1467,28 +1471,33 @@ void HMI_Move_Z() {
uint8_t bed_line;
switch (HMI_ValueStruct.show_mode) {
case -1: bed_line = TEMP_CASE_BED; break;
case -2: bed_line = PREHEAT_CASE_BED; break;
case -3: bed_line = PREHEAT_CASE_BED; break;
#if HAS_PREHEAT
case -2: bed_line = PREHEAT_CASE_BED; break;
#if PREHEAT_COUNT > 1
case -3: bed_line = PREHEAT_CASE_BED; break;
#endif
#endif
default: bed_line = TUNE_CASE_BED + MROWS - index_tune;
}
if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Bed_Temp)) {
EncoderRate.enabled = false;
if (HMI_ValueStruct.show_mode == -2) {
checkkey = PLAPreheat;
ui.material_preset[0].bed_temp = HMI_ValueStruct.Bed_Temp;
Draw_Edit_Integer3(bed_line, ui.material_preset[0].bed_temp);
return;
}
else if (HMI_ValueStruct.show_mode == -3) {
checkkey = ABSPreheat;
ui.material_preset[1].bed_temp = HMI_ValueStruct.Bed_Temp;
Draw_Edit_Integer3(bed_line, ui.material_preset[1].bed_temp);
return;
}
else if (HMI_ValueStruct.show_mode == -1)
checkkey = TemperatureID;
else
checkkey = Tune;
#if HAS_PREHEAT
if (HMI_ValueStruct.show_mode == -2) {
checkkey = PLAPreheat;
ui.material_preset[0].bed_temp = HMI_ValueStruct.Bed_Temp;
Draw_Edit_Integer3(bed_line, ui.material_preset[0].bed_temp);
return;
}
#if PREHEAT_COUNT > 1
if (HMI_ValueStruct.show_mode == -3) {
checkkey = ABSPreheat;
ui.material_preset[1].bed_temp = HMI_ValueStruct.Bed_Temp;
Draw_Edit_Integer3(bed_line, ui.material_preset[1].bed_temp);
return;
}
#endif
#endif
checkkey = HMI_ValueStruct.show_mode == -1 ? TemperatureID : Tune;
Draw_Edit_Integer3(bed_line, HMI_ValueStruct.Bed_Temp);
thermalManager.setTargetBed(HMI_ValueStruct.Bed_Temp);
return;
@ -1522,16 +1531,15 @@ void HMI_Move_Z() {
Draw_Edit_Integer3(fan_line, ui.material_preset[0].fan_speed);
return;
}
else if (HMI_ValueStruct.show_mode == -3) {
checkkey = ABSPreheat;
ui.material_preset[1].fan_speed = HMI_ValueStruct.Fan_speed;
Draw_Edit_Integer3(fan_line, ui.material_preset[1].fan_speed);
return;
}
else if (HMI_ValueStruct.show_mode == -1)
checkkey = TemperatureID;
else
checkkey = Tune;
#if PREHEAT_COUNT > 1
if (HMI_ValueStruct.show_mode == -3) {
checkkey = ABSPreheat;
ui.material_preset[1].fan_speed = HMI_ValueStruct.Fan_speed;
Draw_Edit_Integer3(fan_line, ui.material_preset[1].fan_speed);
return;
}
#endif
checkkey = HMI_ValueStruct.show_mode == -1 ? TemperatureID : Tune;
Draw_Edit_Integer3(fan_line, HMI_ValueStruct.Fan_speed);
thermalManager.set_fan_speed(0, HMI_ValueStruct.Fan_speed);
return;
@ -3068,7 +3076,7 @@ void HMI_Temperature() {
EncoderRate.enabled = true;
break;
#endif
#if HAS_HOTEND
#if HAS_PREHEAT
case TEMP_CASE_PLA: {
checkkey = PLAPreheat;
select_PLA.reset();
@ -3145,7 +3153,8 @@ void HMI_Temperature() {
Draw_Menu_Line(++i, ICON_WriteEEPROM);
#endif
} break;
#endif
#if PREHEAT_COUNT > 1
case TEMP_CASE_ABS: { // ABS preheat setting
checkkey = ABSPreheat;
select_ABS.reset();

View File

@ -31,13 +31,6 @@
#include "../../../inc/MarlinConfigPre.h"
#if ANY(HAS_HOTEND, HAS_HEATED_BED, HAS_FAN) && PREHEAT_COUNT
#define HAS_PREHEAT 1
#if PREHEAT_COUNT < 2
#error "Creality DWIN requires two material preheat presets."
#endif
#endif
enum processID : uint8_t {
// Process ID
MainMenu,
@ -53,7 +46,9 @@ enum processID : uint8_t {
Tune,
#if HAS_PREHEAT
PLAPreheat,
ABSPreheat,
#if PREHEAT_COUNT > 1
ABSPreheat,
#endif
#endif
MaxSpeed,
MaxSpeed_value,

View File

@ -3124,12 +3124,14 @@ void Draw_Prepare_Menu() {
ADDMENUITEM(ICON_SetHome, GET_TEXT_F(MSG_SET_HOME_OFFSETS), onDrawHomeOffset, SetHome);
#endif
#endif
#if HAS_HOTEND
ADDMENUITEM(ICON_PLAPreheat, GET_TEXT_F(MSG_PREHEAT_1), onDrawPreheat1, SetPreheat0);
ADDMENUITEM(ICON_ABSPreheat, PSTR("Preheat " PREHEAT_2_LABEL), onDrawPreheat2, SetPreheat1);
ADDMENUITEM(ICON_CustomPreheat, GET_TEXT_F(MSG_PREHEAT_CUSTOM), onDrawMenuItem, SetPreheat2);
#endif
#if HAS_PREHEAT
ADDMENUITEM(ICON_PLAPreheat, GET_TEXT_F(MSG_PREHEAT_1), onDrawPreheat1, SetPreheat0);
#if PREHEAT_COUNT > 1
ADDMENUITEM(ICON_ABSPreheat, PSTR("Preheat " PREHEAT_2_LABEL), onDrawPreheat2, SetPreheat1);
#endif
#if PREHEAT_COUNT > 2
ADDMENUITEM(ICON_CustomPreheat, GET_TEXT_F(MSG_PREHEAT_CUSTOM), onDrawMenuItem, SetPreheat2);
#endif
ADDMENUITEM(ICON_Cool, GET_TEXT_F(MSG_COOLDOWN), onDrawCooldown, SetCoolDown);
#endif
ADDMENUITEM(ICON_Language, PSTR("UI Language"), onDrawLanguage, SetLanguage);

View File

@ -33,13 +33,6 @@
#include "../common/encoder.h"
#include "../../../libs/BL24CXX.h"
#if ANY(HAS_HOTEND, HAS_HEATED_BED, HAS_FAN) && PREHEAT_COUNT
#define HAS_PREHEAT 1
#if PREHEAT_COUNT < 2
#error "Creality DWIN requires two material preheat presets."
#endif
#endif
#if ANY(AUTO_BED_LEVELING_BILINEAR, AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_3POINT) && DISABLED(PROBE_MANUALLY)
#define HAS_ONESTEP_LEVELING 1
#endif
@ -123,12 +116,14 @@ typedef struct {
uint16_t Barfill_Color = Def_Barfill_Color;
uint16_t Indicator_Color = Def_Indicator_Color;
uint16_t Coordinate_Color = Def_Coordinate_Color;
#if HAS_HOTEND
int16_t HotendPidT = PREHEAT_1_TEMP_HOTEND;
int16_t PidCycles = 10;
#endif
#ifdef PREHEAT_1_TEMP_BED
int16_t BedPidT = PREHEAT_1_TEMP_BED;
#if HAS_PREHEAT
#ifdef PREHEAT_1_TEMP_HOTEND
int16_t HotendPidT = PREHEAT_1_TEMP_HOTEND;
int16_t PidCycles = 10;
#endif
#ifdef PREHEAT_1_TEMP_BED
int16_t BedPidT = PREHEAT_1_TEMP_BED;
#endif
#endif
#if ENABLED(PREVENT_COLD_EXTRUSION)
int16_t ExtMinT = EXTRUDE_MINTEMP;

View File

@ -76,10 +76,6 @@
#include "../../../module/probe.h"
#endif
#if ANY(HAS_HOTEND, HAS_HEATED_BED, HAS_FAN) && PREHEAT_COUNT
#define HAS_PREHEAT 1
#endif
#if ENABLED(POWER_LOSS_RECOVERY)
#include "../../../feature/powerloss.h"
#endif
@ -1593,7 +1589,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/
#define PREHEAT_BACK 0
#define PREHEAT_MODE (PREHEAT_BACK + 1)
#define PREHEAT_1 (PREHEAT_MODE + (PREHEAT_COUNT >= 1))
#define PREHEAT_1 (PREHEAT_MODE + 1)
#define PREHEAT_2 (PREHEAT_1 + (PREHEAT_COUNT >= 2))
#define PREHEAT_3 (PREHEAT_2 + (PREHEAT_COUNT >= 3))
#define PREHEAT_4 (PREHEAT_3 + (PREHEAT_COUNT >= 4))