Add HAS_HOTEND, etc.

This commit is contained in:
Scott Lahteine
2020-04-19 23:56:55 -05:00
parent 5d0deba938
commit 15f6f53638
38 changed files with 554 additions and 256 deletions

View File

@ -745,7 +745,7 @@ void MarlinUI::draw_status_screen() {
//
// Hotend 1 or Bed Temperature
//
#if HOTENDS > 1
#if HAS_MULTI_HOTEND
lcd_moveto(8, 0);
_draw_heater_status(H_E1, LCD_STR_THERMOMETER[0], blink);
#elif HAS_HEATED_BED
@ -763,7 +763,7 @@ void MarlinUI::draw_status_screen() {
//
// Hotend 1 or Bed Temperature
//
#if HOTENDS > 1
#if HAS_MULTI_HOTEND
lcd_moveto(10, 0);
_draw_heater_status(H_E1, LCD_STR_THERMOMETER[0], blink);
#elif HAS_HEATED_BED
@ -791,7 +791,7 @@ void MarlinUI::draw_status_screen() {
// If the first line has two extruder temps,
// show more temperatures on the next line
#if HOTENDS > 2 || (HOTENDS > 1 && HAS_HEATED_BED)
#if HOTENDS > 2 || (HAS_MULTI_HOTEND && HAS_HEATED_BED)
#if HOTENDS > 2
_draw_heater_status(H_E2, LCD_STR_THERMOMETER[0], blink);
@ -924,7 +924,7 @@ void MarlinUI::draw_status_screen() {
lcd_moveto(LCD_WIDTH - 9, 0);
_draw_axis_value(Z_AXIS, ftostr52sp(LOGICAL_Z_POSITION(current_position.z)), blink);
#if HAS_LEVELING && (HOTENDS > 1 || !HAS_HEATED_BED)
#if HAS_LEVELING && (HAS_MULTI_HOTEND || !HAS_HEATED_BED)
lcd_put_wchar(LCD_WIDTH - 1, 0, planner.leveling_active || blink ? '_' : ' ');
#endif
@ -934,7 +934,7 @@ void MarlinUI::draw_status_screen() {
// Hotend 1 or Bed Temperature
//
lcd_moveto(0, 1);
#if HOTENDS > 1
#if HAS_MULTI_HOTEND
_draw_heater_status(H_E1, LCD_STR_THERMOMETER[0], blink);
#elif HAS_HEATED_BED
_draw_bed_status(blink);
@ -952,7 +952,7 @@ void MarlinUI::draw_status_screen() {
lcd_moveto(0, 2);
#if HOTENDS > 2
_draw_heater_status(H_E2, LCD_STR_THERMOMETER[0], blink);
#elif HOTENDS > 1 && HAS_HEATED_BED
#elif HAS_MULTI_HOTEND && HAS_HEATED_BED
_draw_bed_status(blink);
#elif HAS_PRINT_PROGRESS
#define DREW_PRINT_PROGRESS
@ -1077,7 +1077,7 @@ void MarlinUI::draw_status_screen() {
if (thermalManager.degTargetBed() > 0) leds |= LED_A;
#endif
#if HOTENDS
#if HAS_HOTEND
if (thermalManager.degTargetHotend(0) > 0) leds |= LED_B;
#endif
@ -1110,7 +1110,7 @@ void MarlinUI::draw_status_screen() {
) leds |= LED_C;
#endif // FAN_COUNT > 0
#if HOTENDS > 1
#if HAS_MULTI_HOTEND
if (thermalManager.degTargetHotend(1) > 0) leds |= LED_C;
#endif

View File

@ -278,7 +278,7 @@
//
// Status Screen Hotends bitmaps
//
#if HOTENDS
#if HAS_HOTEND
#define STATUS_HOTEND1_WIDTH 16
@ -1343,7 +1343,7 @@
#undef STATUS_LOGO_WIDTH
#endif
#if (HOTENDS > 1 && STATUS_LOGO_WIDTH && BED_OR_CHAMBER_OR_FAN) || (HOTENDS >= 3 && !BED_OR_CHAMBER_OR_FAN)
#if (HAS_MULTI_HOTEND && STATUS_LOGO_WIDTH && BED_OR_CHAMBER_OR_FAN) || (HOTENDS >= 3 && !BED_OR_CHAMBER_OR_FAN)
#define _STATUS_HEATERS_X(H,S,N) ((LCD_PIXEL_WIDTH - (H * (S + N)) - (_EXTRA_WIDTH) + (STATUS_LOGO_WIDTH)) / 2)
#if STATUS_HOTEND1_WIDTH
#if HOTENDS > 2
@ -1474,7 +1474,7 @@
constexpr uint8_t status_hotend_x[HOTENDS] = ARRAY_N(HOTENDS, STATUS_HOTEND1_X, STATUS_HOTEND2_X, STATUS_HOTEND3_X, STATUS_HOTEND4_X, STATUS_HOTEND5_X, STATUS_HOTEND6_X);
#define STATUS_HOTEND_X(N) status_hotend_x[N]
#elif HOTENDS > 1
#elif HAS_MULTI_HOTEND
#define STATUS_HOTEND_X(N) ((N) ? STATUS_HOTEND2_X : STATUS_HOTEND1_X)
#else
#define STATUS_HOTEND_X(N) STATUS_HOTEND1_X

View File

@ -431,7 +431,7 @@ void ST7920_Lite_Status_Screen::draw_static_elements() {
// Draw the static icons in GDRAM
draw_gdram_icon(0, 0, nozzle_icon);
#if HOTENDS > 1
#if HAS_MULTI_HOTEND
draw_gdram_icon(0, 1, nozzle_icon);
draw_gdram_icon(0, 2, bed_icon);
#else
@ -584,7 +584,7 @@ void ST7920_Lite_Status_Screen::draw_extruder_2_temp(const int16_t temp, const i
#if HAS_HEATED_BED
void ST7920_Lite_Status_Screen::draw_bed_temp(const int16_t temp, const int16_t target, bool forceUpdate) {
const bool show_target = target && FAR(temp, target);
draw_temps(HOTENDS > 1 ? 2 : 1, temp, target, show_target, display_state.bed_show_target != show_target || forceUpdate);
draw_temps(HAS_MULTI_HOTEND ? 2 : 1, temp, target, show_target, display_state.bed_show_target != show_target || forceUpdate);
display_state.bed_show_target = show_target;
}
#endif
@ -704,7 +704,7 @@ bool ST7920_Lite_Status_Screen::indicators_changed() {
const uint16_t feedrate_perc = feedrate_percentage;
const uint16_t fs = thermalManager.scaledFanSpeed(0);
const int16_t extruder_1_target = thermalManager.degTargetHotend(0);
#if HOTENDS > 1
#if HAS_MULTI_HOTEND
const int16_t extruder_2_target = thermalManager.degTargetHotend(1);
#endif
#if HAS_HEATED_BED
@ -731,7 +731,7 @@ void ST7920_Lite_Status_Screen::update_indicators(const bool forceUpdate) {
const uint16_t feedrate_perc = feedrate_percentage;
const int16_t extruder_1_temp = thermalManager.degHotend(0),
extruder_1_target = thermalManager.degTargetHotend(0);
#if HOTENDS > 1
#if HAS_MULTI_HOTEND
const int16_t extruder_2_temp = thermalManager.degHotend(1),
extruder_2_target = thermalManager.degTargetHotend(1);
#endif
@ -741,7 +741,7 @@ void ST7920_Lite_Status_Screen::update_indicators(const bool forceUpdate) {
#endif
draw_extruder_1_temp(extruder_1_temp, extruder_1_target, forceUpdate);
#if HOTENDS > 1
#if HAS_MULTI_HOTEND
draw_extruder_2_temp(extruder_2_temp, extruder_2_target, forceUpdate);
#endif
#if HAS_HEATED_BED

View File

@ -115,7 +115,7 @@ void AdvancedSettingsMenu::onRedraw(draw_mode_t what) {
)
.tag(14).button( TMC_HOMING_THRS_POS, GET_TEXT_F(MSG_TMC_HOMING_THRS))
.enabled(
#if HOTENDS > 1
#if HAS_MULTI_HOTEND
1
#endif
)
@ -157,7 +157,7 @@ bool AdvancedSettingsMenu::onTouchEnd(uint8_t tag) {
case 2: GOTO_SCREEN(ZOffsetScreen); break;
#endif
case 3: GOTO_SCREEN(StepsScreen); break;
#if HOTENDS > 1
#if HAS_MULTI_HOTEND
case 4: GOTO_SCREEN(NozzleOffsetScreen); break;
#endif
case 5: GOTO_SCREEN(MaxVelocityScreen); break;

View File

@ -58,7 +58,7 @@ void AdvancedSettingsMenu::onRedraw(draw_mode_t what) {
.tag(4) .button( BTN_POS(1,3), BTN_SIZE(1,1), GET_TEXT_F(MSG_TMC_HOMING_THRS))
.tag(5) .button( BTN_POS(1,4), BTN_SIZE(1,1), GET_TEXT_F(MSG_LCD_ENDSTOPS))
.enabled(
#if HOTENDS > 1
#if HAS_MULTI_HOTEND
1
#endif
)
@ -105,7 +105,7 @@ bool AdvancedSettingsMenu::onTouchEnd(uint8_t tag) {
case 4: GOTO_SCREEN(StepperBumpSensitivityScreen); break;
#endif
case 5: GOTO_SCREEN(EndstopStatesScreen); break;
#if HOTENDS > 1
#if HAS_MULTI_HOTEND
case 6: GOTO_SCREEN(NozzleOffsetScreen); break;
#endif

View File

@ -172,8 +172,8 @@ void ChangeFilamentScreen::onRedraw(draw_mode_t what) {
const bool tog3 = screen_data.ChangeFilamentScreen.t_tag == 3;
const bool tog4 = screen_data.ChangeFilamentScreen.t_tag == 4;
const bool tog10 = screen_data.ChangeFilamentScreen.e_tag == 10;
#if HOTENDS > 1
const bool tog11 = screen_data.ChangeFilamentScreen.e_tag == 11;
#if HAS_MULTI_HOTEND
const bool tog11 = screen_data.ChangeFilamentScreen.e_tag == 11;
#endif
#ifdef TOUCH_UI_PORTRAIT

View File

@ -22,7 +22,7 @@
#include "../config.h"
#if ENABLED(TOUCH_UI_FTDI_EVE) && HOTENDS > 1
#if ENABLED(TOUCH_UI_FTDI_EVE) && HAS_MULTI_HOTEND
#include "screens.h"

View File

@ -72,7 +72,7 @@ void NudgeNozzleScreen::onRedraw(draw_mode_t what) {
w.text_field(0, GET_TEXT_F(MSG_ZPROBE_ZOFFSET), str);
#endif
#if HOTENDS > 1
#if HAS_MULTI_HOTEND
format_position(str, getNozzleOffset_mm(X, E1), getNozzleOffset_mm(Y, E1), getNozzleOffset_mm(Z, E1));
w.text_field(0, GET_TEXT_F(MSG_OFFSETS_MENU), str);
#endif

View File

@ -68,7 +68,7 @@ SCREEN_TABLE {
#if HAS_BED_PROBE
DECL_SCREEN(ZOffsetScreen),
#endif
#if HOTENDS > 1
#if HAS_MULTI_HOTEND
DECL_SCREEN(NozzleOffsetScreen),
#endif
#if ENABLED(BACKLASH_GCODE)

View File

@ -514,7 +514,7 @@ class StepsScreen : public BaseNumericAdjustmentScreen, public CachedScreen<STEP
};
#endif
#if HOTENDS > 1
#if HAS_MULTI_HOTEND
class NozzleOffsetScreen : public BaseNumericAdjustmentScreen, public CachedScreen<NOZZLE_OFFSET_SCREEN_CACHE> {
public:
static void onEntry();

View File

@ -78,7 +78,7 @@ bool TemperatureScreen::onTouchHeld(uint8_t tag) {
case 2: UI_DECREMENT(TargetTemp_celsius, E0); break;
case 3: UI_INCREMENT(TargetTemp_celsius, E0); break;
#endif
#if HOTENDS > 1
#if HAS_MULTI_HOTEND
case 4: UI_DECREMENT(TargetTemp_celsius, E1); break;
case 5: UI_INCREMENT(TargetTemp_celsius, E1); break;
#endif

View File

@ -192,7 +192,7 @@ namespace ExtUI {
case CHAMBER: return; // Chamber has no idle timer
#endif
default:
#if HOTENDS
#if HAS_HOTEND
thermalManager.reset_hotend_idle_timer(heater - H0);
#endif
break;
@ -258,7 +258,7 @@ namespace ExtUI {
case CHAMBER: return false; // Chamber has no idle timer
#endif
default:
#if HOTENDS
#if HAS_HOTEND
return thermalManager.hotend_idle[heater - H0].timed_out;
#else
return false;
@ -985,7 +985,7 @@ namespace ExtUI {
else
#endif
{
#if HOTENDS
#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;
thermalManager.setTargetHotend(LROUND(constrain(value, 0, heater_maxtemp[e] - 15)), e);
@ -997,7 +997,7 @@ namespace ExtUI {
#ifdef TOUCH_UI_LCD_TEMP_SCALING
value *= TOUCH_UI_LCD_TEMP_SCALING;
#endif
#if HOTENDS
#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;
enableHeater(extruder);

View File

@ -29,7 +29,7 @@
extern int8_t encoderLine, encoderTopLine, screen_items;
#if HOTENDS
#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

View File

@ -233,9 +233,9 @@ void menu_cancelobject();
#define DEFINE_PIDTEMP_FUNCS(N) _DEFINE_PIDTEMP_BASE_FUNCS(N);
#endif
#if HOTENDS
#if HAS_HOTEND
DEFINE_PIDTEMP_FUNCS(0);
#if HOTENDS > 1 && ENABLED(PID_PARAMS_PER_HOTEND)
#if HAS_MULTI_HOTEND && ENABLED(PID_PARAMS_PER_HOTEND)
REPEAT_S(1, HOTENDS, DEFINE_PIDTEMP_FUNCS)
#endif
#endif
@ -308,7 +308,7 @@ void menu_cancelobject();
#endif
PID_EDIT_MENU_ITEMS(0);
#if HOTENDS > 1 && ENABLED(PID_PARAMS_PER_HOTEND)
#if HAS_MULTI_HOTEND && ENABLED(PID_PARAMS_PER_HOTEND)
REPEAT_S(1, HOTENDS, PID_EDIT_MENU_ITEMS)
#endif

View File

@ -48,7 +48,7 @@ uint8_t MarlinUI::preheat_fan_speed[2];
//
void _lcd_preheat(const int16_t endnum, const int16_t temph, const int16_t tempb, const uint8_t fan) {
#if HOTENDS
#if HAS_HOTEND
if (temph > 0) thermalManager.setTargetHotend(_MIN(heater_maxtemp[endnum] - 15, temph), endnum);
#endif
#if HAS_HEATED_BED
@ -107,7 +107,7 @@ void _lcd_preheat(const int16_t endnum, const int16_t temph, const int16_t tempb
#else
ACTION_ITEM(MSG_PREHEAT_1, []{ _preheat_end(0, 0); });
#endif
#elif HOTENDS > 1
#elif HAS_MULTI_HOTEND
#if HAS_HEATED_BED
_PREHEAT_ITEMS(1,0);
#endif
@ -118,7 +118,7 @@ void _lcd_preheat(const int16_t endnum, const int16_t temph, const int16_t tempb
#endif
HOTEND_LOOP() thermalManager.setTargetHotend(ui.preheat_hotend_temp[0], e);
});
#endif // HOTENDS > 1
#endif // HAS_MULTI_HOTEND
#if HAS_HEATED_BED
ACTION_ITEM(MSG_PREHEAT_1_BEDONLY, []{ _preheat_bed(0); });
#endif
@ -135,7 +135,7 @@ void _lcd_preheat(const int16_t endnum, const int16_t temph, const int16_t tempb
#else
ACTION_ITEM(MSG_PREHEAT_2, []{ _preheat_end(1, 0); });
#endif
#elif HOTENDS > 1
#elif HAS_MULTI_HOTEND
#if HAS_HEATED_BED
_PREHEAT_ITEMS(2,0);
#endif
@ -146,7 +146,7 @@ void _lcd_preheat(const int16_t endnum, const int16_t temph, const int16_t tempb
#endif
HOTEND_LOOP() thermalManager.setTargetHotend(ui.preheat_hotend_temp[1], e);
});
#endif // HOTENDS > 1
#endif // HAS_MULTI_HOTEND
#if HAS_HEATED_BED
ACTION_ITEM(MSG_PREHEAT_2_BEDONLY, []{ _preheat_bed(1); });
#endif
@ -171,7 +171,7 @@ void menu_temperature() {
//
#if HOTENDS == 1
EDIT_ITEM_FAST(int3, MSG_NOZZLE, &thermalManager.temp_hotend[0].target, 0, HEATER_0_MAXTEMP - 15, []{ thermalManager.start_watching_hotend(0); });
#elif HOTENDS > 1
#elif HAS_MULTI_HOTEND
HOTEND_LOOP()
EDIT_ITEM_FAST_N(int3, e, MSG_NOZZLE_N, &thermalManager.temp_hotend[e].target, 0, heater_maxtemp[e] - 15, []{ thermalManager.start_watching_hotend(MenuItemBase::itemIndex); });
#endif

View File

@ -127,7 +127,7 @@ void menu_tune() {
//
#if HOTENDS == 1
EDIT_ITEM_FAST(int3, MSG_NOZZLE, &thermalManager.temp_hotend[0].target, 0, HEATER_0_MAXTEMP - 15, []{ thermalManager.start_watching_hotend(0); });
#elif HOTENDS > 1
#elif HAS_MULTI_HOTEND
HOTEND_LOOP()
EDIT_ITEM_FAST_N(int3, e, MSG_NOZZLE_N, &thermalManager.temp_hotend[e].target, 0, heater_maxtemp[e] - 15, []{ thermalManager.start_watching_hotend(MenuItemBase::itemIndex); });
#endif