From f193cda03b1e70205406a8fea70f7345fd886c69 Mon Sep 17 00:00:00 2001 From: Marcio T Date: Wed, 9 Dec 2020 04:09:31 -0700 Subject: [PATCH] Fixes and additions to FTDI EVE Touch UI (#20393) - Fixed name conflict with "SUBSCRIPT_TWO" - Fixed rendering bugs in "Leveling Menu" - Only show "Bed Mesh Screen" when UBL is enabled - Removed CocoaPress code from generic "Main Menu" - Removed CocoaPress code from LulzBot Bio "Status" screen - Moved generic "Move Axis" functionality into a base class - Added CocoaPress custom screens: - Status Screen - Unload Cartridge - Load Chocolate - Main Menu - Advanced Settings - XYZ Move (based on "Move Axis" base class) - Extrusion Move (based on "Move Axis" base class) - CocoaPress tweaks to "Temperature" screen - Fix FTDI EVE Touch UI compilation errors when not using leveling. --- .../extended/unicode/western_char_set.cpp | 12 +- .../ftdi_eve_touch_ui/language/language_en.h | 24 +- .../screens/advanced_settings_menu.cpp | 2 +- .../screens/bed_mesh_screen.cpp | 2 +- .../screens/bio_status_screen.cpp | 179 +++------- .../cocoa_press_advanced_settings_menu.cpp | 102 ++++++ .../screens/cocoa_press_load_chocolate.cpp | 101 ++++++ .../screens/cocoa_press_main_menu.cpp | 89 +++++ .../screens/cocoa_press_move_e_screen.cpp | 62 ++++ .../screens/cocoa_press_move_xyz_screen.cpp | 53 +++ ..._menu.cpp => cocoa_press_preheat_menu.cpp} | 72 ++-- ...een.cpp => cocoa_press_preheat_screen.cpp} | 68 +++- .../screens/cocoa_press_status_screen.cpp | 307 ++++++++++++++++++ .../screens/cocoa_press_ui.h | 54 +++ .../screens/cocoa_press_unload_cartridge.cpp | 101 ++++++ .../screens/leveling_menu.cpp | 17 +- .../ftdi_eve_touch_ui/screens/main_menu.cpp | 38 +-- .../screens/move_axis_screen.cpp | 10 +- .../lib/ftdi_eve_touch_ui/screens/screens.cpp | 4 + .../lib/ftdi_eve_touch_ui/screens/screens.h | 89 +++-- .../screens/temperature_screen.cpp | 19 +- .../ftdi_eve_touch_ui/screens/tune_menu.cpp | 4 +- .../screens/z_offset_screen.cpp | 2 +- 23 files changed, 1167 insertions(+), 244 deletions(-) create mode 100644 Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_advanced_settings_menu.cpp create mode 100644 Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_load_chocolate.cpp create mode 100644 Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_main_menu.cpp create mode 100644 Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_move_e_screen.cpp create mode 100644 Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_move_xyz_screen.cpp rename Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/{preheat_menu.cpp => cocoa_press_preheat_menu.cpp} (55%) rename Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/{preheat_timer_screen.cpp => cocoa_press_preheat_screen.cpp} (55%) create mode 100644 Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_status_screen.cpp create mode 100644 Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_ui.h create mode 100644 Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_unload_cartridge.cpp diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/unicode/western_char_set.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/unicode/western_char_set.cpp index 171637f03a..fc5d4de85d 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/unicode/western_char_set.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/unicode/western_char_set.cpp @@ -71,9 +71,9 @@ YEN_SIGN, #endif #if ENABLED(TOUCH_UI_UTF8_SUPERSCRIPTS) - SUPERSCRIPT_ONE, - SUPERSCRIPT_TWO, - SUPERSCRIPT_THREE, + SUPERSCRIPT_1, + SUPERSCRIPT_2, + SUPERSCRIPT_3, #endif #if ENABLED(TOUCH_UI_UTF8_ORDINALS) MASCULINE_ORDINAL, @@ -177,15 +177,15 @@ {UTF8('±'), 0 , NOT_SIGN, 32 }, #endif #if ENABLED(TOUCH_UI_UTF8_SUPERSCRIPTS) - {UTF8('²'), 0 , SUPERSCRIPT_TWO, 16 }, - {UTF8('³'), 0 , SUPERSCRIPT_THREE, 16 }, + {UTF8('²'), 0 , SUPERSCRIPT_2, 16 }, + {UTF8('³'), 0 , SUPERSCRIPT_3, 16 }, #endif #if ENABLED(TOUCH_UI_UTF8_SYMBOLS) {UTF8('µ'), 0 , MICRON_SIGN, 28 }, {UTF8('¶'), 0 , PILCROW_SIGN, 24 }, #endif #if ENABLED(TOUCH_UI_UTF8_SUPERSCRIPTS) - {UTF8('¹'), 0 , SUPERSCRIPT_ONE, 16 }, + {UTF8('¹'), 0 , SUPERSCRIPT_1, 16 }, #endif #if ENABLED(TOUCH_UI_UTF8_ORDINALS) {UTF8('º'), 0 , MASCULINE_ORDINAL, 19 }, diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/language/language_en.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/language/language_en.h index 807c816307..09ac965e49 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/language/language_en.h +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/language/language_en.h @@ -29,12 +29,6 @@ #define COPYRIGHT_SIGN u8"(c)" #endif -#if ENABLED(TOUCH_UI_UTF8_SUPERSCRIPTS) - #define SUPERSCRIPT_TWO u8"²" -#else - #define SUPERSCRIPT_TWO u8"^2" -#endif - #if ENABLED(TOUCH_UI_UTF8_WESTERN_CHARSET) #define DEGREE_SIGN u8"°" #else @@ -162,9 +156,21 @@ namespace Language_en { #endif #ifdef TOUCH_UI_COCOA_PRESS - PROGMEM Language_Str MSG_ZONE_1 = u8"Zone 1:"; - PROGMEM Language_Str MSG_ZONE_2 = u8"Zone 2:"; - PROGMEM Language_Str MSG_ZONE_3 = u8"Zone 3:"; + PROGMEM Language_Str MSG_BODY = u8"Body"; + PROGMEM Language_Str MSG_INTERNAL = u8"Internal"; + PROGMEM Language_Str MSG_EXTERNAL = u8"External"; + PROGMEM Language_Str MSG_CHOCOLATE = u8"Chocolate"; + PROGMEM Language_Str MSG_UNLOAD_CARTRIDGE = u8"Unload Cartridge"; + PROGMEM Language_Str MSG_LOAD_CHOCOLATE = u8"Load Chocolate"; + PROGMEM Language_Str MSG_CARTRIDGE_IN = u8"Cartridge In"; + PROGMEM Language_Str MSG_CARTRIDGE_OUT = u8"Cartridge Out"; + PROGMEM Language_Str MSG_PREHEAT_CHOCOLATE = u8"Preheat Chocolate"; PROGMEM Language_Str MSG_PREHEAT_FINISHED = u8"Preheat finished"; + PROGMEM Language_Str MSG_PREHEAT = u8"Preheat"; + PROGMEM Language_Str MSG_BUTTON_PAUSE = u8"Pause"; + PROGMEM Language_Str MSG_BUTTON_RESUME = u8"Resume"; + PROGMEM Language_Str MSG_ELAPSED_PRINT = u8"Elapsed Print"; + PROGMEM Language_Str MSG_XYZ_MOVE = u8"XYZ Move"; + PROGMEM Language_Str MSG_E_MOVE = u8"Extrusion Move"; #endif }; // namespace Language_en diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/advanced_settings_menu.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/advanced_settings_menu.cpp index 3ffc88c385..431c601581 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/advanced_settings_menu.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/advanced_settings_menu.cpp @@ -22,7 +22,7 @@ #include "../config.h" -#if ENABLED(TOUCH_UI_FTDI_EVE) && DISABLED(TOUCH_UI_LULZBOT_BIO) +#if ENABLED(TOUCH_UI_FTDI_EVE) && NONE(TOUCH_UI_LULZBOT_BIO, TOUCH_UI_COCOA_PRESS) #include "screens.h" diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bed_mesh_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bed_mesh_screen.cpp index c54a7e04b5..2cce884d36 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bed_mesh_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bed_mesh_screen.cpp @@ -21,7 +21,7 @@ #include "../config.h" -#if BOTH(TOUCH_UI_FTDI_EVE, HAS_MESH) +#if BOTH(TOUCH_UI_FTDI_EVE, AUTO_BED_LEVELING_UBL) #include "screens.h" #include "screen_data.h" diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_status_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_status_screen.cpp index 2515732d43..c95d2d1dba 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_status_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_status_screen.cpp @@ -23,15 +23,13 @@ #include "../config.h" -#if ENABLED(TOUCH_UI_FTDI_EVE) && ANY(TOUCH_UI_LULZBOT_BIO, TOUCH_UI_COCOA_PRESS) +#if BOTH(TOUCH_UI_FTDI_EVE, TOUCH_UI_LULZBOT_BIO) #include "screens.h" #include "../ftdi_eve_lib/extras/poly_ui.h" -#if ENABLED(TOUCH_UI_COCOA_PRESS) - #include "cocoa_press_ui.h" -#elif ENABLED(TOUCH_UI_PORTRAIT) +#if ENABLED(TOUCH_UI_PORTRAIT) #include "bio_printer_ui_portrait.h" #else #include "bio_printer_ui_landscape.h" @@ -72,55 +70,30 @@ void StatusScreen::draw_temperature(draw_mode_t what) { if (what & BACKGROUND) { cmd.cmd(COLOR_RGB(bg_color)); - #if ENABLED(TOUCH_UI_LULZBOT_BIO) - // The LulzBot Bio shows the temperature for - // the bed. + // The LulzBot Bio shows the temperature for + // the bed. - #ifdef TOUCH_UI_PORTRAIT - // Draw touch surfaces - ui.bounds(POLY(target_temp), x, y, h, v); - cmd.rectangle(x, y, h, v); - ui.bounds(POLY(actual_temp), x, y, h, v); - cmd.rectangle(x, y, h, v); - #else - ui.bounds(POLY(bed_temp), x, y, h, v); - cmd.rectangle(x, y, h, v); - #endif - ui.bounds(POLY(bed_icon), x, y, h, v); + #ifdef TOUCH_UI_PORTRAIT + // Draw touch surfaces + ui.bounds(POLY(target_temp), x, y, h, v); + cmd.rectangle(x, y, h, v); + ui.bounds(POLY(actual_temp), x, y, h, v); cmd.rectangle(x, y, h, v); - - // Draw bed icon - cmd.cmd(BITMAP_SOURCE(Bed_Heat_Icon_Info)) - .cmd(BITMAP_LAYOUT(Bed_Heat_Icon_Info)) - .cmd(BITMAP_SIZE (Bed_Heat_Icon_Info)) - .cmd(COLOR_RGB(shadow_rgb)) - .icon (x + 2, y + 2, h, v, Bed_Heat_Icon_Info, icon_scale * 2) - .cmd(COLOR_RGB(bg_text_enabled)) - .icon (x, y, h, v, Bed_Heat_Icon_Info, icon_scale * 2); - #elif ENABLED(TOUCH_UI_COCOA_PRESS) && DISABLED(TOUCH_UI_PORTRAIT) - // The CocoaPress shows the temperature for two - // heating zones, but has no bed temperature - - cmd.cmd(COLOR_RGB(bg_text_enabled)); - cmd.font(font_xsmall); - - ui.bounds(POLY(h0_label), x, y, h, v); - cmd.text(x, y, h, v, GET_TEXT_F(MSG_ZONE_1)); - - ui.bounds(POLY(h1_label), x, y, h, v); - cmd.text(x, y, h, v, GET_TEXT_F(MSG_ZONE_2)); - - ui.bounds(POLY(h2_label), x, y, h, v); - cmd.text(x, y, h, v, GET_TEXT_F(MSG_ZONE_3)); - - ui.bounds(POLY(h3_label), x, y, h, v); - cmd.text(x, y, h, v, GET_TEXT_F(MSG_CHAMBER)); #else - UNUSED(x); - UNUSED(y); - UNUSED(h); - UNUSED(v); + ui.bounds(POLY(bed_temp), x, y, h, v); + cmd.rectangle(x, y, h, v); #endif + ui.bounds(POLY(bed_icon), x, y, h, v); + cmd.rectangle(x, y, h, v); + + // Draw bed icon + cmd.cmd(BITMAP_SOURCE(Bed_Heat_Icon_Info)) + .cmd(BITMAP_LAYOUT(Bed_Heat_Icon_Info)) + .cmd(BITMAP_SIZE (Bed_Heat_Icon_Info)) + .cmd(COLOR_RGB(shadow_rgb)) + .icon (x + 2, y + 2, h, v, Bed_Heat_Icon_Info, icon_scale * 2) + .cmd(COLOR_RGB(bg_text_enabled)) + .icon (x, y, h, v, Bed_Heat_Icon_Info, icon_scale * 2); #ifdef TOUCH_UI_USE_UTF8 load_utf8_bitmaps(cmd); // Restore font bitmap handles @@ -130,71 +103,29 @@ void StatusScreen::draw_temperature(draw_mode_t what) { if (what & FOREGROUND) { char str[15]; cmd.cmd(COLOR_RGB(bg_text_enabled)); - #if ENABLED(TOUCH_UI_LULZBOT_BIO) - cmd.font(font_medium); + cmd.font(font_medium); - #ifdef TOUCH_UI_PORTRAIT - if (!isHeaterIdle(BED) && getTargetTemp_celsius(BED) > 0) - format_temp(str, getTargetTemp_celsius(BED)); - else - strcpy_P(str, GET_TEXT(MSG_BED)); - - ui.bounds(POLY(target_temp), x, y, h, v); - cmd.text(x, y, h, v, str); - - format_temp(str, getActualTemp_celsius(BED)); - ui.bounds(POLY(actual_temp), x, y, h, v); - cmd.text(x, y, h, v, str); - #else - if (!isHeaterIdle(BED) && getTargetTemp_celsius(BED) > 0) - format_temp_and_temp(str, getActualTemp_celsius(BED), getTargetTemp_celsius(BED)); - else - format_temp_and_idle(str, getActualTemp_celsius(BED)); - - ui.bounds(POLY(bed_temp), x, y, h, v); - cmd.text(x, y, h, v, str); - #endif - - #elif ENABLED(TOUCH_UI_COCOA_PRESS) && DISABLED(TOUCH_UI_PORTRAIT) - // The CocoaPress shows the temperature for two - // heating zones, but has no bed temperature - - cmd.font(font_large); - - if (!isHeaterIdle(E0) && getTargetTemp_celsius(E0) > 0) - format_temp_and_temp(str, getActualTemp_celsius(E0), getTargetTemp_celsius(E0)); + #ifdef TOUCH_UI_PORTRAIT + if (!isHeaterIdle(BED) && getTargetTemp_celsius(BED) > 0) + format_temp(str, getTargetTemp_celsius(BED)); else - format_temp_and_idle(str, getActualTemp_celsius(E0)); + strcpy_P(str, GET_TEXT(MSG_BED)); - ui.bounds(POLY(h0_temp), x, y, h, v); + ui.bounds(POLY(target_temp), x, y, h, v); cmd.text(x, y, h, v, str); - if (!isHeaterIdle(E1) && getTargetTemp_celsius(E1) > 0) - format_temp_and_temp(str, getActualTemp_celsius(E1), getTargetTemp_celsius(E1)); - else - format_temp_and_idle(str, getActualTemp_celsius(E1)); - - ui.bounds(POLY(h1_temp), x, y, h, v); - cmd.text(x, y, h, v, str); - - if (!isHeaterIdle(E2) && getTargetTemp_celsius(E2) > 0) - format_temp_and_temp(str, getActualTemp_celsius(E2), getTargetTemp_celsius(E2)); - else - format_temp_and_idle(str, getActualTemp_celsius(E2)); - - ui.bounds(POLY(h2_temp), x, y, h, v); - cmd.text(x, y, h, v, str); - - if (!isHeaterIdle(CHAMBER) && getTargetTemp_celsius(CHAMBER) > 0) - format_temp_and_temp(str, getActualTemp_celsius(CHAMBER), getTargetTemp_celsius(CHAMBER)); - else - format_temp_and_idle(str, getActualTemp_celsius(CHAMBER)); - - ui.bounds(POLY(h3_temp), x, y, h, v); + format_temp(str, getActualTemp_celsius(BED)); + ui.bounds(POLY(actual_temp), x, y, h, v); cmd.text(x, y, h, v, str); #else - UNUSED(str); - #endif + if (!isHeaterIdle(BED) && getTargetTemp_celsius(BED) > 0) + format_temp_and_temp(str, getActualTemp_celsius(BED), getTargetTemp_celsius(BED)); + else + format_temp_and_idle(str, getActualTemp_celsius(BED)); + + ui.bounds(POLY(bed_temp), x, y, h, v); + cmd.text(x, y, h, v, str); + #endif } } @@ -207,7 +138,7 @@ void StatusScreen::draw_syringe(draw_mode_t what) { 0.75 #endif ); - const bool e_homed = TERN0(TOUCH_UI_LULZBOT_BIO, isAxisPositionKnown(E0)); + const bool e_homed = TERN1(TOUCH_UI_LULZBOT_BIO, isAxisPositionKnown(E0)); CommandProcessor cmd; PolyUI ui(cmd, what); @@ -247,7 +178,7 @@ void StatusScreen::draw_arrows(draw_mode_t what) { ui.button_stroke(stroke_rgb, 28); ui.button_shadow(shadow_rgb, shadow_depth); - constexpr uint8_t style = TERN(TOUCH_UI_COCOA_PRESS, PolyUI::FILL | PolyUI::SHADOW, PolyUI::REGULAR); + constexpr uint8_t style = PolyUI::REGULAR; if ((what & BACKGROUND) || jog_xy) { ui.button(1, POLY(x_neg), style); @@ -262,9 +193,7 @@ void StatusScreen::draw_arrows(draw_mode_t what) { } if ((what & BACKGROUND) || e_homed) { - #if DISABLED(TOUCH_UI_COCOA_PRESS) - ui.button(7, POLY(e_neg), style); - #endif + ui.button(7, POLY(e_neg), style); ui.button(8, POLY(e_pos), style); } } @@ -304,11 +233,11 @@ void StatusScreen::draw_overlay_icons(draw_mode_t what) { PolyUI ui(cmd, what); if (what & FOREGROUND) { - ui.button_fill (TERN(TOUCH_UI_COCOA_PRESS, stroke_rgb, fill_rgb)); + ui.button_fill (fill_rgb); ui.button_stroke(stroke_rgb, 28); ui.button_shadow(shadow_rgb, shadow_depth); - constexpr uint8_t style = TERN(TOUCH_UI_COCOA_PRESS, PolyUI::FILL | PolyUI::SHADOW, PolyUI::REGULAR); + constexpr uint8_t style = PolyUI::REGULAR; if (!jog_xy) ui.button(12, POLY(padlock), style); if (!e_homed) ui.button(13, POLY(home_e), style); if (!z_homed) ui.button(14, POLY(home_z), style); @@ -389,9 +318,7 @@ bool StatusScreen::onTouchEnd(uint8_t tag) { break; case 9: GOTO_SCREEN(FilesScreen); break; case 10: GOTO_SCREEN(MainMenu); break; - #if ENABLED(TOUCH_UI_LULZBOT_BIO) - case 13: GOTO_SCREEN(BioConfirmHomeE); break; - #endif + case 13: GOTO_SCREEN(BioConfirmHomeE); break; case 14: SpinnerDialogBox::enqueueAndWait_P(F("G28 Z")); break; case 15: GOTO_SCREEN(TemperatureScreen); break; case 16: fine_motion = !fine_motion; break; @@ -431,19 +358,11 @@ bool StatusScreen::onTouchHeld(uint8_t tag) { } void StatusScreen::setStatusMessage(progmem_str pstr) { - #ifdef TOUCH_UI_LULZBOT_BIO - BioPrintingDialogBox::setStatusMessage(pstr); - #else - UNUSED(pstr); - #endif + BioPrintingDialogBox::setStatusMessage(pstr); } void StatusScreen::setStatusMessage(const char * const str) { - #ifdef TOUCH_UI_LULZBOT_BIO - BioPrintingDialogBox::setStatusMessage(str); - #else - UNUSED(str); - #endif + BioPrintingDialogBox::setStatusMessage(str); } void StatusScreen::onIdle() { @@ -451,10 +370,8 @@ void StatusScreen::onIdle() { if (refresh_timer.elapsed(STATUS_UPDATE_INTERVAL)) { if (!EventLoop::is_touch_held()) onRefresh(); - #ifdef TOUCH_UI_LULZBOT_BIO - if (isPrintingFromMedia()) - BioPrintingDialogBox::show(); - #endif + if (isPrintingFromMedia()) + BioPrintingDialogBox::show(); refresh_timer.start(); } } diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_advanced_settings_menu.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_advanced_settings_menu.cpp new file mode 100644 index 0000000000..23314d5c27 --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_advanced_settings_menu.cpp @@ -0,0 +1,102 @@ +/***************************************** + * cocoa_press_advance_settings_menu.cpp * + *****************************************/ + +/**************************************************************************** + * Written By Mark Pelletier 2017 - Aleph Objects, Inc. * + * Written By Marcio Teixeira 2018 - Aleph Objects, Inc. * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * To view a copy of the GNU General Public License, go to the following * + * location: . * + ****************************************************************************/ + +#include "../config.h" + +#if BOTH(TOUCH_UI_FTDI_EVE, TOUCH_UI_COCOA_PRESS) + +#include "screens.h" + +using namespace FTDI; +using namespace ExtUI; +using namespace Theme; + +#define GRID_ROWS 4 +#define GRID_COLS 3 +#define STEPS_PER_MM_POS BTN_POS(1,1), BTN_SIZE(1,1) +#define TMC_CURRENT_POS BTN_POS(2,1), BTN_SIZE(1,1) +#define LIN_ADVANCE_POS BTN_POS(3,1), BTN_SIZE(1,1) +#define VELOCITY_POS BTN_POS(1,2), BTN_SIZE(1,1) +#define ACCELERATION_POS BTN_POS(2,2), BTN_SIZE(1,1) +#define JERK_POS BTN_POS(3,2), BTN_SIZE(1,1) +#define DISPLAY_POS BTN_POS(1,3), BTN_SIZE(1,1) +#define INTERFACE_POS BTN_POS(2,3), BTN_SIZE(1,1) +#define ENDSTOPS_POS BTN_POS(3,3), BTN_SIZE(1,1) +#define CASE_LIGHT_POS BTN_POS(1,4), BTN_SIZE(1,1) +#define RESTORE_DEFAULTS_POS BTN_POS(2,4), BTN_SIZE(1,1) +#define BACK_POS BTN_POS(3,4), BTN_SIZE(1,1) + +void AdvancedSettingsMenu::onRedraw(draw_mode_t what) { + if (what & BACKGROUND) { + CommandProcessor cmd; + cmd.cmd(CLEAR_COLOR_RGB(Theme::bg_color)) + .cmd(CLEAR(true,true,true)); + } + + if (what & FOREGROUND) { + CommandProcessor cmd; + cmd.colors(normal_btn) + .font(Theme::font_medium) + .tag(2) .button( STEPS_PER_MM_POS, GET_TEXT_F(MSG_STEPS_PER_MM)) + .enabled(ENABLED(HAS_TRINAMIC_CONFIG)) + .tag(3) .button( TMC_CURRENT_POS, GET_TEXT_F(MSG_TMC_CURRENT)) + .enabled(ENABLED(LIN_ADVANCE)) + .tag(4) .button(LIN_ADVANCE_POS, GET_TEXT_F(MSG_LINEAR_ADVANCE)) + .tag(5) .button( VELOCITY_POS, GET_TEXT_F(MSG_VELOCITY)) + .tag(6) .button( ACCELERATION_POS, GET_TEXT_F(MSG_ACCELERATION)) + .tag(7) .button( JERK_POS, GET_TEXT_F(TERN(HAS_JUNCTION_DEVIATION, MSG_JUNCTION_DEVIATION, MSG_JERK))) + .tag(8) .button( ENDSTOPS_POS, GET_TEXT_F(MSG_LCD_ENDSTOPS)) + .tag(9) .button( INTERFACE_POS, GET_TEXT_F(MSG_INTERFACE)) + .tag(10).button( DISPLAY_POS, GET_TEXT_F(MSG_DISPLAY_MENU)) + .enabled(ENABLED(CASE_LIGHT_ENABLE)) + .tag(11).button( CASE_LIGHT_POS, GET_TEXT_F(MSG_CASE_LIGHT)) + .tag(12).button( RESTORE_DEFAULTS_POS, GET_TEXT_F(MSG_RESTORE_DEFAULTS)) + .colors(action_btn) + .tag(1).button( BACK_POS, GET_TEXT_F(MSG_BACK)); + } +} + +bool AdvancedSettingsMenu::onTouchEnd(uint8_t tag) { + switch (tag) { + case 1: SaveSettingsDialogBox::promptToSaveSettings(); break; + case 2: GOTO_SCREEN(StepsScreen); break; + #if HAS_TRINAMIC_CONFIG + case 3: GOTO_SCREEN(StepperCurrentScreen); break; + #endif + #if ENABLED(LIN_ADVANCE) + case 4: GOTO_SCREEN(LinearAdvanceScreen); break; + #endif + case 5: GOTO_SCREEN(MaxVelocityScreen); break; + case 6: GOTO_SCREEN(DefaultAccelerationScreen); break; + case 7: GOTO_SCREEN(TERN(HAS_JUNCTION_DEVIATION, JunctionDeviationScreen, JerkScreen)); break; + case 8: GOTO_SCREEN(EndstopStatesScreen); break; + case 9: GOTO_SCREEN(InterfaceSettingsScreen); LockScreen::check_passcode(); break; + case 10: GOTO_SCREEN(DisplayTuningScreen); break; + #if ENABLED(CASE_LIGHT_ENABLE) + case 11: GOTO_SCREEN(CaseLightScreen); break; + #endif + case 12: GOTO_SCREEN(RestoreFailsafeDialogBox); LockScreen::check_passcode(); break; + default: return false; + } + return true; +} +#endif // TOUCH_UI_FTDI_EVE diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_load_chocolate.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_load_chocolate.cpp new file mode 100644 index 0000000000..36dc3404b9 --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_load_chocolate.cpp @@ -0,0 +1,101 @@ +/************************************ + * cocoa_press_unload_cartridge.cpp * + ************************************/ + +/**************************************************************************** + * Written By Mark Pelletier 2017 - Aleph Objects, Inc. * + * Written By Marcio Teixeira 2018 - Aleph Objects, Inc. * + * Written By Marcio Teixeira 2020 - Cocoa Press * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * To view a copy of the GNU General Public License, go to the following * + * location: . * + ****************************************************************************/ + +#include "../config.h" + +#if ENABLED(TOUCH_UI_FTDI_EVE) && ENABLED(TOUCH_UI_COCOA_PRESS) + +#include "screens.h" +#include "screen_data.h" + +using namespace ExtUI; +using namespace FTDI; +using namespace Theme; + +#define GRID_COLS 2 +#define GRID_ROWS 6 + +#define TITLE_POS BTN_POS(1,1), BTN_SIZE(2,1) +#define DESCRIPTION_POS BTN_POS(1,2), BTN_SIZE(2,3) +#define CARTRIDGE_OUT_BTN_POS BTN_POS(1,5), BTN_SIZE(1,1) +#define CARTRIDGE_IN_BTN_POS BTN_POS(2,5), BTN_SIZE(1,1) +#define BACK_BTN_POS BTN_POS(1,6), BTN_SIZE(2,1) + +void LoadChocolateScreen::onRedraw(draw_mode_t what) { + CommandProcessor cmd; + + if (what & BACKGROUND) { + cmd.cmd(CLEAR_COLOR_RGB(bg_color)) + .cmd(CLEAR(true,true,true)) + .cmd(COLOR_RGB(bg_text_enabled)) + .tag(0) + .font(font_large) + .text(TITLE_POS, GET_TEXT_F(MSG_LOAD_CHOCOLATE)); + draw_text_box(cmd, DESCRIPTION_POS, F( + "Drop your chocolate refill into the cartridge. " + "Press and hold the Cartridge Out button until " + "the plunger adapter is visible at the bottom of " + "the extruder. Securely attach a red plunger to " + "the plunger adapter and load the cartridge onto " + "the plunger. Press and hold Cartridge In button " + "until cartridge is fully loaded into the extruder, " + "and use the buttons to help follow the locking path " + "to lock"), + OPT_CENTERY, font_medium); + } + + if (what & FOREGROUND) { + cmd.font(font_medium) + .colors(normal_btn) + .tag(2).button(CARTRIDGE_OUT_BTN_POS, GET_TEXT_F(MSG_CARTRIDGE_OUT)) + .tag(3).button(CARTRIDGE_IN_BTN_POS, GET_TEXT_F(MSG_CARTRIDGE_IN)) + .colors(action_btn) + .tag(1).button(BACK_BTN_POS, GET_TEXT_F(MSG_BACK)); + } +} + +bool LoadChocolateScreen::onTouchEnd(uint8_t tag) { + using namespace ExtUI; + switch (tag) { + case 1: GOTO_PREVIOUS(); break; + } + return true; +} + +bool LoadChocolateScreen::onTouchHeld(uint8_t tag) { + if (ExtUI::isMoving()) return false; // Don't allow moves to accumulate + constexpr float increment = 0.25; + MoveAxisScreen::setManualFeedrate(E0, increment); + #define UI_INCREMENT_AXIS(axis) UI_INCREMENT(AxisPosition_mm, axis); + #define UI_DECREMENT_AXIS(axis) UI_DECREMENT(AxisPosition_mm, axis); + switch (tag) { + case 2: UI_DECREMENT_AXIS(E0); break; + case 3: UI_INCREMENT_AXIS(E0); break; + default: return false; + } + #undef UI_DECREMENT_AXIS + #undef UI_INCREMENT_AXIS + return false; +} + +#endif // TOUCH_UI_FTDI_EVE diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_main_menu.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_main_menu.cpp new file mode 100644 index 0000000000..da095eaab6 --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_main_menu.cpp @@ -0,0 +1,89 @@ +/***************************** + * cocoa_press_main_menu.cpp * + *****************************/ + +/**************************************************************************** + * Written By Mark Pelletier 2017 - Aleph Objects, Inc. * + * Written By Marcio Teixeira 2018 - Aleph Objects, Inc. * + * Written By Marcio Teixeira 2019 - Cocoa Press * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * To view a copy of the GNU General Public License, go to the following * + * location: . * + ****************************************************************************/ + +#include "../config.h" + +#if BOTH(TOUCH_UI_FTDI_EVE, TOUCH_UI_COCOA_PRESS) + +#include "screens.h" + +using namespace FTDI; +using namespace Theme; + +#define GRID_ROWS 4 +#define GRID_COLS 2 + +#define MOVE_XYZ_POS BTN_POS(1,1), BTN_SIZE(1,1) +#define TEMPERATURE_POS BTN_POS(2,1), BTN_SIZE(1,1) +#define ZPROBE_ZOFFSET_POS BTN_POS(1,2), BTN_SIZE(1,1) +#define MOVE_E_POS BTN_POS(2,2), BTN_SIZE(1,1) +#define SPEED_POS BTN_POS(1,3), BTN_SIZE(1,1) +#define ADVANCED_SETTINGS_POS BTN_POS(2,3), BTN_SIZE(1,1) +#define ABOUT_PRINTER_POS BTN_POS(1,4), BTN_SIZE(1,1) +#define BACK_POS BTN_POS(2,4), BTN_SIZE(1,1) + +void MainMenu::onRedraw(draw_mode_t what) { + if (what & BACKGROUND) { + CommandProcessor cmd; + cmd.cmd(CLEAR_COLOR_RGB(Theme::bg_color)) + .cmd(CLEAR(true,true,true)); + } + + if (what & FOREGROUND) { + CommandProcessor cmd; + cmd.colors(normal_btn) + .font(Theme::font_medium) + .tag(2).button( MOVE_XYZ_POS, GET_TEXT_F(MSG_XYZ_MOVE)) + .tag(3).button( TEMPERATURE_POS, GET_TEXT_F(MSG_TEMPERATURE)) + .enabled(BOTH(HAS_LEVELING, HAS_BED_PROBE)) + .tag(4).button( ZPROBE_ZOFFSET_POS, GET_TEXT_F(MSG_ZPROBE_ZOFFSET)) + .tag(5).button( MOVE_E_POS, GET_TEXT_F(MSG_E_MOVE)) + .tag(6).button( SPEED_POS, GET_TEXT_F(MSG_PRINT_SPEED)) + .tag(7).button( ADVANCED_SETTINGS_POS, GET_TEXT_F(MSG_ADVANCED_SETTINGS)) + .tag(8).button( ABOUT_PRINTER_POS, GET_TEXT_F(MSG_INFO_MENU)) + .colors(action_btn) + .tag(1).button( BACK_POS, GET_TEXT_F(MSG_BACK)); + } +} + +bool MainMenu::onTouchEnd(uint8_t tag) { + using namespace ExtUI; + + switch (tag) { + case 1: SaveSettingsDialogBox::promptToSaveSettings(); break; + case 2: GOTO_SCREEN(MoveXYZScreen); break; + case 3: GOTO_SCREEN(TemperatureScreen); break; + #if BOTH(HAS_LEVELING, HAS_BED_PROBE) + case 4: GOTO_SCREEN(ZOffsetScreen); break; + #endif + case 5: GOTO_SCREEN(MoveEScreen); break; + case 6: GOTO_SCREEN(FeedratePercentScreen); break; + case 7: GOTO_SCREEN(AdvancedSettingsMenu); break; + case 8: GOTO_SCREEN(AboutScreen); break; + default: + return false; + } + return true; +} + +#endif // TOUCH_UI_FTDI_EVE diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_move_e_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_move_e_screen.cpp new file mode 100644 index 0000000000..6e2b4adc39 --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_move_e_screen.cpp @@ -0,0 +1,62 @@ +/********************************* + * cocoa_press_move_e_screen.cpp * + *********************************/ + +/**************************************************************************** + * Written By Mark Pelletier 2017 - Aleph Objects, Inc. * + * Written By Marcio Teixeira 2018 - Aleph Objects, Inc. * + * Written By Marcio Teixeira 2019 - Cocoa Press * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * To view a copy of the GNU General Public License, go to the following * + * location: . * + ****************************************************************************/ + +#include "../config.h" + +#if BOTH(TOUCH_UI_FTDI_EVE, TOUCH_UI_COCOA_PRESS) + +#include "screens.h" +#include "screen_data.h" + +using namespace FTDI; +using namespace ExtUI; + +void MoveEScreen::onRedraw(draw_mode_t what) { + widgets_t w(what); + w.precision(1); + w.units(GET_TEXT_F(MSG_UNITS_MM)); + w.heading( GET_TEXT_F(MSG_E_MOVE)); + 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 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 + w.adjuster( 12, GET_TEXT_F(MSG_AXIS_E3), screen_data.MoveAxisScreen.e_rel[2], canMove(E2)); + #endif + #if EXTRUDERS > 3 + w.adjuster( 14, GET_TEXT_F(MSG_AXIS_E4), screen_data.MoveAxisScreen.e_rel[3], canMove(E3)); + #endif + #endif + w.increments(); +} + +void MoveEScreen::onIdle() { + if (refresh_timer.elapsed(STATUS_UPDATE_INTERVAL)) { + onRefresh(); + refresh_timer.start(); + } + BaseScreen::onIdle(); +} +#endif // TOUCH_UI_FTDI_EVE diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_move_xyz_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_move_xyz_screen.cpp new file mode 100644 index 0000000000..52a70448cd --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_move_xyz_screen.cpp @@ -0,0 +1,53 @@ +/************************************ + * cocoa_press_move_xyz_screen.cpp * + ************************************/ + +/**************************************************************************** + * Written By Mark Pelletier 2017 - Aleph Objects, Inc. * + * Written By Marcio Teixeira 2018 - Aleph Objects, Inc. * + * Written By Marcio Teixeira 2019 - Cocoa Press * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * To view a copy of the GNU General Public License, go to the following * + * location: . * + ****************************************************************************/ + +#include "../config.h" + +#if BOTH(TOUCH_UI_FTDI_EVE, TOUCH_UI_COCOA_PRESS) + +#include "screens.h" +#include "screen_data.h" + +using namespace FTDI; +using namespace ExtUI; + +void MoveXYZScreen::onRedraw(draw_mode_t what) { + widgets_t w(what); + w.precision(1); + w.units(GET_TEXT_F(MSG_UNITS_MM)); + w.heading( GET_TEXT_F(MSG_XYZ_MOVE)); + w.home_buttons(20); + w.color(Theme::x_axis).adjuster( 2, GET_TEXT_F(MSG_AXIS_X), getAxisPosition_mm(X), canMove(X)); + w.color(Theme::y_axis).adjuster( 4, GET_TEXT_F(MSG_AXIS_Y), getAxisPosition_mm(Y), canMove(Y)); + w.color(Theme::z_axis).adjuster( 6, GET_TEXT_F(MSG_AXIS_Z), getAxisPosition_mm(Z), canMove(Z)); + w.increments(); +} + +void MoveXYZScreen::onIdle() { + if (refresh_timer.elapsed(STATUS_UPDATE_INTERVAL)) { + onRefresh(); + refresh_timer.start(); + } + BaseScreen::onIdle(); +} +#endif // TOUCH_UI_FTDI_EVE diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/preheat_menu.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_preheat_menu.cpp similarity index 55% rename from Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/preheat_menu.cpp rename to Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_preheat_menu.cpp index 03f9e2c465..476c5e468b 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/preheat_menu.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_preheat_menu.cpp @@ -1,6 +1,6 @@ -/******************** - * preheat_menu.cpp * - ********************/ +/******************************** + * cocoa_press_preheat_menu.cpp * + ********************************/ /**************************************************************************** * Written By Marcio Teixeira 2020 - Cocoa Press * @@ -29,28 +29,40 @@ using namespace FTDI; using namespace ExtUI; using namespace Theme; +#define GRID_ROWS 5 +#define GRID_COLS 2 + void PreheatMenu::onRedraw(draw_mode_t what) { + const int16_t w = has_extra_heater() ? BTN_W(1) : BTN_W(2); + const int16_t h = BTN_H(1); + if (what & BACKGROUND) { CommandProcessor cmd; cmd.cmd(CLEAR_COLOR_RGB(Theme::bg_color)) .cmd(CLEAR(true,true,true)) - .tag(0); + .tag(0) + .cmd(COLOR_RGB(bg_text_enabled)) + .font(Theme::font_medium) + .text ( BTN_POS(1,1), w, h, GET_TEXT_F(MSG_INTERNAL)); + if (has_extra_heater()) { + cmd.text( BTN_POS(2,1), w, h, GET_TEXT_F(MSG_EXTERNAL)); + } } - #define GRID_ROWS 3 - #define GRID_COLS 2 - if (what & FOREGROUND) { CommandProcessor cmd; - cmd.cmd(COLOR_RGB(bg_text_enabled)) - .font(Theme::font_medium) - .text ( BTN_POS(1,1), BTN_SIZE(2,1), GET_TEXT_F(MSG_PREHEAT_1)) + cmd.font(Theme::font_medium) .colors(normal_btn) - .tag(2).button( BTN_POS(1,2), BTN_SIZE(1,1), F("Dark Chocolate")) - .tag(3).button( BTN_POS(2,2), BTN_SIZE(1,1), F("Milk Chocolate")) - .tag(4).button( BTN_POS(1,3), BTN_SIZE(1,1), F("White Chocolate")) - .colors(action_btn) - .tag(1) .button( BTN_POS(2,3), BTN_SIZE(1,1), GET_TEXT_F(MSG_BACK)); + .tag(2).button( BTN_POS(1,2), w, h, F("Dark Chocolate")) + .tag(3).button( BTN_POS(1,3), w, h, F("Milk Chocolate")) + .tag(4).button( BTN_POS(1,4), w, h, F("White Chocolate")); + if (has_extra_heater()) { + cmd.tag(5).button( BTN_POS(2,2), w, h, F("Dark Chocolate")) + .tag(6).button( BTN_POS(2,3), w, h, F("Milk Chocolate")) + .tag(7).button( BTN_POS(2,4), w, h, F("White Chocolate")); + } + cmd.colors(action_btn) + .tag(1) .button( BTN_POS(1,5), BTN_SIZE(2,1), GET_TEXT_F(MSG_BACK)); } } @@ -58,20 +70,38 @@ bool PreheatMenu::onTouchEnd(uint8_t tag) { switch (tag) { case 1: GOTO_PREVIOUS(); break; case 2: - #ifdef COCOA_PRESS_PREHEAT_DARK_CHOCOLATE_SCRIPT - injectCommands_P(PSTR(COCOA_PRESS_PREHEAT_DARK_CHOCOLATE_SCRIPT)); + #ifdef COCOA_PRESS_PREHEAT_DARK_CHOCOLATE_INT_SCRIPT + injectCommands_P(PSTR(COCOA_PRESS_PREHEAT_DARK_CHOCOLATE_INT_SCRIPT)); #endif GOTO_SCREEN(PreheatTimerScreen); break; case 3: - #ifdef COCOA_PRESS_PREHEAT_MILK_CHOCOLATE_SCRIPT - injectCommands_P(PSTR(COCOA_PRESS_PREHEAT_MILK_CHOCOLATE_SCRIPT)); + #ifdef COCOA_PRESS_PREHEAT_MILK_CHOCOLATE_INT_SCRIPT + injectCommands_P(PSTR(COCOA_PRESS_PREHEAT_MILK_CHOCOLATE_INT_SCRIPT)); #endif GOTO_SCREEN(PreheatTimerScreen); break; case 4: - #ifdef COCOA_PRESS_PREHEAT_WHITE_CHOCOLATE_SCRIPT - injectCommands_P(PSTR(COCOA_PRESS_PREHEAT_WHITE_CHOCOLATE_SCRIPT)); + #ifdef COCOA_PRESS_PREHEAT_WHITE_CHOCOLATE_INT_SCRIPT + injectCommands_P(PSTR(COCOA_PRESS_PREHEAT_WHITE_CHOCOLATE_INT_SCRIPT)); + #endif + GOTO_SCREEN(PreheatTimerScreen); + break; + case 5: + #ifdef COCOA_PRESS_PREHEAT_DARK_CHOCOLATE_EXT_SCRIPT + injectCommands_P(PSTR(COCOA_PRESS_PREHEAT_DARK_CHOCOLATE_EXT_SCRIPT)); + #endif + GOTO_SCREEN(PreheatTimerScreen); + break; + case 6: + #ifdef COCOA_PRESS_PREHEAT_MILK_CHOCOLATE_EXT_SCRIPT + injectCommands_P(PSTR(COCOA_PRESS_PREHEAT_MILK_CHOCOLATE_EXT_SCRIPT)); + #endif + GOTO_SCREEN(PreheatTimerScreen); + break; + case 7: + #ifdef COCOA_PRESS_PREHEAT_WHITE_CHOCOLATE_EXT_SCRIPT + injectCommands_P(PSTR(COCOA_PRESS_PREHEAT_WHITE_CHOCOLATE_EXT_SCRIPT)); #endif GOTO_SCREEN(PreheatTimerScreen); break; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/preheat_timer_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_preheat_screen.cpp similarity index 55% rename from Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/preheat_timer_screen.cpp rename to Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_preheat_screen.cpp index c3110b77dc..1aad1f5b4c 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/preheat_timer_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_preheat_screen.cpp @@ -33,7 +33,14 @@ using namespace ExtUI; using namespace Theme; #define GRID_COLS 2 -#define GRID_ROWS 5 +#define GRID_ROWS 8 + +#define HEADER_POS BTN_POS(2,1), BTN_SIZE(1,2) +#define NOZZLE_ADJ_POS BTN_POS(2,3), BTN_SIZE(1,2) +#define BODY_ADJ_POS BTN_POS(2,5), BTN_SIZE(1,2) +#define CHAMBER_ADJ_POS BTN_POS(2,7), BTN_SIZE(1,2) +#define PROGRESS_POS BTN_POS(1,1), BTN_SIZE(1,7) +#define BACK_POS BTN_POS(1,8), BTN_SIZE(1,1) void PreheatTimerScreen::draw_message(draw_mode_t what) { if (what & BACKGROUND) { @@ -42,7 +49,7 @@ void PreheatTimerScreen::draw_message(draw_mode_t what) { .cmd(CLEAR(true,true,true)) .cmd(COLOR_RGB(bg_text_enabled)) .tag(0); - draw_text_box(cmd, BTN_POS(2,2), BTN_SIZE(1,1), GET_TEXT_F(MSG_HEATING), OPT_CENTER, font_large); + draw_text_box(cmd, HEADER_POS, GET_TEXT_F(MSG_HEATING), OPT_CENTER, font_large); } } @@ -62,7 +69,7 @@ void PreheatTimerScreen::draw_time_remaining(draw_mode_t what) { CommandProcessor cmd; cmd.font(font_xlarge); - draw_circular_progress(cmd, BTN_POS(1,1), BTN_SIZE(1,5), float(secondsRemaining()) * 100 / COCOA_PRESS_PREHEAT_SECONDS, str, theme_dark, theme_darkest); + draw_circular_progress(cmd, PROGRESS_POS, float(secondsRemaining()) * 100 / COCOA_PRESS_PREHEAT_SECONDS, str, theme_dark, theme_darkest); } } @@ -71,10 +78,45 @@ void PreheatTimerScreen::draw_interaction_buttons(draw_mode_t what) { CommandProcessor cmd; cmd.colors(normal_btn) .font(font_medium) - .tag(1).button( BTN_POS(2,5), BTN_SIZE(1,1), F("Cancel")); + .tag(1).button( BACK_POS, GET_TEXT_F(MSG_BACK)); } } +void PreheatTimerScreen::draw_adjuster(draw_mode_t what, uint8_t tag, progmem_str label, float value, int16_t x, int16_t y, int16_t w, int16_t h) { + #define SUB_COLS 9 + #define SUB_ROWS 2 + #define SUB_GRID_W(W) ((W)*w/SUB_COLS) + #define SUB_GRID_H(H) ((H)*h/SUB_ROWS) + #define SUB_GRID_X(X) (SUB_GRID_W((X)-1) + x) + #define SUB_GRID_Y(Y) (SUB_GRID_H((Y)-1) + y) + #define SUB_X(X) (SUB_GRID_X(X) + MARGIN_L) + #define SUB_Y(Y) (SUB_GRID_Y(Y) + MARGIN_T) + #define SUB_W(W) (SUB_GRID_W(W) - MARGIN_L - MARGIN_R) + #define SUB_H(H) (SUB_GRID_H(H) - MARGIN_T - MARGIN_B) + #define SUB_POS(X,Y) SUB_X(X), SUB_Y(Y) + #define SUB_SIZE(W,H) SUB_W(W), SUB_H(H) + + CommandProcessor cmd; + cmd.tag(0) + .font(font_small); + if (what & BACKGROUND) { + cmd.text( SUB_POS(1,1), SUB_SIZE(9,1), label) + .button( SUB_POS(1,2), SUB_SIZE(5,1), F(""), OPT_FLAT); + } + + if (what & FOREGROUND) { + char str[32]; + dtostrf(value, 5, 1, str); + strcat_P(str, PSTR(" ")); + strcat_P(str, (const char*) GET_TEXT_F(MSG_UNITS_C)); + + cmd.text(SUB_POS(1,2), SUB_SIZE(5,1), str) + .font(font_medium) + .tag(tag ).button(SUB_POS(6,2), SUB_SIZE(2,1), F("-")) + .tag(tag+1).button(SUB_POS(8,2), SUB_SIZE(2,1), F("+")); + } +} + void PreheatTimerScreen::onEntry() { screen_data.PreheatTimerScreen.start_ms = millis(); } @@ -83,6 +125,24 @@ void PreheatTimerScreen::onRedraw(draw_mode_t what) { draw_message(what); draw_time_remaining(what); draw_interaction_buttons(what); + draw_adjuster(what, 1, GET_TEXT_F(MSG_NOZZLE), getTargetTemp_celsius(E0), NOZZLE_ADJ_POS); + draw_adjuster(what, 3, GET_TEXT_F(MSG_BODY), getTargetTemp_celsius(E1), BODY_ADJ_POS); + draw_adjuster(what, 5, GET_TEXT_F(MSG_CHAMBER), getTargetTemp_celsius(CHAMBER), CHAMBER_ADJ_POS); +} + +bool PreheatTimerScreen::onTouchHeld(uint8_t tag) { + const float increment = (tag == 5 || tag == 6) ? 1 : 0.1; + switch (tag) { + case 1: UI_DECREMENT(TargetTemp_celsius, E0); break; + case 2: UI_INCREMENT(TargetTemp_celsius, E0); break; + case 3: UI_DECREMENT(TargetTemp_celsius, E1); break; + case 4: UI_INCREMENT(TargetTemp_celsius, E1); break; + case 5: UI_DECREMENT(TargetTemp_celsius, CHAMBER); break; + case 6: UI_INCREMENT(TargetTemp_celsius, CHAMBER); break; + default: + return false; + } + return true; } bool PreheatTimerScreen::onTouchEnd(uint8_t tag) { diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_status_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_status_screen.cpp new file mode 100644 index 0000000000..e3310abaa7 --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_status_screen.cpp @@ -0,0 +1,307 @@ +/********************************* + * cocoa_press_status_screen.cpp * + *********************************/ + +/**************************************************************************** + * Written By Mark Pelletier 2017 - Aleph Objects, Inc. * + * Written By Marcio Teixeira 2018 - Aleph Objects, Inc. * + * Written By Marcio Teixeira 2019 - Cocoa Press * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * To view a copy of the GNU General Public License, go to the following * + * location: . * + ****************************************************************************/ + +#include "../config.h" + +#if BOTH(TOUCH_UI_FTDI_EVE, TOUCH_UI_COCOA_PRESS) + +#include "screens.h" + +#include "../ftdi_eve_lib/extras/poly_ui.h" + +#include "cocoa_press_ui.h" + +#define POLY(A) PolyUI::poly_reader_t(A, sizeof(A)/sizeof(A[0])) + +const uint8_t shadow_depth = 5; + +using namespace FTDI; +using namespace Theme; +using namespace ExtUI; + +float StatusScreen::increment; + +void StatusScreen::loadBitmaps() { + constexpr uint32_t base = ftdi_memory_map::RAM_G; + + // Load fonts for internationalization + #ifdef TOUCH_UI_USE_UTF8 + load_utf8_data(base + UTF8_FONT_OFFSET); + #endif +} + +void StatusScreen::draw_progress(draw_mode_t what) { + CommandProcessor cmd; + PolyUI ui(cmd, what); + + int16_t x, y, h, v; + + cmd.cmd(COLOR_RGB(accent_color_1)); + cmd.font(font_medium); + + if (what & BACKGROUND) { + ui.bounds(POLY(print_time_label), x, y, h, v); + cmd.text(x, y, h, v, GET_TEXT_F(MSG_ELAPSED_PRINT)); + } + + if (what & FOREGROUND) { + const uint32_t elapsed = getProgress_seconds_elapsed(); + const uint8_t hrs = elapsed/3600; + const uint8_t min = (elapsed/60)%60; + + char str[10]; + sprintf_P(str, PSTR(" %02d : %02d"), hrs, min); + ui.bounds(POLY(print_time_hms), x, y, h, v); + cmd.text(x, y, h, v, str); + + sprintf_P(str, PSTR("%-3d%%"), getProgress_percent() ); + ui.bounds(POLY(print_time_percent), x, y, h, v); + cmd.text(x, y, h, v, str); + } +} + +void StatusScreen::draw_temperature(draw_mode_t what) { + CommandProcessor cmd; + PolyUI ui(cmd, what); + + int16_t x, y, h, v; + + if (what & BACKGROUND) { + cmd.cmd(COLOR_RGB(bg_color)); + + cmd.cmd(COLOR_RGB(fluid_rgb)); + cmd.font(font_medium); + + ui.bounds(POLY(chocolate_label), x, y, h, v); + cmd.text(x, y, h, v, GET_TEXT_F(MSG_CHOCOLATE)); + + ui.bounds(POLY(h0_label), x, y, h, v); + cmd.text(x, y, h, v, GET_TEXT_F(MSG_NOZZLE)); + + ui.bounds(POLY(h1_label), x, y, h, v); + cmd.text(x, y, h, v, GET_TEXT_F(MSG_BODY)); + + #if ENABLED(COCOA_PRESS_EXTRA_HEATER) + if (has_extra_heater()) { + ui.bounds(POLY(h2_label), x, y, h, v); + cmd.text(x, y, h, v, GET_TEXT_F(MSG_EXTERNAL)); + } + #endif + + ui.bounds(POLY(h3_label), x, y, h, v); + cmd.text(x, y, h, v, GET_TEXT_F(MSG_CHAMBER)); + + #ifdef TOUCH_UI_USE_UTF8 + load_utf8_bitmaps(cmd); // Restore font bitmap handles + #endif + } + + if (what & FOREGROUND) { + char str[15]; + cmd.cmd(COLOR_RGB(fluid_rgb)); + + cmd.font(font_large); + + format_temp(str, getActualTemp_celsius(E0)); + ui.bounds(POLY(h0_temp), x, y, h, v); + cmd.text(x, y, h, v, str); + + format_temp(str, getActualTemp_celsius(E1)); + ui.bounds(POLY(h1_temp), x, y, h, v); + cmd.text(x, y, h, v, str); + + #if ENABLED(COCOA_PRESS_EXTRA_HEATER) + if (has_extra_heater()) { + format_temp(str, getActualTemp_celsius(E2)); + ui.bounds(POLY(h2_temp), x, y, h, v); + cmd.text(x, y, h, v, str); + } + #endif + + format_temp(str, getActualTemp_celsius(CHAMBER)); + ui.bounds(POLY(h3_temp), x, y, h, v); + cmd.text(x, y, h, v, str); + } +} + +void StatusScreen::draw_syringe(draw_mode_t what) { + #if NUM_SERVOS < 2 + // Note, this requires a new pin 108 to be added to to access ADC9 + // "ArduinoAddons/arduino-1.8.5/packages/ultimachine/hardware/sam/1.6.9-b/variants/archim/variant.cpp" + const int val = analogRead(108); + const float fill_level = float(val) / 1024; + #else + constexpr float fill_level = 1.0f; + #endif + + CommandProcessor cmd; + PolyUI ui(cmd, what); + + if (what & BACKGROUND) { + // Paint the shadow for the syringe + ui.color(shadow_rgb); + ui.shadow(POLY(syringe_outline), shadow_depth); + } + + if (what & FOREGROUND) { + int16_t x, y, h, v; + + // Paint the syringe icon + ui.color(syringe_rgb); + ui.fill(POLY(syringe_outline)); + + ui.color(fluid_rgb); + ui.bounds(POLY(syringe_fluid), x, y, h, v); + cmd.cmd(SAVE_CONTEXT()); + cmd.cmd(SCISSOR_XY(x,y + v * (1.0 - fill_level))); + cmd.cmd(SCISSOR_SIZE(h, v * fill_level)); + ui.fill(POLY(syringe_fluid), false); + cmd.cmd(RESTORE_CONTEXT()); + + ui.color(stroke_rgb); + ui.fill(POLY(syringe)); + } +} + +void StatusScreen::draw_buttons(draw_mode_t what) { + int16_t x, y, h, v; + + const bool can_print = isMediaInserted() && !isPrintingFromMedia(); + const bool sdOrHostPrinting = ExtUI::isPrinting(); + const bool sdOrHostPaused = ExtUI::isPrintingPaused(); + + CommandProcessor cmd; + PolyUI ui(cmd, what); + + ui.bounds(POLY(unload_cartridge_btn), x, y, h, v); + + cmd.font(font_medium).colors(normal_btn); + + ui.bounds(POLY(unload_cartridge_btn), x, y, h, v); + cmd.tag(1).button(x, y, h, v, GET_TEXT_F(MSG_UNLOAD_CARTRIDGE)); + + ui.bounds(POLY(load_chocolate_btn), x, y, h, v); + cmd.tag(2).button(x, y, h, v, GET_TEXT_F(MSG_LOAD_CHOCOLATE)); + + ui.bounds(POLY(preheat_chocolate_btn), x, y, h, v); + cmd.tag(3).button(x, y, h, v, GET_TEXT_F(MSG_PREHEAT_CHOCOLATE)); + + ui.bounds(POLY(menu_btn), x, y, h, v); + cmd.tag(4).button(x, y, h, v, GET_TEXT_F(MSG_BUTTON_MENU)); + + ui.bounds(POLY(pause_btn), x, y, h, v); + cmd.tag(sdOrHostPaused ? 6 : 5).enabled(sdOrHostPrinting).button(x, y, h, v, sdOrHostPaused ? GET_TEXT_F(MSG_BUTTON_RESUME) : GET_TEXT_F(MSG_BUTTON_PAUSE)); + + ui.bounds(POLY(stop_btn), x, y, h, v); + cmd.tag(7).enabled(sdOrHostPrinting).button(x, y, h, v, GET_TEXT_F(MSG_BUTTON_STOP)); + + ui.bounds(POLY(extrude_btn), x, y, h, v); + cmd.tag(8).button(x, y, h, v, GET_TEXT_F(MSG_EXTRUDE)); + + ui.bounds(POLY(print_btn), x, y, h, v); + cmd.tag(9).colors(action_btn).enabled(can_print).button(x, y, h, v, GET_TEXT_F(MSG_BUTTON_PRINT)); +} + +void StatusScreen::onRedraw(draw_mode_t what) { + if (what & BACKGROUND) { + CommandProcessor cmd; + cmd.cmd(CLEAR_COLOR_RGB(bg_color)) + .cmd(CLEAR(true,true,true)) + .tag(0); + } + + draw_progress(what); + draw_syringe(what); + draw_temperature(what); + draw_buttons(what); +} + +bool StatusScreen::onTouchStart(uint8_t) { + increment = 0; + return true; +} + +bool StatusScreen::onTouchEnd(uint8_t tag) { + switch (tag) { + case 1: GOTO_SCREEN(UnloadCartridgeScreen); break; + case 2: GOTO_SCREEN(LoadChocolateScreen); break; + case 3: GOTO_SCREEN(PreheatMenu); break; + case 4: GOTO_SCREEN(MainMenu); break; + case 5: + sound.play(twinkle, PLAY_ASYNCHRONOUS); + if (ExtUI::isPrintingFromMedia()) + ExtUI::pausePrint(); + #ifdef ACTION_ON_PAUSE + else host_action_pause(); + #endif + GOTO_SCREEN(StatusScreen); + break; + case 6: + sound.play(twinkle, PLAY_ASYNCHRONOUS); + if (ExtUI::isPrintingFromMedia()) + ExtUI::resumePrint(); + #ifdef ACTION_ON_RESUME + else host_action_resume(); + #endif + GOTO_SCREEN(StatusScreen); + break; + case 7: + GOTO_SCREEN(ConfirmAbortPrintDialogBox); + current_screen.forget(); + PUSH_SCREEN(StatusScreen); + break; + case 9: GOTO_SCREEN(FilesScreen); break; + default: return false; + } + // If a passcode is enabled, the LockScreen will prevent the + // user from proceeding. + LockScreen::check_passcode(); + return true; +} + +bool StatusScreen::onTouchHeld(uint8_t tag) { + if (tag == 8 && !ExtUI::isMoving()) { + increment = 0.05; + MoveAxisScreen::setManualFeedrate(E0, increment); + UI_INCREMENT(AxisPosition_mm, E0); + current_screen.onRefresh(); + } + return false; +} + +void StatusScreen::setStatusMessage(progmem_str) { +} + +void StatusScreen::setStatusMessage(const char * const) { +} + +void StatusScreen::onIdle() { + reset_menu_timeout(); + if (refresh_timer.elapsed(STATUS_UPDATE_INTERVAL)) { + if (!EventLoop::is_touch_held()) + onRefresh(); + refresh_timer.start(); + } +} + +#endif // TOUCH_UI_FTDI_EVE diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_ui.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_ui.h new file mode 100644 index 0000000000..5cbaced7f6 --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_ui.h @@ -0,0 +1,54 @@ + +/**************************************************************************** + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * To view a copy of the GNU General Public License, go to the following * + * location: . * + ****************************************************************************/ + +/** + * This file was auto-generated using "svg2cpp.py" + * + * The encoding consists of x,y pairs with the min and max scaled to + * 0x0000 and 0xFFFE. A single 0xFFFF in the data stream indicates the + * start of a new closed path. + */ + +#pragma once + +constexpr float x_min = 0.000000; +constexpr float x_max = 480.000000; +constexpr float y_min = 0.000000; +constexpr float y_max = 272.000000; + +const PROGMEM uint16_t syringe_outline[] = {0xED96, 0x14F0, 0xE65D, 0x10E9, 0xDED2, 0x0F9C, 0xD74B, 0x110E, 0xD01B, 0x1543, 0xCE80, 0x1836, 0xCE0A, 0x1C3A, 0xCE0F, 0x27AD, 0xCF0A, 0x2BD3, 0xD127, 0x2E5B, 0xD2A1, 0x2FF0, 0xD2A2, 0x9FC9, 0xD407, 0xA97A, 0xD7B9, 0xB10C, 0xD7BF, 0xBB58, 0xD978, 0xC2BE, 0xDD55, 0xC6EB, 0xDD58, 0xD159, 0xDE3B, 0xD3A8, 0xDFCF, 0xD3AF, 0xE0B8, 0xD04C, 0xE0B8, 0xC6EB, 0xE4A7, 0xC299, 0xE652, 0xBAF6, 0xE652, 0xB10C, 0xEA2E, 0xA8EA, 0xEB6C, 0x9E86, 0xEB6C, 0x2F58, 0xEF3C, 0x2B4E, 0xF003, 0x2583, 0xEFFD, 0x1AC2, 0xED96, 0x14F0, 0xED96, 0x14F0}; +const PROGMEM uint16_t syringe_fluid[] = {0xDE73, 0x2512, 0xDA0C, 0x261D, 0xD5B8, 0x29A0, 0xD4AE, 0x2D87, 0xD4AE, 0x9F60, 0xD585, 0xA63B, 0xDE44, 0xA9DE, 0xE32A, 0xA942, 0xE7E3, 0xA6A5, 0xE930, 0xA342, 0xE95D, 0x9C1D, 0xE95B, 0x31B8, 0xE955, 0x2B63, 0xE867, 0x2A67, 0xE790, 0x28DE, 0xE342, 0x25CB, 0xDE73, 0x2512}; +const PROGMEM uint16_t syringe[] = {0xED91, 0x1502, 0xE658, 0x10FB, 0xDECE, 0x0FAE, 0xD746, 0x1120, 0xD016, 0x1555, 0xCE7B, 0x1848, 0xCE05, 0x1C4D, 0xCE0A, 0x27BF, 0xCF05, 0x2BE5, 0xD122, 0x2E6E, 0xD29C, 0x3002, 0xD29D, 0x9FDB, 0xD402, 0xA98C, 0xD7B4, 0xB11F, 0xD7BA, 0xBB6A, 0xD973, 0xC2D1, 0xDD50, 0xC6FD, 0xDD53, 0xD16C, 0xDE36, 0xD3BA, 0xDFCA, 0xD3C2, 0xE0B3, 0xD05E, 0xE0B3, 0xC6FD, 0xE4A2, 0xC2AB, 0xE64D, 0xBB09, 0xE64D, 0xB11F, 0xEA29, 0xA8FC, 0xEB67, 0x9E98, 0xEB67, 0x2F6B, 0xEF37, 0x2B60, 0xEFFE, 0x2595, 0xEFF8, 0x1AD5, 0xED91, 0x1502, 0xED91, 0x1502, 0xFFFF, 0xD1CF, 0x1A7E, 0xD84F, 0x16DB, 0xDF19, 0x15A9, 0xE5E0, 0x16EA, 0xEC5B, 0x1AA4, 0xEC9D, 0x1D34, 0xEC9D, 0x20CC, 0xE5F1, 0x1D41, 0xDF02, 0x1C12, 0xD812, 0x1D41, 0xD166, 0x20CC, 0xD16C, 0x1B45, 0xD1CF, 0x1A7E, 0xFFFF, 0xE3BD, 0xACFD, 0xDE8E, 0xAF4F, 0xD988, 0xAC0F, 0xD7CC, 0xA8CD, 0xDD1C, 0xAAA9, 0xE287, 0xAA5B, 0xE655, 0xA8BE, 0xE3BD, 0xACFD, 0xFFFF, 0xE802, 0x2DC5, 0xE809, 0x343C, 0xE808, 0x9FC8, 0xE7E3, 0xA296, 0xE70D, 0xA4B1, 0xE2C9, 0xA70E, 0xDE4E, 0xA790, 0xD6A1, 0xA457, 0xD5FF, 0x9F2B, 0xD5FF, 0x2DFD, 0xD6B2, 0x2B72, 0xDA78, 0x2861, 0xDE9D, 0x276F, 0xE300, 0x2824, 0xE70D, 0x2B13, 0xE7FF, 0x2DB6, 0xE800, 0x2DC5, 0xE802, 0x2DC5, 0xFFFF, 0xE2ED, 0xBA8B, 0xE1CC, 0xBF52, 0xDF1C, 0xC165, 0xDC64, 0xBF99, 0xDB1B, 0xBAFF, 0xDB19, 0xB433, 0xDF04, 0xB552, 0xE2EF, 0xB438, 0xE2ED, 0xBA8B, 0xFFFF, 0xEC09, 0x2893, 0xE925, 0x2A08, 0xE57D, 0x261D, 0xE149, 0x246F, 0xDBDE, 0x24A0, 0xD6BC, 0x2795, 0xD484, 0x2A46, 0xD1C0, 0x2853, 0xD166, 0x251E, 0xD80D, 0x2151, 0xDF02, 0x200C, 0xE5F6, 0x2151, 0xEC9D, 0x251E, 0xEC09, 0x2893}; +const PROGMEM uint16_t unload_cartridge_btn[] = {0x0AAA, 0x0E1E, 0x57FF, 0x0E1E, 0x57FF, 0x33C3, 0x0AAA, 0x33C3, 0x0AAA, 0x0E1E}; +const PROGMEM uint16_t pause_btn[] = {0x47FF, 0xCA58, 0x7FFF, 0xCA58, 0x7FFF, 0xEFFE, 0x47FF, 0xEFFE, 0x47FF, 0xCA58}; +const PROGMEM uint16_t load_chocolate_btn[] = {0x0AAA, 0x3D2C, 0x57FF, 0x3D2C, 0x57FF, 0x62D2, 0x0AAA, 0x62D2, 0x0AAA, 0x3D2C}; +const PROGMEM uint16_t preheat_chocolate_btn[] = {0x0AAA, 0x6C3B, 0x57FF, 0x6C3B, 0x57FF, 0x91E0, 0x0AAA, 0x91E0, 0x0AAA, 0x6C3B}; +const PROGMEM uint16_t menu_btn[] = {0x0AAA, 0x9B4A, 0x57FF, 0x9B4A, 0x57FF, 0xC0EF, 0x0AAA, 0xC0EF, 0x0AAA, 0x9B4A}; +const PROGMEM uint16_t print_btn[] = {0x0AAA, 0xCA58, 0x42AA, 0xCA58, 0x42AA, 0xEFFE, 0x0AAA, 0xEFFE, 0x0AAA, 0xCA58}; +const PROGMEM uint16_t stop_btn[] = {0x8554, 0xCA58, 0xBD53, 0xCA58, 0xBD53, 0xEFFE, 0x8554, 0xEFFE, 0x8554, 0xCA58}; +const PROGMEM uint16_t print_time_hms[] = {0x62A9, 0xA968, 0x8FFE, 0xA968, 0x8FFE, 0xC0EF, 0x62A9, 0xC0EF, 0x62A9, 0xA968}; +const PROGMEM uint16_t print_time_percent[] = {0x8FFE, 0xA968, 0xBD53, 0xA968, 0xBD53, 0xC0EF, 0x8FFE, 0xC0EF, 0x8FFE, 0xA968}; +const PROGMEM uint16_t print_time_label[] = {0x62A9, 0x91E0, 0xBD53, 0x91E0, 0xBD53, 0xA986, 0x62A9, 0xA986, 0x62A9, 0x91E0}; +const PROGMEM uint16_t h3_temp[] = {0x62A9, 0x75A4, 0x8FFE, 0x75A4, 0x8FFE, 0x8D2C, 0x62A9, 0x8D2C, 0x62A9, 0x75A4}; +const PROGMEM uint16_t h3_label[] = {0x62A9, 0x5E1D, 0x8FFE, 0x5E1D, 0x8FFE, 0x75A4, 0x62A9, 0x75A4, 0x62A9, 0x5E1D}; +const PROGMEM uint16_t chocolate_label[] = {0x62A9, 0x12D2, 0xBD53, 0x12D2, 0xBD53, 0x2A5A, 0x62A9, 0x2A5A, 0x62A9, 0x12D2}; +const PROGMEM uint16_t h0_label[] = {0x62A9, 0x2A5A, 0x8FFE, 0x2A5A, 0x8FFE, 0x41E1, 0x62A9, 0x41E1, 0x62A9, 0x2A5A}; +const PROGMEM uint16_t h0_temp[] = {0x62A9, 0x41E1, 0x8FFE, 0x41E1, 0x8FFE, 0x5968, 0x62A9, 0x5968, 0x62A9, 0x41E1}; +const PROGMEM uint16_t h1_label[] = {0x8FFE, 0x2A5A, 0xBD53, 0x2A5A, 0xBD53, 0x41E1, 0x8FFE, 0x41E1, 0x8FFE, 0x2A5A}; +const PROGMEM uint16_t h1_temp[] = {0x8FFE, 0x41E1, 0xBD53, 0x41E1, 0xBD53, 0x5968, 0x8FFE, 0x5968, 0x8FFE, 0x41E1}; +const PROGMEM uint16_t extrude_btn[] = {0xC859, 0xDD2B, 0xF5AE, 0xDD2B, 0xF5AE, 0xEFFE, 0xC859, 0xEFFE, 0xC859, 0xDD2B}; +const PROGMEM uint16_t h2_label[] = {0x8FFE, 0x5E1D, 0xBD53, 0x5E1D, 0xBD53, 0x75A4, 0x8FFE, 0x75A4, 0x8FFE, 0x5E1D}; +const PROGMEM uint16_t h2_temp[] = {0x8FFE, 0x75A4, 0xBD53, 0x75A4, 0xBD53, 0x8D2C, 0x8FFE, 0x8D2C, 0x8FFE, 0x75A4}; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_unload_cartridge.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_unload_cartridge.cpp new file mode 100644 index 0000000000..2e71093370 --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_unload_cartridge.cpp @@ -0,0 +1,101 @@ +/************************************ + * cocoa_press_unload_cartridge.cpp * + ************************************/ + +/**************************************************************************** + * Written By Mark Pelletier 2017 - Aleph Objects, Inc. * + * Written By Marcio Teixeira 2018 - Aleph Objects, Inc. * + * Written By Marcio Teixeira 2020 - Cocoa Press * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * To view a copy of the GNU General Public License, go to the following * + * location: . * + ****************************************************************************/ + +#include "../config.h" + +#if ENABLED(TOUCH_UI_FTDI_EVE) && ENABLED(TOUCH_UI_COCOA_PRESS) + +#include "screens.h" +#include "screen_data.h" + +using namespace ExtUI; +using namespace FTDI; +using namespace Theme; + +#define GRID_COLS 2 +#define GRID_ROWS 6 + +#define TITLE_POS BTN_POS(1,1), BTN_SIZE(2,1) +#define DESCRIPTION_POS BTN_POS(1,2), BTN_SIZE(2,3) +#define CARTRIDGE_OUT_BTN_POS BTN_POS(1,5), BTN_SIZE(1,1) +#define CARTRIDGE_IN_BTN_POS BTN_POS(2,5), BTN_SIZE(1,1) +#define BACK_BTN_POS BTN_POS(1,6), BTN_SIZE(2,1) + +void UnloadCartridgeScreen::onRedraw(draw_mode_t what) { + CommandProcessor cmd; + + if (what & BACKGROUND) { + cmd.cmd(CLEAR_COLOR_RGB(bg_color)) + .cmd(CLEAR(true,true,true)) + .cmd(COLOR_RGB(bg_text_enabled)) + .tag(0) + .font(font_large) + .text(TITLE_POS, GET_TEXT_F(MSG_UNLOAD_CARTRIDGE)); + draw_text_box(cmd, DESCRIPTION_POS, F( + "Press and hold the buttons below to help " + "you unlock the cartridge. After unlocking, " + "press and hold the Cartridge Out button " + "until the cartridge is sticking out of the " + "extruder enough to grip and remove. After " + "removing the cartridge, continue holding the " + "Cartridge Out button until the plunger adapter is " + "visible at the bottom of the extruder." + ), + OPT_CENTERY, font_medium); + } + + if (what & FOREGROUND) { + cmd.font(font_medium) + .colors(normal_btn) + .tag(2).button(CARTRIDGE_OUT_BTN_POS, GET_TEXT_F(MSG_CARTRIDGE_OUT)) + .tag(3).button(CARTRIDGE_IN_BTN_POS, GET_TEXT_F(MSG_CARTRIDGE_IN)) + .colors(action_btn) + .tag(1).button(BACK_BTN_POS, GET_TEXT_F(MSG_BACK)); + } +} + +bool UnloadCartridgeScreen::onTouchEnd(uint8_t tag) { + using namespace ExtUI; + switch (tag) { + case 1: GOTO_PREVIOUS(); break; + } + return true; +} + +bool UnloadCartridgeScreen::onTouchHeld(uint8_t tag) { + if (ExtUI::isMoving()) return false; // Don't allow moves to accumulate + constexpr float increment = 0.25; + MoveAxisScreen::setManualFeedrate(E0, increment); + #define UI_INCREMENT_AXIS(axis) UI_INCREMENT(AxisPosition_mm, axis); + #define UI_DECREMENT_AXIS(axis) UI_DECREMENT(AxisPosition_mm, axis); + switch (tag) { + case 2: UI_DECREMENT_AXIS(E0); break; + case 3: UI_INCREMENT_AXIS(E0); break; + default: return false; + } + #undef UI_DECREMENT_AXIS + #undef UI_INCREMENT_AXIS + return false; +} + +#endif // TOUCH_UI_FTDI_EVE diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/leveling_menu.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/leveling_menu.cpp index a202a611ec..bf1e2d522e 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/leveling_menu.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/leveling_menu.cpp @@ -69,20 +69,23 @@ void LevelingMenu::onRedraw(draw_mode_t what) { if (what & FOREGROUND) { CommandProcessor cmd; cmd.font(font_large) + .cmd(COLOR_RGB(bg_text_enabled)) .text(TITLE_POS, GET_TEXT_F(MSG_LEVELING)) + #if ENABLED(BLTOUCH) + .text(BLTOUCH_TITLE_POS, GET_TEXT_F(MSG_BLTOUCH)) + #endif .font(font_medium).colors(normal_btn) #if EITHER(Z_STEPPER_AUTO_ALIGN,MECHANICAL_GANTRY_CALIBRATION) .tag(2).button(LEVEL_AXIS_POS, GET_TEXT_F(MSG_AUTOLEVEL_X_AXIS)) #endif .tag(3).button(LEVEL_BED_POS, GET_TEXT_F(MSG_LEVEL_BED)) .enabled(ENABLED(HAS_MESH)) - .tag(4).button(SHOW_MESH_POS, GET_TEXT_F(MSG_SHOW_MESH)); + .tag(4).button(SHOW_MESH_POS, GET_TEXT_F(MSG_SHOW_MESH)) #if ENABLED(BLTOUCH) - cmd.text(BLTOUCH_TITLE_POS, GET_TEXT_F(MSG_BLTOUCH)) - .tag(5).button(BLTOUCH_RESET_POS, GET_TEXT_F(MSG_BLTOUCH_RESET)) - .tag(6).button(BLTOUCH_TEST_POS, GET_TEXT_F(MSG_BLTOUCH_SELFTEST)); + .tag(5).button(BLTOUCH_RESET_POS, GET_TEXT_F(MSG_BLTOUCH_RESET)) + .tag(6).button(BLTOUCH_TEST_POS, GET_TEXT_F(MSG_BLTOUCH_SELFTEST)) #endif - cmd.colors(action_btn) + .colors(action_btn) .tag(1).button(BACK_POS, GET_TEXT_F(MSG_BACK)); } } @@ -97,13 +100,13 @@ bool LevelingMenu::onTouchEnd(uint8_t tag) { #ifndef BED_LEVELING_COMMANDS #define BED_LEVELING_COMMANDS "G29" #endif - #if HAS_MESH + #if ENABLED(AUTO_BED_LEVELING_UBL) BedMeshScreen::startMeshProbe(); #else SpinnerDialogBox::enqueueAndWait_P(F(BED_LEVELING_COMMANDS)); #endif break; - #if HAS_MESH + #if ENABLED(AUTO_BED_LEVELING_UBL) case 4: GOTO_SCREEN(BedMeshScreen); break; #endif #if ENABLED(BLTOUCH) diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/main_menu.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/main_menu.cpp index 85006566bb..4bd22cdabd 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/main_menu.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/main_menu.cpp @@ -23,7 +23,7 @@ #include "../config.h" -#if ENABLED(TOUCH_UI_FTDI_EVE) && DISABLED(TOUCH_UI_LULZBOT_BIO) +#if ENABLED(TOUCH_UI_FTDI_EVE) && NONE(TOUCH_UI_LULZBOT_BIO,TOUCH_UI_COCOA_PRESS) #include "screens.h" @@ -69,24 +69,20 @@ void MainMenu::onRedraw(draw_mode_t what) { CommandProcessor cmd; cmd.colors(normal_btn) .font(Theme::font_medium) - .tag(2).button( AUTO_HOME_POS, GET_TEXT_F(MSG_AUTO_HOME)) - .enabled( - #if ANY(NOZZLE_CLEAN_FEATURE, TOUCH_UI_COCOA_PRESS) - 1 - #endif - ) - .tag(3).button( CLEAN_NOZZLE_POS, GET_TEXT_F(TERN(TOUCH_UI_COCOA_PRESS, MSG_PREHEAT_1, MSG_CLEAN_NOZZLE))) - .tag(4).button( MOVE_AXIS_POS, GET_TEXT_F(MSG_MOVE_AXIS)) - .tag(5).button( DISABLE_STEPPERS_POS, GET_TEXT_F(MSG_DISABLE_STEPPERS)) - .tag(6).button( TEMPERATURE_POS, GET_TEXT_F(MSG_TEMPERATURE)) + .tag( 2).button( AUTO_HOME_POS, GET_TEXT_F(MSG_AUTO_HOME)) + .enabled(ENABLED(NOZZLE_CLEAN_FEATURE)) + .tag( 3).button( CLEAN_NOZZLE_POS, GET_TEXT_F(MSG_CLEAN_NOZZLE)) + .tag( 4).button( MOVE_AXIS_POS, GET_TEXT_F(MSG_MOVE_AXIS)) + .tag( 5).button( DISABLE_STEPPERS_POS,GET_TEXT_F(MSG_DISABLE_STEPPERS)) + .tag( 6).button( TEMPERATURE_POS, GET_TEXT_F(MSG_TEMPERATURE)) .enabled(IF_DISABLED(TOUCH_UI_LULZBOT_BIO, 1)) - .tag(7).button( FILAMENTCHANGE_POS, GET_TEXT_F(TERN(TOUCH_UI_COCOA_PRESS, MSG_CASE_LIGHT, MSG_FILAMENTCHANGE)) - .tag(8).button( ADVANCED_SETTINGS_POS, GET_TEXT_F(MSG_ADVANCED_SETTINGS)) + .tag( 7).button( FILAMENTCHANGE_POS, GET_TEXT_F(MSG_FILAMENTCHANGE)) + .tag( 8).button( ADVANCED_SETTINGS_POS, GET_TEXT_F(MSG_ADVANCED_SETTINGS)) .enabled(TERN_(HAS_LEVELING, 1)) - .tag(9).button( LEVELING_POS, GET_TEXT_F(MSG_LEVELING)) - .tag(10).button( ABOUT_PRINTER_POS, GET_TEXT_F(MSG_INFO_MENU)) + .tag( 9).button( LEVELING_POS, GET_TEXT_F(MSG_LEVELING)) + .tag(10).button( ABOUT_PRINTER_POS, GET_TEXT_F(MSG_INFO_MENU)) .colors(action_btn) - .tag(1).button( BACK_POS, GET_TEXT_F(MSG_BACK)); + .tag(1).button( BACK_POS, GET_TEXT_F(MSG_BACK)); } } @@ -96,22 +92,16 @@ bool MainMenu::onTouchEnd(uint8_t tag) { switch (tag) { case 1: SaveSettingsDialogBox::promptToSaveSettings(); break; case 2: SpinnerDialogBox::enqueueAndWait_P(F("G28")); break; - #if ENABLED(TOUCH_UI_COCOA_PRESS) - case 3: GOTO_SCREEN(PreheatMenu); break; - #elif ENABLED(NOZZLE_CLEAN_FEATURE) + #if ENABLED(NOZZLE_CLEAN_FEATURE) case 3: injectCommands_P(PSTR("G12")); GOTO_SCREEN(StatusScreen); break; #endif case 4: GOTO_SCREEN(MoveAxisScreen); break; case 5: injectCommands_P(PSTR("M84")); break; case 6: GOTO_SCREEN(TemperatureScreen); break; - #if BOTH(TOUCH_UI_COCOA_PRESS, CASE_LIGHT_ENABLE) - case 7: GOTO_SCREEN(CaseLightScreen); break; - #else case 7: GOTO_SCREEN(ChangeFilamentScreen); break; - #endif case 8: GOTO_SCREEN(AdvancedSettingsMenu); break; #ifdef HAS_LEVELING - case 9: GOTO_SCREEN(LevelingMenu); break; + case 9: GOTO_SCREEN(LevelingMenu); break; #endif case 10: GOTO_SCREEN(AboutScreen); break; default: diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/move_axis_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/move_axis_screen.cpp index 06faf303e2..972b758024 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/move_axis_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/move_axis_screen.cpp @@ -30,7 +30,7 @@ using namespace FTDI; using namespace ExtUI; -void MoveAxisScreen::onEntry() { +void BaseMoveAxisScreen::onEntry() { // Since Marlin keeps only one absolute position for all the extruders, // we have to keep track of the relative motion of individual extruders // ourselves. The relative distances are reset to zero whenever this @@ -68,7 +68,7 @@ void MoveAxisScreen::onRedraw(draw_mode_t what) { w.increments(); } -bool MoveAxisScreen::onTouchHeld(uint8_t tag) { +bool BaseMoveAxisScreen::onTouchHeld(uint8_t tag) { #define UI_INCREMENT_AXIS(axis) UI_INCREMENT(AxisPosition_mm, axis); #define UI_DECREMENT_AXIS(axis) UI_DECREMENT(AxisPosition_mm, axis); const float increment = getIncrement(); @@ -106,7 +106,7 @@ bool MoveAxisScreen::onTouchHeld(uint8_t tag) { return true; } -float MoveAxisScreen::getManualFeedrate(uint8_t axis, float increment_mm) { +float BaseMoveAxisScreen::getManualFeedrate(uint8_t axis, float increment_mm) { // Compute feedrate so that the tool lags the adjuster when it is // being held down, this allows enough margin for the planner to // connect segments and even out the motion. @@ -114,11 +114,11 @@ float MoveAxisScreen::getManualFeedrate(uint8_t axis, float increment_mm) { return min(max_manual_feedrate[axis] / 60.0f, abs(increment_mm * (TOUCH_REPEATS_PER_SECOND) * 0.80f)); } -void MoveAxisScreen::setManualFeedrate(ExtUI::axis_t axis, float increment_mm) { +void BaseMoveAxisScreen::setManualFeedrate(ExtUI::axis_t axis, float increment_mm) { ExtUI::setFeedrate_mm_s(getManualFeedrate(X_AXIS + (axis - ExtUI::X), increment_mm)); } -void MoveAxisScreen::setManualFeedrate(ExtUI::extruder_t, float increment_mm) { +void BaseMoveAxisScreen::setManualFeedrate(ExtUI::extruder_t, float increment_mm) { ExtUI::setFeedrate_mm_s(getManualFeedrate(E_AXIS, increment_mm)); } diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screens.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screens.cpp index 64927d58d9..ff85689ef2 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screens.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screens.cpp @@ -115,6 +115,10 @@ SCREEN_TABLE { #if ENABLED(TOUCH_UI_COCOA_PRESS) DECL_SCREEN(PreheatMenu), DECL_SCREEN(PreheatTimerScreen), + DECL_SCREEN(UnloadCartridgeScreen), + DECL_SCREEN(LoadChocolateScreen), + DECL_SCREEN(MoveXYZScreen), + DECL_SCREEN(MoveEScreen), #endif #if ENABLED(TOUCH_UI_DEVELOPER_MENU) DECL_SCREEN(DeveloperMenu), diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screens.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screens.h index 7b062045f9..3fa18d9f67 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screens.h +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screens.h @@ -98,6 +98,10 @@ enum { #if ENABLED(TOUCH_UI_COCOA_PRESS) PREHEAT_MENU_CACHE, PREHEAT_TIMER_SCREEN_CACHE, + UNLOAD_CARTRIDGE_SCREEN_CACHE, + LOAD_CHOCOLATE_SCREEN_CACHE, + MOVE_XYZ_SCREEN_CACHE, + MOVE_E_SCREEN_CACHE, #endif #if ENABLED(SDSUPPORT) FILES_SCREEN_CACHE, @@ -112,7 +116,7 @@ enum { // To save MCU RAM, the status message is "baked" in to the status screen // cache, so we reserve a large chunk of memory for the DL cache -#define STATUS_SCREEN_DL_SIZE 2048 +#define STATUS_SCREEN_DL_SIZE 4096 #define ALERT_BOX_DL_SIZE 3072 #define SPINNER_DL_SIZE 3072 #define FILE_SCREEN_DL_SIZE 4160 @@ -280,6 +284,7 @@ class StatusScreen : public BaseScreen, public CachedScreen { - public: - static void onRedraw(draw_mode_t); - static bool onTouchEnd(uint8_t tag); - }; - - class PreheatTimerScreen : public BaseScreen, public CachedScreen { - private: - static uint16_t secondsRemaining(); - - static void draw_message(draw_mode_t); - static void draw_time_remaining(draw_mode_t); - static void draw_interaction_buttons(draw_mode_t); - public: - static void onRedraw(draw_mode_t); - - static void onEntry(); - static void onIdle(); - static bool onTouchEnd(uint8_t tag); - }; -#endif - class MainMenu : public BaseScreen, public CachedScreen { public: static void onRedraw(draw_mode_t); @@ -467,7 +449,7 @@ class BaseNumericAdjustmentScreen : public BaseScreen { static bool onTouchEnd(uint8_t tag); }; -class MoveAxisScreen : public BaseNumericAdjustmentScreen, public CachedScreen { +class BaseMoveAxisScreen : public BaseNumericAdjustmentScreen { private: static float getManualFeedrate(uint8_t axis, float increment_mm); public: @@ -475,8 +457,12 @@ class MoveAxisScreen : public BaseNumericAdjustmentScreen, public CachedScreen { + public: + static void onRedraw(draw_mode_t); static void onIdle(); }; @@ -852,3 +838,54 @@ class MediaPlayerScreen : public BaseScreen, public UncachedScreen { static bool onTouchEnd(uint8_t tag); }; #endif + +#if ENABLED(TOUCH_UI_COCOA_PRESS) + class PreheatMenu : public BaseScreen, public CachedScreen { + public: + static void onRedraw(draw_mode_t); + static bool onTouchEnd(uint8_t tag); + }; + + class PreheatTimerScreen : public BaseScreen, public CachedScreen { + private: + static uint16_t secondsRemaining(); + + static void draw_message(draw_mode_t); + static void draw_time_remaining(draw_mode_t); + static void draw_interaction_buttons(draw_mode_t); + static void draw_adjuster(draw_mode_t, uint8_t tag, progmem_str label, float value, int16_t x, int16_t y, int16_t w, int16_t h); + public: + static void onRedraw(draw_mode_t); + + static void onEntry(); + static void onIdle(); + static bool onTouchHeld(uint8_t tag); + static bool onTouchEnd(uint8_t tag); + }; + + class UnloadCartridgeScreen : public BaseScreen, public CachedScreen { + public: + static void onRedraw(draw_mode_t); + static bool onTouchEnd(uint8_t tag); + static bool onTouchHeld(uint8_t tag); + }; + + class LoadChocolateScreen : public BaseScreen, public CachedScreen { + public: + static void onRedraw(draw_mode_t); + static bool onTouchEnd(uint8_t tag); + static bool onTouchHeld(uint8_t tag); + }; + + class MoveXYZScreen : public BaseMoveAxisScreen, public CachedScreen { + public: + static void onRedraw(draw_mode_t); + static void onIdle(); + }; + + class MoveEScreen : public BaseMoveAxisScreen, public CachedScreen { + public: + static void onRedraw(draw_mode_t); + static void onIdle(); + }; +#endif \ No newline at end of file diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/temperature_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/temperature_screen.cpp index e320bf5a01..0011306c7e 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/temperature_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/temperature_screen.cpp @@ -33,7 +33,7 @@ using namespace ExtUI; void TemperatureScreen::onRedraw(draw_mode_t what) { widgets_t w(what); #if TOUCH_UI_LCD_TEMP_SCALING == 10 - w.precision(1) + w.precision(1, DEFAULT_MIDRANGE) #else w.precision(0, getTargetTemp_celsius(E0) == 0 ? DEFAULT_HIGHEST : DEFAULT_MIDRANGE) #endif @@ -41,7 +41,14 @@ void TemperatureScreen::onRedraw(draw_mode_t what) { w.heading(GET_TEXT_F(MSG_TEMPERATURE)); w.button(30, GET_TEXT_F(MSG_COOLDOWN)); #ifndef NO_TOOLHEAD_HEATER_GCODE - #if HOTENDS == 1 + #ifdef TOUCH_UI_COCOA_PRESS + w.adjuster( 2, GET_TEXT_F(MSG_NOZZLE), getTargetTemp_celsius(E0)); + w.adjuster( 4, GET_TEXT_F(MSG_BODY), getTargetTemp_celsius(E1)); + #if ENABLED(COCOA_PRESS_EXTRA_HEATER) + if (has_extra_heater()) + w.adjuster(6, GET_TEXT_F(MSG_EXTERNAL), getTargetTemp_celsius(E2)); + #endif + #elif HOTENDS == 1 w.adjuster( 2, GET_TEXT_F(MSG_NOZZLE), getTargetTemp_celsius(E0)); #else w.adjuster( 2, F(LCD_STR_E0), getTargetTemp_celsius(E0)); @@ -95,12 +102,12 @@ bool TemperatureScreen::onTouchHeld(uint8_t tag) { case 11: UI_INCREMENT(TargetFan_percent, FAN0); break; #endif case 30: - #define _HOTEND_OFF(N) setTargetTemp_celsius(0,E##N); + #define _HOTEND_OFF(N) setTargetTemp_celsius(0, E##N); REPEAT(HOTENDS, _HOTEND_OFF); - TERN_(HAS_HEATED_BED, setTargetTemp_celsius(0,BED)); - TERN_(HAS_HEATED_CHAMBER, setTargetTemp_celsius(0,CHAMBER)); + TERN_(HAS_HEATED_BED, setTargetTemp_celsius(0, BED)); + TERN_(HAS_HEATED_CHAMBER, setTargetTemp_celsius(0, CHAMBER)); #if HAS_FAN - setTargetFan_percent(0,FAN0); + setTargetFan_percent(0, FAN0); #endif break; default: diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/tune_menu.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/tune_menu.cpp index 10cbb8af53..f70851521a 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/tune_menu.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/tune_menu.cpp @@ -76,7 +76,7 @@ void TuneMenu::onRedraw(draw_mode_t what) { .tag(3).button( FIL_CHANGE_POS, GET_TEXT_F(MSG_FILAMENTCHANGE)) .enabled(EITHER(LIN_ADVANCE, FILAMENT_RUNOUT_SENSOR)) .tag(9).button( FILAMENT_POS, GET_TEXT_F(MSG_FILAMENT)) - .enabled(EITHER(HAS_BED_PROBE, BABYSTEPPING)) + .enabled(BOTH(HAS_LEVELING, HAS_BED_PROBE) || ENABLED(BABYSTEPPING)) .tag(4).button( NUDGE_NOZ_POS, GET_TEXT_F(TERN(BABYSTEPPING, MSG_NUDGE_NOZZLE, MSG_ZPROBE_ZOFFSET))) .tag(5).button( SPEED_POS, GET_TEXT_F(MSG_PRINT_SPEED)) .enabled(sdOrHostPrinting) @@ -103,7 +103,7 @@ bool TuneMenu::onTouchEnd(uint8_t tag) { case 4: #if ENABLED(BABYSTEPPING) GOTO_SCREEN(NudgeNozzleScreen); - #elif HAS_BED_PROBE + #elif BOTH(HAS_LEVELING, HAS_BED_PROBE) GOTO_SCREEN(ZOffsetScreen); #endif break; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/z_offset_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/z_offset_screen.cpp index dd211e3439..0acfbb07d6 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/z_offset_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/z_offset_screen.cpp @@ -22,7 +22,7 @@ #include "../config.h" -#if BOTH(TOUCH_UI_FTDI_EVE, HAS_BED_PROBE) +#if ENABLED(TOUCH_UI_FTDI_EVE) && BOTH(HAS_LEVELING, HAS_BED_PROBE) #include "screens.h"