|
@ -31,6 +31,43 @@ using namespace ExtUI; |
|
|
using namespace FTDI; |
|
|
using namespace FTDI; |
|
|
using namespace Theme; |
|
|
using namespace Theme; |
|
|
|
|
|
|
|
|
|
|
|
#ifdef TOUCH_UI_PORTRAIT |
|
|
|
|
|
#define GRID_COLS 2 |
|
|
|
|
|
#define GRID_ROWS 11 |
|
|
|
|
|
#define E_TEMP_POS BTN_POS(2,7), BTN_SIZE(1,1) |
|
|
|
|
|
#define E_TEMP_LBL_POS BTN_POS(1,7), BTN_SIZE(1,1) |
|
|
|
|
|
#define UNLD_LABL_POS BTN_POS(1,8), BTN_SIZE(1,1) |
|
|
|
|
|
#define LOAD_LABL_POS BTN_POS(2,8), BTN_SIZE(1,1) |
|
|
|
|
|
#define UNLD_MOMN_POS BTN_POS(1,9), BTN_SIZE(1,1) |
|
|
|
|
|
#define LOAD_MOMN_POS BTN_POS(2,9), BTN_SIZE(1,1) |
|
|
|
|
|
#define UNLD_CONT_POS BTN_POS(1,10), BTN_SIZE(1,1) |
|
|
|
|
|
#define LOAD_CONT_POS BTN_POS(2,10), BTN_SIZE(1,1) |
|
|
|
|
|
#define BACK_POS BTN_POS(1,11), BTN_SIZE(2,1) |
|
|
|
|
|
#else |
|
|
|
|
|
#define GRID_COLS 4 |
|
|
|
|
|
#define GRID_ROWS 6 |
|
|
|
|
|
#define E_TEMP_POS BTN_POS(3,2), BTN_SIZE(2,1) |
|
|
|
|
|
#define E_TEMP_LBL_POS BTN_POS(3,1), BTN_SIZE(2,1) |
|
|
|
|
|
#define UNLD_LABL_POS BTN_POS(3,3), BTN_SIZE(1,1) |
|
|
|
|
|
#define LOAD_LABL_POS BTN_POS(4,3), BTN_SIZE(1,1) |
|
|
|
|
|
#define UNLD_MOMN_POS BTN_POS(3,4), BTN_SIZE(1,1) |
|
|
|
|
|
#define LOAD_MOMN_POS BTN_POS(4,4), BTN_SIZE(1,1) |
|
|
|
|
|
#define UNLD_CONT_POS BTN_POS(3,5), BTN_SIZE(1,1) |
|
|
|
|
|
#define LOAD_CONT_POS BTN_POS(4,5), BTN_SIZE(1,1) |
|
|
|
|
|
#define BACK_POS BTN_POS(3,6), BTN_SIZE(2,1) |
|
|
|
|
|
#endif |
|
|
|
|
|
#define REMOVAL_TEMP_LBL_POS BTN_POS(1,3), BTN_SIZE(2,1) |
|
|
|
|
|
#define GRADIENT_POS BTN_POS(1,4), BTN_SIZE(1,3) |
|
|
|
|
|
#define LOW_TEMP_POS BTN_POS(2,6), BTN_SIZE(1,1) |
|
|
|
|
|
#define MED_TEMP_POS BTN_POS(2,5), BTN_SIZE(1,1) |
|
|
|
|
|
#define HIG_TEMP_POS BTN_POS(2,4), BTN_SIZE(1,1) |
|
|
|
|
|
#define HEATING_LBL_POS BTN_POS(1,6), BTN_SIZE(1,1) |
|
|
|
|
|
#define CAUTION_LBL_POS BTN_POS(1,4), BTN_SIZE(1,1) |
|
|
|
|
|
#define HOT_LBL_POS BTN_POS(1,6), BTN_SIZE(1,1) |
|
|
|
|
|
#define E_SEL_LBL_POS BTN_POS(1,1), BTN_SIZE(2,1) |
|
|
|
|
|
#define E1_SEL_POS BTN_POS(1,2), BTN_SIZE(1,1) |
|
|
|
|
|
#define E2_SEL_POS BTN_POS(2,2), BTN_SIZE(1,1) |
|
|
|
|
|
|
|
|
#define COOL_TEMP 40 |
|
|
#define COOL_TEMP 40 |
|
|
#define LOW_TEMP 180 |
|
|
#define LOW_TEMP 180 |
|
|
#define MED_TEMP 200 |
|
|
#define MED_TEMP 200 |
|
@ -101,70 +138,45 @@ void ChangeFilamentScreen::onExit() { |
|
|
void ChangeFilamentScreen::onRedraw(draw_mode_t what) { |
|
|
void ChangeFilamentScreen::onRedraw(draw_mode_t what) { |
|
|
CommandProcessor cmd; |
|
|
CommandProcessor cmd; |
|
|
|
|
|
|
|
|
#if ENABLED(TOUCH_UI_PORTRAIT) |
|
|
|
|
|
#define GRID_COLS 2 |
|
|
|
|
|
#define GRID_ROWS 11 |
|
|
|
|
|
#else |
|
|
|
|
|
#define GRID_COLS 4 |
|
|
|
|
|
#define GRID_ROWS 6 |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
if (what & BACKGROUND) { |
|
|
if (what & BACKGROUND) { |
|
|
cmd.cmd(CLEAR_COLOR_RGB(bg_color)) |
|
|
cmd.cmd(CLEAR_COLOR_RGB(bg_color)) |
|
|
.cmd(CLEAR(true,true,true)) |
|
|
.cmd(CLEAR(true,true,true)) |
|
|
.cmd(COLOR_RGB(bg_text_enabled)) |
|
|
.cmd(COLOR_RGB(bg_text_enabled)) |
|
|
.tag(0) |
|
|
.tag(0) |
|
|
#if ENABLED(TOUCH_UI_PORTRAIT) |
|
|
.font(TERN(TOUCH_UI_PORTRAIT, font_large, font_medium)) |
|
|
.font(font_large) |
|
|
.text(E_SEL_LBL_POS, GET_TEXT_F(MSG_EXTRUDER_SELECTION)) |
|
|
#else |
|
|
.text(E_TEMP_LBL_POS, GET_TEXT_F(MSG_CURRENT_TEMPERATURE)) |
|
|
.font(font_medium) |
|
|
.text(REMOVAL_TEMP_LBL_POS, GET_TEXT_F(MSG_REMOVAL_TEMPERATURE)); |
|
|
#endif |
|
|
drawTempGradient(GRADIENT_POS); |
|
|
.text(BTN_POS(1,1), BTN_SIZE(2,1), GET_TEXT_F(MSG_EXTRUDER_SELECTION)) |
|
|
|
|
|
#if ENABLED(TOUCH_UI_PORTRAIT) |
|
|
|
|
|
.text(BTN_POS(1,7), BTN_SIZE(1,1), GET_TEXT_F(MSG_CURRENT_TEMPERATURE)) |
|
|
|
|
|
#else |
|
|
|
|
|
.text(BTN_POS(3,1), BTN_SIZE(2,1), GET_TEXT_F(MSG_CURRENT_TEMPERATURE)) |
|
|
|
|
|
.font(font_small) |
|
|
|
|
|
#endif |
|
|
|
|
|
.text(BTN_POS(1,3), BTN_SIZE(2,1), GET_TEXT_F(MSG_REMOVAL_TEMPERATURE)); |
|
|
|
|
|
drawTempGradient(BTN_POS(1,4), BTN_SIZE(1,3)); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (what & FOREGROUND) { |
|
|
if (what & FOREGROUND) { |
|
|
|
|
|
char str[15]; |
|
|
const extruder_t e = getExtruder(); |
|
|
const extruder_t e = getExtruder(); |
|
|
|
|
|
|
|
|
char e_str[15]; |
|
|
|
|
|
if (isHeaterIdle(e)) |
|
|
if (isHeaterIdle(e)) |
|
|
format_temp_and_idle(e_str, getActualTemp_celsius(e)); |
|
|
format_temp_and_idle(str, getActualTemp_celsius(e)); |
|
|
else |
|
|
else |
|
|
format_temp_and_temp(e_str, getActualTemp_celsius(e), getTargetTemp_celsius(e)); |
|
|
format_temp_and_temp(str, getActualTemp_celsius(e), getTargetTemp_celsius(e)); |
|
|
|
|
|
|
|
|
const rgb_t tcol = getWarmColor(getActualTemp_celsius(e), COOL_TEMP, LOW_TEMP, MED_TEMP, HIGH_TEMP); |
|
|
const rgb_t tcol = getWarmColor(getActualTemp_celsius(e), COOL_TEMP, LOW_TEMP, MED_TEMP, HIGH_TEMP); |
|
|
cmd.cmd(COLOR_RGB(tcol)) |
|
|
cmd.cmd(COLOR_RGB(tcol)) |
|
|
.tag(15) |
|
|
.tag(15) |
|
|
#if ENABLED(TOUCH_UI_PORTRAIT) |
|
|
.rectangle(E_TEMP_POS) |
|
|
.rectangle(BTN_POS(2,7), BTN_SIZE(1,1)) |
|
|
|
|
|
#else |
|
|
|
|
|
.rectangle(BTN_POS(3,2), BTN_SIZE(2,1)) |
|
|
|
|
|
#endif |
|
|
|
|
|
.cmd(COLOR_RGB(tcol.luminance() > 128 ? 0x000000 : 0xFFFFFF)) |
|
|
.cmd(COLOR_RGB(tcol.luminance() > 128 ? 0x000000 : 0xFFFFFF)) |
|
|
.font(font_medium) |
|
|
.font(font_medium) |
|
|
#if ENABLED(TOUCH_UI_PORTRAIT) |
|
|
.text(E_TEMP_POS, str) |
|
|
.text(BTN_POS(2,7), BTN_SIZE(1,1), e_str) |
|
|
|
|
|
#else |
|
|
|
|
|
.text(BTN_POS(3,2), BTN_SIZE(2,1), e_str) |
|
|
|
|
|
#endif |
|
|
|
|
|
.colors(normal_btn); |
|
|
.colors(normal_btn); |
|
|
|
|
|
|
|
|
const bool t_ok = getActualTemp_celsius(e) > getSoftenTemp() - 10; |
|
|
const bool t_ok = getActualTemp_celsius(e) > getSoftenTemp() - 10; |
|
|
|
|
|
|
|
|
if (screen_data.ChangeFilamentScreen.t_tag && !t_ok) { |
|
|
if (screen_data.ChangeFilamentScreen.t_tag && !t_ok) { |
|
|
cmd.text(BTN_POS(1,6), BTN_SIZE(1,1), GET_TEXT_F(MSG_HEATING)); |
|
|
cmd.text(HEATING_LBL_POS, GET_TEXT_F(MSG_HEATING)); |
|
|
} else if (getActualTemp_celsius(e) > 100) { |
|
|
} else if (getActualTemp_celsius(e) > 100) { |
|
|
cmd.cmd(COLOR_RGB(0xFF0000)) |
|
|
cmd.cmd(COLOR_RGB(0xFF0000)) |
|
|
.text(BTN_POS(1,4), BTN_SIZE(1,1), GET_TEXT_F(MSG_CAUTION)) |
|
|
.text(CAUTION_LBL_POS, GET_TEXT_F(MSG_CAUTION)) |
|
|
.colors(normal_btn) |
|
|
.colors(normal_btn) |
|
|
.text(BTN_POS(1,6), BTN_SIZE(1,1), GET_TEXT_F(MSG_HOT)); |
|
|
.text(HOT_LBL_POS, GET_TEXT_F(MSG_HOT)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#define TOG_STYLE(A) colors(A ? action_btn : normal_btn) |
|
|
#define TOG_STYLE(A) colors(A ? action_btn : normal_btn) |
|
@ -177,79 +189,42 @@ void ChangeFilamentScreen::onRedraw(draw_mode_t what) { |
|
|
const bool tog11 = screen_data.ChangeFilamentScreen.e_tag == 11; |
|
|
const bool tog11 = screen_data.ChangeFilamentScreen.e_tag == 11; |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
#if ENABLED(TOUCH_UI_PORTRAIT) |
|
|
cmd.TOG_STYLE(tog10) |
|
|
cmd.font(font_large) |
|
|
.tag(10).button (E1_SEL_POS, F("1")) |
|
|
#else |
|
|
|
|
|
cmd.font(font_medium) |
|
|
|
|
|
#endif |
|
|
|
|
|
.TOG_STYLE(tog10) |
|
|
|
|
|
.tag(10) .button (BTN_POS(1,2), BTN_SIZE(1,1), F("1")) |
|
|
|
|
|
#if HOTENDS < 2 |
|
|
#if HOTENDS < 2 |
|
|
.enabled(false) |
|
|
.enabled(false) |
|
|
#else |
|
|
#else |
|
|
.TOG_STYLE(tog11) |
|
|
.TOG_STYLE(tog11) |
|
|
#endif |
|
|
#endif |
|
|
.tag(11) .button (BTN_POS(2,2), BTN_SIZE(1,1), F("2")); |
|
|
.tag(11).button (E2_SEL_POS, F("2")); |
|
|
|
|
|
|
|
|
if (!t_ok) reset_menu_timeout(); |
|
|
if (!t_ok) reset_menu_timeout(); |
|
|
|
|
|
|
|
|
const bool tog7 = screen_data.ChangeFilamentScreen.repeat_tag == 7; |
|
|
const bool tog7 = screen_data.ChangeFilamentScreen.repeat_tag == 7; |
|
|
const bool tog8 = screen_data.ChangeFilamentScreen.repeat_tag == 8; |
|
|
const bool tog8 = screen_data.ChangeFilamentScreen.repeat_tag == 8; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cmd.font( |
|
|
|
|
|
#if ENABLED(TOUCH_UI_PORTRAIT) |
|
|
|
|
|
font_large |
|
|
|
|
|
#else |
|
|
|
|
|
font_small |
|
|
|
|
|
#endif |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
{ |
|
|
{ |
|
|
char str[30]; |
|
|
char str[30]; |
|
|
|
|
|
|
|
|
format_temp(str, LOW_TEMP); |
|
|
format_temp(str, LOW_TEMP); |
|
|
cmd.tag(2) .TOG_STYLE(tog2) .button (BTN_POS(2,6), BTN_SIZE(1,1), str); |
|
|
cmd.tag(2) .TOG_STYLE(tog2).button (LOW_TEMP_POS, str); |
|
|
|
|
|
|
|
|
format_temp(str, MED_TEMP); |
|
|
format_temp(str, MED_TEMP); |
|
|
cmd.tag(3) .TOG_STYLE(tog3) .button (BTN_POS(2,5), BTN_SIZE(1,1), str); |
|
|
cmd.tag(3) .TOG_STYLE(tog3).button (MED_TEMP_POS, str); |
|
|
|
|
|
|
|
|
format_temp(str, HIGH_TEMP); |
|
|
format_temp(str, HIGH_TEMP); |
|
|
cmd.tag(4) .TOG_STYLE(tog4) .button (BTN_POS(2,4), BTN_SIZE(1,1), str); |
|
|
cmd.tag(4) .TOG_STYLE(tog4).button (HIG_TEMP_POS, str); |
|
|
} |
|
|
} |
|
|
cmd.colors(normal_btn) |
|
|
|
|
|
|
|
|
cmd.cmd(COLOR_RGB(t_ok ? bg_text_enabled : bg_text_disabled)) |
|
|
// Add tags to color gradient
|
|
|
.tag(0) .text (UNLD_LABL_POS, GET_TEXT_F(MSG_UNLOAD_FILAMENT)) |
|
|
.cmd(COLOR_MASK(0,0,0,0)) |
|
|
.text (LOAD_LABL_POS, GET_TEXT_F(MSG_LOAD_FILAMENT)) |
|
|
.tag(2) .rectangle(BTN_POS(1,6), BTN_SIZE(1,1)) |
|
|
.colors(normal_btn) |
|
|
.tag(3) .rectangle(BTN_POS(1,5), BTN_SIZE(1,1)) |
|
|
.tag(5) .enabled(t_ok).button (UNLD_MOMN_POS, GET_TEXT_F(MSG_MOMENTARY)) |
|
|
.tag(4) .rectangle(BTN_POS(1,4), BTN_SIZE(1,1)) |
|
|
.tag(6) .enabled(t_ok).button (LOAD_MOMN_POS, GET_TEXT_F(MSG_MOMENTARY)) |
|
|
.cmd(COLOR_MASK(1,1,1,1)) |
|
|
.tag(7).TOG_STYLE(tog7).enabled(t_ok).button (UNLD_CONT_POS, GET_TEXT_F(MSG_CONTINUOUS)) |
|
|
|
|
|
.tag(8).TOG_STYLE(tog8).enabled(t_ok).button (LOAD_CONT_POS, GET_TEXT_F(MSG_CONTINUOUS)) |
|
|
.cmd(COLOR_RGB(t_ok ? bg_text_enabled : bg_text_disabled)) |
|
|
.tag(1).colors(action_btn) .button (BACK_POS, GET_TEXT_F(MSG_BACK)); |
|
|
#if ENABLED(TOUCH_UI_PORTRAIT) |
|
|
|
|
|
.font(font_large) |
|
|
|
|
|
.tag(0) .text (BTN_POS(1,8), BTN_SIZE(1,1), GET_TEXT_F(MSG_UNLOAD_FILAMENT)) |
|
|
|
|
|
.text (BTN_POS(2,8), BTN_SIZE(1,1), GET_TEXT_F(MSG_LOAD_FILAMENT)) |
|
|
|
|
|
.tag(5) .enabled(t_ok).button (BTN_POS(1,9), BTN_SIZE(1,1), GET_TEXT_F(MSG_MOMENTARY)) |
|
|
|
|
|
.tag(6) .enabled(t_ok).button (BTN_POS(2,9), BTN_SIZE(1,1), GET_TEXT_F(MSG_MOMENTARY)) |
|
|
|
|
|
.tag(7).TOG_STYLE(tog7).enabled(t_ok).button (BTN_POS(1,10), BTN_SIZE(1,1), GET_TEXT_F(MSG_CONTINUOUS)) |
|
|
|
|
|
.tag(8).TOG_STYLE(tog8).enabled(t_ok).button (BTN_POS(2,10), BTN_SIZE(1,1), GET_TEXT_F(MSG_CONTINUOUS)) |
|
|
|
|
|
.tag(1).colors(action_btn) .button (BTN_POS(1,11), BTN_SIZE(2,1), GET_TEXT_F(MSG_BACK)); |
|
|
|
|
|
#else |
|
|
|
|
|
.font(font_small) |
|
|
|
|
|
.tag(0) .text (BTN_POS(3,3), BTN_SIZE(1,1), GET_TEXT_F(MSG_UNLOAD_FILAMENT)) |
|
|
|
|
|
.text (BTN_POS(4,3), BTN_SIZE(1,1), GET_TEXT_F(MSG_LOAD_FILAMENT)) |
|
|
|
|
|
.tag(5) .enabled(t_ok).button (BTN_POS(3,4), BTN_SIZE(1,1), GET_TEXT_F(MSG_MOMENTARY)) |
|
|
|
|
|
.tag(6) .enabled(t_ok).button (BTN_POS(4,4), BTN_SIZE(1,1), GET_TEXT_F(MSG_MOMENTARY)) |
|
|
|
|
|
.tag(7).TOG_STYLE(tog7).enabled(t_ok).button (BTN_POS(3,5), BTN_SIZE(1,1), GET_TEXT_F(MSG_CONTINUOUS)) |
|
|
|
|
|
.tag(8).TOG_STYLE(tog8).enabled(t_ok).button (BTN_POS(4,5), BTN_SIZE(1,1), GET_TEXT_F(MSG_CONTINUOUS)) |
|
|
|
|
|
.font(font_medium) |
|
|
|
|
|
.tag(1).colors(action_btn) .button (BTN_POS(3,6), BTN_SIZE(2,1), GET_TEXT_F(MSG_BACK)); |
|
|
|
|
|
#endif |
|
|
|
|
|
} |
|
|
} |
|
|
#undef GRID_COLS |
|
|
|
|
|
#undef GRID_ROWS |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
uint8_t ChangeFilamentScreen::getSoftenTemp() { |
|
|
uint8_t ChangeFilamentScreen::getSoftenTemp() { |
|
|