Add multi-extruder condition

This commit is contained in:
Scott Lahteine
2020-09-20 18:29:08 -05:00
parent 5a35595a3a
commit b3890d385c
50 changed files with 127 additions and 144 deletions

View File

@ -96,7 +96,7 @@ void EndstopStatesScreen::onRedraw(draw_mode_t) {
#else
PIN_DISABLED(1, 4, GET_TEXT_F(MSG_RUNOUT_1), FIL_RUNOUT)
#endif
#if ENABLED(FILAMENT_RUNOUT_SENSOR) && PIN_EXISTS(FIL_RUNOUT2) && EXTRUDERS > 1
#if BOTH(HAS_MULTI_EXTRUDER, FILAMENT_RUNOUT_SENSOR) && PIN_EXISTS(FIL_RUNOUT2)
PIN_ENABLED (3, 4, GET_TEXT_F(MSG_RUNOUT_2), FIL_RUNOUT2, FIL_RUNOUT_STATE)
#else
PIN_DISABLED(3, 4, GET_TEXT_F(MSG_RUNOUT_2), FIL_RUNOUT2)

View File

@ -34,7 +34,7 @@ void LinearAdvanceScreen::onRedraw(draw_mode_t what) {
widgets_t w(what);
w.precision(2, DEFAULT_LOWEST).color(e_axis);
w.heading( GET_TEXT_F(MSG_LINEAR_ADVANCE));
#if EXTRUDERS == 1
#if !HAS_MULTI_EXTRUDER
w.adjuster( 2, GET_TEXT_F(MSG_LINEAR_ADVANCE_K), getLinearAdvance_mm_mm_s(E0) );
#else
w.adjuster( 2, GET_TEXT_F(MSG_LINEAR_ADVANCE_K1), getLinearAdvance_mm_mm_s(E0) );
@ -55,7 +55,7 @@ bool LinearAdvanceScreen::onTouchHeld(uint8_t tag) {
switch (tag) {
case 2: UI_DECREMENT(LinearAdvance_mm_mm_s, E0); break;
case 3: UI_INCREMENT(LinearAdvance_mm_mm_s, E0); break;
#if EXTRUDERS > 1
#if HAS_MULTI_EXTRUDER
case 4: UI_DECREMENT(LinearAdvance_mm_mm_s, E1); break;
case 5: UI_INCREMENT(LinearAdvance_mm_mm_s, E1); break;
#if EXTRUDERS > 2

View File

@ -41,7 +41,7 @@ void MaxVelocityScreen::onRedraw(draw_mode_t what) {
w.color(z_axis) .adjuster( 6, GET_TEXT_F(MSG_VMAX_Z), getAxisMaxFeedrate_mm_s(Z) );
#if EXTRUDERS == 1 || DISABLED(DISTINCT_E_FACTORS)
w.color(e_axis) .adjuster( 8, GET_TEXT_F(MSG_VMAX_E), getAxisMaxFeedrate_mm_s(E0) );
#elif EXTRUDERS > 1
#elif HAS_MULTI_EXTRUDER
w.heading(GET_TEXT_F(MSG_VMAX_E));
w.color(e_axis) .adjuster( 8, F(LCD_STR_E0), getAxisMaxFeedrate_mm_s(E0) );
w.color(e_axis) .adjuster( 10, F(LCD_STR_E1), getAxisMaxFeedrate_mm_s(E1) );

View File

@ -55,7 +55,7 @@ void MoveAxisScreen::onRedraw(draw_mode_t what) {
w.color(Theme::e_axis);
#if EXTRUDERS == 1
w.adjuster( 8, GET_TEXT_F(MSG_AXIS_E), screen_data.MoveAxisScreen.e_rel[0], canMove(E0));
#elif EXTRUDERS > 1
#elif HAS_MULTI_EXTRUDER
w.adjuster( 8, GET_TEXT_F(MSG_AXIS_E1), screen_data.MoveAxisScreen.e_rel[0], canMove(E0));
w.adjuster( 10, GET_TEXT_F(MSG_AXIS_E2), screen_data.MoveAxisScreen.e_rel[1], canMove(E1));
#if EXTRUDERS > 2
@ -82,7 +82,7 @@ bool MoveAxisScreen::onTouchHeld(uint8_t tag) {
// For extruders, also update relative distances.
case 8: UI_DECREMENT_AXIS(E0); screen_data.MoveAxisScreen.e_rel[0] -= increment; break;
case 9: UI_INCREMENT_AXIS(E0); screen_data.MoveAxisScreen.e_rel[0] += increment; break;
#if EXTRUDERS > 1
#if HAS_MULTI_EXTRUDER
case 10: UI_DECREMENT_AXIS(E1); screen_data.MoveAxisScreen.e_rel[1] -= increment; break;
case 11: UI_INCREMENT_AXIS(E1); screen_data.MoveAxisScreen.e_rel[1] += increment; break;
#endif

View File

@ -33,7 +33,7 @@ using namespace ExtUI;
void NudgeNozzleScreen::onEntry() {
screen_data.NudgeNozzleScreen.show_offsets = false;
#if EXTRUDERS > 1
#if HAS_MULTI_EXTRUDER
screen_data.NudgeNozzleScreen.link_nozzles = true;
#endif
screen_data.NudgeNozzleScreen.rel.reset();
@ -52,11 +52,11 @@ void NudgeNozzleScreen::onRedraw(draw_mode_t what) {
#endif
w.color(z_axis).adjuster(6, GET_TEXT_F(MSG_AXIS_Z), screen_data.NudgeNozzleScreen.rel.z / getAxisSteps_per_mm(Z));
w.increments();
#if EXTRUDERS > 1
#if HAS_MULTI_EXTRUDER
w.toggle(8, GET_TEXT_F(MSG_ADJUST_BOTH_NOZZLES), screen_data.NudgeNozzleScreen.link_nozzles);
#endif
#if EXTRUDERS > 1 || HAS_BED_PROBE
#if HAS_MULTI_EXTRUDER || HAS_BED_PROBE
w.toggle(9, GET_TEXT_F(MSG_SHOW_OFFSETS), screen_data.NudgeNozzleScreen.show_offsets);
if (screen_data.NudgeNozzleScreen.show_offsets) {
@ -82,7 +82,7 @@ void NudgeNozzleScreen::onRedraw(draw_mode_t what) {
bool NudgeNozzleScreen::onTouchHeld(uint8_t tag) {
const float inc = getIncrement();
#if EXTRUDERS > 1
#if HAS_MULTI_EXTRUDER
const bool link = screen_data.NudgeNozzleScreen.link_nozzles;
#else
constexpr bool link = true;
@ -95,13 +95,13 @@ bool NudgeNozzleScreen::onTouchHeld(uint8_t tag) {
case 5: steps = mmToWholeSteps(inc, Y); smartAdjustAxis_steps( steps, Y, link); screen_data.NudgeNozzleScreen.rel.y += steps; break;
case 6: steps = mmToWholeSteps(inc, Z); smartAdjustAxis_steps(-steps, Z, link); screen_data.NudgeNozzleScreen.rel.z -= steps; break;
case 7: steps = mmToWholeSteps(inc, Z); smartAdjustAxis_steps( steps, Z, link); screen_data.NudgeNozzleScreen.rel.z += steps; break;
#if EXTRUDERS > 1
#if HAS_MULTI_EXTRUDER
case 8: screen_data.NudgeNozzleScreen.link_nozzles = !link; break;
#endif
case 9: screen_data.NudgeNozzleScreen.show_offsets = !screen_data.NudgeNozzleScreen.show_offsets; break;
default: return false;
}
#if EXTRUDERS > 1 || HAS_BED_PROBE
#if HAS_MULTI_EXTRUDER || HAS_BED_PROBE
SaveSettingsDialogBox::settingsChanged();
#endif
return true;

View File

@ -86,7 +86,7 @@ union screen_data_t {
struct {
struct base_numeric_adjustment_t placeholder;
xyz_int_t rel;
#if EXTRUDERS > 1
#if HAS_MULTI_EXTRUDER
bool link_nozzles;
#endif
bool show_offsets;

View File

@ -40,7 +40,7 @@ void StepperCurrentScreen::onRedraw(draw_mode_t what) {
w.color(z_axis) .adjuster( 6, GET_TEXT_F(MSG_AXIS_Z), getAxisCurrent_mA(Z) );
#if EXTRUDERS == 1
w.color(e_axis).adjuster( 8, GET_TEXT_F(MSG_AXIS_E), getAxisCurrent_mA(E0) );
#elif EXTRUDERS > 1
#elif HAS_MULTI_EXTRUDER
w.color(e_axis).adjuster( 8, GET_TEXT_F(MSG_AXIS_E1), getAxisCurrent_mA(E0) );
w.color(e_axis).adjuster(10, GET_TEXT_F(MSG_AXIS_E2), getAxisCurrent_mA(E1) );
#if EXTRUDERS > 2
@ -64,7 +64,7 @@ bool StepperCurrentScreen::onTouchHeld(uint8_t tag) {
case 7: UI_INCREMENT(AxisCurrent_mA, Z ); break;
case 8: UI_DECREMENT(AxisCurrent_mA, E0); break;
case 9: UI_INCREMENT(AxisCurrent_mA, E0); break;
#if EXTRUDERS > 1
#if HAS_MULTI_EXTRUDER
case 10: UI_DECREMENT(AxisCurrent_mA, E1); break;
case 11: UI_INCREMENT(AxisCurrent_mA, E1); break;
#endif

View File

@ -40,7 +40,7 @@ void StepsScreen::onRedraw(draw_mode_t what) {
w.color(z_axis) .adjuster( 6, GET_TEXT_F(MSG_AXIS_Z), getAxisSteps_per_mm(Z) );
#if EXTRUDERS == 1 || DISABLED(DISTINCT_E_FACTORS)
w.color(e_axis) .adjuster( 8, GET_TEXT_F(MSG_AXIS_E), getAxisSteps_per_mm(E0) );
#elif EXTRUDERS > 1
#elif HAS_MULTI_EXTRUDER
w.color(e_axis) .adjuster( 8, GET_TEXT_F(MSG_AXIS_E1), getAxisSteps_per_mm(E0) );
w.color(e_axis) .adjuster(10, GET_TEXT_F(MSG_AXIS_E2), getAxisSteps_per_mm(E1) );
#if EXTRUDERS > 2
@ -64,7 +64,7 @@ bool StepsScreen::onTouchHeld(uint8_t tag) {
case 7: UI_INCREMENT(AxisSteps_per_mm, Z); break;
case 8: UI_DECREMENT(AxisSteps_per_mm, E0); break;
case 9: UI_INCREMENT(AxisSteps_per_mm, E0); break;
#if EXTRUDERS > 1
#if HAS_MULTI_EXTRUDER
case 10: UI_DECREMENT(AxisSteps_per_mm, E1); break;
case 11: UI_INCREMENT(AxisSteps_per_mm, E1); break;
#endif

View File

@ -127,9 +127,7 @@ void StressTestScreen::onIdle() {
injectCommands_P(PSTR(
"G0 X100 Y100 Z100 F6000\n"
"T0\nG4 S1"
#if EXTRUDERS > 1
"\nT1\nG4 S1"
#endif
TERN_(HAS_MULTI_EXTRUDER, "\nT1\nG4 S1")
"\nG0 X150 Y150 Z150"
));
}

View File

@ -70,7 +70,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
//planner.flow_percentage[1] = planner.flow_percentage[0];
//planner.e_factor[1]= planner.flow_percentage[1]*0.01;
planner.refresh_e_factor(0);
if (EXTRUDERS == 2) {
#if HAS_MULTI_EXTRUDER
planner.flow_percentage[1] = planner.flow_percentage[0];
planner.refresh_e_factor(1);
}

View File

@ -95,7 +95,7 @@ static void btn_ok_event_cb(lv_obj_t * btn, lv_event_t event) {
//saved_feedrate_percentage = feedrate_percentage;
planner.flow_percentage[0] = 100;
planner.e_factor[0] = planner.flow_percentage[0] * 0.01f;
#if EXTRUDERS == 2
#if HAS_MULTI_EXTRUDER
planner.flow_percentage[1] = 100;
planner.e_factor[1] = planner.flow_percentage[1] * 0.01f;
#endif

View File

@ -90,7 +90,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
// nothing to do
}
else if (event == LV_EVENT_RELEASED) {
if (EXTRUDERS == 2) {
if (ENABLED(HAS_MULTI_EXTRUDER)) {
if (uiCfg.curSprayerChoose == 0) {
uiCfg.curSprayerChoose = 1;
queue.inject_P(PSTR("T1"));

View File

@ -61,7 +61,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
thermalManager.start_watching_hotend(uiCfg.curSprayerChoose);
}
}
#if !defined(SINGLENOZZLE) && EXTRUDERS >= 2
#if !defined(SINGLENOZZLE) && HAS_MULTI_EXTRUDER
else if ((int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].target > (HEATER_1_MAXTEMP - (WATCH_TEMP_INCREASE + TEMP_HYSTERESIS + 1))) {
thermalManager.temp_hotend[uiCfg.curSprayerChoose].target = (float)HEATER_1_MAXTEMP - (WATCH_TEMP_INCREASE + TEMP_HYSTERESIS + 1);
thermalManager.start_watching_hotend(uiCfg.curSprayerChoose);
@ -117,7 +117,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
}
else if (event == LV_EVENT_RELEASED) {
if (uiCfg.curTempType == 0) {
if (EXTRUDERS == 2) {
if (ENABLED(HAS_MULTI_EXTRUDER)) {
if (uiCfg.curSprayerChoose == 0) {
uiCfg.curSprayerChoose = 1;
}

View File

@ -242,8 +242,10 @@ void lv_draw_printing(void) {
#endif // if 1
lv_obj_set_pos(buttonExt1, 205, 136);
if (EXTRUDERS == 2)
#if HAS_MULTI_EXTRUDER
lv_obj_set_pos(buttonExt2, 350, 136);
#endif
#if HAS_HEATED_BED
lv_obj_set_pos(buttonBedstate, 205, 186);
@ -275,11 +277,11 @@ void lv_draw_printing(void) {
lv_obj_set_style(labelExt1, &tft_style_label_rel);
lv_obj_set_pos(labelExt1, 250, 146);
if (EXTRUDERS == 2) {
#if HAS_MULTI_EXTRUDER
labelExt2 = lv_label_create(scr, NULL);
lv_obj_set_style(labelExt2, &tft_style_label_rel);
lv_obj_set_pos(labelExt2, 395, 146);
}
#endif
#if HAS_HEATED_BED
labelBed = lv_label_create(scr, NULL);
@ -344,11 +346,11 @@ void disp_ext_temp() {
sprintf(public_buf_l, printing_menu.temp1, (int)thermalManager.temp_hotend[0].celsius, (int)thermalManager.temp_hotend[0].target);
lv_label_set_text(labelExt1, public_buf_l);
if (EXTRUDERS == 2) {
#if HAS_MULTI_EXTRUDER
ZERO(public_buf_l);
sprintf(public_buf_l, printing_menu.temp1, (int)thermalManager.temp_hotend[1].celsius, (int)thermalManager.temp_hotend[1].target);
lv_label_set_text(labelExt2, public_buf_l);
}
#endif
}
void disp_bed_temp() {

View File

@ -61,7 +61,7 @@
#include "../../libs/numtostr.h"
#endif
#if EXTRUDERS > 1
#if HAS_MULTI_EXTRUDER
#include "../../module/tool_change.h"
#endif
@ -348,7 +348,7 @@ namespace ExtUI {
}
void setActiveTool(const extruder_t extruder, bool no_move) {
#if EXTRUDERS > 1
#if HAS_MULTI_EXTRUDER
const uint8_t e = extruder - E0;
if (e != active_extruder) tool_change(e, no_move);
active_extruder = e;
@ -699,21 +699,17 @@ namespace ExtUI {
*/
void smartAdjustAxis_steps(const int16_t steps, const axis_t axis, bool linked_nozzles) {
const float mm = steps * planner.steps_to_mm[axis];
UNUSED(mm);
if (!babystepAxis_steps(steps, axis)) return;
#if ENABLED(BABYSTEP_ZPROBE_OFFSET)
// Make it so babystepping in Z adjusts the Z probe offset.
if (axis == Z
#if EXTRUDERS > 1
&& (linked_nozzles || active_extruder == 0)
#endif
) probe.offset.z += mm;
#else
UNUSED(mm);
if (axis == Z && TERN1(HAS_MULTI_EXTRUDER, linked_nozzles || active_extruder == 0))
probe.offset.z += mm;
#endif
#if EXTRUDERS > 1 && HAS_HOTEND_OFFSET
#if HAS_MULTI_EXTRUDER && HAS_HOTEND_OFFSET
/**
* When linked_nozzles is false, as an axis is babystepped
* adjust the hotend offsets so that the other nozzles are
@ -730,7 +726,6 @@ namespace ExtUI {
}
#else
UNUSED(linked_nozzles);
UNUSED(mm);
#endif
}