From e640d9246d9c4ed26edd55d518f5a4074afdd7ee Mon Sep 17 00:00:00 2001 From: Marcio T Date: Mon, 26 Apr 2021 22:40:59 -0600 Subject: [PATCH] FTDI EVE Touch UI fixes (#21706) --- .../archim2-flash/media_file_reader.h | 2 +- .../cocoa_press_advanced_settings_menu.cpp | 12 ++--- .../screens/cocoa_press_main_menu.cpp | 31 ++++++------ .../screens/flow_percent_screen.cpp | 50 +++++++++++++++++++ .../screens/flow_percent_screen.h | 31 ++++++++++++ .../screens/leveling_menu.cpp | 3 +- .../lib/ftdi_eve_touch_ui/screens/screens.cpp | 1 + .../lib/ftdi_eve_touch_ui/screens/screens.h | 2 + .../src/lcd/extui/lib/nextion/nextion_tft.cpp | 8 +-- Marlin/src/lcd/extui/ui_api.cpp | 2 +- Marlin/src/lcd/extui/ui_api.h | 2 +- 11 files changed, 112 insertions(+), 32 deletions(-) create mode 100644 Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/flow_percent_screen.cpp create mode 100644 Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/flow_percent_screen.h diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/archim2-flash/media_file_reader.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/archim2-flash/media_file_reader.h index d9edea8388..3528dd9e15 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/archim2-flash/media_file_reader.h +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/archim2-flash/media_file_reader.h @@ -32,7 +32,7 @@ class MediaFileReader { private: #if ENABLED(SDSUPPORT) - Sd2Card card; + DiskIODriver_SPI_SD card; SdVolume volume; SdFile root, file; #endif 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 index 8d5a3d793a..7bd149bd46 100644 --- 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 @@ -40,8 +40,7 @@ using namespace Theme; #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 RESTORE_DEFAULTS_POS BTN_POS(1,4), BTN_SIZE(2,1) #define BACK_POS BTN_POS(3,4), BTN_SIZE(1,1) void AdvancedSettingsMenu::onRedraw(draw_mode_t what) { @@ -66,9 +65,7 @@ void AdvancedSettingsMenu::onRedraw(draw_mode_t what) { .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)) + .tag(11).button(RESTORE_DEFAULTS_POS, GET_TEXT_F(MSG_RESTORE_DEFAULTS)) .colors(action_btn) .tag(1).button(BACK_POS, GET_TEXT_F(MSG_BACK)); } @@ -90,10 +87,7 @@ bool AdvancedSettingsMenu::onTouchEnd(uint8_t tag) { 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; + case 11: GOTO_SCREEN(RestoreFailsafeDialogBox); LockScreen::check_passcode(); break; default: return false; } return true; 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 index f35b3296d8..7708b38eca 100644 --- 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 @@ -29,7 +29,7 @@ using namespace FTDI; using namespace Theme; -#define GRID_ROWS 5 +#define GRID_ROWS 6 #define GRID_COLS 2 #define ZPROBE_ZOFFSET_POS BTN_POS(1,1), BTN_SIZE(1,1) @@ -37,11 +37,12 @@ using namespace Theme; #define TEMPERATURE_POS BTN_POS(2,1), 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 DISABLE_STEPPERS_POS BTN_POS(1,4), BTN_SIZE(1,1) -#define LEVELING_POS BTN_POS(2,4), BTN_SIZE(1,1) -#define ABOUT_PRINTER_POS BTN_POS(1,5), BTN_SIZE(1,1) -#define BACK_POS BTN_POS(2,5), BTN_SIZE(1,1) +#define FLOW_POS BTN_POS(2,3), BTN_SIZE(1,1) +#define ADVANCED_SETTINGS_POS BTN_POS(1,4), BTN_SIZE(1,1) +#define DISABLE_STEPPERS_POS BTN_POS(2,4), BTN_SIZE(1,1) +#define LEVELING_POS BTN_POS(1,5), BTN_SIZE(1,1) +#define ABOUT_PRINTER_POS BTN_POS(2,5), BTN_SIZE(1,1) +#define BACK_POS BTN_POS(1,6), BTN_SIZE(2,1) void MainMenu::onRedraw(draw_mode_t what) { if (what & BACKGROUND) { @@ -60,11 +61,12 @@ void MainMenu::onRedraw(draw_mode_t what) { .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(DISABLE_STEPPERS_POS, GET_TEXT_F(MSG_DISABLE_STEPPERS)) + .tag( 7).button(FLOW_POS, GET_TEXT_F(MSG_FLOW)) + .tag( 8).button(ADVANCED_SETTINGS_POS, GET_TEXT_F(MSG_ADVANCED_SETTINGS)) + .tag( 9).button(DISABLE_STEPPERS_POS, GET_TEXT_F(MSG_DISABLE_STEPPERS)) .enabled(HAS_LEVELING) - .tag( 9).button(LEVELING_POS, GET_TEXT_F(MSG_LEVELING)) - .tag(10).button(ABOUT_PRINTER_POS, GET_TEXT_F(MSG_INFO_MENU)) + .tag(10).button(LEVELING_POS, GET_TEXT_F(MSG_LEVELING)) + .tag(11).button(ABOUT_PRINTER_POS, GET_TEXT_F(MSG_INFO_MENU)) .colors(action_btn) .tag(1).button(BACK_POS, GET_TEXT_F(MSG_BACK)); } @@ -82,12 +84,13 @@ bool MainMenu::onTouchEnd(uint8_t tag) { #endif case 5: GOTO_SCREEN(MoveEScreen); break; case 6: GOTO_SCREEN(FeedratePercentScreen); break; - case 7: GOTO_SCREEN(AdvancedSettingsMenu); break; - case 8: injectCommands_P(PSTR("M84")); break; + case 7: GOTO_SCREEN(FlowPercentScreen); break; + case 8: GOTO_SCREEN(AdvancedSettingsMenu); break; + case 9: injectCommands_P(PSTR("M84")); break; #if HAS_LEVELING - case 9: GOTO_SCREEN(LevelingMenu); break; + case 10: GOTO_SCREEN(LevelingMenu); break; #endif - case 10: GOTO_SCREEN(AboutScreen); break; + case 11: GOTO_SCREEN(AboutScreen); break; default: return false; } diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/flow_percent_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/flow_percent_screen.cpp new file mode 100644 index 0000000000..5280092ced --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/flow_percent_screen.cpp @@ -0,0 +1,50 @@ +/*************************** + * flow_percent_screen.cpp * + ***************************/ + +/**************************************************************************** + * Written By Marcio Teixeira 2021 - 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" +#include "screens.h" + +#ifdef FTDI_FLOW_PERCENT_SCREEN + +using namespace FTDI; +using namespace ExtUI; + +void FlowPercentScreen::onRedraw(draw_mode_t what) { + widgets_t w(what); + w.precision(0).units(GET_TEXT_F(MSG_UNITS_PERCENT)); + + w.heading(GET_TEXT_F(MSG_FLOW)); + w.adjuster(4, GET_TEXT_F(MSG_FLOW), getFlow_percent(E0)); + w.increments(); +} + +bool FlowPercentScreen::onTouchHeld(uint8_t tag) { + const float increment = getIncrement(); + switch (tag) { + case 4: UI_DECREMENT(Flow_percent, E0); break; + case 5: UI_INCREMENT(Flow_percent, E0); break; + default: + return false; + } + return true; +} + +#endif // FTDI_FLOW_PERCENT_SCREEN diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/flow_percent_screen.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/flow_percent_screen.h new file mode 100644 index 0000000000..3e37531d1d --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/flow_percent_screen.h @@ -0,0 +1,31 @@ +/************************* + * flow_percent_screen.h * + *************************/ + +/**************************************************************************** + * Written By Marcio Teixeira 2021 - 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_FLOW_PERCENT_SCREEN +#define FTDI_FLOW_PERCENT_SCREEN_CLASS FlowPercentScreen + +class FlowPercentScreen : public BaseNumericAdjustmentScreen, public CachedScreen { + public: + static void onRedraw(draw_mode_t); + static bool onTouchHeld(uint8_t tag); +}; 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 ffdd69b2dd..752b17ee00 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 @@ -81,9 +81,8 @@ void LevelingMenu::onRedraw(draw_mode_t what) { .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) + .enabled(EITHER(Z_STEPPER_AUTO_ALIGN,MECHANICAL_GANTRY_CALIBRATION)) .tag(2).button(LEVEL_AXIS_POS, GET_TEXT_F(MSG_LEVEL_X_AXIS)) - #endif .tag(3).button(PROBE_BED_POS, GET_TEXT_F(MSG_PROBE_BED)) .enabled(ENABLED(HAS_MESH)) .tag(4).button(SHOW_MESH_POS, GET_TEXT_F(MSG_SHOW_MESH)) 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 f115aecbc7..c3e015d75c 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 @@ -80,6 +80,7 @@ SCREEN_TABLE { DECL_SCREEN_IF_INCLUDED(FTDI_NOZZLE_OFFSETS_SCREEN) DECL_SCREEN_IF_INCLUDED(FTDI_BACKLASH_COMP_SCREEN) DECL_SCREEN_IF_INCLUDED(FTDI_FEEDRATE_PERCENT_SCREEN) + DECL_SCREEN_IF_INCLUDED(FTDI_FLOW_PERCENT_SCREEN) DECL_SCREEN_IF_INCLUDED(FTDI_MAX_VELOCITY_SCREEN) DECL_SCREEN_IF_INCLUDED(FTDI_MAX_ACCELERATION_SCREEN) DECL_SCREEN_IF_INCLUDED(FTDI_DEFAULT_ACCELERATION_SCREEN) 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 14b8197fbf..a0cb71a6a6 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 @@ -55,6 +55,7 @@ enum { MAX_VELOCITY_SCREEN_CACHE, MAX_ACCELERATION_SCREEN_CACHE, DEFAULT_ACCELERATION_SCREEN_CACHE, + FLOW_PERCENT_SCREEN_CACHE, #if HAS_LEVELING LEVELING_SCREEN_CACHE, #if HAS_BED_PROBE @@ -150,6 +151,7 @@ enum { #include "cocoa_press_preheat_screen.h" #include "cocoa_press_load_chocolate.h" #include "move_axis_screen.h" + #include "flow_percent_screen.h" #include "cocoa_press_move_xyz_screen.h" #include "cocoa_press_move_e_screen.h" #include "tune_menu.h" diff --git a/Marlin/src/lcd/extui/lib/nextion/nextion_tft.cpp b/Marlin/src/lcd/extui/lib/nextion/nextion_tft.cpp index 679f66d807..6272d58970 100644 --- a/Marlin/src/lcd/extui/lib/nextion/nextion_tft.cpp +++ b/Marlin/src/lcd/extui/lib/nextion/nextion_tft.cpp @@ -237,7 +237,7 @@ void NextionTFT::PanelInfo(uint8_t req) { SEND_VALasTXT("tmppage.tool", getActiveTool()); SEND_VALasTXT("tmppage.fan", ui8tostr3rj(getActualFan_percent(FAN0))); SEND_VALasTXT("tmppage.speed", getFeedrate_percent()); - SEND_VALasTXT("tmppage.flow", getFlowPercentage(getActiveTool())); + SEND_VALasTXT("tmppage.flow", getFlow_percent(getActiveTool())); SEND_VALasTXT("tmppage.progress", ui8tostr3rj(getProgress_percent())); SEND_VALasTXT("tmppage.layer", layer); SEND_VALasTXT("tmppage.x", getAxisPosition_mm(X)); @@ -640,9 +640,9 @@ void NextionTFT::UpdateOnChange() { // tmppage Flow static uint8_t last_flow_speed = 99; - if (last_flow_speed != getFlowPercentage(getActiveTool())) { - SEND_VALasTXT("tmppage.flow", getFlowPercentage(getActiveTool())); - last_flow_speed = getFlowPercentage(getActiveTool()); + if (last_flow_speed != getFlow_percent(getActiveTool())) { + SEND_VALasTXT("tmppage.flow", getFlow_percent(getActiveTool())); + last_flow_speed = getFlow_percent(getActiveTool()); } // tmppage Progress + Layer + Time diff --git a/Marlin/src/lcd/extui/ui_api.cpp b/Marlin/src/lcd/extui/ui_api.cpp index accca50d1e..9cc8b9962c 100644 --- a/Marlin/src/lcd/extui/ui_api.cpp +++ b/Marlin/src/lcd/extui/ui_api.cpp @@ -691,7 +691,7 @@ namespace ExtUI { #endif feedRate_t getFeedrate_mm_s() { return feedrate_mm_s; } - int16_t getFlowPercentage(const extruder_t extr) { return planner.flow_percentage[extr]; } + int16_t getFlow_percent(const extruder_t extr) { return planner.flow_percentage[extr]; } feedRate_t getMinFeedrate_mm_s() { return planner.settings.min_feedrate_mm_s; } feedRate_t getMinTravelFeedrate_mm_s() { return planner.settings.min_travel_feedrate_mm_s; } float getPrintingAcceleration_mm_s2() { return planner.settings.acceleration; } diff --git a/Marlin/src/lcd/extui/ui_api.h b/Marlin/src/lcd/extui/ui_api.h index 04395bec4e..e6452243fd 100644 --- a/Marlin/src/lcd/extui/ui_api.h +++ b/Marlin/src/lcd/extui/ui_api.h @@ -129,7 +129,7 @@ namespace ExtUI { float getRetractAcceleration_mm_s2(); float getTravelAcceleration_mm_s2(); float getFeedrate_percent(); - int16_t getFlowPercentage(const extruder_t); + int16_t getFlow_percent(const extruder_t); inline uint8_t getProgress_percent() { return ui.get_progress_percent(); }