diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/screen_types.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/screen_types.cpp index a0b434818a..d76b897e0f 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/screen_types.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/screen_types.cpp @@ -26,7 +26,7 @@ /********************** VIRTUAL DISPATCH DATA TYPE ******************************/ uint8_t ScreenRef::lookupScreen(onRedraw_func_t onRedraw_ptr) { - for (uint8_t type = 0; type < functionTableSize; type++) { + for (uint8_t type = 0; type < tableSize(); type++) { if (GET_METHOD(type, onRedraw) == onRedraw_ptr) { return type; } @@ -49,7 +49,7 @@ void ScreenRef::setScreen(onRedraw_func_t onRedraw_ptr) { } void ScreenRef::initializeAll() { - for (uint8_t type = 0; type < functionTableSize; type++) + for (uint8_t type = 0; type < tableSize(); type++) GET_METHOD(type, onStartup)(); } diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/screen_types.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/screen_types.h index 1581cbbbc7..94d6d4e26c 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/screen_types.h +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/screen_types.h @@ -50,7 +50,11 @@ typedef enum { #define GET_METHOD(type, method) reinterpret_cast(pgm_read_ptr_far(&functionTable[type].method##_ptr)) #define SCREEN_TABLE PROGMEM const ScreenRef::table_t ScreenRef::functionTable[] = -#define SCREEN_TABLE_POST const uint8_t ScreenRef::functionTableSize = sizeof(ScreenRef::functionTable)/sizeof(ScreenRef::functionTable[0]); +#define SCREEN_TABLE_POST size_t ScreenRef::tableSize() { \ + constexpr size_t siz = sizeof(functionTable)/sizeof(functionTable[0]); \ + static_assert(siz > 0, "The screen table is empty!"); \ + return siz; \ + } class ScreenRef { protected: @@ -79,14 +83,12 @@ class ScreenRef { uint8_t type = 0; static PROGMEM const table_t functionTable[]; - static const uint8_t functionTableSize; public: - uint8_t getType() {return type;} + static size_t tableSize(); - void setType(uint8_t t) { - type = t; - } + uint8_t getType() {return type;} + void setType(uint8_t t) {type = t;} uint8_t lookupScreen(onRedraw_func_t onRedraw_ptr); diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/about_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/about_screen.cpp index 952f0cac02..1d8db12ef9 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/about_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/about_screen.cpp @@ -21,11 +21,10 @@ ****************************************************************************/ #include "../config.h" - -#if ENABLED(TOUCH_UI_FTDI_EVE) - #include "screens.h" +#ifdef FTDI_ABOUT_SCREEN + #define GRID_COLS 4 #define GRID_ROWS 7 @@ -113,4 +112,4 @@ bool AboutScreen::onTouchEnd(uint8_t tag) { return true; } -#endif // TOUCH_UI_FTDI_EVE +#endif // FTDI_ABOUT_SCREEN diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/about_screen.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/about_screen.h new file mode 100644 index 0000000000..b9d94f08b3 --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/about_screen.h @@ -0,0 +1,33 @@ +/****************** + * about_screen.h * + ******************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_ABOUT_SCREEN +#define FTDI_ABOUT_SCREEN_CLASS AboutScreen + +class AboutScreen : public BaseScreen, public UncachedScreen { + public: + static void onEntry(); + static void onRedraw(draw_mode_t); + static bool onTouchEnd(uint8_t tag); +}; 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 9036fc144b..b9255c11b9 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 @@ -21,11 +21,10 @@ ****************************************************************************/ #include "../config.h" - -#if ENABLED(TOUCH_UI_FTDI_EVE) && NONE(TOUCH_UI_LULZBOT_BIO, TOUCH_UI_COCOA_PRESS) - #include "screens.h" +#ifdef FTDI_ADVANCED_SETTINGS_MENU + using namespace FTDI; using namespace ExtUI; using namespace Theme; @@ -153,4 +152,4 @@ bool AdvancedSettingsMenu::onTouchEnd(uint8_t tag) { return true; } -#endif // TOUCH_UI_FTDI_EVE && !TOUCH_UI_LULZBOT_BIO +#endif // FTDI_ADVANCED_SETTINGS_MENU diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/advanced_settings_menu.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/advanced_settings_menu.h new file mode 100644 index 0000000000..a7e34fe6fe --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/advanced_settings_menu.h @@ -0,0 +1,32 @@ +/*************************** + * advance_settings_menu.h * + ***************************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_ADVANCED_SETTINGS_MENU +#define FTDI_ADVANCED_SETTINGS_MENU_CLASS AdvancedSettingsMenu + +class AdvancedSettingsMenu : public BaseScreen, public CachedScreen { + public: + static void onRedraw(draw_mode_t); + static bool onTouchEnd(uint8_t tag); +}; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/alert_dialog_box.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/alert_dialog_box.cpp index d63119afe5..bbe922ad5d 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/alert_dialog_box.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/alert_dialog_box.cpp @@ -21,18 +21,19 @@ ****************************************************************************/ #include "../config.h" - -#if ENABLED(TOUCH_UI_FTDI_EVE) - #include "screens.h" #include "screen_data.h" +#ifdef FTDI_ALERT_DIALOG_BOX + +constexpr static AlertDialogBoxData &mydata = screen_data.AlertDialogBox; + using namespace FTDI; using namespace Theme; void AlertDialogBox::onEntry() { BaseScreen::onEntry(); - sound.play(screen_data.AlertDialog.isError ? sad_trombone : twinkle, PLAY_ASYNCHRONOUS); + sound.play(mydata.isError ? sad_trombone : twinkle, PLAY_ASYNCHRONOUS); } void AlertDialogBox::onRedraw(draw_mode_t what) { @@ -45,7 +46,7 @@ template void AlertDialogBox::show(const T message) { drawMessage(message); storeBackground(); - screen_data.AlertDialog.isError = false; + mydata.isError = false; GOTO_SCREEN(AlertDialogBox); } @@ -53,7 +54,7 @@ template void AlertDialogBox::showError(const T message) { drawMessage(message); storeBackground(); - screen_data.AlertDialog.isError = true; + mydata.isError = true; GOTO_SCREEN(AlertDialogBox); } @@ -67,4 +68,4 @@ template void AlertDialogBox::show(const progmem_str); template void AlertDialogBox::showError(const char *); template void AlertDialogBox::showError(const progmem_str); -#endif // TOUCH_UI_FTDI_EVE +#endif // FTDI_ALERT_DIALOG_BOX diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/alert_dialog_box.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/alert_dialog_box.h new file mode 100644 index 0000000000..0186acf7a0 --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/alert_dialog_box.h @@ -0,0 +1,39 @@ +/********************** + * alert_dialog_box.h * + **********************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_ALERT_DIALOG_BOX +#define FTDI_ALERT_DIALOG_BOX_CLASS AlertDialogBox + +struct AlertDialogBoxData { + bool isError; +}; + +class AlertDialogBox : public DialogBoxBaseClass, public CachedScreen { + public: + static void onEntry(); + static void onRedraw(draw_mode_t); + template static void show(T); + template static void showError(T); + static void hide(); +}; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/backlash_compensation_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/backlash_compensation_screen.cpp index 58f4544ffc..11fb72b5a8 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/backlash_compensation_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/backlash_compensation_screen.cpp @@ -21,11 +21,10 @@ ****************************************************************************/ #include "../config.h" - -#if BOTH(TOUCH_UI_FTDI_EVE, BACKLASH_GCODE) - #include "screens.h" +#ifdef FTDI_BACKLASH_COMP_SCREEN + using namespace FTDI; using namespace ExtUI; using namespace Theme; @@ -73,4 +72,4 @@ bool BacklashCompensationScreen::onTouchHeld(uint8_t tag) { return true; } -#endif // TOUCH_UI_FTDI_EVE +#endif // FTDI_BACKLASH_COMP_SCREEN diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/backlash_compensation_screen.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/backlash_compensation_screen.h new file mode 100644 index 0000000000..b9e46eb27f --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/backlash_compensation_screen.h @@ -0,0 +1,32 @@ +/********************************** + * backlash_compensation_screen.h * + **********************************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_BACKLASH_COMP_SCREEN +#define FTDI_BACKLASH_COMP_SCREEN_CLASS BacklashCompensationScreen + +class BacklashCompensationScreen : 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/base_numeric_adjustment_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/base_numeric_adjustment_screen.cpp index 5271df3022..3b40e7f14e 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/base_numeric_adjustment_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/base_numeric_adjustment_screen.cpp @@ -21,15 +21,16 @@ ****************************************************************************/ #include "../config.h" - -#if ENABLED(TOUCH_UI_FTDI_EVE) - #include "screens.h" #include "screen_data.h" +#ifdef FTDI_BASE_NUMERIC_ADJ_SCREEN + using namespace FTDI; using namespace Theme; +constexpr static BaseNumericAdjustmentScreenData &mydata = screen_data.BaseNumericAdjustmentScreen; + #if ENABLED(TOUCH_UI_PORTRAIT) #define GRID_COLS 13 #define GRID_ROWS 10 @@ -116,8 +117,8 @@ void BaseNumericAdjustmentScreen::widgets_t::_button(CommandProcessor &cmd, uint BaseNumericAdjustmentScreen::widgets_t &BaseNumericAdjustmentScreen::widgets_t::precision(uint8_t decimals, precision_default_t initial) { _decimals = decimals; - if (screen_data.BaseNumericAdjustment.increment == 0) { - screen_data.BaseNumericAdjustment.increment = 243 + (initial - DEFAULT_LOWEST) - _decimals; + if (mydata.increment == 0) { + mydata.increment = 243 + (initial - DEFAULT_LOWEST) - _decimals; } return *this; } @@ -154,7 +155,7 @@ void BaseNumericAdjustmentScreen::widgets_t::heading(progmem_str label) { void BaseNumericAdjustmentScreen::widgets_t::_draw_increment_btn(CommandProcessor &cmd, uint8_t, const uint8_t tag) { const char *label = PSTR("?"); uint8_t pos; - uint8_t & increment = screen_data.BaseNumericAdjustment.increment; + uint8_t & increment = mydata.increment; if (increment == 0) { increment = tag; // Set the default value to be the first. @@ -358,7 +359,7 @@ void BaseNumericAdjustmentScreen::widgets_t::home_buttons(uint8_t tag) { } void BaseNumericAdjustmentScreen::onEntry() { - screen_data.BaseNumericAdjustment.increment = 0; // This will force the increment to be picked while drawing. + mydata.increment = 0; // This will force the increment to be picked while drawing. BaseScreen::onEntry(); CommandProcessor cmd; cmd.set_button_style_callback(nullptr); @@ -367,14 +368,14 @@ void BaseNumericAdjustmentScreen::onEntry() { bool BaseNumericAdjustmentScreen::onTouchEnd(uint8_t tag) { switch (tag) { case 1: GOTO_PREVIOUS(); return true; - case 240 ... 245: screen_data.BaseNumericAdjustment.increment = tag; break; + case 240 ... 245: mydata.increment = tag; break; default: return current_screen.onTouchHeld(tag); } return true; } float BaseNumericAdjustmentScreen::getIncrement() { - switch (screen_data.BaseNumericAdjustment.increment) { + switch (mydata.increment) { case 240: return 0.001; case 241: return 0.01; case 242: return 0.1; @@ -385,4 +386,4 @@ float BaseNumericAdjustmentScreen::getIncrement() { } } -#endif // TOUCH_UI_FTDI_EVE +#endif // FTDI_BASE_NUMERIC_ADJ_SCREEN diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/base_numeric_adjustment_screen.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/base_numeric_adjustment_screen.h new file mode 100644 index 0000000000..c097752674 --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/base_numeric_adjustment_screen.h @@ -0,0 +1,87 @@ +/************************************ + * base_numeric_adjustment_screen.h * + ************************************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_BASE_NUMERIC_ADJ_SCREEN +#define FTDI_BASE_NUMERIC_ADJ_SCREEN_CLASS BaseNumericAdjustmentScreen + +struct BaseNumericAdjustmentScreenData { + uint8_t increment; +}; + +class BaseNumericAdjustmentScreen : public BaseScreen { + public: + enum precision_default_t { + DEFAULT_LOWEST, + DEFAULT_MIDRANGE, + DEFAULT_HIGHEST + }; + + protected: + class widgets_t { + private: + draw_mode_t _what; + uint8_t _line; + uint32_t _color; + uint8_t _decimals; + progmem_str _units; + enum style_t { + BTN_NORMAL, + BTN_ACTION, + BTN_TOGGLE, + BTN_DISABLED, + TEXT_AREA, + TEXT_LABEL + } _style; + + protected: + void _draw_increment_btn(CommandProcessor &, uint8_t line, const uint8_t tag); + void _button(CommandProcessor &, uint8_t tag, int16_t x, int16_t y, int16_t w, int16_t h, progmem_str, bool enabled = true, bool highlight = false); + void _button_style(CommandProcessor &cmd, style_t style); + public: + widgets_t(draw_mode_t); + + widgets_t &color(uint32_t color) {_color = color; return *this;} + widgets_t &units(progmem_str units) {_units = units; return *this;} + widgets_t &draw_mode(draw_mode_t what) {_what = what; return *this;} + widgets_t &precision(uint8_t decimals, precision_default_t = DEFAULT_HIGHEST); + + void heading (progmem_str label); + void adjuster_sram_val (uint8_t tag, progmem_str label, const char *value, bool is_enabled = true); + void adjuster (uint8_t tag, progmem_str label, const char *value, bool is_enabled = true); + void adjuster (uint8_t tag, progmem_str label, float value=0, bool is_enabled = true); + void button (uint8_t tag, progmem_str label, bool is_enabled = true); + void text_field (uint8_t tag, progmem_str label, const char *value, bool is_enabled = true); + void two_buttons (uint8_t tag1, progmem_str label1, + uint8_t tag2, progmem_str label2, bool is_enabled = true); + void toggle (uint8_t tag, progmem_str label, bool value, bool is_enabled = true); + void home_buttons (uint8_t tag); + void increments (); + }; + + static float getIncrement(); + + public: + static void onEntry(); + static bool onTouchEnd(uint8_t tag); +}; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/base_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/base_screen.cpp index 16b26e6821..139a3100cf 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/base_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/base_screen.cpp @@ -21,11 +21,10 @@ ****************************************************************************/ #include "../config.h" - -#if ENABLED(TOUCH_UI_FTDI_EVE) - #include "screens.h" +#ifdef FTDI_BASE_SCREEN + using namespace FTDI; using namespace Theme; @@ -87,4 +86,4 @@ void BaseScreen::reset_menu_timeout() { uint32_t BaseScreen::last_interaction; #endif -#endif // TOUCH_UI_FTDI_EVE +#endif // FTDI_BASE_SCREEN diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/base_screen.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/base_screen.h new file mode 100644 index 0000000000..cbeea1f750 --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/base_screen.h @@ -0,0 +1,43 @@ +/***************** + * base_screen.h * + *****************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_BASE_SCREEN +#define FTDI_BASE_SCREEN_CLASS BaseScreen + +class BaseScreen : public UIScreen { + protected: + #if LCD_TIMEOUT_TO_STATUS > 0 + static uint32_t last_interaction; + #endif + + static bool buttonIsPressed(uint8_t tag); + + public: + static bool buttonStyleCallback(CommandProcessor &, uint8_t, uint8_t &, uint16_t &, bool); + + static void reset_menu_timeout(); + + static void onEntry(); + static void onIdle(); +}; 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 9fb2b20025..b62a9bf01b 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 @@ -20,16 +20,17 @@ ****************************************************************************/ #include "../config.h" - -#if BOTH(TOUCH_UI_FTDI_EVE, HAS_MESH) - #include "screens.h" #include "screen_data.h" +#ifdef FTDI_BED_MESH_SCREEN + using namespace FTDI; using namespace Theme; using namespace ExtUI; +constexpr static BedMeshScreenData &mydata = screen_data.BedMeshScreen; + #if ENABLED(TOUCH_UI_PORTRAIT) #define GRID_COLS 2 #define GRID_ROWS 10 @@ -196,7 +197,7 @@ void BedMeshScreen::drawMesh(int16_t x, int16_t y, int16_t w, int16_t h, ExtUI:: } if (opts & USE_HIGHLIGHT) { - const uint8_t tag = screen_data.BedMesh.highlightedTag; + const uint8_t tag = mydata.highlightedTag; uint8_t x, y; if (tagToPoint(tag, x, y)) { cmd.cmd(COLOR_A(128)) @@ -221,16 +222,16 @@ bool BedMeshScreen::tagToPoint(uint8_t tag, uint8_t &x, uint8_t &y) { } void BedMeshScreen::onEntry() { - screen_data.BedMesh.highlightedTag = 0; - screen_data.BedMesh.count = GRID_MAX_POINTS; - screen_data.BedMesh.message = screen_data.BedMesh.MSG_NONE; + mydata.highlightedTag = 0; + mydata.count = GRID_MAX_POINTS; + mydata.message = mydata.MSG_NONE; BaseScreen::onEntry(); } float BedMeshScreen::getHightlightedValue() { - if (screen_data.BedMesh.highlightedTag) { + if (mydata.highlightedTag) { xy_uint8_t pt; - tagToPoint(screen_data.BedMesh.highlightedTag, pt.x, pt.y); + tagToPoint(mydata.highlightedTag, pt.x, pt.y); return ExtUI::getMeshPoint(pt); } return NAN; @@ -253,9 +254,9 @@ void BedMeshScreen::drawHighlightedPointValue() { .tag(1).button(OKAY_POS, GET_TEXT_F(MSG_BUTTON_OKAY)) .tag(0); - switch (screen_data.BedMesh.message) { - case screen_data.BedMesh.MSG_MESH_COMPLETE: cmd.text(MESSAGE_POS, GET_TEXT_F(MSG_BED_MAPPING_DONE)); break; - case screen_data.BedMesh.MSG_MESH_INCOMPLETE: cmd.text(MESSAGE_POS, GET_TEXT_F(MSG_BED_MAPPING_INCOMPLETE)); break; + switch (mydata.message) { + case mydata.MSG_MESH_COMPLETE: cmd.text(MESSAGE_POS, GET_TEXT_F(MSG_BED_MAPPING_DONE)); break; + case mydata.MSG_MESH_INCOMPLETE: cmd.text(MESSAGE_POS, GET_TEXT_F(MSG_BED_MAPPING_INCOMPLETE)); break; default: break; } } @@ -277,11 +278,11 @@ void BedMeshScreen::onRedraw(draw_mode_t what) { if (what & FOREGROUND) { constexpr float autoscale_max_amplitude = 0.03; - const bool gotAllPoints = screen_data.BedMesh.count >= GRID_MAX_POINTS; + const bool gotAllPoints = mydata.count >= GRID_MAX_POINTS; if (gotAllPoints) { drawHighlightedPointValue(); } - const float levelingProgress = sq(float(screen_data.BedMesh.count) / GRID_MAX_POINTS); + const float levelingProgress = sq(float(mydata.count) / GRID_MAX_POINTS); BedMeshScreen::drawMesh(INSET_POS(MESH_POS), ExtUI::getMeshArray(), USE_POINTS | USE_HIGHLIGHT | USE_AUTOSCALE | (gotAllPoints ? USE_COLORS : 0), autoscale_max_amplitude * levelingProgress @@ -290,7 +291,7 @@ void BedMeshScreen::onRedraw(draw_mode_t what) { } bool BedMeshScreen::onTouchStart(uint8_t tag) { - screen_data.BedMesh.highlightedTag = tag; + mydata.highlightedTag = tag; return true; } @@ -312,21 +313,21 @@ void BedMeshScreen::onMeshUpdate(const int8_t, const int8_t, const float) { void BedMeshScreen::onMeshUpdate(const int8_t x, const int8_t y, const ExtUI::probe_state_t state) { switch (state) { case ExtUI::MESH_START: - screen_data.BedMesh.count = 0; - screen_data.BedMesh.message = screen_data.BedMesh.MSG_NONE; + mydata.count = 0; + mydata.message = mydata.MSG_NONE; break; case ExtUI::MESH_FINISH: - if (screen_data.BedMesh.count == GRID_MAX_POINTS && ExtUI::getMeshValid()) - screen_data.BedMesh.message = screen_data.BedMesh.MSG_MESH_COMPLETE; + if (mydata.count == GRID_MAX_POINTS && ExtUI::getMeshValid()) + mydata.message = mydata.MSG_MESH_COMPLETE; else - screen_data.BedMesh.message = screen_data.BedMesh.MSG_MESH_INCOMPLETE; - screen_data.BedMesh.count = GRID_MAX_POINTS; + mydata.message = mydata.MSG_MESH_INCOMPLETE; + mydata.count = GRID_MAX_POINTS; break; case ExtUI::PROBE_START: - screen_data.BedMesh.highlightedTag = pointToTag(x, y); + mydata.highlightedTag = pointToTag(x, y); break; case ExtUI::PROBE_FINISH: - screen_data.BedMesh.count++; + mydata.count++; break; } BedMeshScreen::onMeshUpdate(x, y, 0); @@ -334,8 +335,8 @@ void BedMeshScreen::onMeshUpdate(const int8_t x, const int8_t y, const ExtUI::pr void BedMeshScreen::startMeshProbe() { GOTO_SCREEN(BedMeshScreen); - screen_data.BedMesh.count = 0; + mydata.count = 0; injectCommands_P(PSTR(BED_LEVELING_COMMANDS)); } -#endif // TOUCH_UI_FTDI_EVE && HAS_MESH +#endif // FTDI_BED_MESH_SCREEN diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bed_mesh_screen.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bed_mesh_screen.h new file mode 100644 index 0000000000..7aac484cb6 --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bed_mesh_screen.h @@ -0,0 +1,62 @@ +/********************* + * bed_mesh_screen.h * + *********************/ + +/**************************************************************************** + * Written By Marcio Teixeira 2020 * + * * + * 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_BED_MESH_SCREEN +#define FTDI_BED_MESH_SCREEN_CLASS BedMeshScreen + +struct BedMeshScreenData { + enum : uint8_t { + MSG_NONE, + MSG_MESH_COMPLETE, + MSG_MESH_INCOMPLETE + } message; + uint8_t count; + uint8_t highlightedTag; +}; + +class BedMeshScreen : public BaseScreen, public CachedScreen { + private: + enum MeshOpts { + USE_POINTS = 0x01, + USE_COLORS = 0x02, + USE_TAGS = 0x04, + USE_HIGHLIGHT = 0x08, + USE_AUTOSCALE = 0x10 + }; + + static uint8_t pointToTag(uint8_t x, uint8_t y); + static bool tagToPoint(uint8_t tag, uint8_t &x, uint8_t &y); + static float getHightlightedValue(); + static void drawHighlightedPointValue(); + static void drawMesh(int16_t x, int16_t y, int16_t w, int16_t h, ExtUI::bed_mesh_t data, uint8_t opts, float autoscale_max = 0.1); + + public: + static void onMeshUpdate(const int8_t x, const int8_t y, const float val); + static void onMeshUpdate(const int8_t x, const int8_t y, const ExtUI::probe_state_t); + static void onEntry(); + static void onRedraw(draw_mode_t); + static bool onTouchStart(uint8_t tag); + static bool onTouchEnd(uint8_t tag); + + static void startMeshProbe(); +}; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_advanced_settings.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_advanced_settings.cpp index cabcd5ded7..16b2891e27 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_advanced_settings.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_advanced_settings.cpp @@ -21,11 +21,10 @@ ****************************************************************************/ #include "../config.h" - -#if BOTH(TOUCH_UI_FTDI_EVE, TOUCH_UI_LULZBOT_BIO) - #include "screens.h" +#ifdef FTDI_BIO_ADVANCED_SETTINGS_MENU + using namespace FTDI; using namespace Theme; @@ -134,4 +133,4 @@ bool AdvancedSettingsMenu::onTouchEnd(uint8_t tag) { return true; } -#endif // TOUCH_UI_FTDI_EVE && TOUCH_UI_LULZBOT_BIO +#endif // FTDI_BIO_ADVANCED_SETTINGS_MENU diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_advanced_settings.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_advanced_settings.h new file mode 100644 index 0000000000..29a21fe5d9 --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_advanced_settings.h @@ -0,0 +1,32 @@ +/*************************** + * bio_advanced_settings.h * + ***************************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_BIO_ADVANCED_SETTINGS_MENU +#define FTDI_BIO_ADVANCED_SETTINGS_MENU_CLASS AdvancedSettingsMenu + +class AdvancedSettingsMenu : public BaseScreen, public CachedScreen { + public: + static void onRedraw(draw_mode_t); + static bool onTouchEnd(uint8_t tag); +}; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_confirm_home_e.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_confirm_home_e.cpp index 3f6b4116f1..3b55551375 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_confirm_home_e.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_confirm_home_e.cpp @@ -21,11 +21,10 @@ ****************************************************************************/ #include "../config.h" - -#if BOTH(TOUCH_UI_FTDI_EVE, TOUCH_UI_LULZBOT_BIO) - #include "screens.h" +#ifdef FTDI_BIO_CONFIRM_HOME_E + using namespace FTDI; void BioConfirmHomeE::onRedraw(draw_mode_t) { @@ -54,4 +53,4 @@ bool BioConfirmHomeE::onTouchEnd(uint8_t tag) { return true; } -#endif // TOUCH_UI_FTDI_EVE && TOUCH_UI_LULZBOT_BIO +#endif // FTDI_BIO_CONFIRM_HOME_E diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_confirm_home_e.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_confirm_home_e.h new file mode 100644 index 0000000000..151b784b93 --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_confirm_home_e.h @@ -0,0 +1,32 @@ +/**************************** + * bio_confirm_home_e.h * + ****************************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_BIO_CONFIRM_HOME_E +#define FTDI_BIO_CONFIRM_HOME_E_CLASS BioConfirmHomeE + +class BioConfirmHomeE : public DialogBoxBaseClass, public UncachedScreen { + public: + static void onRedraw(draw_mode_t); + static bool onTouchEnd(uint8_t tag); +}; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_confirm_home_xyz.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_confirm_home_xyz.cpp index f712fdfff9..f1abd2e76a 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_confirm_home_xyz.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_confirm_home_xyz.cpp @@ -21,11 +21,10 @@ ****************************************************************************/ #include "../config.h" - -#if BOTH(TOUCH_UI_FTDI_EVE, TOUCH_UI_LULZBOT_BIO) - #include "screens.h" +#ifdef FTDI_BIO_CONFIRM_HOME_XYZ + using namespace FTDI; void BioConfirmHomeXYZ::onRedraw(draw_mode_t) { @@ -53,4 +52,4 @@ bool BioConfirmHomeXYZ::onTouchEnd(uint8_t tag) { return true; } -#endif // TOUCH_UI_FTDI_EVE && TOUCH_UI_LULZBOT_BIO +#endif // FTDI_BIO_CONFIRM_HOME_XYZ diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_confirm_home_xyz.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_confirm_home_xyz.h new file mode 100644 index 0000000000..d8cb1cdb67 --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_confirm_home_xyz.h @@ -0,0 +1,32 @@ +/************************** + * bio_confirm_home_xyz.h * + **************************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_BIO_CONFIRM_HOME_XYZ +#define FTDI_BIO_CONFIRM_HOME_XYZ_CLASS BioConfirmHomeXYZ + +class BioConfirmHomeXYZ : public DialogBoxBaseClass, public UncachedScreen { + public: + static void onRedraw(draw_mode_t); + static bool onTouchEnd(uint8_t tag); +}; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_main_menu.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_main_menu.cpp index 53203cd35e..6897ceb914 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_main_menu.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_main_menu.cpp @@ -21,11 +21,10 @@ ****************************************************************************/ #include "../config.h" - -#if BOTH(TOUCH_UI_FTDI_EVE, TOUCH_UI_LULZBOT_BIO) - #include "screens.h" +#ifdef FTDI_BIO_MAIN_MENU + using namespace FTDI; using namespace Theme; @@ -85,4 +84,4 @@ bool MainMenu::onTouchEnd(uint8_t tag) { return true; } -#endif // TOUCH_UI_FTDI_EVE && TOUCH_UI_LULZBOT_BIO +#endif // FTDI_BIO_MAIN_MENU diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_main_menu.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_main_menu.h new file mode 100644 index 0000000000..fdf977fcbf --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_main_menu.h @@ -0,0 +1,32 @@ +/********************* + * bio_main_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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_BIO_MAIN_MENU +#define FTDI_BIO_MAIN_MENU_CLASS MainMenu + +class MainMenu : public BaseScreen, public CachedScreen { + public: + static void onRedraw(draw_mode_t); + static bool onTouchEnd(uint8_t tag); +}; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_printing_dialog_box.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_printing_dialog_box.cpp index fb8dc3edf3..7f81d49a27 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_printing_dialog_box.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_printing_dialog_box.cpp @@ -21,11 +21,10 @@ ****************************************************************************/ #include "../config.h" - -#if BOTH(TOUCH_UI_FTDI_EVE, TOUCH_UI_LULZBOT_BIO) - #include "screens.h" +#ifdef FTDI_BIO_PRINTING_DIALOG_BOX + #include "../ftdi_eve_lib/extras/circular_progress.h" using namespace FTDI; @@ -147,4 +146,4 @@ void BioPrintingDialogBox::show() { GOTO_SCREEN(BioPrintingDialogBox); } -#endif // TOUCH_UI_FTDI_EVE && TOUCH_UI_LULZBOT_BIO +#endif // FTDI_BIO_PRINTING_DIALOG_BOX diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_printing_dialog_box.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_printing_dialog_box.h new file mode 100644 index 0000000000..aebbd16128 --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_printing_dialog_box.h @@ -0,0 +1,44 @@ +/***************************** + * bio_printing_dialog_box.h * + *****************************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_BIO_PRINTING_DIALOG_BOX +#define FTDI_BIO_PRINTING_DIALOG_BOX_CLASS BioPrintingDialogBox + +class BioPrintingDialogBox : public BaseScreen, public CachedScreen { + private: + static void draw_status_message(draw_mode_t, const char * const); + static void draw_progress(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 show(); + + static void setStatusMessage(const char *); + static void setStatusMessage(progmem_str); + + static void onIdle(); + static bool onTouchEnd(uint8_t tag); +}; 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 90d8d6251d..f2bb5f3d3c 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 @@ -22,11 +22,10 @@ ****************************************************************************/ #include "../config.h" - -#if BOTH(TOUCH_UI_FTDI_EVE, TOUCH_UI_LULZBOT_BIO) - #include "screens.h" +#ifdef FTDI_BIO_STATUS_SCREEN + #include "../ftdi_eve_lib/extras/poly_ui.h" #if ENABLED(TOUCH_UI_PORTRAIT) @@ -376,4 +375,4 @@ void StatusScreen::onIdle() { } } -#endif // TOUCH_UI_FTDI_EVE +#endif // FTDI_BIO_STATUS_SCREEN diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_status_screen.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_status_screen.h new file mode 100644 index 0000000000..a3bbb60f6c --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_status_screen.h @@ -0,0 +1,56 @@ +/************************* + * bio_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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_BIO_STATUS_SCREEN +#define FTDI_BIO_STATUS_SCREEN_CLASS StatusScreen + +class StatusScreen : public BaseScreen, public CachedScreen { + private: + static float increment; + static bool jog_xy; + static bool fine_motion; + + static void draw_progress(draw_mode_t what); + static void draw_temperature(draw_mode_t what); + static void draw_syringe(draw_mode_t what); + static void draw_arrows(draw_mode_t what); + static void draw_overlay_icons(draw_mode_t what); + static void draw_fine_motion(draw_mode_t what); + static void draw_buttons(draw_mode_t what); + public: + static void loadBitmaps(); + static void unlockMotors(); + + static void setStatusMessage(const char *); + static void setStatusMessage(progmem_str); + + static void onRedraw(draw_mode_t); + + static bool onTouchStart(uint8_t tag); + static bool onTouchHeld(uint8_t tag); + static bool onTouchEnd(uint8_t tag); + static void onIdle(); + +}; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_tune_menu.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_tune_menu.cpp index dacc1cb6ea..806f7bd1af 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_tune_menu.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_tune_menu.cpp @@ -21,11 +21,10 @@ ****************************************************************************/ #include "../config.h" - -#if BOTH(TOUCH_UI_FTDI_EVE, TOUCH_UI_LULZBOT_BIO) - #include "screens.h" +#ifdef FTDI_BIO_TUNE_MENU + using namespace FTDI; using namespace Theme; using namespace ExtUI; @@ -76,4 +75,4 @@ bool TuneMenu::onTouchEnd(uint8_t tag) { return true; } -#endif // TOUCH_UI_FTDI_EVE && TOUCH_UI_LULZBOT_BIO +#endif // FTDI_BIO_TUNE_MENU diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_tune_menu.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_tune_menu.h new file mode 100644 index 0000000000..52fe694f37 --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_tune_menu.h @@ -0,0 +1,35 @@ +/******************* + * bio_tune_menu.h * + *******************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_BIO_TUNE_MENU +#define FTDI_BIO_TUNE_MENU_CLASS TuneMenu + +class TuneMenu : public BaseScreen, public CachedScreen { + private: + static void pausePrint(); + static void resumePrint(); + public: + static void onRedraw(draw_mode_t); + static bool onTouchEnd(uint8_t tag); +}; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/boot_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/boot_screen.cpp index a6a8705350..236830dbc4 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/boot_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/boot_screen.cpp @@ -22,11 +22,10 @@ ****************************************************************************/ #include "../config.h" - -#if ENABLED(TOUCH_UI_FTDI_EVE) - #include "screens.h" +#ifdef FTDI_BOOT_SCREEN + #include "../ftdi_eve_lib/extras/poly_ui.h" #include "../archim2-flash/flash_storage.h" @@ -127,4 +126,4 @@ void BootScreen::showSplashScreen() { ExtUI::delay_ms(2500); } -#endif // TOUCH_UI_FTDI_EVE +#endif // FTDI_BOOT_SCREEN diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/boot_screen.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/boot_screen.h new file mode 100644 index 0000000000..a267faba6a --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/boot_screen.h @@ -0,0 +1,35 @@ +/***************** + * boot_screen.h * + *****************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_BOOT_SCREEN +#define FTDI_BOOT_SCREEN_CLASS BootScreen + +class BootScreen : public BaseScreen, public UncachedScreen { + private: + static void showSplashScreen(); + public: + static void onRedraw(draw_mode_t); + static void onIdle(); +}; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/case_light_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/case_light_screen.cpp index 5b2b7d4116..04327128ab 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/case_light_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/case_light_screen.cpp @@ -20,11 +20,10 @@ ****************************************************************************/ #include "../config.h" - -#if BOTH(TOUCH_UI_FTDI_EVE, CASE_LIGHT_ENABLE) - #include "screens.h" +#ifdef FTDI_CASE_LIGHT_SCREEN + using namespace FTDI; using namespace ExtUI; using namespace Theme; @@ -59,4 +58,4 @@ bool CaseLightScreen::onTouchHeld(uint8_t tag) { return true; } -#endif // TOUCH_UI_FTDI_EVE +#endif // FTDI_CASE_LIGHT_SCREEN diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/case_light_screen.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/case_light_screen.h new file mode 100644 index 0000000000..55d5fe902f --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/case_light_screen.h @@ -0,0 +1,31 @@ +/*********************** + * case_light_screen.h * + ***********************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_CASE_LIGHT_SCREEN +#define FTDI_CASE_LIGHT_SCREEN_CLASS CaseLightScreen + +class CaseLightScreen : 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/change_filament_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/change_filament_screen.cpp index 624bb263eb..e9fa8a66d4 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/change_filament_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/change_filament_screen.cpp @@ -21,16 +21,17 @@ ****************************************************************************/ #include "../config.h" - -#if ENABLED(TOUCH_UI_FTDI_EVE) - #include "screens.h" #include "screen_data.h" +#ifdef FTDI_CHANGE_FILAMENT_SCREEN + using namespace ExtUI; using namespace FTDI; using namespace Theme; +constexpr static ChangeFilamentScreenData &mydata = screen_data.ChangeFilamentScreen; + #ifdef TOUCH_UI_PORTRAIT #define GRID_COLS 2 #define GRID_ROWS 11 @@ -122,17 +123,17 @@ void ChangeFilamentScreen::drawTempGradient(uint16_t x, uint16_t y, uint16_t w, void ChangeFilamentScreen::onEntry() { BaseScreen::onEntry(); - screen_data.ChangeFilament.e_tag = ExtUI::getActiveTool() + 10; - screen_data.ChangeFilament.t_tag = 0; - screen_data.ChangeFilament.repeat_tag = 0; - screen_data.ChangeFilament.saved_extruder = getActiveTool(); + mydata.e_tag = ExtUI::getActiveTool() + 10; + mydata.t_tag = 0; + mydata.repeat_tag = 0; + mydata.saved_extruder = getActiveTool(); #if FILAMENT_UNLOAD_PURGE_LENGTH > 0 - screen_data.ChangeFilament.need_purge = true; + mydata.need_purge = true; #endif } void ChangeFilamentScreen::onExit() { - setActiveTool(screen_data.ChangeFilament.saved_extruder, true); + setActiveTool(mydata.saved_extruder, true); } void ChangeFilamentScreen::onRedraw(draw_mode_t what) { @@ -170,7 +171,7 @@ void ChangeFilamentScreen::onRedraw(draw_mode_t what) { const bool t_ok = getActualTemp_celsius(e) > getSoftenTemp() - 10; - if (screen_data.ChangeFilament.t_tag && !t_ok) { + if (mydata.t_tag && !t_ok) { cmd.text(HEATING_LBL_POS, GET_TEXT_F(MSG_HEATING)); } else if (getActualTemp_celsius(e) > 100) { cmd.cmd(COLOR_RGB(0xFF0000)) @@ -181,12 +182,12 @@ void ChangeFilamentScreen::onRedraw(draw_mode_t what) { #define TOG_STYLE(A) colors(A ? action_btn : normal_btn) - const bool tog2 = screen_data.ChangeFilament.t_tag == 2; - const bool tog3 = screen_data.ChangeFilament.t_tag == 3; - const bool tog4 = screen_data.ChangeFilament.t_tag == 4; - const bool tog10 = screen_data.ChangeFilament.e_tag == 10; + const bool tog2 = mydata.t_tag == 2; + const bool tog3 = mydata.t_tag == 3; + const bool tog4 = mydata.t_tag == 4; + const bool tog10 = mydata.e_tag == 10; #if HAS_MULTI_HOTEND - const bool tog11 = screen_data.ChangeFilament.e_tag == 11; + const bool tog11 = mydata.e_tag == 11; #endif cmd.TOG_STYLE(tog10) @@ -200,8 +201,8 @@ void ChangeFilamentScreen::onRedraw(draw_mode_t what) { if (!t_ok) reset_menu_timeout(); - const bool tog7 = screen_data.ChangeFilament.repeat_tag == 7; - const bool tog8 = screen_data.ChangeFilament.repeat_tag == 8; + const bool tog7 = mydata.repeat_tag == 7; + const bool tog8 = mydata.repeat_tag == 8; { char str[30]; @@ -228,7 +229,7 @@ void ChangeFilamentScreen::onRedraw(draw_mode_t what) { } uint8_t ChangeFilamentScreen::getSoftenTemp() { - switch (screen_data.ChangeFilament.t_tag) { + switch (mydata.t_tag) { case 2: return LOW_TEMP; case 3: return MED_TEMP; case 4: return HIGH_TEMP; @@ -237,7 +238,7 @@ uint8_t ChangeFilamentScreen::getSoftenTemp() { } ExtUI::extruder_t ChangeFilamentScreen::getExtruder() { - switch (screen_data.ChangeFilament.e_tag) { + switch (mydata.e_tag) { case 13: return ExtUI::E3; case 12: return ExtUI::E2; case 11: return ExtUI::E1; @@ -248,8 +249,8 @@ ExtUI::extruder_t ChangeFilamentScreen::getExtruder() { void ChangeFilamentScreen::doPurge() { #if FILAMENT_UNLOAD_PURGE_LENGTH > 0 constexpr float purge_distance_mm = FILAMENT_UNLOAD_PURGE_LENGTH; - if (screen_data.ChangeFilament.need_purge) { - screen_data.ChangeFilament.need_purge = false; + if (mydata.need_purge) { + mydata.need_purge = false; MoveAxisScreen::setManualFeedrate(getExtruder(), purge_distance_mm); ExtUI::setAxisPosition_mm(ExtUI::getAxisPosition_mm(getExtruder()) + purge_distance_mm, getExtruder()); } @@ -277,23 +278,23 @@ bool ChangeFilamentScreen::onTouchEnd(uint8_t tag) { case 3: case 4: // Change temperature - screen_data.ChangeFilament.t_tag = tag; + mydata.t_tag = tag; setTargetTemp_celsius(getSoftenTemp(), getExtruder()); break; case 7: - screen_data.ChangeFilament.repeat_tag = (screen_data.ChangeFilament.repeat_tag == 7) ? 0 : 7; + mydata.repeat_tag = (mydata.repeat_tag == 7) ? 0 : 7; break; case 8: - screen_data.ChangeFilament.repeat_tag = (screen_data.ChangeFilament.repeat_tag == 8) ? 0 : 8; + mydata.repeat_tag = (mydata.repeat_tag == 8) ? 0 : 8; break; case 10: case 11: // Change extruder - screen_data.ChangeFilament.e_tag = tag; - screen_data.ChangeFilament.t_tag = 0; - screen_data.ChangeFilament.repeat_tag = 0; + mydata.e_tag = tag; + mydata.t_tag = 0; + mydata.repeat_tag = 0; #if FILAMENT_UNLOAD_PURGE_LENGTH > 0 - screen_data.ChangeFilament.need_purge = true; + mydata.need_purge = true; #endif setActiveTool(getExtruder(), true); break; @@ -319,7 +320,7 @@ bool ChangeFilamentScreen::onTouchHeld(uint8_t tag) { void ChangeFilamentScreen::onIdle() { reset_menu_timeout(); - if (screen_data.ChangeFilament.repeat_tag) onTouchHeld(screen_data.ChangeFilament.repeat_tag); + if (mydata.repeat_tag) onTouchHeld(mydata.repeat_tag); if (refresh_timer.elapsed(STATUS_UPDATE_INTERVAL)) { onRefresh(); refresh_timer.start(); @@ -327,4 +328,4 @@ void ChangeFilamentScreen::onIdle() { BaseScreen::onIdle(); } -#endif // TOUCH_UI_FTDI_EVE +#endif // FTDI_CHANGE_FILAMENT_SCREEN diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/change_filament_screen.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/change_filament_screen.h new file mode 100644 index 0000000000..43a4bae6e0 --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/change_filament_screen.h @@ -0,0 +1,51 @@ +/**************************** + * change_filament_screen.h * + ****************************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_CHANGE_FILAMENT_SCREEN +#define FTDI_CHANGE_FILAMENT_SCREEN_CLASS ChangeFilamentScreen + +struct ChangeFilamentScreenData { + uint8_t e_tag, t_tag, repeat_tag; + ExtUI::extruder_t saved_extruder; + #if FILAMENT_UNLOAD_PURGE_LENGTH > 0 + bool need_purge; + #endif +}; + +class ChangeFilamentScreen : public BaseScreen, public CachedScreen { + private: + static uint8_t getSoftenTemp(); + static ExtUI::extruder_t getExtruder(); + static void drawTempGradient(uint16_t x, uint16_t y, uint16_t w, uint16_t h); + static uint32_t getTempColor(uint32_t temp); + static void doPurge(); + public: + static void onEntry(); + static void onExit(); + static void onRedraw(draw_mode_t); + static bool onTouchStart(uint8_t tag); + static bool onTouchEnd(uint8_t tag); + static bool onTouchHeld(uint8_t tag); + static void onIdle(); +}; 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 656bf1db13..8d5a3d793a 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 @@ -21,11 +21,10 @@ ****************************************************************************/ #include "../config.h" - -#if BOTH(TOUCH_UI_FTDI_EVE, TOUCH_UI_COCOA_PRESS) - #include "screens.h" +#ifdef FTDI_COCOA_ADVANCED_SETTINGS_MENU + using namespace FTDI; using namespace ExtUI; using namespace Theme; @@ -99,4 +98,4 @@ bool AdvancedSettingsMenu::onTouchEnd(uint8_t tag) { } return true; } -#endif // TOUCH_UI_FTDI_EVE +#endif // FTDI_COCOA_ADVANCED_SETTINGS_MENU diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_advanced_settings_menu.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_advanced_settings_menu.h new file mode 100644 index 0000000000..08c0745321 --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_advanced_settings_menu.h @@ -0,0 +1,32 @@ +/*************************************** + * cocoa_press_advance_settings_menu.h * + ***************************************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_COCOA_ADVANCED_SETTINGS_MENU +#define FTDI_COCOA_ADVANCED_SETTINGS_MENU_CLASS AdvancedSettingsMenu + +class AdvancedSettingsMenu : public BaseScreen, public CachedScreen { + public: + static void onRedraw(draw_mode_t); + static bool onTouchEnd(uint8_t tag); +}; 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 index 36dc3404b9..23ad1b5da6 100644 --- 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 @@ -22,12 +22,11 @@ ****************************************************************************/ #include "../config.h" - -#if ENABLED(TOUCH_UI_FTDI_EVE) && ENABLED(TOUCH_UI_COCOA_PRESS) - #include "screens.h" #include "screen_data.h" +#ifdef FTDI_COCOA_LOAD_CHOCOLATE_SCREEN + using namespace ExtUI; using namespace FTDI; using namespace Theme; @@ -98,4 +97,4 @@ bool LoadChocolateScreen::onTouchHeld(uint8_t tag) { return false; } -#endif // TOUCH_UI_FTDI_EVE +#endif // FTDI_COCOA_LOAD_CHOCOLATE_SCREEN diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_load_chocolate.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_load_chocolate.h new file mode 100644 index 0000000000..262a6c9802 --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_load_chocolate.h @@ -0,0 +1,34 @@ +/******************************** + * cocoa_press_load_chocolate.h * + ********************************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_COCOA_LOAD_CHOCOLATE_SCREEN +#define FTDI_COCOA_LOAD_CHOCOLATE_SCREEN_CLASS LoadChocolateScreen + +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); +}; 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 9c8ad062aa..56981e3084 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 @@ -22,11 +22,10 @@ ****************************************************************************/ #include "../config.h" - -#if BOTH(TOUCH_UI_FTDI_EVE, TOUCH_UI_COCOA_PRESS) - #include "screens.h" +#ifdef FTDI_COCOA_MAIN_MENU + using namespace FTDI; using namespace Theme; @@ -86,4 +85,4 @@ bool MainMenu::onTouchEnd(uint8_t tag) { return true; } -#endif // TOUCH_UI_FTDI_EVE +#endif // FTDI_COCOA_MAIN_MENU diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_main_menu.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_main_menu.h new file mode 100644 index 0000000000..7c2bb5039a --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_main_menu.h @@ -0,0 +1,33 @@ +/*************************** + * cocoa_press_main_menu.h * + ***************************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_COCOA_MAIN_MENU +#define FTDI_COCOA_MAIN_MENU_CLASS MainMenu + +class MainMenu : public BaseScreen, public CachedScreen { + public: + static void onRedraw(draw_mode_t); + static bool onTouchEnd(uint8_t tag); +}; 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 index 61411afa1b..10660736fa 100644 --- 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 @@ -22,12 +22,11 @@ ****************************************************************************/ #include "../config.h" - -#if BOTH(TOUCH_UI_FTDI_EVE, TOUCH_UI_COCOA_PRESS) - #include "screens.h" #include "screen_data.h" +#ifdef FTDI_COCOA_MOVE_E_SCREEN + using namespace FTDI; using namespace ExtUI; @@ -59,4 +58,4 @@ void MoveEScreen::onIdle() { } BaseScreen::onIdle(); } -#endif // TOUCH_UI_FTDI_EVE +#endif // FTDI_COCOA_MOVE_E_SCREEN diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_move_e_screen.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_move_e_screen.h new file mode 100644 index 0000000000..e86a91a529 --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_move_e_screen.h @@ -0,0 +1,33 @@ +/******************************* + * cocoa_press_move_e_screen.h * + *******************************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_COCOA_MOVE_E_SCREEN +#define FTDI_COCOA_MOVE_E_SCREEN_CLASS MoveEScreen + +class MoveEScreen : public BaseMoveAxisScreen, public CachedScreen { + public: + static void onRedraw(draw_mode_t); + static void onIdle(); +}; 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 index 52a70448cd..c9442c9322 100644 --- 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 @@ -1,6 +1,6 @@ -/************************************ +/*********************************** * cocoa_press_move_xyz_screen.cpp * - ************************************/ + ***********************************/ /**************************************************************************** * Written By Mark Pelletier 2017 - Aleph Objects, Inc. * @@ -22,12 +22,11 @@ ****************************************************************************/ #include "../config.h" - -#if BOTH(TOUCH_UI_FTDI_EVE, TOUCH_UI_COCOA_PRESS) - #include "screens.h" #include "screen_data.h" +#ifdef FTDI_COCOA_MOVE_XYZ_SCREEN + using namespace FTDI; using namespace ExtUI; @@ -50,4 +49,4 @@ void MoveXYZScreen::onIdle() { } BaseScreen::onIdle(); } -#endif // TOUCH_UI_FTDI_EVE +#endif // FTDI_COCOA_MOVE_XYZ_SCREEN diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_move_xyz_screen.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_move_xyz_screen.h new file mode 100644 index 0000000000..9cbec113e6 --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_move_xyz_screen.h @@ -0,0 +1,33 @@ +/********************************* + * cocoa_press_move_xyz_screen.h * + *********************************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_COCOA_MOVE_XYZ_SCREEN +#define FTDI_COCOA_MOVE_XYZ_SCREEN_CLASS MoveXYZScreen + +class MoveXYZScreen : public BaseMoveAxisScreen, public CachedScreen { + public: + static void onRedraw(draw_mode_t); + static void onIdle(); +}; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_preheat_menu.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_preheat_menu.cpp index 99c0c1b664..d515b2a27b 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_preheat_menu.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_preheat_menu.cpp @@ -20,11 +20,10 @@ ****************************************************************************/ #include "../config.h" - -#if BOTH(TOUCH_UI_FTDI_EVE, TOUCH_UI_COCOA_PRESS) - #include "screens.h" +#ifdef FTDI_COCOA_PREHEAT_MENU + using namespace FTDI; using namespace ExtUI; using namespace Theme; @@ -110,4 +109,4 @@ bool PreheatMenu::onTouchEnd(uint8_t tag) { return true; } -#endif // TOUCH_UI_FTDI_EVE +#endif // FTDI_COCOA_PREHEAT_MENU diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_preheat_menu.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_preheat_menu.h new file mode 100644 index 0000000000..a109e42111 --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_preheat_menu.h @@ -0,0 +1,31 @@ +/****************************** + * cocoa_press_preheat_menu.h * + ******************************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_COCOA_PREHEAT_MENU +#define FTDI_COCOA_PREHEAT_MENU_CLASS PreheatMenu + +class PreheatMenu : public BaseScreen, public CachedScreen { + public: + static void onRedraw(draw_mode_t); + static bool onTouchEnd(uint8_t tag); +}; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_preheat_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_preheat_screen.cpp index c9caef6524..abea9dcdfe 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_preheat_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_preheat_screen.cpp @@ -20,18 +20,19 @@ ****************************************************************************/ #include "../config.h" - -#if BOTH(TOUCH_UI_FTDI_EVE, TOUCH_UI_COCOA_PRESS) - #include "screens.h" #include "screen_data.h" +#ifdef FTDI_COCOA_PREHEAT_SCREEN + #include "../ftdi_eve_lib/extras/circular_progress.h" using namespace FTDI; using namespace ExtUI; using namespace Theme; +constexpr static PreheatTimerScreenData &mydata = screen_data.PreheatTimerScreen; + #define GRID_COLS 2 #define GRID_ROWS 8 @@ -54,7 +55,7 @@ void PreheatTimerScreen::draw_message(draw_mode_t what) { } uint16_t PreheatTimerScreen::secondsRemaining() { - const uint32_t elapsed_sec = (millis() - screen_data.PreheatTimer.start_ms) / 1000; + const uint32_t elapsed_sec = (millis() - mydata.start_ms) / 1000; return (COCOA_PRESS_PREHEAT_SECONDS > elapsed_sec) ? COCOA_PRESS_PREHEAT_SECONDS - elapsed_sec : 0; } @@ -118,7 +119,7 @@ void PreheatTimerScreen::draw_adjuster(draw_mode_t what, uint8_t tag, progmem_st } void PreheatTimerScreen::onEntry() { - screen_data.PreheatTimer.start_ms = millis(); + mydata.start_ms = millis(); } void PreheatTimerScreen::onRedraw(draw_mode_t what) { @@ -169,4 +170,4 @@ void PreheatTimerScreen::onIdle() { BaseScreen::onIdle(); } -#endif // TOUCH_UI_FTDI_EVE +#endif // FTDI_COCOA_PREHEAT_SCREEN diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_preheat_screen.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_preheat_screen.h new file mode 100644 index 0000000000..e91340a3aa --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_preheat_screen.h @@ -0,0 +1,46 @@ +/********************************* + * cocoapress_preheat_screen.cpp * + *********************************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_COCOA_PREHEAT_SCREEN +#define FTDI_COCOA_PREHEAT_SCREEN_CLASS PreheatTimerScreen + +struct PreheatTimerScreenData { + uint32_t start_ms; +}; + +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); +}; 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 index d9881d747a..f7d44e2936 100644 --- 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 @@ -22,11 +22,10 @@ ****************************************************************************/ #include "../config.h" - -#if BOTH(TOUCH_UI_FTDI_EVE, TOUCH_UI_COCOA_PRESS) - #include "screens.h" +#ifdef FTDI_COCOA_STATUS_SCREEN + #include "../ftdi_eve_lib/extras/poly_ui.h" #include "cocoa_press_ui.h" @@ -304,4 +303,4 @@ void StatusScreen::onIdle() { } } -#endif // TOUCH_UI_FTDI_EVE +#endif // FTDI_COCOA_STATUS_SCREEN diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_status_screen.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_status_screen.h new file mode 100644 index 0000000000..b22bceac14 --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_status_screen.h @@ -0,0 +1,55 @@ +/******************************* + * cocoa_press_status_screen.h * + *******************************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_COCOA_STATUS_SCREEN +#define FTDI_COCOA_STATUS_SCREEN_CLASS StatusScreen + +class StatusScreen : public BaseScreen, public CachedScreen { + private: + static float increment; + static bool jog_xy; + static bool fine_motion; + + static void draw_progress(draw_mode_t what); + static void draw_temperature(draw_mode_t what); + static void draw_syringe(draw_mode_t what); + static void draw_arrows(draw_mode_t what); + static void draw_overlay_icons(draw_mode_t what); + static void draw_fine_motion(draw_mode_t what); + static void draw_buttons(draw_mode_t what); + public: + static void loadBitmaps(); + static void unlockMotors(); + + static void setStatusMessage(const char *); + static void setStatusMessage(progmem_str); + + static void onRedraw(draw_mode_t); + + static bool onTouchStart(uint8_t tag); + static bool onTouchHeld(uint8_t tag); + static bool onTouchEnd(uint8_t tag); + static void onIdle(); +}; 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 index 2e71093370..3428c38bb1 100644 --- 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 @@ -22,12 +22,11 @@ ****************************************************************************/ #include "../config.h" - -#if ENABLED(TOUCH_UI_FTDI_EVE) && ENABLED(TOUCH_UI_COCOA_PRESS) - #include "screens.h" #include "screen_data.h" +#ifdef FTDI_COCOA_UNLOAD_CARTRIDGE_SCREEN + using namespace ExtUI; using namespace FTDI; using namespace Theme; @@ -98,4 +97,4 @@ bool UnloadCartridgeScreen::onTouchHeld(uint8_t tag) { return false; } -#endif // TOUCH_UI_FTDI_EVE +#endif // FTDI_COCOA_UNLOAD_CARTRIDGE_SCREEN diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_unload_cartridge.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_unload_cartridge.h new file mode 100644 index 0000000000..95a9ee47ec --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/cocoa_press_unload_cartridge.h @@ -0,0 +1,34 @@ +/********************************** + * cocoa_press_unload_cartridge.h * + **********************************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_COCOA_UNLOAD_CARTRIDGE_SCREEN +#define FTDI_COCOA_UNLOAD_CARTRIDGE_SCREEN_CLASS UnloadCartridgeScreen + +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); +}; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/confirm_abort_print_dialog_box.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/confirm_abort_print_dialog_box.cpp index 528d93d5d1..dba565189a 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/confirm_abort_print_dialog_box.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/confirm_abort_print_dialog_box.cpp @@ -21,11 +21,10 @@ ****************************************************************************/ #include "../config.h" - -#if ENABLED(TOUCH_UI_FTDI_EVE) - #include "screens.h" +#ifdef FTDI_CONFIRM_ABORT_PRINT_DIALOG_BOX + #include "../../../../../feature/host_actions.h" using namespace ExtUI; @@ -50,4 +49,4 @@ bool ConfirmAbortPrintDialogBox::onTouchEnd(uint8_t tag) { } } -#endif // TOUCH_UI_FTDI_EVE +#endif // FTDI_CONFIRM_ABORT_PRINT_DIALOG_BOX diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/confirm_abort_print_dialog_box.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/confirm_abort_print_dialog_box.h new file mode 100644 index 0000000000..a97a2000a0 --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/confirm_abort_print_dialog_box.h @@ -0,0 +1,32 @@ +/************************************ + * confirm_abort_print_dialog_box.h * + ************************************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_CONFIRM_ABORT_PRINT_DIALOG_BOX +#define FTDI_CONFIRM_ABORT_PRINT_DIALOG_BOX_CLASS ConfirmAbortPrintDialogBox + +class ConfirmAbortPrintDialogBox : public DialogBoxBaseClass, public UncachedScreen { + public: + static void onRedraw(draw_mode_t); + static bool onTouchEnd(uint8_t tag); +}; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/confirm_auto_calibration_dialog_box.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/confirm_auto_calibration_dialog_box.cpp index f7c85672af..65b5140ccb 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/confirm_auto_calibration_dialog_box.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/confirm_auto_calibration_dialog_box.cpp @@ -21,11 +21,10 @@ ****************************************************************************/ #include "../config.h" - -#if BOTH(TOUCH_UI_FTDI_EVE, CALIBRATION_GCODE) - #include "screens.h" +#ifdef FTDI_CONFIRM_AUTO_CALIBRATION_DIALOG_BOX + using namespace ExtUI; using namespace Theme; @@ -45,4 +44,4 @@ bool ConfirmAutoCalibrationDialogBox::onTouchEnd(uint8_t tag) { } } -#endif // TOUCH_UI_FTDI_EVE +#endif // FTDI_CONFIRM_AUTO_CALIBRATION_DIALOG_BOX diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/confirm_auto_calibration_dialog_box.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/confirm_auto_calibration_dialog_box.h new file mode 100644 index 0000000000..5093b68c73 --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/confirm_auto_calibration_dialog_box.h @@ -0,0 +1,32 @@ +/***************************************** + * confirm_auto_calibration_dialog_box.h * + *****************************************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_CONFIRM_AUTO_CALIBRATION_DIALOG_BOX +#define FTDI_CONFIRM_AUTO_CALIBRATION_DIALOG_BOX_CLASS ConfirmAutoCalibrationDialogBox + +class ConfirmAutoCalibrationDialogBox : public DialogBoxBaseClass, public UncachedScreen { + public: + static void onRedraw(draw_mode_t); + static bool onTouchEnd(uint8_t tag); +}; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/confirm_erase_flash_dialog_box.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/confirm_erase_flash_dialog_box.cpp index baf5959c1b..13d61005e8 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/confirm_erase_flash_dialog_box.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/confirm_erase_flash_dialog_box.cpp @@ -21,11 +21,10 @@ ****************************************************************************/ #include "../config.h" - -#if BOTH(TOUCH_UI_FTDI_EVE, TOUCH_UI_DEVELOPER_MENU) - #include "screens.h" +#ifdef FTDI_CONFIRM_ERASE_FLASH_DIALOG_BOX + #include "../archim2-flash/flash_storage.h" using namespace FTDI; @@ -51,4 +50,4 @@ bool ConfirmEraseFlashDialogBox::onTouchEnd(uint8_t tag) { } } -#endif // TOUCH_UI_FTDI_EVE +#endif // FTDI_CONFIRM_ERASE_FLASH_DIALOG_BOX diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/confirm_erase_flash_dialog_box.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/confirm_erase_flash_dialog_box.h new file mode 100644 index 0000000000..a06f886176 --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/confirm_erase_flash_dialog_box.h @@ -0,0 +1,32 @@ +/************************************ + * confirm_erase_flash_dialog_box.h * + ************************************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_CONFIRM_ERASE_FLASH_DIALOG_BOX +#define FTDI_CONFIRM_ERASE_FLASH_DIALOG_BOX_CLASS ConfirmEraseFlashDialogBox + +class ConfirmEraseFlashDialogBox : public DialogBoxBaseClass, public UncachedScreen { + public: + static void onRedraw(draw_mode_t); + static bool onTouchEnd(uint8_t tag); +}; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/confirm_start_print_dialog_box.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/confirm_start_print_dialog_box.cpp index eeca88f280..86e7e33035 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/confirm_start_print_dialog_box.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/confirm_start_print_dialog_box.cpp @@ -21,16 +21,17 @@ ****************************************************************************/ #include "../config.h" - -#if ENABLED(TOUCH_UI_FTDI_EVE) - #include "screens.h" #include "screen_data.h" +#ifdef FTDI_CONFIRM_START_PRINT_DIALOG_BOX + using namespace FTDI; using namespace Theme; using namespace ExtUI; +constexpr static ConfirmStartPrintDialogBoxData &mydata = screen_data.ConfirmStartPrintDialogBox; + void ConfirmStartPrintDialogBox::onRedraw(draw_mode_t) { const char *filename = getLongFilename(); char buffer[strlen_P(GET_TEXT(MSG_START_PRINT_CONFIRMATION)) + strlen(filename) + 1]; @@ -53,13 +54,13 @@ bool ConfirmStartPrintDialogBox::onTouchEnd(uint8_t tag) { const char *ConfirmStartPrintDialogBox::getFilename(bool longName) { FileList files; - files.seek(screen_data.ConfirmStartPrintDialog.file_index, true); + files.seek(mydata.file_index, true); return longName ? files.longFilename() : files.shortFilename(); } void ConfirmStartPrintDialogBox::show(uint8_t file_index) { - screen_data.ConfirmStartPrintDialog.file_index = file_index; + mydata.file_index = file_index; GOTO_SCREEN(ConfirmStartPrintDialogBox); } -#endif // TOUCH_UI_FTDI_EVE +#endif // FTDI_CONFIRM_START_PRINT_DIALOG_BOX diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/confirm_start_print_dialog_box.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/confirm_start_print_dialog_box.h new file mode 100644 index 0000000000..e073ed55fa --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/confirm_start_print_dialog_box.h @@ -0,0 +1,43 @@ +/************************************ + * confirm_start_print_dialog_box.h * + ************************************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_CONFIRM_START_PRINT_DIALOG_BOX +#define FTDI_CONFIRM_START_PRINT_DIALOG_BOX_CLASS ConfirmStartPrintDialogBox + +struct ConfirmStartPrintDialogBoxData { + uint8_t file_index; +}; + +class ConfirmStartPrintDialogBox : public DialogBoxBaseClass, public UncachedScreen { + private: + inline static const char *getShortFilename() {return getFilename(false);} + inline static const char *getLongFilename() {return getFilename(true);} + + static const char *getFilename(bool longName); + public: + static void onRedraw(draw_mode_t); + static bool onTouchEnd(uint8_t); + + static void show(uint8_t file_index); +}; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/confirm_user_request_alert_box.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/confirm_user_request_alert_box.cpp index 59e1c8220d..957c95f047 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/confirm_user_request_alert_box.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/confirm_user_request_alert_box.cpp @@ -21,12 +21,11 @@ ****************************************************************************/ #include "../config.h" - -#if ENABLED(TOUCH_UI_FTDI_EVE) - #include "screens.h" #include "screen_data.h" +#ifdef FTDI_CONFIRM_USER_REQUEST_ALERT_BOX + using namespace FTDI; void ConfirmUserRequestAlertBox::onRedraw(draw_mode_t mode) { @@ -54,7 +53,7 @@ bool ConfirmUserRequestAlertBox::onTouchEnd(uint8_t tag) { void ConfirmUserRequestAlertBox::show(const char* msg) { drawMessage(msg); storeBackground(); - screen_data.AlertDialog.isError = false; + screen_data.AlertDialogBox.isError = false; GOTO_SCREEN(ConfirmUserRequestAlertBox); } @@ -63,4 +62,4 @@ void ConfirmUserRequestAlertBox::hide() { GOTO_PREVIOUS(); } -#endif // TOUCH_UI_FTDI_EVE +#endif // FTDI_CONFIRM_USER_REQUEST_ALERT_BOX diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/confirm_user_request_alert_box.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/confirm_user_request_alert_box.h new file mode 100644 index 0000000000..d9a6c4a4fe --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/confirm_user_request_alert_box.h @@ -0,0 +1,35 @@ +/************************************ + * confirm_user_request_alert_box.h * + ************************************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_CONFIRM_USER_REQUEST_ALERT_BOX +#define FTDI_CONFIRM_USER_REQUEST_ALERT_BOX_CLASS ConfirmUserRequestAlertBox + +class ConfirmUserRequestAlertBox : public AlertDialogBox { + public: + static void onRedraw(draw_mode_t); + static bool onTouchEnd(uint8_t); + static void hide(); + static void show(const char*); + static void onIdle(); +}; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/custom_user_menus.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/custom_user_menus.cpp index 20f90d5a41..9c7c12e10b 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/custom_user_menus.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/custom_user_menus.cpp @@ -21,11 +21,10 @@ */ #include "../config.h" - -#if BOTH(TOUCH_UI_FTDI_EVE, CUSTOM_USER_MENUS) && NONE(TOUCH_UI_LULZBOT_BIO, TOUCH_UI_COCOA_PRESS) - #include "screens.h" +#ifdef FTDI_CUSTOM_USER_MENUS + using namespace FTDI; using namespace ExtUI; using namespace Theme; @@ -212,4 +211,4 @@ bool CustomUserMenus::onTouchEnd(uint8_t tag) { return true; } -#endif // TOUCH_UI_FTDI_EVE && CUSTOM_USER_MENUS && !TOUCH_UI_LULZBOT_BIO && !TOUCH_UI_COCOA_PRESS +#endif // FTDI_CUSTOM_USER_MENUS diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/custom_user_menus.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/custom_user_menus.h new file mode 100644 index 0000000000..e46a280369 --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/custom_user_menus.h @@ -0,0 +1,32 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +#pragma once + +#define FTDI_CUSTOM_USER_MENUS +#define FTDI_CUSTOM_USER_MENUS_CLASS CustomUserMenus + +class CustomUserMenus : public BaseScreen, public CachedScreen { + public: + static void onRedraw(draw_mode_t); + static bool onTouchEnd(uint8_t tag); +}; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/default_acceleration_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/default_acceleration_screen.cpp index de617d4374..6178228d09 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/default_acceleration_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/default_acceleration_screen.cpp @@ -21,11 +21,10 @@ ****************************************************************************/ #include "../config.h" - -#if ENABLED(TOUCH_UI_FTDI_EVE) - #include "screens.h" +#ifdef FTDI_DEFAULT_ACCELERATION_SCREEN + using namespace FTDI; using namespace ExtUI; using namespace Theme; @@ -60,4 +59,4 @@ bool DefaultAccelerationScreen::onTouchHeld(uint8_t tag) { return true; } -#endif // TOUCH_UI_FTDI_EVE +#endif // FTDI_DEFAULT_ACCELERATION_SCREEN diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/default_acceleration_screen.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/default_acceleration_screen.h new file mode 100644 index 0000000000..9042f6d2b8 --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/default_acceleration_screen.h @@ -0,0 +1,32 @@ +/********************************* + * default_acceleration_screen.h * + *********************************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_DEFAULT_ACCELERATION_SCREEN +#define FTDI_DEFAULT_ACCELERATION_SCREEN_CLASS DefaultAccelerationScreen + +class DefaultAccelerationScreen : 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/developer_menu.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/developer_menu.cpp index 9df060a6c4..0bbce08a2b 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/developer_menu.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/developer_menu.cpp @@ -21,11 +21,10 @@ ****************************************************************************/ #include "../config.h" - -#if BOTH(TOUCH_UI_FTDI_EVE, TOUCH_UI_DEVELOPER_MENU) - #include "screens.h" +#ifdef FTDI_DEVELOPER_MENU + #include "../archim2-flash/flash_storage.h" using namespace FTDI; @@ -147,4 +146,4 @@ bool DeveloperMenu::onTouchEnd(uint8_t tag) { return true; } -#endif // TOUCH_UI_FTDI_EVE +#endif // FTDI_DEVELOPER_MENU diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/developer_menu.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/developer_menu.h new file mode 100644 index 0000000000..8757248329 --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/developer_menu.h @@ -0,0 +1,32 @@ +/******************** + * developer_menu.h * + ********************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_DEVELOPER_MENU +#define FTDI_DEVELOPER_MENU_CLASS DeveloperMenu + +class DeveloperMenu : public BaseScreen, public UncachedScreen { + public: + static void onRedraw(draw_mode_t); + static bool onTouchEnd(uint8_t tag); +}; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/dialog_box_base_class.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/dialog_box_base_class.cpp index 6fe7be492d..feaebb77be 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/dialog_box_base_class.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/dialog_box_base_class.cpp @@ -21,11 +21,10 @@ ****************************************************************************/ #include "../config.h" - -#if ENABLED(TOUCH_UI_FTDI_EVE) - #include "screens.h" +#ifdef FTDI_DIALOG_BOX_BASE_CLASS + using namespace FTDI; using namespace Theme; @@ -84,4 +83,4 @@ void DialogBoxBaseClass::onIdle() { reset_menu_timeout(); } -#endif // TOUCH_UI_FTDI_EVE +#endif // FTDI_DIALOG_BOX_BASE_CLASS diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/dialog_box_base_class.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/dialog_box_base_class.h new file mode 100644 index 0000000000..ef5e6b569b --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/dialog_box_base_class.h @@ -0,0 +1,40 @@ +/*************************** + * dialog_box_base_class.h * + ***************************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_DIALOG_BOX_BASE_CLASS +#define FTDI_DIALOG_BOX_BASE_CLASS_CLASS DialogBoxBaseClass + +class DialogBoxBaseClass : public BaseScreen { + protected: + template static void drawMessage(const T, int16_t font = 0); + static void drawYesNoButtons(uint8_t default_btn = 0); + static void drawOkayButton(); + static void drawSpinner(); + static void drawButton(const progmem_str); + + static void onRedraw(draw_mode_t) {}; + public: + static bool onTouchEnd(uint8_t tag); + static void onIdle(); +}; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/display_tuning_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/display_tuning_screen.cpp index 1a4d9fd705..62a329e907 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/display_tuning_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/display_tuning_screen.cpp @@ -21,11 +21,10 @@ ****************************************************************************/ #include "../config.h" - -#if ENABLED(TOUCH_UI_FTDI_EVE) - #include "screens.h" +#ifdef FTDI_DISPLAY_TUNING_SCREEN + using namespace FTDI; using namespace Theme; @@ -58,4 +57,4 @@ bool DisplayTuningScreen::onTouchHeld(uint8_t tag) { return true; } -#endif // TOUCH_UI_FTDI_EVE +#endif // FTDI_DISPLAY_TUNING_SCREEN diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/display_tuning_screen.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/display_tuning_screen.h new file mode 100644 index 0000000000..3de840b82e --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/display_tuning_screen.h @@ -0,0 +1,32 @@ +/*************************** + * display_tuning_screen.h * + ***************************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_DISPLAY_TUNING_SCREEN +#define FTDI_DISPLAY_TUNING_SCREEN_CLASS DisplayTuningScreen + +class DisplayTuningScreen : 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/endstop_state_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/endstop_state_screen.cpp index a091197a87..3648321dce 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/endstop_state_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/endstop_state_screen.cpp @@ -21,11 +21,10 @@ ****************************************************************************/ #include "../config.h" - -#if ENABLED(TOUCH_UI_FTDI_EVE) - #include "screens.h" +#ifdef FTDI_ENDSTOP_STATE_SCREEN + using namespace FTDI; using namespace Theme; using namespace ExtUI; @@ -149,4 +148,4 @@ void EndstopStatesScreen::onIdle() { BaseScreen::onIdle(); } -#endif // TOUCH_UI_FTDI_EVE +#endif // FTDI_ENDSTOP_STATE_SCREEN diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/endstop_state_screen.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/endstop_state_screen.h new file mode 100644 index 0000000000..c0eaccbe01 --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/endstop_state_screen.h @@ -0,0 +1,35 @@ +/************************** + * endstop_state_screen.h * + **************************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_ENDSTOP_STATE_SCREEN +#define FTDI_ENDSTOP_STATE_SCREEN_CLASS EndstopStatesScreen + +class EndstopStatesScreen : public BaseScreen, public UncachedScreen { + public: + static void onEntry(); + static void onExit(); + static void onRedraw(draw_mode_t); + static bool onTouchEnd(uint8_t tag); + static void onIdle(); +}; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/feedrate_percent_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/feedrate_percent_screen.cpp index 28f0e6a731..8b3984aa01 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/feedrate_percent_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/feedrate_percent_screen.cpp @@ -21,11 +21,10 @@ ****************************************************************************/ #include "../config.h" - -#if ENABLED(TOUCH_UI_FTDI_EVE) - #include "screens.h" +#ifdef FTDI_FEEDRATE_PERCENT_SCREEN + using namespace FTDI; using namespace ExtUI; @@ -49,4 +48,4 @@ bool FeedratePercentScreen::onTouchHeld(uint8_t tag) { return true; } -#endif // TOUCH_UI_FTDI_EVE +#endif // FTDI_FEEDRATE_PERCENT_SCREEN diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/feedrate_percent_screen.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/feedrate_percent_screen.h new file mode 100644 index 0000000000..076cfe97ca --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/feedrate_percent_screen.h @@ -0,0 +1,32 @@ +/***************************** + * feedrate_percent_screen.h * + *****************************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_FEEDRATE_PERCENT_SCREEN +#define FTDI_FEEDRATE_PERCENT_SCREEN_CLASS FeedratePercentScreen + +class FeedratePercentScreen : 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/filament_menu.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/filament_menu.cpp index f63fc416dd..cf63a1a124 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/filament_menu.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/filament_menu.cpp @@ -21,11 +21,10 @@ ****************************************************************************/ #include "../config.h" - -#if ENABLED(TOUCH_UI_FTDI_EVE) && ANY(LIN_ADVANCE, FILAMENT_RUNOUT_SENSOR) - #include "screens.h" +#ifdef FTDI_FILAMENT_MENU + using namespace FTDI; using namespace ExtUI; using namespace Theme; @@ -82,4 +81,4 @@ bool FilamentMenu::onTouchEnd(uint8_t tag) { return true; } -#endif // TOUCH_UI_FTDI_EVE +#endif // FTDI_FILAMENT_MENU diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/filament_menu.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/filament_menu.h new file mode 100644 index 0000000000..73ceec29a5 --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/filament_menu.h @@ -0,0 +1,32 @@ +/******************* + * filament_menu.h * + *******************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_FILAMENT_MENU +#define FTDI_FILAMENT_MENU_CLASS FilamentMenu + +class FilamentMenu : public BaseNumericAdjustmentScreen, public CachedScreen { + public: + static void onRedraw(draw_mode_t); + static bool onTouchEnd(uint8_t tag); +}; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/filament_runout_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/filament_runout_screen.cpp index 41e3be22ef..069686b541 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/filament_runout_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/filament_runout_screen.cpp @@ -21,11 +21,10 @@ ****************************************************************************/ #include "../config.h" - -#if BOTH(TOUCH_UI_FTDI_EVE, FILAMENT_RUNOUT_SENSOR) - #include "screens.h" +#ifdef FTDI_FILAMENT_RUNOUT_SCREEN + using namespace FTDI; using namespace ExtUI; using namespace Theme; @@ -62,4 +61,4 @@ bool FilamentRunoutScreen::onTouchHeld(uint8_t tag) { return true; } -#endif // TOUCH_UI_FTDI_EVE +#endif // FTDI_FILAMENT_RUNOUT_SCREEN diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/filament_runout_screen.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/filament_runout_screen.h new file mode 100644 index 0000000000..ebe7d020cb --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/filament_runout_screen.h @@ -0,0 +1,32 @@ +/**************************** + * filament_runout_screen.h * + ****************************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_FILAMENT_RUNOUT_SCREEN +#define FTDI_FILAMENT_RUNOUT_SCREEN_CLASS FilamentRunoutScreen + +class FilamentRunoutScreen : 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/files_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/files_screen.cpp index cadc582267..c8febfd7d8 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/files_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/files_screen.cpp @@ -21,19 +21,20 @@ ****************************************************************************/ #include "../config.h" - -#if BOTH(TOUCH_UI_FTDI_EVE, SDSUPPORT) - #include "screens.h" #include "screen_data.h" +#ifdef FTDI_FILES_SCREEN + using namespace FTDI; using namespace ExtUI; using namespace Theme; +constexpr static FilesScreenData &mydata = screen_data.FilesScreen; + void FilesScreen::onEntry() { - screen_data.Files.cur_page = 0; - screen_data.Files.selected_tag = 0xFF; + mydata.cur_page = 0; + mydata.selected_tag = 0xFF; #if ENABLED(SCROLL_LONG_FILENAMES) && (FTDI_API_LEVEL >= 810) CLCD::mem_write_32(CLCD::REG::MACRO_0,DL::NOP); #endif @@ -50,21 +51,21 @@ const char *FilesScreen::getSelectedFilename(bool longName) { void FilesScreen::drawSelectedFile() { FileList files; files.seek(getSelectedFileIndex(), true); - screen_data.Files.flags.is_dir = files.isDir(); + mydata.flags.is_dir = files.isDir(); drawFileButton( files.filename(), - screen_data.Files.selected_tag, - screen_data.Files.flags.is_dir, + mydata.selected_tag, + mydata.flags.is_dir, true ); } uint16_t FilesScreen::getSelectedFileIndex() { - return getFileForTag(screen_data.Files.selected_tag); + return getFileForTag(mydata.selected_tag); } uint16_t FilesScreen::getFileForTag(uint8_t tag) { - return screen_data.Files.cur_page * files_per_page + tag - 2; + return mydata.cur_page * files_per_page + tag - 2; } #if ENABLED(TOUCH_UI_PORTRAIT) @@ -106,15 +107,15 @@ void FilesScreen::drawFileButton(const char* filename, uint8_t tag, bool is_dir, void FilesScreen::drawFileList() { FileList files; - screen_data.Files.num_page = max(1,ceil(float(files.count()) / files_per_page)); - screen_data.Files.cur_page = min(screen_data.Files.cur_page, screen_data.Files.num_page-1); - screen_data.Files.flags.is_root = files.isAtRootDir(); + mydata.num_page = max(1,ceil(float(files.count()) / files_per_page)); + mydata.cur_page = min(mydata.cur_page, mydata.num_page-1); + mydata.flags.is_root = files.isAtRootDir(); #undef MARGIN_T #undef MARGIN_B #define MARGIN_T 0 #define MARGIN_B 0 - uint16_t fileIndex = screen_data.Files.cur_page * files_per_page; + uint16_t fileIndex = mydata.cur_page * files_per_page; for (uint8_t i = 0; i < files_per_page; i++, fileIndex++) { if (files.seek(fileIndex)) { drawFileButton(files.filename(), getTagForLine(i), files.isDir(), false); @@ -126,8 +127,8 @@ void FilesScreen::drawFileList() { } void FilesScreen::drawHeader() { - const bool prev_enabled = screen_data.Files.cur_page > 0; - const bool next_enabled = screen_data.Files.cur_page < (screen_data.Files.num_page - 1); + const bool prev_enabled = mydata.cur_page > 0; + const bool next_enabled = mydata.cur_page < (mydata.num_page - 1); #undef MARGIN_T #undef MARGIN_B @@ -136,7 +137,7 @@ void FilesScreen::drawHeader() { char str[16]; sprintf_P(str, PSTR("Page %d of %d"), - screen_data.Files.cur_page + 1, screen_data.Files.num_page); + mydata.cur_page + 1, mydata.num_page); CommandProcessor cmd; cmd.colors(normal_btn) @@ -158,8 +159,8 @@ void FilesScreen::drawFooter() { #define MARGIN_T 5 #define MARGIN_B 5 #endif - const bool has_selection = screen_data.Files.selected_tag != 0xFF; - const uint8_t back_tag = screen_data.Files.flags.is_root ? 240 : 245; + const bool has_selection = mydata.selected_tag != 0xFF; + const uint8_t back_tag = mydata.flags.is_root ? 240 : 245; const uint8_t y = GRID_ROWS - footer_h + 1; const uint8_t h = footer_h; @@ -171,7 +172,7 @@ void FilesScreen::drawFooter() { .enabled(has_selection) .colors(has_selection ? action_btn : normal_btn); - if (screen_data.Files.flags.is_dir) + if (mydata.flags.is_dir) cmd.tag(244).button(BTN_POS(1, y), BTN_SIZE(3,h), GET_TEXT_F(MSG_BUTTON_OPEN)); else cmd.tag(243).button(BTN_POS(1, y), BTN_SIZE(3,h), GET_TEXT_F(MSG_BUTTON_PRINT)); @@ -186,8 +187,8 @@ void FilesScreen::onRedraw(draw_mode_t what) { } void FilesScreen::gotoPage(uint8_t page) { - screen_data.Files.selected_tag = 0xFF; - screen_data.Files.cur_page = page; + mydata.selected_tag = 0xFF; + mydata.cur_page = page; CommandProcessor cmd; cmd.cmd(CMD_DLSTART) .cmd(CLEAR_COLOR_RGB(bg_color)) @@ -201,13 +202,13 @@ bool FilesScreen::onTouchEnd(uint8_t tag) { switch (tag) { case 240: GOTO_PREVIOUS(); return true; case 241: - if (screen_data.Files.cur_page > 0) { - gotoPage(screen_data.Files.cur_page-1); + if (mydata.cur_page > 0) { + gotoPage(mydata.cur_page-1); } break; case 242: - if (screen_data.Files.cur_page < (screen_data.Files.num_page-1)) { - gotoPage(screen_data.Files.cur_page+1); + if (mydata.cur_page < (mydata.num_page-1)) { + gotoPage(mydata.cur_page+1); } break; case 243: @@ -229,18 +230,18 @@ bool FilesScreen::onTouchEnd(uint8_t tag) { break; default: if (tag < 240) { - screen_data.Files.selected_tag = tag; + mydata.selected_tag = tag; #if ENABLED(SCROLL_LONG_FILENAMES) && (FTDI_API_LEVEL >= 810) if (FTDI::ftdi_chip >= 810) { const char *longFilename = getSelectedLongFilename(); if (longFilename[0]) { CommandProcessor cmd; uint16_t text_width = cmd.font(font_medium).text_width(longFilename); - screen_data.Files.scroll_pos = 0; + mydata.scroll_pos = 0; if (text_width > display_width) - screen_data.Files.scroll_max = text_width - display_width + MARGIN_L + MARGIN_R; + mydata.scroll_max = text_width - display_width + MARGIN_L + MARGIN_R; else - screen_data.Files.scroll_max = 0; + mydata.scroll_max = 0; } } #endif @@ -254,11 +255,11 @@ void FilesScreen::onIdle() { #if ENABLED(SCROLL_LONG_FILENAMES) && (FTDI_API_LEVEL >= 810) if (FTDI::ftdi_chip >= 810) { CLCD::mem_write_32(CLCD::REG::MACRO_0, - VERTEX_TRANSLATE_X(-int32_t(screen_data.Files.scroll_pos))); - if (screen_data.Files.scroll_pos < screen_data.Files.scroll_max * 16) - screen_data.Files.scroll_pos++; + VERTEX_TRANSLATE_X(-int32_t(mydata.scroll_pos))); + if (mydata.scroll_pos < mydata.scroll_max * 16) + mydata.scroll_pos++; } #endif } -#endif // TOUCH_UI_FTDI_EVE +#endif // FTDI_FILES_SCREEN diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/files_screen.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/files_screen.h new file mode 100644 index 0000000000..a4fb37cc14 --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/files_screen.h @@ -0,0 +1,75 @@ +/****************** + * files_screen.h * + ******************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_FILES_SCREEN +#define FTDI_FILES_SCREEN_CLASS FilesScreen + +struct FilesScreenData { + struct { + uint8_t is_dir : 1; + uint8_t is_root : 1; + } flags; + uint8_t selected_tag; + uint8_t num_page; + uint8_t cur_page; + #if ENABLED(SCROLL_LONG_FILENAMES) && (FTDI_API_LEVEL >= 810) + uint16_t scroll_pos; + uint16_t scroll_max; + #endif +}; + +class FilesScreen : public BaseScreen, public CachedScreen { + private: + #if ENABLED(TOUCH_UI_PORTRAIT) + static constexpr uint8_t header_h = 2; + static constexpr uint8_t footer_h = 2; + static constexpr uint8_t files_per_page = 11; + #else + static constexpr uint8_t header_h = 1; + static constexpr uint8_t footer_h = 1; + static constexpr uint8_t files_per_page = 6; + #endif + + static uint8_t getTagForLine(uint8_t line) {return line + 2;} + static uint8_t getLineForTag(uint8_t tag) {return tag - 2;} + static uint16_t getFileForTag(uint8_t tag); + static uint16_t getSelectedFileIndex(); + + inline static const char *getSelectedShortFilename() {return getSelectedFilename(false);} + inline static const char *getSelectedLongFilename() {return getSelectedFilename(true);} + static const char *getSelectedFilename(bool longName); + + static void drawFileButton(const char* filename, uint8_t tag, bool is_dir, bool is_highlighted); + static void drawFileList(); + static void drawHeader(); + static void drawFooter(); + static void drawSelectedFile(); + + static void gotoPage(uint8_t); + public: + static void onEntry(); + static void onRedraw(draw_mode_t); + static bool onTouchEnd(uint8_t tag); + static void onIdle(); +}; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/interface_settings_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/interface_settings_screen.cpp index 3d50b616fc..2566a960e1 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/interface_settings_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/interface_settings_screen.cpp @@ -21,12 +21,11 @@ ****************************************************************************/ #include "../config.h" - -#if ENABLED(TOUCH_UI_FTDI_EVE) - #include "screens.h" #include "screen_data.h" +#ifdef FTDI_INTERFACE_SETTINGS_SCREEN + #include "../archim2-flash/flash_storage.h" #include "../../../../../module/settings.h" @@ -42,13 +41,14 @@ using namespace ExtUI; using namespace Theme; constexpr bool PERSISTENT_STORE_SUCCESS = false; // persistentStore uses true for error +constexpr static InterfaceSettingsScreenData &mydata = screen_data.InterfaceSettingsScreen; void InterfaceSettingsScreen::onStartup() { } void InterfaceSettingsScreen::onEntry() { - screen_data.InterfaceSettings.brightness = CLCD::get_brightness(); - screen_data.InterfaceSettings.volume = SoundPlayer::get_volume(); + mydata.brightness = CLCD::get_brightness(); + mydata.volume = SoundPlayer::get_volume(); BaseScreen::onEntry(); } @@ -96,9 +96,9 @@ void InterfaceSettingsScreen::onRedraw(draw_mode_t what) { #define EDGE_R 30 .colors(ui_slider) #if DISABLED(LCD_FYSETC_TFT81050) - .tag(2).slider(BTN_POS(3,2), BTN_SIZE(2,1), screen_data.InterfaceSettings.brightness, 128) + .tag(2).slider(BTN_POS(3,2), BTN_SIZE(2,1), mydata.brightness, 128) #endif - .tag(3).slider(BTN_POS(3,3), BTN_SIZE(2,1), screen_data.InterfaceSettings.volume, 0xFF) + .tag(3).slider(BTN_POS(3,3), BTN_SIZE(2,1), mydata.volume, 0xFF) .colors(ui_toggle) .tag(4).toggle2(BTN_POS(3,4), BTN_SIZE(w,1), GET_TEXT_F(MSG_NO), GET_TEXT_F(MSG_YES), LockScreen::is_enabled()) #if DISABLED(TOUCH_UI_NO_BOOTSCREEN) @@ -161,13 +161,13 @@ void InterfaceSettingsScreen::onIdle() { CommandProcessor cmd; switch (cmd.track_tag(value)) { case 2: - screen_data.InterfaceSettings.brightness = max(11, (value * 128UL) / 0xFFFF); - CLCD::set_brightness(screen_data.InterfaceSettings.brightness); + mydata.brightness = max(11, (value * 128UL) / 0xFFFF); + CLCD::set_brightness(mydata.brightness); SaveSettingsDialogBox::settingsChanged(); break; case 3: - screen_data.InterfaceSettings.volume = value >> 8; - SoundPlayer::set_volume(screen_data.InterfaceSettings.volume); + mydata.volume = value >> 8; + SoundPlayer::set_volume(mydata.volume); SaveSettingsDialogBox::settingsChanged(); break; default: @@ -288,4 +288,4 @@ void InterfaceSettingsScreen::loadSettings(const char *buff) { } #endif -#endif // TOUCH_UI_FTDI_EVE +#endif // FTDI_INTERFACE_SETTINGS_SCREEN diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/interface_settings_screen.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/interface_settings_screen.h new file mode 100644 index 0000000000..f5ddbb1004 --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/interface_settings_screen.h @@ -0,0 +1,67 @@ +/******************************* + * interface_settings_screen.h * + *******************************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_INTERFACE_SETTINGS_SCREEN +#define FTDI_INTERFACE_SETTINGS_SCREEN_CLASS InterfaceSettingsScreen + +struct InterfaceSettingsScreenData { + uint8_t volume; + uint8_t brightness; +}; + +class InterfaceSettingsScreen : public BaseScreen, public CachedScreen { + private: + struct persistent_data_t { + uint32_t touch_transform_a; + uint32_t touch_transform_b; + uint32_t touch_transform_c; + uint32_t touch_transform_d; + uint32_t touch_transform_e; + uint32_t touch_transform_f; + uint16_t passcode; + uint8_t display_brightness; + int8_t display_h_offset_adj; + int8_t display_v_offset_adj; + uint8_t sound_volume; + uint8_t bit_flags; + uint8_t event_sounds[InterfaceSoundsScreen::NUM_EVENTS]; + }; + + public: + #ifdef ARCHIM2_SPI_FLASH_EEPROM_BACKUP_SIZE + static bool backupEEPROM(); + #endif + + static void saveSettings(char *); + static void loadSettings(const char *); + static void defaultSettings(); + static void failSafeSettings(); + + static void onStartup(); + static void onEntry(); + static void onRedraw(draw_mode_t); + static bool onTouchStart(uint8_t tag); + static bool onTouchEnd(uint8_t tag); + static void onIdle(); +}; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/interface_sounds_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/interface_sounds_screen.cpp index 9f21c6b8c7..4e47653899 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/interface_sounds_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/interface_sounds_screen.cpp @@ -21,12 +21,11 @@ ****************************************************************************/ #include "../config.h" - -#if ENABLED(TOUCH_UI_FTDI_EVE) - #include "screens.h" #include "screen_data.h" +#ifdef FTDI_INTERFACE_SOUNDS_SCREEN + using namespace FTDI; using namespace Theme; using namespace ExtUI; @@ -93,7 +92,7 @@ void InterfaceSoundsScreen::onRedraw(draw_mode_t what) { cmd.font(font_medium) .colors(ui_slider) #define EDGE_R 30 - .tag(2).slider (BTN_POS(3,2), BTN_SIZE(2,1), screen_data.InterfaceSettings.volume, 0xFF) + .tag(2).slider (BTN_POS(3,2), BTN_SIZE(2,1), screen_data.InterfaceSettingsScreen.volume, 0xFF) .colors(ui_toggle) .tag(3).toggle2 (BTN_POS(3,3), BTN_SIZE(w,1), GET_TEXT_F(MSG_NO), GET_TEXT_F(MSG_YES), UIData::touch_sounds_enabled()) #undef EDGE_R @@ -108,7 +107,7 @@ void InterfaceSoundsScreen::onRedraw(draw_mode_t what) { } void InterfaceSoundsScreen::onEntry() { - screen_data.InterfaceSettings.volume = SoundPlayer::get_volume(); + screen_data.InterfaceSettingsScreen.volume = SoundPlayer::get_volume(); BaseScreen::onEntry(); } @@ -145,8 +144,8 @@ void InterfaceSoundsScreen::onIdle() { CommandProcessor cmd; switch (cmd.track_tag(value)) { case 2: - screen_data.InterfaceSettings.volume = value >> 8; - SoundPlayer::set_volume(screen_data.InterfaceSettings.volume); + screen_data.InterfaceSettingsScreen.volume = value >> 8; + SoundPlayer::set_volume(screen_data.InterfaceSettingsScreen.volume); SaveSettingsDialogBox::settingsChanged(); break; default: @@ -157,4 +156,4 @@ void InterfaceSoundsScreen::onIdle() { BaseScreen::onIdle(); } -#endif // TOUCH_UI_FTDI_EVE +#endif // FTDI_INTERFACE_SOUNDS_SCREEN diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/interface_sounds_screen.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/interface_sounds_screen.h new file mode 100644 index 0000000000..046d7390fe --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/interface_sounds_screen.h @@ -0,0 +1,57 @@ +/***************************** + * interface_sounds_screen.h * + *****************************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_INTERFACE_SOUNDS_SCREEN +#define FTDI_INTERFACE_SOUNDS_SCREEN_CLASS InterfaceSoundsScreen + +class InterfaceSoundsScreen : public BaseScreen, public CachedScreen { + public: + enum event_t { + PRINTING_STARTED = 0, + PRINTING_FINISHED = 1, + PRINTING_FAILED = 2, + + NUM_EVENTS + }; + + private: + friend class InterfaceSettingsScreen; + + static uint8_t event_sounds[NUM_EVENTS]; + + static const char* getSoundSelection(event_t); + static void toggleSoundSelection(event_t); + static void setSoundSelection(event_t, const FTDI::SoundPlayer::sound_t*); + + public: + static void playEventSound(event_t, FTDI::play_mode_t = FTDI::PLAY_ASYNCHRONOUS); + + static void defaultSettings(); + + static void onEntry(); + static void onRedraw(draw_mode_t); + static bool onTouchStart(uint8_t tag); + static bool onTouchEnd(uint8_t tag); + static void onIdle(); +}; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/jerk_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/jerk_screen.cpp index 9c751bc345..d74879fd41 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/jerk_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/jerk_screen.cpp @@ -21,11 +21,10 @@ ****************************************************************************/ #include "../config.h" - -#if BOTH(TOUCH_UI_FTDI_EVE, CLASSIC_JERK) - #include "screens.h" +#ifdef FTDI_JERK_SCREEN + using namespace FTDI; using namespace ExtUI; using namespace Theme; @@ -62,4 +61,4 @@ bool JerkScreen::onTouchHeld(uint8_t tag) { return true; } -#endif // TOUCH_UI_FTDI_EVE && CLASSIC_JERK +#endif // FTDI_JERK_SCREEN diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/jerk_screen.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/jerk_screen.h new file mode 100644 index 0000000000..5f7acb2960 --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/jerk_screen.h @@ -0,0 +1,32 @@ +/***************** + * jerk_screen.h * + *****************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_JERK_SCREEN +#define FTDI_JERK_SCREEN_CLASS JerkScreen + +class JerkScreen : 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/junction_deviation_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/junction_deviation_screen.cpp index 329fa6c97f..4b9f5512bb 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/junction_deviation_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/junction_deviation_screen.cpp @@ -1,6 +1,6 @@ -/******************* - * boot_screen.cpp * - *******************/ +/********************************* + * junction_deviation_screen.cpp * + *********************************/ /**************************************************************************** * Written By Mark Pelletier 2017 - Aleph Objects, Inc. * @@ -21,11 +21,10 @@ ****************************************************************************/ #include "../config.h" - -#if BOTH(TOUCH_UI_FTDI_EVE, HAS_JUNCTION_DEVIATION) - #include "screens.h" +#ifdef FTDI_JUNCTION_DEVIATION_SCREEN + using namespace FTDI; using namespace ExtUI; using namespace Theme; @@ -51,4 +50,4 @@ bool JunctionDeviationScreen::onTouchHeld(uint8_t tag) { return true; } -#endif // TOUCH_UI_FTDI_EVE && !CLASSIC_JERK +#endif // FTDI_JUNCTION_DEVIATION_SCREEN diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/junction_deviation_screen.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/junction_deviation_screen.h new file mode 100644 index 0000000000..2239e2a450 --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/junction_deviation_screen.h @@ -0,0 +1,32 @@ +/******************************* + * junction_deviation_screen.h * + *******************************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_JUNCTION_DEVIATION_SCREEN +#define FTDI_JUNCTION_DEVIATION_SCREEN_CLASS JunctionDeviationScreen + +class JunctionDeviationScreen : 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/kill_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/kill_screen.cpp index 273da348c1..fe58cad93c 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/kill_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/kill_screen.cpp @@ -21,11 +21,10 @@ ****************************************************************************/ #include "../config.h" - -#if ENABLED(TOUCH_UI_FTDI_EVE) - #include "screens.h" +#ifdef FTDI_KILL_SCREEN + using namespace FTDI; // The kill screen is an oddball that happens after Marlin has killed the events @@ -59,4 +58,4 @@ void KillScreen::show(const char *message) { InterfaceSoundsScreen::playEventSound(InterfaceSoundsScreen::PRINTING_FAILED, PLAY_SYNCHRONOUS); } -#endif // TOUCH_UI_FTDI_EVE +#endif // FTDI_KILL_SCREEN diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/kill_screen.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/kill_screen.h new file mode 100644 index 0000000000..b6d9495884 --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/kill_screen.h @@ -0,0 +1,33 @@ +/***************** + * kill_screen.h * + *****************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_KILL_SCREEN +#define FTDI_KILL_SCREEN_CLASS KillScreen + +class KillScreen { + // The KillScreen is behaves differently than the + // others, so we do not bother extending UIScreen. + public: + static void show(const char*); +}; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/language_menu.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/language_menu.cpp index 6c5dfcfa9f..77c0d02756 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/language_menu.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/language_menu.cpp @@ -21,11 +21,11 @@ ****************************************************************************/ #include "../config.h" -#include "../language/language.h" +#include "screens.h" -#if ENABLED(TOUCH_UI_FTDI_EVE) && NUM_LANGUAGES > 1 +#ifdef FTDI_LANGUAGE_MENU -#include "screens.h" +#include "../language/language.h" using namespace FTDI; using namespace Theme; @@ -63,4 +63,4 @@ bool LanguageMenu::onTouchEnd(uint8_t tag) { return false; } -#endif // TOUCH_UI_FTDI_EVE +#endif // FTDI_LANGUAGE_MENU diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/language_menu.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/language_menu.h new file mode 100644 index 0000000000..a86333363f --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/language_menu.h @@ -0,0 +1,32 @@ +/******************* + * language_menu.h * + *******************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_LANGUAGE_MENU +#define FTDI_LANGUAGE_MENU_CLASS LanguageMenu + +class LanguageMenu : public BaseScreen, public UncachedScreen { + public: + static void onRedraw(draw_mode_t); + static bool onTouchEnd(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 8d372309bd..1d4ef84271 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 @@ -21,11 +21,10 @@ ****************************************************************************/ #include "../config.h" - -#if BOTH(TOUCH_UI_FTDI_EVE,HAS_LEVELING) - #include "screens.h" +#ifdef FTDI_LEVELING_MENU + #if BOTH(HAS_BED_PROBE,BLTOUCH) #include "../../../../../feature/bltouch.h" #endif @@ -118,4 +117,4 @@ bool LevelingMenu::onTouchEnd(uint8_t tag) { return true; } -#endif // TOUCH_UI_FTDI_EVE && HAS_LEVELING +#endif // FTDI_LEVELING_MENU diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/leveling_menu.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/leveling_menu.h new file mode 100644 index 0000000000..aaf852be6c --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/leveling_menu.h @@ -0,0 +1,32 @@ +/******************* + * leveling_menu.h * + *******************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_LEVELING_MENU +#define FTDI_LEVELING_MENU_CLASS LevelingMenu + +class LevelingMenu : public BaseScreen, public CachedScreen { + public: + static void onRedraw(draw_mode_t); + static bool onTouchEnd(uint8_t tag); +}; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/linear_advance_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/linear_advance_screen.cpp index 2feaa03295..e70d6933cc 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/linear_advance_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/linear_advance_screen.cpp @@ -21,11 +21,10 @@ ****************************************************************************/ #include "../config.h" - -#if BOTH(TOUCH_UI_FTDI_EVE, LIN_ADVANCE) - #include "screens.h" +#ifdef FTDI_LINEAR_ADVANCE_SCREEN + using namespace FTDI; using namespace ExtUI; using namespace Theme; @@ -74,4 +73,4 @@ bool LinearAdvanceScreen::onTouchHeld(uint8_t tag) { return true; } -#endif // TOUCH_UI_FTDI_EVE +#endif // FTDI_LINEAR_ADVANCE_SCREEN diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/linear_advance_screen.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/linear_advance_screen.h new file mode 100644 index 0000000000..8c083c8aeb --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/linear_advance_screen.h @@ -0,0 +1,32 @@ +/*************************** + * linear_advance_screen.h * + ***************************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_LINEAR_ADVANCE_SCREEN +#define FTDI_LINEAR_ADVANCE_SCREEN_CLASS LinearAdvanceScreen + +class LinearAdvanceScreen : 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/lock_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/lock_screen.cpp index 766f414a11..f89ad5c44c 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/lock_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/lock_screen.cpp @@ -21,21 +21,21 @@ ****************************************************************************/ #include "../config.h" - -#if ENABLED(TOUCH_UI_FTDI_EVE) - #include "screens.h" #include "screen_data.h" +#ifdef FTDI_LOCK_SCREEN + using namespace FTDI; using namespace Theme; uint16_t LockScreen::passcode = 0; +constexpr static LockScreenData &mydata = screen_data.LockScreen; void LockScreen::onEntry() { - const uint8_t siz = sizeof(screen_data.Lock.passcode); - memset(screen_data.Lock.passcode, '_', siz-1); - screen_data.Lock.passcode[siz-1] = '\0'; + const uint8_t siz = sizeof(mydata.passcode); + memset(mydata.passcode, '_', siz-1); + mydata.passcode[siz-1] = '\0'; BaseScreen::onEntry(); } @@ -84,11 +84,11 @@ void LockScreen::onRedraw(draw_mode_t what) { #if ENABLED(TOUCH_UI_PORTRAIT) .text(BTN_POS(1,2), BTN_SIZE(1,1), message) .font(font_xlarge) - .text(BTN_POS(1,4), BTN_SIZE(1,1), screen_data.Lock.passcode) + .text(BTN_POS(1,4), BTN_SIZE(1,1), mydata.passcode) #else .text(BTN_POS(1,1), BTN_SIZE(1,1), message) .font(font_xlarge) - .text(BTN_POS(1,2), BTN_SIZE(1,1), screen_data.Lock.passcode) + .text(BTN_POS(1,2), BTN_SIZE(1,1), mydata.passcode) #endif .font(font_large) .colors(normal_btn) @@ -117,8 +117,8 @@ void LockScreen::onRedraw(draw_mode_t what) { char &LockScreen::message_style() { // We use the last byte of the passcode string as a flag to indicate, // which message to show. - constexpr uint8_t last_char = sizeof(screen_data.Lock.passcode)-1; - return screen_data.Lock.passcode[last_char]; + constexpr uint8_t last_char = sizeof(mydata.passcode)-1; + return mydata.passcode[last_char]; } void LockScreen::onPasscodeEntered() { @@ -145,10 +145,10 @@ void LockScreen::onPasscodeEntered() { } bool LockScreen::onTouchEnd(uint8_t tag) { - char *c = strchr(screen_data.Lock.passcode,'_'); + char *c = strchr(mydata.passcode,'_'); if (c) { if (tag == '<') { - if (c != screen_data.Lock.passcode) { + if (c != mydata.passcode) { // Backspace deletes previous entered characters. *--c = '_'; } @@ -167,7 +167,7 @@ bool LockScreen::onTouchEnd(uint8_t tag) { uint16_t LockScreen::compute_checksum() { uint16_t checksum = 0; - const char* c = screen_data.Lock.passcode; + const char* c = mydata.passcode; while (*c) { checksum = (checksum << 2) ^ *c++; } @@ -202,4 +202,4 @@ void LockScreen::enable() { GOTO_SCREEN(LockScreen); } -#endif // TOUCH_UI_FTDI_EVE +#endif // FTDI_LOCK_SCREEN diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/lock_screen.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/lock_screen.h new file mode 100644 index 0000000000..05ab8bf80f --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/lock_screen.h @@ -0,0 +1,53 @@ +/***************** + * lock_screen.h * + *****************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_LOCK_SCREEN +#define FTDI_LOCK_SCREEN_CLASS LockScreen + +struct LockScreenData { + char passcode[5]; +}; + +class LockScreen : public BaseScreen, public CachedScreen { + private: + friend InterfaceSettingsScreen; + + static uint16_t passcode; + + static char & message_style(); + static uint16_t compute_checksum(); + static void onPasscodeEntered(); + public: + static bool is_enabled(); + static void check_passcode(); + static void enable(); + static void disable(); + + static void set_hash(uint16_t pass) {passcode = pass;}; + static uint16_t get_hash() {return passcode;}; + + static void onEntry(); + static void onRedraw(draw_mode_t); + static bool onTouchEnd(uint8_t tag); +}; 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 146b799c20..b7914d629b 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 @@ -22,11 +22,10 @@ ****************************************************************************/ #include "../config.h" - -#if ENABLED(TOUCH_UI_FTDI_EVE) && NONE(TOUCH_UI_LULZBOT_BIO,TOUCH_UI_COCOA_PRESS) - #include "screens.h" +#ifdef FTDI_MAIN_MENU + using namespace FTDI; using namespace Theme; @@ -128,4 +127,4 @@ bool MainMenu::onTouchEnd(uint8_t tag) { return true; } -#endif // TOUCH_UI_FTDI_EVE && !TOUCH_UI_LULZBOT_BIO +#endif // FTDI_MAIN_MENU diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/main_menu.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/main_menu.h new file mode 100644 index 0000000000..ac1300e1b8 --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/main_menu.h @@ -0,0 +1,33 @@ +/*************** + * main_menu.h * + ***************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_MAIN_MENU +#define FTDI_MAIN_MENU_CLASS MainMenu + +class MainMenu : public BaseScreen, public CachedScreen { + public: + static void onRedraw(draw_mode_t); + static bool onTouchEnd(uint8_t tag); +}; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/max_acceleration_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/max_acceleration_screen.cpp index fdbb9623b5..d4d14d6331 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/max_acceleration_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/max_acceleration_screen.cpp @@ -21,11 +21,10 @@ ****************************************************************************/ #include "../config.h" - -#if ENABLED(TOUCH_UI_FTDI_EVE) - #include "screens.h" +#ifdef FTDI_MAX_ACCELERATION_SCREEN + using namespace FTDI; using namespace ExtUI; using namespace Theme; @@ -83,4 +82,4 @@ bool MaxAccelerationScreen::onTouchHeld(uint8_t tag) { return true; } -#endif // TOUCH_UI_FTDI_EVE +#endif // FTDI_MAX_ACCELERATION_SCREEN diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/max_acceleration_screen.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/max_acceleration_screen.h new file mode 100644 index 0000000000..87a79b3bd9 --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/max_acceleration_screen.h @@ -0,0 +1,32 @@ +/***************************** + * max_acceleration_screen.h * + *****************************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_MAX_ACCELERATION_SCREEN +#define FTDI_MAX_ACCELERATION_SCREEN_CLASS MaxAccelerationScreen + +class MaxAccelerationScreen : 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/max_velocity_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/max_velocity_screen.cpp index ac1374b99a..4de3e33360 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/max_velocity_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/max_velocity_screen.cpp @@ -21,11 +21,10 @@ ****************************************************************************/ #include "../config.h" - -#if ENABLED(TOUCH_UI_FTDI_EVE) - #include "screens.h" +#ifdef FTDI_MAX_VELOCITY_SCREEN + using namespace FTDI; using namespace ExtUI; using namespace Theme; @@ -87,4 +86,4 @@ bool MaxVelocityScreen::onTouchHeld(uint8_t tag) { return true; } -#endif // TOUCH_UI_FTDI_EVE +#endif // FTDI_MAX_VELOCITY_SCREEN diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/max_velocity_screen.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/max_velocity_screen.h new file mode 100644 index 0000000000..e904a2c058 --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/max_velocity_screen.h @@ -0,0 +1,32 @@ +/************************* + * max_velocity_screen.h * + *************************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_MAX_VELOCITY_SCREEN +#define FTDI_MAX_VELOCITY_SCREEN_CLASS MaxVelocityScreen + +class MaxVelocityScreen : 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/media_player_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/media_player_screen.cpp index eb0b78a325..38e8b0b5c7 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/media_player_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/media_player_screen.cpp @@ -21,6 +21,7 @@ ****************************************************************************/ #include "../config.h" +#include "screens.h" /** * The MediaPlayerScreen allows an AVI to be played. @@ -39,9 +40,7 @@ * ffmpeg -i video.avi -i silence.wav -c copy -map 0:v:0 -map 1:a:0 startup.avi */ -#if ENABLED(TOUCH_UI_FTDI_EVE) - -#include "screens.h" +#ifdef FTDI_MEDIA_PLAYER_SCREEN #include "../archim2-flash/flash_storage.h" #include "../archim2-flash/media_file_reader.h" @@ -165,4 +164,4 @@ void MediaPlayerScreen::playStream(void *obj, media_streamer_func_t *data_stream #endif // FTDI_API_LEVEL >= 810 } -#endif // TOUCH_UI_FTDI_EVE +#endif // FTDI_MEDIA_PLAYER_SCREEN diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/media_player_screen.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/media_player_screen.h new file mode 100644 index 0000000000..510d5a9386 --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/media_player_screen.h @@ -0,0 +1,40 @@ +/************************* + * media_player_screen.h * + *************************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_MEDIA_PLAYER_SCREEN +#define FTDI_MEDIA_PLAYER_SCREEN_CLASS MediaPlayerScreen + +class MediaPlayerScreen : public BaseScreen, public UncachedScreen { + private: + typedef int16_t media_streamer_func_t(void *obj, void *buff, size_t bytes); + + public: + static bool playCardMedia(); + static bool playBootMedia(); + + static void onEntry(); + static void onRedraw(draw_mode_t); + + static void playStream(void *obj, media_streamer_func_t*); +}; 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 ba38918b1c..5f5971458a 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 @@ -21,15 +21,16 @@ ****************************************************************************/ #include "../config.h" - -#if ENABLED(TOUCH_UI_FTDI_EVE) - #include "screens.h" #include "screen_data.h" +#ifdef FTDI_MOVE_AXIS_SCREEN + using namespace FTDI; using namespace ExtUI; +constexpr static MoveAxisScreenData &mydata = screen_data.MoveAxisScreen; + 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 @@ -37,7 +38,7 @@ void BaseMoveAxisScreen::onEntry() { // screen is entered. LOOP_L_N(i, ExtUI::extruderCount) { - screen_data.MoveAxis.e_rel[i] = 0; + mydata.e_rel[i] = 0; } BaseNumericAdjustmentScreen::onEntry(); } @@ -54,15 +55,15 @@ void MoveAxisScreen::onRedraw(draw_mode_t what) { w.color(Theme::e_axis); #if EXTRUDERS == 1 - w.adjuster( 8, GET_TEXT_F(MSG_AXIS_E), screen_data.MoveAxis.e_rel[0], canMove(E0)); + w.adjuster( 8, GET_TEXT_F(MSG_AXIS_E), mydata.e_rel[0], canMove(E0)); #elif HAS_MULTI_EXTRUDER - w.adjuster( 8, GET_TEXT_F(MSG_AXIS_E1), screen_data.MoveAxis.e_rel[0], canMove(E0)); - w.adjuster( 10, GET_TEXT_F(MSG_AXIS_E2), screen_data.MoveAxis.e_rel[1], canMove(E1)); + w.adjuster( 8, GET_TEXT_F(MSG_AXIS_E1), mydata.e_rel[0], canMove(E0)); + w.adjuster( 10, GET_TEXT_F(MSG_AXIS_E2), mydata.e_rel[1], canMove(E1)); #if EXTRUDERS > 2 - w.adjuster( 12, GET_TEXT_F(MSG_AXIS_E3), screen_data.MoveAxis.e_rel[2], canMove(E2)); + w.adjuster( 12, GET_TEXT_F(MSG_AXIS_E3), mydata.e_rel[2], canMove(E2)); #endif #if EXTRUDERS > 3 - w.adjuster( 14, GET_TEXT_F(MSG_AXIS_E4), screen_data.MoveAxis.e_rel[3], canMove(E3)); + w.adjuster( 14, GET_TEXT_F(MSG_AXIS_E4), mydata.e_rel[3], canMove(E3)); #endif #endif w.increments(); @@ -80,19 +81,19 @@ bool BaseMoveAxisScreen::onTouchHeld(uint8_t tag) { case 6: UI_DECREMENT_AXIS(Z); break; case 7: UI_INCREMENT_AXIS(Z); break; // For extruders, also update relative distances. - case 8: UI_DECREMENT_AXIS(E0); screen_data.MoveAxis.e_rel[0] -= increment; break; - case 9: UI_INCREMENT_AXIS(E0); screen_data.MoveAxis.e_rel[0] += increment; break; + case 8: UI_DECREMENT_AXIS(E0); mydata.e_rel[0] -= increment; break; + case 9: UI_INCREMENT_AXIS(E0); mydata.e_rel[0] += increment; break; #if HAS_MULTI_EXTRUDER - case 10: UI_DECREMENT_AXIS(E1); screen_data.MoveAxis.e_rel[1] -= increment; break; - case 11: UI_INCREMENT_AXIS(E1); screen_data.MoveAxis.e_rel[1] += increment; break; + case 10: UI_DECREMENT_AXIS(E1); mydata.e_rel[1] -= increment; break; + case 11: UI_INCREMENT_AXIS(E1); mydata.e_rel[1] += increment; break; #endif #if EXTRUDERS > 2 - case 12: UI_DECREMENT_AXIS(E2); screen_data.MoveAxis.e_rel[2] -= increment; break; - case 13: UI_INCREMENT_AXIS(E2); screen_data.MoveAxis.e_rel[2] += increment; break; + case 12: UI_DECREMENT_AXIS(E2); mydata.e_rel[2] -= increment; break; + case 13: UI_INCREMENT_AXIS(E2); mydata.e_rel[2] += increment; break; #endif #if EXTRUDERS > 3 - case 14: UI_DECREMENT_AXIS(E3); screen_data.MoveAxis.e_rel[3] -= increment; break; - case 15: UI_INCREMENT_AXIS(E3); screen_data.MoveAxis.e_rel[3] += increment; break; + case 14: UI_DECREMENT_AXIS(E3); mydata.e_rel[3] -= increment; break; + case 15: UI_INCREMENT_AXIS(E3); mydata.e_rel[3] += increment; break; #endif case 20: SpinnerDialogBox::enqueueAndWait_P(F("G28X")); break; case 21: SpinnerDialogBox::enqueueAndWait_P(F("G28Y")); break; @@ -130,4 +131,4 @@ void MoveAxisScreen::onIdle() { BaseScreen::onIdle(); } -#endif // TOUCH_UI_FTDI_EVE +#endif // FTDI_MOVE_AXIS_SCREEN diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/move_axis_screen.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/move_axis_screen.h new file mode 100644 index 0000000000..6053286eda --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/move_axis_screen.h @@ -0,0 +1,48 @@ +/********************** + * move_axis_screen.h * + **********************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_MOVE_AXIS_SCREEN +#define FTDI_MOVE_AXIS_SCREEN_CLASS MoveAxisScreen + +struct MoveAxisScreenData { + struct BaseNumericAdjustmentScreenData placeholder; + float e_rel[ExtUI::extruderCount]; +}; + +class BaseMoveAxisScreen : public BaseNumericAdjustmentScreen { + private: + static float getManualFeedrate(uint8_t axis, float increment_mm); + public: + static void setManualFeedrate(ExtUI::axis_t, float increment_mm); + static void setManualFeedrate(ExtUI::extruder_t, float increment_mm); + + static void onEntry(); + static bool onTouchHeld(uint8_t tag); +}; + +class MoveAxisScreen : public BaseMoveAxisScreen, public CachedScreen { + public: + static void onRedraw(draw_mode_t); + static void onIdle(); +}; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/nozzle_offsets_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/nozzle_offsets_screen.cpp index 85c7206b04..a444a07cfc 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/nozzle_offsets_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/nozzle_offsets_screen.cpp @@ -21,11 +21,10 @@ ****************************************************************************/ #include "../config.h" - -#if BOTH(TOUCH_UI_FTDI_EVE, HAS_MULTI_HOTEND) - #include "screens.h" +#ifdef FTDI_NOZZLE_OFFSETS_SCREEN + using namespace FTDI; using namespace ExtUI; @@ -70,4 +69,4 @@ bool NozzleOffsetScreen::onTouchHeld(uint8_t tag) { return true; } -#endif // TOUCH_UI_FTDI_EVE +#endif // FTDI_NOZZLE_OFFSETS_SCREEN diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/nozzle_offsets_screen.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/nozzle_offsets_screen.h new file mode 100644 index 0000000000..763f3364ce --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/nozzle_offsets_screen.h @@ -0,0 +1,33 @@ +/*************************** + * nozzle_offsets_screen.h * + ***************************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_NOZZLE_OFFSETS_SCREEN +#define FTDI_NOZZLE_OFFSETS_SCREEN_CLASS NozzleOffsetScreen + +class NozzleOffsetScreen : public BaseNumericAdjustmentScreen, public CachedScreen { + public: + static void onEntry(); + 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/nudge_nozzle_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/nudge_nozzle_screen.cpp index f0d3f7eec5..96ad833b14 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/nudge_nozzle_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/nudge_nozzle_screen.cpp @@ -21,22 +21,23 @@ ****************************************************************************/ #include "../config.h" - -#if BOTH(TOUCH_UI_FTDI_EVE, BABYSTEPPING) - #include "screens.h" #include "screen_data.h" +#ifdef FTDI_NUDGE_NOZZLE_SCREEN + using namespace FTDI; using namespace Theme; using namespace ExtUI; +constexpr static NudgeNozzleScreenData &mydata = screen_data.NudgeNozzleScreen; + void NudgeNozzleScreen::onEntry() { - screen_data.NudgeNozzle.show_offsets = false; + mydata.show_offsets = false; #if HAS_MULTI_EXTRUDER - screen_data.NudgeNozzle.link_nozzles = true; + mydata.link_nozzles = true; #endif - screen_data.NudgeNozzle.rel.reset(); + mydata.rel.reset(); BaseNumericAdjustmentScreen::onEntry(); } @@ -47,19 +48,19 @@ void NudgeNozzleScreen::onRedraw(draw_mode_t what) { w.heading(GET_TEXT_F(MSG_NUDGE_NOZZLE)); #if ENABLED(BABYSTEP_XY) - w.color(x_axis).adjuster(2, GET_TEXT_F(MSG_AXIS_X), screen_data.NudgeNozzle.rel.x / getAxisSteps_per_mm(X)); - w.color(y_axis).adjuster(4, GET_TEXT_F(MSG_AXIS_Y), screen_data.NudgeNozzle.rel.y / getAxisSteps_per_mm(Y)); + w.color(x_axis).adjuster(2, GET_TEXT_F(MSG_AXIS_X), mydata.rel.x / getAxisSteps_per_mm(X)); + w.color(y_axis).adjuster(4, GET_TEXT_F(MSG_AXIS_Y), mydata.rel.y / getAxisSteps_per_mm(Y)); #endif - w.color(z_axis).adjuster(6, GET_TEXT_F(MSG_AXIS_Z), screen_data.NudgeNozzle.rel.z / getAxisSteps_per_mm(Z)); + w.color(z_axis).adjuster(6, GET_TEXT_F(MSG_AXIS_Z), mydata.rel.z / getAxisSteps_per_mm(Z)); w.increments(); #if HAS_MULTI_EXTRUDER - w.toggle(8, GET_TEXT_F(MSG_ADJUST_BOTH_NOZZLES), screen_data.NudgeNozzle.link_nozzles); + w.toggle(8, GET_TEXT_F(MSG_ADJUST_BOTH_NOZZLES), mydata.link_nozzles); #endif #if HAS_MULTI_EXTRUDER || HAS_BED_PROBE - w.toggle(9, GET_TEXT_F(MSG_SHOW_OFFSETS), screen_data.NudgeNozzle.show_offsets); + w.toggle(9, GET_TEXT_F(MSG_SHOW_OFFSETS), mydata.show_offsets); - if (screen_data.NudgeNozzle.show_offsets) { + if (mydata.show_offsets) { char str[19]; w.draw_mode(BOTH); @@ -83,22 +84,22 @@ void NudgeNozzleScreen::onRedraw(draw_mode_t what) { bool NudgeNozzleScreen::onTouchHeld(uint8_t tag) { const float inc = getIncrement(); #if HAS_MULTI_EXTRUDER - const bool link = screen_data.NudgeNozzle.link_nozzles; + const bool link = mydata.link_nozzles; #else constexpr bool link = true; #endif int16_t steps; switch (tag) { - case 2: steps = mmToWholeSteps(inc, X); smartAdjustAxis_steps(-steps, X, link); screen_data.NudgeNozzle.rel.x -= steps; break; - case 3: steps = mmToWholeSteps(inc, X); smartAdjustAxis_steps( steps, X, link); screen_data.NudgeNozzle.rel.x += steps; break; - case 4: steps = mmToWholeSteps(inc, Y); smartAdjustAxis_steps(-steps, Y, link); screen_data.NudgeNozzle.rel.y -= steps; break; - case 5: steps = mmToWholeSteps(inc, Y); smartAdjustAxis_steps( steps, Y, link); screen_data.NudgeNozzle.rel.y += steps; break; - case 6: steps = mmToWholeSteps(inc, Z); smartAdjustAxis_steps(-steps, Z, link); screen_data.NudgeNozzle.rel.z -= steps; break; - case 7: steps = mmToWholeSteps(inc, Z); smartAdjustAxis_steps( steps, Z, link); screen_data.NudgeNozzle.rel.z += steps; break; + case 2: steps = mmToWholeSteps(inc, X); smartAdjustAxis_steps(-steps, X, link); mydata.rel.x -= steps; break; + case 3: steps = mmToWholeSteps(inc, X); smartAdjustAxis_steps( steps, X, link); mydata.rel.x += steps; break; + case 4: steps = mmToWholeSteps(inc, Y); smartAdjustAxis_steps(-steps, Y, link); mydata.rel.y -= steps; break; + case 5: steps = mmToWholeSteps(inc, Y); smartAdjustAxis_steps( steps, Y, link); mydata.rel.y += steps; break; + case 6: steps = mmToWholeSteps(inc, Z); smartAdjustAxis_steps(-steps, Z, link); mydata.rel.z -= steps; break; + case 7: steps = mmToWholeSteps(inc, Z); smartAdjustAxis_steps( steps, Z, link); mydata.rel.z += steps; break; #if HAS_MULTI_EXTRUDER - case 8: screen_data.NudgeNozzle.link_nozzles = !link; break; + case 8: mydata.link_nozzles = !link; break; #endif - case 9: screen_data.NudgeNozzle.show_offsets = !screen_data.NudgeNozzle.show_offsets; break; + case 9: mydata.show_offsets = !mydata.show_offsets; break; default: return false; } #if HAS_MULTI_EXTRUDER || HAS_BED_PROBE @@ -120,4 +121,4 @@ void NudgeNozzleScreen::onIdle() { reset_menu_timeout(); } -#endif // TOUCH_UI_FTDI_EVE +#endif // FTDI_NUDGE_NOZZLE_SCREEN diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/nudge_nozzle_screen.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/nudge_nozzle_screen.h new file mode 100644 index 0000000000..c490a25fea --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/nudge_nozzle_screen.h @@ -0,0 +1,44 @@ +/****************** + * nudge_nozzle.h * + ******************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_NUDGE_NOZZLE_SCREEN +#define FTDI_NUDGE_NOZZLE_SCREEN_CLASS NudgeNozzleScreen + +struct NudgeNozzleScreenData { + struct BaseNumericAdjustmentScreenData placeholder; + xyz_int_t rel; + #if HAS_MULTI_EXTRUDER + bool link_nozzles; + #endif + bool show_offsets; +}; + +class NudgeNozzleScreen : public BaseNumericAdjustmentScreen, public CachedScreen { + public: + static void onEntry(); + static void onRedraw(draw_mode_t); + static bool onTouchEnd(uint8_t tag); + static bool onTouchHeld(uint8_t tag); + static void onIdle(); +}; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/restore_failsafe_dialog_box.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/restore_failsafe_dialog_box.cpp index 9be2239797..8dce1a259c 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/restore_failsafe_dialog_box.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/restore_failsafe_dialog_box.cpp @@ -21,11 +21,10 @@ ****************************************************************************/ #include "../config.h" - -#if ENABLED(TOUCH_UI_FTDI_EVE) - #include "screens.h" +#ifdef FTDI_RESTORE_FAILSAFE_DIALOG_BOX + using namespace ExtUI; void RestoreFailsafeDialogBox::onRedraw(draw_mode_t) { @@ -48,4 +47,4 @@ bool RestoreFailsafeDialogBox::onTouchEnd(uint8_t tag) { } } -#endif // TOUCH_UI_FTDI_EVE +#endif // FTDI_RESTORE_FAILSAFE_DIALOG_BOX diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/restore_failsafe_dialog_box.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/restore_failsafe_dialog_box.h new file mode 100644 index 0000000000..84a994730d --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/restore_failsafe_dialog_box.h @@ -0,0 +1,32 @@ +/********************************* + * restore_failsafe_dialog_box.h * + *********************************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_RESTORE_FAILSAFE_DIALOG_BOX +#define FTDI_RESTORE_FAILSAFE_DIALOG_BOX_CLASS RestoreFailsafeDialogBox + +class RestoreFailsafeDialogBox : public DialogBoxBaseClass, public UncachedScreen { + public: + static void onRedraw(draw_mode_t); + static bool onTouchEnd(uint8_t tag); +}; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/save_settings_dialog_box.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/save_settings_dialog_box.cpp index eff0431a94..a475a9863c 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/save_settings_dialog_box.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/save_settings_dialog_box.cpp @@ -21,11 +21,10 @@ ****************************************************************************/ #include "../config.h" - -#if ENABLED(TOUCH_UI_FTDI_EVE) - #include "screens.h" +#ifdef FTDI_SAVE_SETTINGS_DIALOG_BOX + using namespace ExtUI; bool SaveSettingsDialogBox::needs_save = false; @@ -61,4 +60,4 @@ void SaveSettingsDialogBox::promptToSaveSettings() { GOTO_PREVIOUS(); // No save needed. } -#endif // TOUCH_UI_FTDI_EVE +#endif // FTDI_SAVE_SETTINGS_DIALOG_BOX diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/save_settings_dialog_box.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/save_settings_dialog_box.h new file mode 100644 index 0000000000..8985a974fe --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/save_settings_dialog_box.h @@ -0,0 +1,38 @@ +/****************************** + * save_settings_dialog_box.h * + ******************************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_SAVE_SETTINGS_DIALOG_BOX +#define FTDI_SAVE_SETTINGS_DIALOG_BOX_CLASS SaveSettingsDialogBox + +class SaveSettingsDialogBox : public DialogBoxBaseClass, public UncachedScreen { + private: + static bool needs_save; + + public: + static void onRedraw(draw_mode_t); + static bool onTouchEnd(uint8_t tag); + + static void promptToSaveSettings(); + static void settingsChanged() {needs_save = true;} +}; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screen_data.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screen_data.h index fe35fc457b..e725a23797 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screen_data.h +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screen_data.h @@ -27,71 +27,40 @@ // To save RAM, store state information related to a particular screen // in a union. The values should be initialized in the onEntry method. -struct base_numeric_adjustment_t {uint8_t increment;}; +/** + * The DECL_DATA_IF_INCLUDED macro: + * + * union screen_data_t { + * DECL_DATA_IF_INCLUDED(FTDI_EXAMPLE_SCREEN) + * } + * + * Is a shorthand for: + * + * union screen_data_t { + * #ifdef FTDI_EXAMPLE_SCREEN + * struct ExampleScreenData ExampleScreen; + * #endif + * } + * + */ +#define __DECL_DATA_IF_INCLUDED(CLASS) struct CLASS ## Data CLASS ; +#define _DECL_DATA_IF_INCLUDED(CLASS) __DECL_DATA_IF_INCLUDED(CLASS) +#define DECL_DATA_IF_INCLUDED(HEADER) TERN(HEADER, _DECL_DATA_IF_INCLUDED(HEADER ## _CLASS), ) union screen_data_t { - struct base_numeric_adjustment_t BaseNumericAdjustment; - struct {uint8_t volume; uint8_t brightness;} InterfaceSettings; - struct {char passcode[5];} Lock; - struct {bool isError;} AlertDialog; - struct {bool auto_hide;} SpinnerDialog; - struct {uint8_t file_index;} ConfirmStartPrintDialog; - struct { - uint8_t e_tag, t_tag, repeat_tag; - ExtUI::extruder_t saved_extruder; - #if FILAMENT_UNLOAD_PURGE_LENGTH > 0 - bool need_purge; - #endif - } ChangeFilament; - struct { - struct { - uint8_t is_dir : 1; - uint8_t is_root : 1; - } flags; - uint8_t selected_tag; - uint8_t num_page; - uint8_t cur_page; - #if ENABLED(SCROLL_LONG_FILENAMES) && (FTDI_API_LEVEL >= 810) - uint16_t scroll_pos; - uint16_t scroll_max; - #endif - } Files; - struct { - struct base_numeric_adjustment_t placeholder; - float e_rel[ExtUI::extruderCount]; - } MoveAxis; - #if HAS_MESH - struct { - enum : uint8_t { - MSG_NONE, - MSG_MESH_COMPLETE, - MSG_MESH_INCOMPLETE - } message; - uint8_t count; - uint8_t highlightedTag; - } BedMesh; - #endif - #if ENABLED(TOUCH_UI_DEVELOPER_MENU) - struct { - uint32_t next_watchdog_trigger; - const char* message; - } StressTest; - #endif - #if ENABLED(TOUCH_UI_COCOA_PRESS) - struct { - uint32_t start_ms; - } PreheatTimer; - #endif - #if ENABLED(BABYSTEPPING) - struct { - struct base_numeric_adjustment_t placeholder; - xyz_int_t rel; - #if HAS_MULTI_EXTRUDER - bool link_nozzles; - #endif - bool show_offsets; - } NudgeNozzle; - #endif + DECL_DATA_IF_INCLUDED(FTDI_INTERFACE_SETTINGS_SCREEN) + DECL_DATA_IF_INCLUDED(FTDI_LOCK_SCREEN) + DECL_DATA_IF_INCLUDED(FTDI_SPINNER_DIALOG_BOX) + DECL_DATA_IF_INCLUDED(FTDI_CONFIRM_START_PRINT_DIALOG_BOX) + DECL_DATA_IF_INCLUDED(FTDI_CHANGE_FILAMENT_SCREEN) + DECL_DATA_IF_INCLUDED(FTDI_FILES_SCREEN) + DECL_DATA_IF_INCLUDED(FTDI_MOVE_AXIS_SCREEN) + DECL_DATA_IF_INCLUDED(FTDI_BED_MESH_SCREEN) + DECL_DATA_IF_INCLUDED(FTDI_STRESS_TEST_SCREEN) + DECL_DATA_IF_INCLUDED(FTDI_COCOA_PREHEAT_SCREEN) + DECL_DATA_IF_INCLUDED(FTDI_NUDGE_NOZZLE_SCREEN) + DECL_DATA_IF_INCLUDED(FTDI_BASE_NUMERIC_ADJ_SCREEN) + DECL_DATA_IF_INCLUDED(FTDI_ALERT_DIALOG_BOX) }; extern screen_data_t screen_data; 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 5841c38f53..ab3c3d7114 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 @@ -24,116 +24,98 @@ #if ENABLED(TOUCH_UI_FTDI_EVE) #include "screens.h" -#include "screen_data.h" - tiny_timer_t refresh_timer; -screen_data_t screen_data; + + +/** + * DECL_SCREEN_IF_INCLUDED allows for a concise + * definition of SCREEN_TABLE: + * + * SCREEN_TABLE { + * DECL_SCREEN_IF_INCLUDED(MY_HEADER) + * } + * + * Is a shorthand for: + * + * SCREEN_TABLE { + * #ifdef MY_HEADER + * DECL_SCREEN(MY_HEADER), + * #endif + * } + * + */ +#define COMMA , +#define __DECL_SCREEN_IF_INCLUDED(O,C) THIRD(O, DECL_SCREEN(C) COMMA,) +#define _DECL_SCREEN_IF_INCLUDED(O,C) __DECL_SCREEN_IF_INCLUDED(O ## COMMA, C) +#define DECL_SCREEN_IF_INCLUDED(H) _DECL_SCREEN_IF_INCLUDED(H, H ## _CLASS) SCREEN_TABLE { - DECL_SCREEN(BootScreen), - #if NUM_LANGUAGES > 1 - DECL_SCREEN(LanguageMenu), - #endif - DECL_SCREEN(TouchCalibrationScreen), - DECL_SCREEN(StatusScreen), - DECL_SCREEN(MainMenu), - DECL_SCREEN(TuneMenu), - DECL_SCREEN(AdvancedSettingsMenu), - DECL_SCREEN(AlertDialogBox), - DECL_SCREEN(ConfirmUserRequestAlertBox), - DECL_SCREEN(RestoreFailsafeDialogBox), - DECL_SCREEN(SaveSettingsDialogBox), - DECL_SCREEN(ConfirmStartPrintDialogBox), - DECL_SCREEN(ConfirmAbortPrintDialogBox), - #if ENABLED(CALIBRATION_GCODE) - DECL_SCREEN(ConfirmAutoCalibrationDialogBox), - #endif - #if ENABLED(CUSTOM_USER_MENUS) - DECL_SCREEN(CustomUserMenus), - #endif - DECL_SCREEN(SpinnerDialogBox), - DECL_SCREEN(AboutScreen), - #if ENABLED(PRINTCOUNTER) - DECL_SCREEN(StatisticsScreen), - #endif - #if ENABLED(BABYSTEPPING) - DECL_SCREEN(NudgeNozzleScreen), - #endif - DECL_SCREEN(MoveAxisScreen), - DECL_SCREEN(StepsScreen), - #if HAS_TRINAMIC_CONFIG - DECL_SCREEN(StepperCurrentScreen), - DECL_SCREEN(StepperBumpSensitivityScreen), - #endif - #if HAS_LEVELING - DECL_SCREEN(LevelingMenu), - #if HAS_BED_PROBE - DECL_SCREEN(ZOffsetScreen), - #endif - #if HAS_MESH - DECL_SCREEN(BedMeshScreen), - #endif - #endif - #if HAS_MULTI_HOTEND - DECL_SCREEN(NozzleOffsetScreen), - #endif - #if ENABLED(BACKLASH_GCODE) - DECL_SCREEN(BacklashCompensationScreen), - #endif - DECL_SCREEN(FeedratePercentScreen), - DECL_SCREEN(MaxVelocityScreen), - DECL_SCREEN(MaxAccelerationScreen), - DECL_SCREEN(DefaultAccelerationScreen), - #if HAS_JUNCTION_DEVIATION - DECL_SCREEN(JunctionDeviationScreen), - #else - DECL_SCREEN(JerkScreen), - #endif - #if ENABLED(CASE_LIGHT_ENABLE) - DECL_SCREEN(CaseLightScreen), - #endif - #if EITHER(LIN_ADVANCE, FILAMENT_RUNOUT_SENSOR) - DECL_SCREEN(FilamentMenu), - #endif - #if ENABLED(FILAMENT_RUNOUT_SENSOR) - DECL_SCREEN(FilamentRunoutScreen), - #endif - #if ENABLED(LIN_ADVANCE) - DECL_SCREEN(LinearAdvanceScreen), - #endif - DECL_SCREEN(TemperatureScreen), - DECL_SCREEN(ChangeFilamentScreen), - DECL_SCREEN(InterfaceSettingsScreen), - DECL_SCREEN(InterfaceSoundsScreen), - DECL_SCREEN(LockScreen), - #if ENABLED(SDSUPPORT) - DECL_SCREEN(FilesScreen), - #endif - DECL_SCREEN(EndstopStatesScreen), - #if ENABLED(TOUCH_UI_LULZBOT_BIO) - DECL_SCREEN(BioPrintingDialogBox), - DECL_SCREEN(BioConfirmHomeXYZ), - DECL_SCREEN(BioConfirmHomeE), - #endif - #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), - DECL_SCREEN(ConfirmEraseFlashDialogBox), - DECL_SCREEN(WidgetsScreen), - DECL_SCREEN(TouchRegistersScreen), - DECL_SCREEN(StressTestScreen), - #endif - DECL_SCREEN(MediaPlayerScreen), - DECL_SCREEN(DisplayTuningScreen) + DECL_SCREEN_IF_INCLUDED(FTDI_BOOT_SCREEN) + DECL_SCREEN_IF_INCLUDED(FTDI_LANGUAGE_MENU) + DECL_SCREEN_IF_INCLUDED(FTDI_TOUCH_CALIBRATION_SCREEN) + DECL_SCREEN_IF_INCLUDED(FTDI_STATUS_SCREEN) + DECL_SCREEN_IF_INCLUDED(FTDI_MAIN_MENU) + DECL_SCREEN_IF_INCLUDED(FTDI_TUNE_MENU) + DECL_SCREEN_IF_INCLUDED(FTDI_ADVANCED_SETTINGS_MENU) + DECL_SCREEN_IF_INCLUDED(FTDI_ALERT_DIALOG_BOX) + DECL_SCREEN_IF_INCLUDED(FTDI_CONFIRM_USER_REQUEST_ALERT_BOX) + DECL_SCREEN_IF_INCLUDED(FTDI_RESTORE_FAILSAFE_DIALOG_BOX) + DECL_SCREEN_IF_INCLUDED(FTDI_SAVE_SETTINGS_DIALOG_BOX) + DECL_SCREEN_IF_INCLUDED(FTDI_CONFIRM_START_PRINT_DIALOG_BOX) + DECL_SCREEN_IF_INCLUDED(FTDI_CONFIRM_ABORT_PRINT_DIALOG_BOX) + DECL_SCREEN_IF_INCLUDED(FTDI_CONFIRM_AUTO_CALIBRATION_DIALOG_BOX) + DECL_SCREEN_IF_INCLUDED(FTDI_CUSTOM_USER_MENUS) + DECL_SCREEN_IF_INCLUDED(FTDI_SPINNER_DIALOG_BOX) + DECL_SCREEN_IF_INCLUDED(FTDI_ABOUT_SCREEN) + DECL_SCREEN_IF_INCLUDED(FTDI_STATISTICS_SCREEN) + DECL_SCREEN_IF_INCLUDED(FTDI_NUDGE_NOZZLE_SCREEN) + DECL_SCREEN_IF_INCLUDED(FTDI_MOVE_AXIS_SCREEN) + DECL_SCREEN_IF_INCLUDED(FTDI_STEPS_SCREEN) + DECL_SCREEN_IF_INCLUDED(FTDI_STEPPER_CURRENT_SCREEN) + DECL_SCREEN_IF_INCLUDED(FTDI_STEPPER_BUMP_SENSITIVITY_SCREEN) + DECL_SCREEN_IF_INCLUDED(FTDI_LEVELING_MENU) + DECL_SCREEN_IF_INCLUDED(FTDI_Z_OFFSET_SCREEN) + DECL_SCREEN_IF_INCLUDED(FTDI_BED_MESH_SCREEN) + 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_MAX_VELOCITY_SCREEN) + DECL_SCREEN_IF_INCLUDED(FTDI_MAX_ACCELERATION_SCREEN) + DECL_SCREEN_IF_INCLUDED(FTDI_DEFAULT_ACCELERATION_SCREEN) + DECL_SCREEN_IF_INCLUDED(FTDI_JUNCTION_DEVIATION_SCREEN) + DECL_SCREEN_IF_INCLUDED(FTDI_JERK_SCREEN) + DECL_SCREEN_IF_INCLUDED(FTDI_CASE_LIGHT_SCREEN) + DECL_SCREEN_IF_INCLUDED(FTDI_FILAMENT_MENU) + DECL_SCREEN_IF_INCLUDED(FTDI_FILAMENT_RUNOUT_SCREEN) + DECL_SCREEN_IF_INCLUDED(FTDI_LINEAR_ADVANCE_SCREEN) + DECL_SCREEN_IF_INCLUDED(FTDI_TEMPERATURE_SCREEN) + DECL_SCREEN_IF_INCLUDED(FTDI_CHANGE_FILAMENT_SCREEN) + DECL_SCREEN_IF_INCLUDED(FTDI_INTERFACE_SETTINGS_SCREEN) + DECL_SCREEN_IF_INCLUDED(FTDI_INTERFACE_SOUNDS_SCREEN) + DECL_SCREEN_IF_INCLUDED(FTDI_LOCK_SCREEN) + DECL_SCREEN_IF_INCLUDED(FTDI_FILES_SCREEN) + DECL_SCREEN_IF_INCLUDED(FTDI_ENDSTOP_STATE_SCREEN) + DECL_SCREEN_IF_INCLUDED(FTDI_BIO_PRINTING_DIALOG_BOX) + DECL_SCREEN_IF_INCLUDED(FTDI_BIO_CONFIRMOME_XYZ) + DECL_SCREEN_IF_INCLUDED(FTDI_BIO_CONFIRMOME_E) + DECL_SCREEN_IF_INCLUDED(FTDI_COCOA_PREHEAT_MENU) + DECL_SCREEN_IF_INCLUDED(FTDI_COCOA_PREHEAT_SCREEN) + DECL_SCREEN_IF_INCLUDED(FTDI_COCOA_UNLOAD_CARTRIDGE_SCREEN) + DECL_SCREEN_IF_INCLUDED(FTDI_COCOA_LOAD_CHOCOLATE_SCREEN) + DECL_SCREEN_IF_INCLUDED(FTDI_COCOA_MOVE_XYZ_SCREEN) + DECL_SCREEN_IF_INCLUDED(FTDI_COCOA_MOVE_E_SCREEN) + DECL_SCREEN_IF_INCLUDED(FTDI_DEVELOPER_MENU) + DECL_SCREEN_IF_INCLUDED(FTDI_CONFIRM_ERASE_FLASH_DIALOG_BOX) + DECL_SCREEN_IF_INCLUDED(FTDI_WIDGET_DEMO_SCREEN) + DECL_SCREEN_IF_INCLUDED(FTDI_TOUCH_REGISTERS_SCREEN) + DECL_SCREEN_IF_INCLUDED(FTDI_STRESS_TEST_SCREEN) + DECL_SCREEN_IF_INCLUDED(FTDI_MEDIA_PLAYER_SCREEN) + DECL_SCREEN_IF_INCLUDED(FTDI_DISPLAY_TUNING_SCREEN) }; SCREEN_TABLE_POST +#include "screen_data.h" +screen_data_t screen_data; + #endif // TOUCH_UI_FTDI_EVE 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 51fc76f15b..a82d8988da 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 @@ -22,6 +22,8 @@ #pragma once +#if ENABLED(TOUCH_UI_FTDI_EVE) + #include "../ftdi_eve_lib/ftdi_eve_lib.h" #include "../language/language.h" #include "../theme/theme.h" @@ -127,785 +129,140 @@ enum { /************************* MENU SCREEN DECLARATIONS *************************/ -class BaseScreen : public UIScreen { - protected: - #if LCD_TIMEOUT_TO_STATUS > 0 - static uint32_t last_interaction; - #endif - - static bool buttonIsPressed(uint8_t tag); - - public: - static bool buttonStyleCallback(CommandProcessor &, uint8_t, uint8_t &, uint16_t &, bool); +#include "base_screen.h" +#include "base_numeric_adjustment_screen.h" +#include "dialog_box_base_class.h" - static void reset_menu_timeout(); - - static void onEntry(); - static void onIdle(); -}; - -class BootScreen : public BaseScreen, public UncachedScreen { - private: - static void showSplashScreen(); - public: - static void onRedraw(draw_mode_t); - static void onIdle(); -}; - -class AboutScreen : public BaseScreen, public UncachedScreen { - public: - static void onEntry(); - static void onRedraw(draw_mode_t); - static bool onTouchEnd(uint8_t tag); -}; - -#if ENABLED(PRINTCOUNTER) - class StatisticsScreen : public BaseScreen, public UncachedScreen { - public: - static void onRedraw(draw_mode_t); - static bool onTouchEnd(uint8_t tag); - }; -#endif - -class KillScreen { - // The KillScreen is behaves differently than the - // others, so we do not bother extending UIScreen. - public: - static void show(const char*); -}; - -class DialogBoxBaseClass : public BaseScreen { - protected: - template static void drawMessage(const T, int16_t font = 0); - static void drawYesNoButtons(uint8_t default_btn = 0); - static void drawOkayButton(); - static void drawSpinner(); - static void drawButton(const progmem_str); - - static void onRedraw(draw_mode_t) {}; - public: - static bool onTouchEnd(uint8_t tag); - static void onIdle(); -}; - -class AlertDialogBox : public DialogBoxBaseClass, public CachedScreen { - public: - static void onEntry(); - static void onRedraw(draw_mode_t); - template static void show(T); - template static void showError(T); - static void hide(); -}; - -class RestoreFailsafeDialogBox : public DialogBoxBaseClass, public UncachedScreen { - public: - static void onRedraw(draw_mode_t); - static bool onTouchEnd(uint8_t tag); -}; - -class SaveSettingsDialogBox : public DialogBoxBaseClass, public UncachedScreen { - private: - static bool needs_save; - - public: - static void onRedraw(draw_mode_t); - static bool onTouchEnd(uint8_t tag); - - static void promptToSaveSettings(); - static void settingsChanged() {needs_save = true;} -}; - -class ConfirmStartPrintDialogBox : public DialogBoxBaseClass, public UncachedScreen { - private: - inline static const char *getShortFilename() {return getFilename(false);} - inline static const char *getLongFilename() {return getFilename(true);} - - static const char *getFilename(bool longName); - public: - static void onRedraw(draw_mode_t); - static bool onTouchEnd(uint8_t); - - static void show(uint8_t file_index); -}; - -class ConfirmAbortPrintDialogBox : public DialogBoxBaseClass, public UncachedScreen { - public: - static void onRedraw(draw_mode_t); - static bool onTouchEnd(uint8_t tag); -}; - -#if ENABLED(CALIBRATION_GCODE) -class ConfirmAutoCalibrationDialogBox : public DialogBoxBaseClass, public UncachedScreen { - public: - static void onRedraw(draw_mode_t); - static bool onTouchEnd(uint8_t tag); -}; -#endif - -class ConfirmUserRequestAlertBox : public AlertDialogBox { - public: - static void onRedraw(draw_mode_t); - static bool onTouchEnd(uint8_t); - static void hide(); - static void show(const char*); -}; - -#if ENABLED(CUSTOM_USER_MENUS) - class CustomUserMenus : public BaseScreen, public CachedScreen { - public: - static void onRedraw(draw_mode_t); - static bool onTouchEnd(uint8_t tag); - }; -#endif - -class SpinnerDialogBox : public DialogBoxBaseClass, public CachedScreen { - public: - static void onRedraw(draw_mode_t); - static void onIdle(); - - static void show(const progmem_str); - static void hide(); - static void enqueueAndWait_P(const progmem_str commands); - static void enqueueAndWait_P(const progmem_str message, const progmem_str commands); -}; +#if ENABLED(TOUCH_UI_LULZBOT_BIO) + #include "bio_status_screen.h" + #include "bio_main_menu.h" + #include "bio_tune_menu.h" + #include "bio_advanced_settings.h" + #include "bio_printing_dialog_box.h" + #include "bio_confirm_home_xyz.h" + #include "bio_confirm_home_e.h" + +#elif ENABLED(TOUCH_UI_COCOA_PRESS) + #include "cocoa_press_status_screen.h" + #include "cocoa_press_main_menu.h" + #include "cocoa_press_advanced_settings.h" + #include "cocoa_press_preheat_menu.h" + #include "cocoa_press_preheat_screen.h" + #include "cocoa_press_unload_cartridge.h" + #include "cocoa_press_load_chocolate.h" + #include "cocoa_press_move_xyz_screen.h" + #include "cocoa_press_move_e_screen.h" + #include "tune_menu.h" -#if NONE(TOUCH_UI_LULZBOT_BIO, TOUCH_UI_COCOA_PRESS) -class StatusScreen : public BaseScreen, public CachedScreen { - private: - static void draw_axis_position(draw_mode_t); - static void draw_temperature(draw_mode_t); - static void draw_progress(draw_mode_t); - static void draw_interaction_buttons(draw_mode_t); - static void draw_status_message(draw_mode_t, const char * const); - static void _format_time(char *outstr, uint32_t time); - public: - static void loadBitmaps(); - static void setStatusMessage(const char *); - static void setStatusMessage(progmem_str); - static void onRedraw(draw_mode_t); - static void onStartup(); - static void onEntry(); - static void onIdle(); - static bool onTouchEnd(uint8_t tag); -}; #else - class StatusScreen : public BaseScreen, public CachedScreen { - private: - static float increment; - static bool jog_xy; - static bool fine_motion; - - static void draw_progress(draw_mode_t what); - static void draw_temperature(draw_mode_t what); - static void draw_syringe(draw_mode_t what); - static void draw_arrows(draw_mode_t what); - static void draw_overlay_icons(draw_mode_t what); - static void draw_fine_motion(draw_mode_t what); - static void draw_buttons(draw_mode_t what); - public: - static void loadBitmaps(); - static void unlockMotors(); - - static void setStatusMessage(const char *); - static void setStatusMessage(progmem_str); - - static void onRedraw(draw_mode_t); - - static bool onTouchStart(uint8_t tag); - static bool onTouchHeld(uint8_t tag); - static bool onTouchEnd(uint8_t tag); - static void onIdle(); - - }; + #include "status_screen.h" + #include "main_menu.h" + #include "advanced_settings_menu.h" + #include "tune_menu.h" #endif -#if ENABLED(TOUCH_UI_LULZBOT_BIO) - class BioPrintingDialogBox : public BaseScreen, public CachedScreen { - private: - static void draw_status_message(draw_mode_t, const char * const); - static void draw_progress(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 show(); - - static void setStatusMessage(const char *); - static void setStatusMessage(progmem_str); - - static void onIdle(); - static bool onTouchEnd(uint8_t tag); - }; - - class BioConfirmHomeXYZ : public DialogBoxBaseClass, public UncachedScreen { - public: - static void onRedraw(draw_mode_t); - static bool onTouchEnd(uint8_t tag); - }; - - class BioConfirmHomeE : public DialogBoxBaseClass, public UncachedScreen { - public: - static void onRedraw(draw_mode_t); - static bool onTouchEnd(uint8_t tag); - }; -#endif - -class MainMenu : public BaseScreen, public CachedScreen { - public: - static void onRedraw(draw_mode_t); - static bool onTouchEnd(uint8_t tag); -}; - -class TuneMenu : public BaseScreen, public CachedScreen { - private: - static void pausePrint(); - static void resumePrint(); - public: - static void onRedraw(draw_mode_t); - static bool onTouchEnd(uint8_t tag); -}; - -class TouchCalibrationScreen : public BaseScreen, public UncachedScreen { - public: - static void onRefresh(); - static void onEntry(); - static void onRedraw(draw_mode_t); - static void onIdle(); -}; - -class TouchRegistersScreen : public BaseScreen, public UncachedScreen { - public: - static void onRedraw(draw_mode_t); - static bool onTouchEnd(uint8_t tag); -}; - -class AdvancedSettingsMenu : public BaseScreen, public CachedScreen { - public: - static void onRedraw(draw_mode_t); - static bool onTouchEnd(uint8_t tag); -}; - -class ChangeFilamentScreen : public BaseScreen, public CachedScreen { - private: - static uint8_t getSoftenTemp(); - static ExtUI::extruder_t getExtruder(); - static void drawTempGradient(uint16_t x, uint16_t y, uint16_t w, uint16_t h); - static uint32_t getTempColor(uint32_t temp); - static void doPurge(); - public: - static void onEntry(); - static void onExit(); - static void onRedraw(draw_mode_t); - static bool onTouchStart(uint8_t tag); - static bool onTouchEnd(uint8_t tag); - static bool onTouchHeld(uint8_t tag); - static void onIdle(); -}; - -class BaseNumericAdjustmentScreen : public BaseScreen { - public: - enum precision_default_t { - DEFAULT_LOWEST, - DEFAULT_MIDRANGE, - DEFAULT_HIGHEST - }; - - protected: - class widgets_t { - private: - draw_mode_t _what; - uint8_t _line; - uint32_t _color; - uint8_t _decimals; - progmem_str _units; - enum style_t { - BTN_NORMAL, - BTN_ACTION, - BTN_TOGGLE, - BTN_DISABLED, - TEXT_AREA, - TEXT_LABEL - } _style; - - protected: - void _draw_increment_btn(CommandProcessor &, uint8_t line, const uint8_t tag); - void _button(CommandProcessor &, uint8_t tag, int16_t x, int16_t y, int16_t w, int16_t h, progmem_str, bool enabled = true, bool highlight = false); - void _button_style(CommandProcessor &cmd, style_t style); - public: - widgets_t(draw_mode_t); - - widgets_t &color(uint32_t color) {_color = color; return *this;} - widgets_t &units(progmem_str units) {_units = units; return *this;} - widgets_t &draw_mode(draw_mode_t what) {_what = what; return *this;} - widgets_t &precision(uint8_t decimals, precision_default_t = DEFAULT_HIGHEST); - - void heading (progmem_str label); - void adjuster_sram_val (uint8_t tag, progmem_str label, const char *value, bool is_enabled = true); - void adjuster (uint8_t tag, progmem_str label, const char *value, bool is_enabled = true); - void adjuster (uint8_t tag, progmem_str label, float value=0, bool is_enabled = true); - void button (uint8_t tag, progmem_str label, bool is_enabled = true); - void text_field (uint8_t tag, progmem_str label, const char *value, bool is_enabled = true); - void two_buttons (uint8_t tag1, progmem_str label1, - uint8_t tag2, progmem_str label2, bool is_enabled = true); - void toggle (uint8_t tag, progmem_str label, bool value, bool is_enabled = true); - void home_buttons (uint8_t tag); - void increments (); - }; - - static float getIncrement(); - - public: - static void onEntry(); - static bool onTouchEnd(uint8_t tag); -}; - -class BaseMoveAxisScreen : public BaseNumericAdjustmentScreen { - private: - static float getManualFeedrate(uint8_t axis, float increment_mm); - public: - static void setManualFeedrate(ExtUI::axis_t, float increment_mm); - static void setManualFeedrate(ExtUI::extruder_t, float increment_mm); - - static void onEntry(); - static bool onTouchHeld(uint8_t tag); -}; +#include "boot_screen.h" +#include "about_screen.h" +#include "kill_screen.h" +#include "alert_dialog_box.h" +#include "spinner_dialog_box.h" +#include "restore_failsafe_dialog_box.h" +#include "save_settings_dialog_box.h" +#include "confirm_start_print_dialog_box.h" +#include "confirm_abort_print_dialog_box.h" +#include "confirm_user_request_alert_box.h" +#include "touch_calibration_screen.h" +#include "touch_registers_screen.h" +#include "change_filament_screen.h" +#include "move_axis_screen.h" +#include "steps_screen.h" +#include "stepper_current_screen.h" +#include "feedrate_percent_screen.h" +#include "max_velocity_screen.h" +#include "max_acceleration_screen.h" +#include "default_acceleration_screen.h" +#include "temperature_screen.h" +#include "interface_sounds_screen.h" +#include "interface_settings_screen.h" +#include "lock_screen.h" +#include "endstop_state_screen.h" +#include "display_tuning_screen.h" +#include "media_player_screen.h" -class MoveAxisScreen : public BaseMoveAxisScreen, public CachedScreen { - public: - static void onRedraw(draw_mode_t); - static void onIdle(); -}; - -class StepsScreen : public BaseNumericAdjustmentScreen, public CachedScreen { - public: - static void onRedraw(draw_mode_t); - static bool onTouchHeld(uint8_t tag); -}; +#if ENABLED(PRINTCOUNTER) + #include "statistics_screen.h" +#endif #if HAS_TRINAMIC_CONFIG - class StepperCurrentScreen : public BaseNumericAdjustmentScreen, public CachedScreen { - public: - static void onRedraw(draw_mode_t); - static bool onTouchHeld(uint8_t tag); - }; - - class StepperBumpSensitivityScreen : public BaseNumericAdjustmentScreen, public CachedScreen { - public: - static void onRedraw(draw_mode_t); - static bool onTouchHeld(uint8_t tag); - }; + #include "stepper_current_screen.h" + #include "stepper_bump_sensitivity_screen.h" #endif #if HAS_MULTI_HOTEND - class NozzleOffsetScreen : public BaseNumericAdjustmentScreen, public CachedScreen { - public: - static void onEntry(); - static void onRedraw(draw_mode_t); - static bool onTouchHeld(uint8_t tag); - }; + #include "nozzle_offsets_screen.h" #endif #if HAS_LEVELING - - class LevelingMenu : public BaseScreen, public CachedScreen { - public: - static void onRedraw(draw_mode_t); - static bool onTouchEnd(uint8_t tag); - }; - + #include "leveling_menu.h" #if HAS_BED_PROBE - class ZOffsetScreen : public BaseNumericAdjustmentScreen, public CachedScreen { - public: - static void onRedraw(draw_mode_t); - static bool onTouchHeld(uint8_t tag); - }; + #include "z_offset_screen.h" #endif - #if HAS_MESH + #include "bed_mesh_screen.h" + #endif +#endif - class BedMeshScreen : public BaseScreen, public CachedScreen { - private: - enum MeshOpts { - USE_POINTS = 0x01, - USE_COLORS = 0x02, - USE_TAGS = 0x04, - USE_HIGHLIGHT = 0x08, - USE_AUTOSCALE = 0x10 - }; - - static uint8_t pointToTag(uint8_t x, uint8_t y); - static bool tagToPoint(uint8_t tag, uint8_t &x, uint8_t &y); - static float getHightlightedValue(); - static void drawHighlightedPointValue(); - static void drawMesh(int16_t x, int16_t y, int16_t w, int16_t h, ExtUI::bed_mesh_t data, uint8_t opts, float autoscale_max = 0.1); - - public: - static void onMeshUpdate(const int8_t x, const int8_t y, const float val); - static void onMeshUpdate(const int8_t x, const int8_t y, const ExtUI::probe_state_t); - static void onEntry(); - static void onRedraw(draw_mode_t); - static bool onTouchStart(uint8_t tag); - static bool onTouchEnd(uint8_t tag); - - static void startMeshProbe(); - }; - - #endif // HAS_MESH - -#endif // HAS_LEVELING +#if ENABLED(CALIBRATION_GCODE) + #include "confirm_auto_calibration_dialog_box.h" +#endif #if ENABLED(BABYSTEPPING) - class NudgeNozzleScreen : public BaseNumericAdjustmentScreen, public CachedScreen { - public: - static void onEntry(); - static void onRedraw(draw_mode_t); - static bool onTouchEnd(uint8_t tag); - static bool onTouchHeld(uint8_t tag); - static void onIdle(); - }; + #include "nudge_nozzle_screen.h" #endif #if ENABLED(BACKLASH_GCODE) - class BacklashCompensationScreen : public BaseNumericAdjustmentScreen, public CachedScreen { - public: - static void onRedraw(draw_mode_t); - static bool onTouchHeld(uint8_t tag); - }; + #include "backlash_compensation_screen.h" #endif -class FeedratePercentScreen : public BaseNumericAdjustmentScreen, public CachedScreen { - public: - static void onRedraw(draw_mode_t); - static bool onTouchHeld(uint8_t tag); -}; - -class MaxVelocityScreen : public BaseNumericAdjustmentScreen, public CachedScreen { - public: - static void onRedraw(draw_mode_t); - static bool onTouchHeld(uint8_t tag); -}; - -class MaxAccelerationScreen : public BaseNumericAdjustmentScreen, public CachedScreen { - public: - static void onRedraw(draw_mode_t); - static bool onTouchHeld(uint8_t tag); -}; - -class DefaultAccelerationScreen : public BaseNumericAdjustmentScreen, public CachedScreen { - public: - static void onRedraw(draw_mode_t); - static bool onTouchHeld(uint8_t tag); -}; - #if HAS_JUNCTION_DEVIATION - class JunctionDeviationScreen : public BaseNumericAdjustmentScreen, public CachedScreen { - public: - static void onRedraw(draw_mode_t); - static bool onTouchHeld(uint8_t tag); - }; + #include "junction_deviation_screen.h" #else - class JerkScreen : public BaseNumericAdjustmentScreen, public CachedScreen { - public: - static void onRedraw(draw_mode_t); - static bool onTouchHeld(uint8_t tag); - }; + #include "jerk_screen.h" #endif #if ENABLED(CASE_LIGHT_ENABLE) - class CaseLightScreen : public BaseNumericAdjustmentScreen, public CachedScreen { - public: - static void onRedraw(draw_mode_t); - static bool onTouchHeld(uint8_t tag); - }; + #include "case_light_screen.h" #endif #if EITHER(LIN_ADVANCE, FILAMENT_RUNOUT_SENSOR) - class FilamentMenu : public BaseNumericAdjustmentScreen, public CachedScreen { - public: - static void onRedraw(draw_mode_t); - static bool onTouchEnd(uint8_t tag); - }; + #include "filament_menu.h" #endif #if ENABLED(FILAMENT_RUNOUT_SENSOR) - class FilamentRunoutScreen : public BaseNumericAdjustmentScreen, public CachedScreen { - public: - static void onRedraw(draw_mode_t); - static bool onTouchHeld(uint8_t tag); - }; + #include "filament_runout_screen.h" #endif #if ENABLED(LIN_ADVANCE) - class LinearAdvanceScreen : public BaseNumericAdjustmentScreen, public CachedScreen { - public: - static void onRedraw(draw_mode_t); - static bool onTouchHeld(uint8_t tag); - }; + #include "linear_advance_screen.h" #endif -class TemperatureScreen : public BaseNumericAdjustmentScreen, public CachedScreen { - public: - static void onRedraw(draw_mode_t); - static bool onTouchHeld(uint8_t tag); -}; - -class InterfaceSoundsScreen : public BaseScreen, public CachedScreen { - public: - enum event_t { - PRINTING_STARTED = 0, - PRINTING_FINISHED = 1, - PRINTING_FAILED = 2, - - NUM_EVENTS - }; - - private: - friend class InterfaceSettingsScreen; - - static uint8_t event_sounds[NUM_EVENTS]; - - static const char* getSoundSelection(event_t); - static void toggleSoundSelection(event_t); - static void setSoundSelection(event_t, const FTDI::SoundPlayer::sound_t*); - - public: - static void playEventSound(event_t, FTDI::play_mode_t = FTDI::PLAY_ASYNCHRONOUS); - - static void defaultSettings(); - - static void onEntry(); - static void onRedraw(draw_mode_t); - static bool onTouchStart(uint8_t tag); - static bool onTouchEnd(uint8_t tag); - static void onIdle(); -}; - -class InterfaceSettingsScreen : public BaseScreen, public CachedScreen { - private: - struct persistent_data_t { - uint32_t touch_transform_a; - uint32_t touch_transform_b; - uint32_t touch_transform_c; - uint32_t touch_transform_d; - uint32_t touch_transform_e; - uint32_t touch_transform_f; - uint16_t passcode; - uint8_t display_brightness; - int8_t display_h_offset_adj; - int8_t display_v_offset_adj; - uint8_t sound_volume; - uint8_t bit_flags; - uint8_t event_sounds[InterfaceSoundsScreen::NUM_EVENTS]; - }; - - public: - #ifdef ARCHIM2_SPI_FLASH_EEPROM_BACKUP_SIZE - static bool backupEEPROM(); - #endif - - static void saveSettings(char *); - static void loadSettings(const char *); - static void defaultSettings(); - static void failSafeSettings(); - - static void onStartup(); - static void onEntry(); - static void onRedraw(draw_mode_t); - static bool onTouchStart(uint8_t tag); - static bool onTouchEnd(uint8_t tag); - static void onIdle(); -}; - -class LockScreen : public BaseScreen, public CachedScreen { - private: - friend InterfaceSettingsScreen; - - static uint16_t passcode; - - static char & message_style(); - static uint16_t compute_checksum(); - static void onPasscodeEntered(); - public: - static bool is_enabled(); - static void check_passcode(); - static void enable(); - static void disable(); - - static void set_hash(uint16_t pass) {passcode = pass;}; - static uint16_t get_hash() {return passcode;}; - - static void onEntry(); - static void onRedraw(draw_mode_t); - static bool onTouchEnd(uint8_t tag); -}; - #if ENABLED(SDSUPPORT) + #include "files_screen.h" +#endif - class FilesScreen : public BaseScreen, public CachedScreen { - private: - #if ENABLED(TOUCH_UI_PORTRAIT) - static constexpr uint8_t header_h = 2; - static constexpr uint8_t footer_h = 2; - static constexpr uint8_t files_per_page = 11; - #else - static constexpr uint8_t header_h = 1; - static constexpr uint8_t footer_h = 1; - static constexpr uint8_t files_per_page = 6; - #endif - - static uint8_t getTagForLine(uint8_t line) {return line + 2;} - static uint8_t getLineForTag(uint8_t tag) {return tag - 2;} - static uint16_t getFileForTag(uint8_t tag); - static uint16_t getSelectedFileIndex(); - - inline static const char *getSelectedShortFilename() {return getSelectedFilename(false);} - inline static const char *getSelectedLongFilename() {return getSelectedFilename(true);} - static const char *getSelectedFilename(bool longName); - - static void drawFileButton(const char* filename, uint8_t tag, bool is_dir, bool is_highlighted); - static void drawFileList(); - static void drawHeader(); - static void drawFooter(); - static void drawSelectedFile(); - - static void gotoPage(uint8_t); - public: - static void onEntry(); - static void onRedraw(draw_mode_t); - static bool onTouchEnd(uint8_t tag); - static void onIdle(); - }; - -#endif // SDSUPPORT - -class EndstopStatesScreen : public BaseScreen, public UncachedScreen { - public: - static void onEntry(); - static void onExit(); - static void onRedraw(draw_mode_t); - static bool onTouchEnd(uint8_t tag); - static void onIdle(); -}; - -class DisplayTuningScreen : public BaseNumericAdjustmentScreen, public CachedScreen { - public: - static void onRedraw(draw_mode_t); - static bool onTouchHeld(uint8_t tag); -}; +#if ENABLED(CUSTOM_USER_MENUS) + #include "custom_user_menus.h" +#endif #if ENABLED(TOUCH_UI_DEVELOPER_MENU) - - class DeveloperMenu : public BaseScreen, public UncachedScreen { - public: - static void onRedraw(draw_mode_t); - static bool onTouchEnd(uint8_t tag); - }; - - class ConfirmEraseFlashDialogBox : public DialogBoxBaseClass, public UncachedScreen { - public: - static void onRedraw(draw_mode_t); - static bool onTouchEnd(uint8_t tag); - }; - - class WidgetsScreen : public BaseScreen, public UncachedScreen { - public: - static void onEntry(); - static void onRedraw(draw_mode_t); - static bool onTouchStart(uint8_t tag); - static void onIdle(); - }; - - class StressTestScreen : public BaseScreen, public UncachedScreen { - private: - static void drawDots(uint16_t x, uint16_t y, uint16_t h, uint16_t v); - static bool watchDogTestNow(); - static void recursiveLockup(); - static void iterativeLockup(); - static void runTestOnBootup(bool enable); - - public: - static void startupCheck(); - - static void onEntry(); - static void onRedraw(draw_mode_t); - static bool onTouchEnd(uint8_t tag); - static void onIdle(); - }; - -#endif // TOUCH_UI_DEVELOPER_MENU - -class MediaPlayerScreen : public BaseScreen, public UncachedScreen { - private: - typedef int16_t media_streamer_func_t(void *obj, void *buff, size_t bytes); - - public: - static bool playCardMedia(); - static bool playBootMedia(); - - static void onEntry(); - static void onRedraw(draw_mode_t); - - static void playStream(void *obj, media_streamer_func_t*); -}; + #include "developer_menu.h" + #include "confirm_erase_flash_dialog_box.h" + #include "widget_demo_screen.h" + #include "stress_test_screen.h" +#endif #if NUM_LANGUAGES > 1 - class LanguageMenu : public BaseScreen, public UncachedScreen { - public: - static void onRedraw(draw_mode_t); - static bool onTouchEnd(uint8_t tag); - }; + #include "language_menu.h" #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 // TOUCH_UI_COCOA_PRESS +#endif // TOUCH_UI_FTDI_EVE diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/spinner_dialog_box.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/spinner_dialog_box.cpp index 2318a0d108..7483261e3c 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/spinner_dialog_box.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/spinner_dialog_box.cpp @@ -21,15 +21,16 @@ ****************************************************************************/ #include "../config.h" - -#if ENABLED(TOUCH_UI_FTDI_EVE) - #include "screens.h" #include "screen_data.h" +#ifdef FTDI_SPINNER_DIALOG_BOX + using namespace FTDI; using namespace ExtUI; +constexpr static SpinnerDialogBoxData &mydata = screen_data.SpinnerDialogBox; + void SpinnerDialogBox::onRedraw(draw_mode_t) { } @@ -37,7 +38,7 @@ void SpinnerDialogBox::show(const progmem_str message) { drawMessage(message); drawSpinner(); storeBackground(); - screen_data.SpinnerDialog.auto_hide = false; + mydata.auto_hide = false; } void SpinnerDialogBox::hide() { @@ -53,16 +54,16 @@ void SpinnerDialogBox::enqueueAndWait_P(const progmem_str message, const progmem show(message); GOTO_SCREEN(SpinnerDialogBox); ExtUI::injectCommands_P((const char*)commands); - screen_data.SpinnerDialog.auto_hide = true; + mydata.auto_hide = true; } void SpinnerDialogBox::onIdle() { reset_menu_timeout(); - if (screen_data.SpinnerDialog.auto_hide && !commandsInQueue()) { - screen_data.SpinnerDialog.auto_hide = false; + if (mydata.auto_hide && !commandsInQueue()) { + mydata.auto_hide = false; hide(); GOTO_PREVIOUS(); } } -#endif // TOUCH_UI_FTDI_EVE +#endif // FTDI_SPINNER_DIALOG_BOX diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/spinner_dialog_box.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/spinner_dialog_box.h new file mode 100644 index 0000000000..c5f0ae8e9f --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/spinner_dialog_box.h @@ -0,0 +1,41 @@ +/************************ + * spinner_dialog_box.h * + ************************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_SPINNER_DIALOG_BOX +#define FTDI_SPINNER_DIALOG_BOX_CLASS SpinnerDialogBox + +struct SpinnerDialogBoxData { + bool auto_hide; +}; + +class SpinnerDialogBox : public DialogBoxBaseClass, public CachedScreen { + public: + static void onRedraw(draw_mode_t); + static void onIdle(); + + static void show(const progmem_str); + static void hide(); + static void enqueueAndWait_P(const progmem_str commands); + static void enqueueAndWait_P(const progmem_str message, const progmem_str commands); +}; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/statistics_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/statistics_screen.cpp index 0e224da967..2d62d5349b 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/statistics_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/statistics_screen.cpp @@ -21,11 +21,10 @@ ****************************************************************************/ #include "../config.h" - -#if BOTH(TOUCH_UI_FTDI_EVE, PRINTCOUNTER) - #include "screens.h" +#ifdef FTDI_STATISTICS_SCREEN + using namespace FTDI; using namespace ExtUI; using namespace Theme; @@ -75,4 +74,4 @@ bool StatisticsScreen::onTouchEnd(uint8_t tag) { } } -#endif // TOUCH_UI_FTDI_EVE && PRINTCOUNTER +#endif // FTDI_STATISTICS_SCREEN diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/statistics_screen.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/statistics_screen.h new file mode 100644 index 0000000000..4176f54101 --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/statistics_screen.h @@ -0,0 +1,32 @@ +/*********************** + * statistics_screen.h * + ***********************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_STATISTICS_SCREEN +#define FTDI_STATISTICS_SCREEN_CLASS StatisticsScreen + +class StatisticsScreen : public BaseScreen, public UncachedScreen { + public: + static void onRedraw(draw_mode_t); + static bool onTouchEnd(uint8_t tag); +}; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/status_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/status_screen.cpp index 51f50343e0..956795c977 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/status_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/status_screen.cpp @@ -21,12 +21,11 @@ ****************************************************************************/ #include "../config.h" - -#if ENABLED(TOUCH_UI_FTDI_EVE) && NONE(TOUCH_UI_LULZBOT_BIO, TOUCH_UI_COCOA_PRESS) - #include "screens.h" #include "screen_data.h" +#ifdef FTDI_STATUS_SCREEN + #include "../archim2-flash/flash_storage.h" using namespace FTDI; @@ -462,4 +461,4 @@ bool StatusScreen::onTouchEnd(uint8_t tag) { return true; } -#endif // TOUCH_UI_FTDI_EVE +#endif // FTDI_STATUS_SCREEN diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/status_screen.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/status_screen.h new file mode 100644 index 0000000000..3a2ba1746c --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/status_screen.h @@ -0,0 +1,45 @@ +/******************* + * status_screen.h * + *******************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_STATUS_SCREEN +#define FTDI_STATUS_SCREEN_CLASS StatusScreen + +class StatusScreen : public BaseScreen, public CachedScreen { + private: + static void draw_axis_position(draw_mode_t); + static void draw_temperature(draw_mode_t); + static void draw_progress(draw_mode_t); + static void draw_interaction_buttons(draw_mode_t); + static void draw_status_message(draw_mode_t, const char * const); + static void _format_time(char *outstr, uint32_t time); + public: + static void loadBitmaps(); + static void setStatusMessage(const char *); + static void setStatusMessage(progmem_str); + static void onRedraw(draw_mode_t); + static void onStartup(); + static void onEntry(); + static void onIdle(); + static bool onTouchEnd(uint8_t tag); +}; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/stepper_bump_sensitivity_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/stepper_bump_sensitivity_screen.cpp index 84d76dcefa..701fb78062 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/stepper_bump_sensitivity_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/stepper_bump_sensitivity_screen.cpp @@ -1,5 +1,5 @@ -/************************************** - * stepper_bump_sensiivity_screen.cpp * +/*************************************** + * stepper_bump_sensitivity_screen.cpp * **************************************/ /**************************************************************************** @@ -21,11 +21,10 @@ ****************************************************************************/ #include "../config.h" - -#if BOTH(TOUCH_UI_FTDI_EVE, HAS_TRINAMIC_CONFIG) - #include "screens.h" +#ifdef FTDI_STEPPER_BUMP_SENSITIVITY_SCREEN + using namespace FTDI; using namespace ExtUI; using namespace Theme; @@ -56,4 +55,4 @@ bool StepperBumpSensitivityScreen::onTouchHeld(uint8_t tag) { return true; } -#endif // TOUCH_UI_FTDI_EVE && HAS_TRINAMIC_CONFIG +#endif // FTDI_STEPPER_BUMP_SENSITIVITY_SCREEN diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/stepper_bump_sensitivity_screen.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/stepper_bump_sensitivity_screen.h new file mode 100644 index 0000000000..b37b8014e8 --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/stepper_bump_sensitivity_screen.h @@ -0,0 +1,32 @@ +/************************************* + * stepper_bump_sensitivity_screen.h * + *************************************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_STEPPER_BUMP_SENSITIVITY_SCREEN +#define FTDI_STEPPER_BUMP_SENSITIVITY_SCREEN_CLASS StepperBumpSensitivityScreen + +class StepperBumpSensitivityScreen : 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/stepper_current_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/stepper_current_screen.cpp index d6e36c1efa..4b63b1f3e4 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/stepper_current_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/stepper_current_screen.cpp @@ -21,11 +21,10 @@ ****************************************************************************/ #include "../config.h" - -#if BOTH(TOUCH_UI_FTDI_EVE, HAS_TRINAMIC_CONFIG) - #include "screens.h" +#ifdef FTDI_STEPPER_CURRENT_SCREEN + using namespace FTDI; using namespace ExtUI; using namespace Theme; @@ -124,4 +123,4 @@ bool StepperCurrentScreen::onTouchHeld(uint8_t tag) { return true; } -#endif // TOUCH_UI_FTDI_EVE +#endif // FTDI_STEPPER_CURRENT_SCREEN diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/stepper_current_screen.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/stepper_current_screen.h new file mode 100644 index 0000000000..9186eb1637 --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/stepper_current_screen.h @@ -0,0 +1,32 @@ +/**************************** + * stepper_current_screen.h * + ****************************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_STEPPER_CURRENT_SCREEN +#define FTDI_STEPPER_CURRENT_SCREEN_CLASS StepperCurrentScreen + +class StepperCurrentScreen : 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/steps_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/steps_screen.cpp index e9bc50ae45..ec812b776b 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/steps_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/steps_screen.cpp @@ -21,11 +21,10 @@ ****************************************************************************/ #include "../config.h" - -#if ENABLED(TOUCH_UI_FTDI_EVE) - #include "screens.h" +#ifdef FTDI_STEPS_SCREEN + using namespace FTDI; using namespace ExtUI; using namespace Theme; @@ -83,4 +82,4 @@ bool StepsScreen::onTouchHeld(uint8_t tag) { return true; } -#endif // TOUCH_UI_FTDI_EVE +#endif // FTDI_STEPS_SCREEN diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/steps_screen.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/steps_screen.h new file mode 100644 index 0000000000..68a3ced8fa --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/steps_screen.h @@ -0,0 +1,32 @@ +/****************** + * steps_screen.h * + ******************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_STEPS_SCREEN +#define FTDI_STEPS_SCREEN_CLASS StepsScreen + +class StepsScreen : 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/stress_test_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/stress_test_screen.cpp index 6c4aab6d31..37fe81938e 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/stress_test_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/stress_test_screen.cpp @@ -21,12 +21,11 @@ ****************************************************************************/ #include "../config.h" - -#if BOTH(TOUCH_UI_FTDI_EVE, TOUCH_UI_DEVELOPER_MENU) - #include "screens.h" #include "screen_data.h" +#ifdef FTDI_STRESS_TEST_SCREEN + #define STRESS_TEST_CHANGE_INTERVAL 6000 #define GRID_COLS 4 @@ -36,6 +35,8 @@ using namespace FTDI; using namespace Theme; using namespace ExtUI; +constexpr static StressTestScreenData &mydata = screen_data.StressTestScreen; + void StressTestScreen::drawDots(uint16_t x, uint16_t y, uint16_t w, uint16_t h) { CommandProcessor cmd; for (uint8_t i = 0; i < 100; i++) { @@ -47,8 +48,8 @@ void StressTestScreen::drawDots(uint16_t x, uint16_t y, uint16_t w, uint16_t h) } bool StressTestScreen::watchDogTestNow() { - return screen_data.StressTest.next_watchdog_trigger && - ELAPSED(millis(), screen_data.StressTest.next_watchdog_trigger); + return mydata.next_watchdog_trigger && + ELAPSED(millis(), mydata.next_watchdog_trigger); } void StressTestScreen::onRedraw(draw_mode_t) { @@ -58,7 +59,7 @@ void StressTestScreen::onRedraw(draw_mode_t) { .cmd(CLEAR(true,true,true)) .cmd(COLOR_RGB(bg_text_enabled)) .font(font_medium) - .text(BTN_POS(1,1), BTN_SIZE(4,1), progmem_str(screen_data.StressTest.message)); + .text(BTN_POS(1,1), BTN_SIZE(4,1), progmem_str(mydata.message)); drawDots(BTN_POS(1,3), BTN_SIZE(4,4)); @@ -92,8 +93,8 @@ void StressTestScreen::startupCheck() { } void StressTestScreen::onEntry() { - screen_data.StressTest.next_watchdog_trigger = millis() + 10000 + random(40000); - screen_data.StressTest.message = PSTR("Test 1: Stress testing..."); + mydata.next_watchdog_trigger = millis() + 10000 + random(40000); + mydata.message = PSTR("Test 1: Stress testing..."); // Turn off heaters. setTargetTemp_celsius(0, E0); @@ -104,13 +105,13 @@ void StressTestScreen::onEntry() { } void StressTestScreen::recursiveLockup() { - screen_data.StressTest.message = PSTR("Test 2: Printer will restart."); + mydata.message = PSTR("Test 2: Printer will restart."); current_screen.onRefresh(); recursiveLockup(); } void StressTestScreen::iterativeLockup() { - screen_data.StressTest.message = PSTR("Test 3: Printer will restart."); + mydata.message = PSTR("Test 3: Printer will restart."); for (;;) current_screen.onRefresh(); } @@ -146,4 +147,4 @@ void StressTestScreen::onIdle() { BaseScreen::onIdle(); } -#endif // TOUCH_UI_FTDI_EVE +#endif // FTDI_STRESS_TEST_SCREEN diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/stress_test_screen.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/stress_test_screen.h new file mode 100644 index 0000000000..f35f11adb6 --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/stress_test_screen.h @@ -0,0 +1,48 @@ +/************************ + * stress_test_screen.h * + ************************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_STRESS_TEST_SCREEN +#define FTDI_STRESS_TEST_SCREEN_CLASS StressTestScreen + +struct StressTestScreenData { + uint32_t next_watchdog_trigger; + const char* message; +}; + +class StressTestScreen : public BaseScreen, public UncachedScreen { + private: + static void drawDots(uint16_t x, uint16_t y, uint16_t h, uint16_t v); + static bool watchDogTestNow(); + static void recursiveLockup(); + static void iterativeLockup(); + static void runTestOnBootup(bool enable); + + public: + static void startupCheck(); + + static void onEntry(); + static void onRedraw(draw_mode_t); + static bool onTouchEnd(uint8_t tag); + static void onIdle(); +}; 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 bdd434b5de..ee78591230 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 @@ -1,6 +1,6 @@ -/******************* - * boot_screen.cpp * - *******************/ +/************************** + * temperature_screen.cpp * + **************************/ /**************************************************************************** * Written By Mark Pelletier 2017 - Aleph Objects, Inc. * @@ -21,11 +21,10 @@ ****************************************************************************/ #include "../config.h" - -#if ENABLED(TOUCH_UI_FTDI_EVE) - #include "screens.h" +#ifdef FTDI_TEMPERATURE_SCREEN + using namespace FTDI; using namespace Theme; using namespace ExtUI; @@ -116,4 +115,4 @@ bool TemperatureScreen::onTouchHeld(uint8_t tag) { return true; } -#endif // TOUCH_UI_FTDI_EVE +#endif // FTDI_TEMPERATURE_SCREEN diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/temperature_screen.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/temperature_screen.h new file mode 100644 index 0000000000..de928c8978 --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/temperature_screen.h @@ -0,0 +1,32 @@ +/************************ + * temperature_screen.h * + ************************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_TEMPERATURE_SCREEN +#define FTDI_TEMPERATURE_SCREEN_CLASS TemperatureScreen + +class TemperatureScreen : 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/touch_calibration_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/touch_calibration_screen.cpp index b5312add5a..37f0c5d33a 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/touch_calibration_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/touch_calibration_screen.cpp @@ -21,11 +21,10 @@ ****************************************************************************/ #include "../config.h" - -#if ENABLED(TOUCH_UI_FTDI_EVE) - #include "screens.h" +#ifdef FTDI_TOUCH_CALIBRATION_SCREEN + using namespace FTDI; using namespace Theme; @@ -91,4 +90,4 @@ void TouchCalibrationScreen::onIdle() { } } -#endif // TOUCH_UI_FTDI_EVE +#endif // FTDI_TOUCH_CALIBRATION_SCREEN diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/touch_calibration_screen.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/touch_calibration_screen.h new file mode 100644 index 0000000000..b4e6cfb66c --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/touch_calibration_screen.h @@ -0,0 +1,34 @@ +/****************************** + * touch_calibration_screen.h * + ******************************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_TOUCH_CALIBRATION_SCREEN +#define FTDI_TOUCH_CALIBRATION_SCREEN_CLASS TouchCalibrationScreen + +class TouchCalibrationScreen : public BaseScreen, public UncachedScreen { + public: + static void onRefresh(); + static void onEntry(); + static void onRedraw(draw_mode_t); + static void onIdle(); +}; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/touch_registers_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/touch_registers_screen.cpp index 3739413213..01c7169a3e 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/touch_registers_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/touch_registers_screen.cpp @@ -21,11 +21,10 @@ ****************************************************************************/ #include "../config.h" - -#if BOTH(TOUCH_UI_FTDI_EVE, TOUCH_UI_DEVELOPER_MENU) - #include "screens.h" +#ifdef FTDI_TOUCH_REGISTERS_SCREEN + using namespace FTDI; using namespace Theme; @@ -83,4 +82,4 @@ void TouchRegistersScreen::onRedraw(draw_mode_t) { return true; } -#endif // TOUCH_UI_FTDI_EVE +#endif // FTDI_TOUCH_REGISTERS_SCREEN diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/touch_registers_screen.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/touch_registers_screen.h new file mode 100644 index 0000000000..b6d4ba8e00 --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/touch_registers_screen.h @@ -0,0 +1,32 @@ +/**************************** + * touch_registers_screen.h * + ****************************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_TOUCH_REGISTERS_SCREEN +#define FTDI_TOUCH_REGISTERS_SCREEN_CLASS TouchRegistersScreen + +class TouchRegistersScreen : public BaseScreen, public UncachedScreen { + public: + static void onRedraw(draw_mode_t); + static bool onTouchEnd(uint8_t tag); +}; 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 5a290109ff..c7ff97ea65 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 @@ -21,11 +21,10 @@ ****************************************************************************/ #include "../config.h" - -#if ENABLED(TOUCH_UI_FTDI_EVE) && DISABLED(TOUCH_UI_LULZBOT_BIO) - #include "screens.h" +#ifdef FTDI_TUNE_MENU + #include "../../../../../feature/host_actions.h" using namespace FTDI; @@ -153,4 +152,4 @@ void TuneMenu::resumePrint() { GOTO_SCREEN(StatusScreen); } -#endif // TOUCH_UI_FTDI_EVE && !TOUCH_UI_LULZBOT_BIO +#endif // FTDI_TUNE_MENU diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/tune_menu.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/tune_menu.h new file mode 100644 index 0000000000..b8f9373b19 --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/tune_menu.h @@ -0,0 +1,35 @@ +/*************** + * tune_menu.h * + ***************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_TUNE_MENU +#define FTDI_TUNE_MENU_CLASS TuneMenu + +class TuneMenu : public BaseScreen, public CachedScreen { + private: + static void pausePrint(); + static void resumePrint(); + public: + static void onRedraw(draw_mode_t); + static bool onTouchEnd(uint8_t tag); +}; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/widget_demo_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/widget_demo_screen.cpp index 96887102dc..451b7e786e 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/widget_demo_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/widget_demo_screen.cpp @@ -21,11 +21,10 @@ ****************************************************************************/ #include "../config.h" - -#if BOTH(TOUCH_UI_FTDI_EVE, TOUCH_UI_DEVELOPER_MENU) - #include "screens.h" +#ifdef FTDI_WIDGET_DEMO_SCREEN + using namespace FTDI; using namespace ExtUI; using namespace Theme; @@ -155,4 +154,4 @@ void WidgetsScreen::onIdle() { BaseScreen::onIdle(); } -#endif // TOUCH_UI_FTDI_EVE && TOUCH_UI_DEVELOPER_MENU +#endif // FTDI_WIDGET_DEMO_SCREEN diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/widget_demo_screen.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/widget_demo_screen.h new file mode 100644 index 0000000000..e0f7422d12 --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/widget_demo_screen.h @@ -0,0 +1,34 @@ +/************************ + * widget_demo_screen.h * + ************************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_WIDGET_DEMO_SCREEN +#define FTDI_WIDGET_DEMO_SCREEN_CLASS WidgetsScreen + +class WidgetsScreen : public BaseScreen, public UncachedScreen { + public: + static void onEntry(); + static void onRedraw(draw_mode_t); + static bool onTouchStart(uint8_t tag); + static void onIdle(); +}; 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 0acfbb07d6..51c9ca79b0 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 @@ -21,11 +21,10 @@ ****************************************************************************/ #include "../config.h" - -#if ENABLED(TOUCH_UI_FTDI_EVE) && BOTH(HAS_LEVELING, HAS_BED_PROBE) - #include "screens.h" +#ifdef FTDI_Z_OFFSET_SCREEN + using namespace FTDI; using namespace ExtUI; using namespace Theme; @@ -51,4 +50,4 @@ bool ZOffsetScreen::onTouchHeld(uint8_t tag) { return true; } -#endif // TOUCH_UI_FTDI_EVE && HAS_BED_PROBE +#endif // FTDI_Z_OFFSET_SCREEN diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/z_offset_screen.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/z_offset_screen.h new file mode 100644 index 0000000000..24f38e827c --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/z_offset_screen.h @@ -0,0 +1,32 @@ +/*********************** + * z_offset_screen.h * + ***********************/ + +/**************************************************************************** + * 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: . * + ****************************************************************************/ + +#pragma once + +#define FTDI_Z_OFFSET_SCREEN +#define FTDI_Z_OFFSET_SCREEN_CLASS ZOffsetScreen + +class ZOffsetScreen : 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/mks_ui/draw_tmc_current_settings.h b/Marlin/src/lcd/extui/lib/mks_ui/draw_tmc_current_settings.h index 8310305e61..92a2fb12b5 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_tmc_current_settings.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_tmc_current_settings.h @@ -31,4 +31,3 @@ extern void lv_clear_tmc_current_settings(); #ifdef __cplusplus } /* C-declarations for C++ */ #endif - diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_wifi.h b/Marlin/src/lcd/extui/lib/mks_ui/draw_wifi.h index 1187741ad6..77ba5925a3 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_wifi.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_wifi.h @@ -33,6 +33,3 @@ extern void disp_wifi_state(); #ifdef __cplusplus } /* C-declarations for C++ */ #endif - - - diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_wifi_tips.h b/Marlin/src/lcd/extui/lib/mks_ui/draw_wifi_tips.h index f9896edcc8..2f9c9f5745 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_wifi_tips.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_wifi_tips.h @@ -48,4 +48,3 @@ extern TIPS_DISP tips_disp; #ifdef __cplusplus } /* C-declarations for C++ */ #endif -