Browse Source
- Fixed name conflict with "SUBSCRIPT_TWO" - Fixed rendering bugs in "Leveling Menu" - Only show "Bed Mesh Screen" when UBL is enabled - Removed CocoaPress code from generic "Main Menu" - Removed CocoaPress code from LulzBot Bio "Status" screen - Moved generic "Move Axis" functionality into a base class - Added CocoaPress custom screens: - Status Screen - Unload Cartridge - Load Chocolate - Main Menu - Advanced Settings - XYZ Move (based on "Move Axis" base class) - Extrusion Move (based on "Move Axis" base class) - CocoaPress tweaks to "Temperature" screen - Fix FTDI EVE Touch UI compilation errors when not using leveling.vanilla_fb_2.0.x
Marcio T
4 years ago
committed by
Scott Lahteine
23 changed files with 1166 additions and 243 deletions
@ -0,0 +1,102 @@ |
|||
/*****************************************
|
|||
* cocoa_press_advance_settings_menu.cpp * |
|||
*****************************************/ |
|||
|
|||
/****************************************************************************
|
|||
* Written By Mark Pelletier 2017 - Aleph Objects, Inc. * |
|||
* Written By Marcio Teixeira 2018 - Aleph Objects, Inc. * |
|||
* * |
|||
* This program is free software: you can redistribute it and/or modify * |
|||
* it under the terms of the GNU General Public License as published by * |
|||
* the Free Software Foundation, either version 3 of the License, or * |
|||
* (at your option) any later version. * |
|||
* * |
|||
* This program is distributed in the hope that it will be useful, * |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
|||
* GNU General Public License for more details. * |
|||
* * |
|||
* To view a copy of the GNU General Public License, go to the following * |
|||
* location: <https://www.gnu.org/licenses/>. *
|
|||
****************************************************************************/ |
|||
|
|||
#include "../config.h" |
|||
|
|||
#if BOTH(TOUCH_UI_FTDI_EVE, TOUCH_UI_COCOA_PRESS) |
|||
|
|||
#include "screens.h" |
|||
|
|||
using namespace FTDI; |
|||
using namespace ExtUI; |
|||
using namespace Theme; |
|||
|
|||
#define GRID_ROWS 4 |
|||
#define GRID_COLS 3 |
|||
#define STEPS_PER_MM_POS BTN_POS(1,1), BTN_SIZE(1,1) |
|||
#define TMC_CURRENT_POS BTN_POS(2,1), BTN_SIZE(1,1) |
|||
#define LIN_ADVANCE_POS BTN_POS(3,1), BTN_SIZE(1,1) |
|||
#define VELOCITY_POS BTN_POS(1,2), BTN_SIZE(1,1) |
|||
#define ACCELERATION_POS BTN_POS(2,2), BTN_SIZE(1,1) |
|||
#define JERK_POS BTN_POS(3,2), BTN_SIZE(1,1) |
|||
#define DISPLAY_POS BTN_POS(1,3), BTN_SIZE(1,1) |
|||
#define INTERFACE_POS BTN_POS(2,3), BTN_SIZE(1,1) |
|||
#define ENDSTOPS_POS BTN_POS(3,3), BTN_SIZE(1,1) |
|||
#define CASE_LIGHT_POS BTN_POS(1,4), BTN_SIZE(1,1) |
|||
#define RESTORE_DEFAULTS_POS BTN_POS(2,4), BTN_SIZE(1,1) |
|||
#define BACK_POS BTN_POS(3,4), BTN_SIZE(1,1) |
|||
|
|||
void AdvancedSettingsMenu::onRedraw(draw_mode_t what) { |
|||
if (what & BACKGROUND) { |
|||
CommandProcessor cmd; |
|||
cmd.cmd(CLEAR_COLOR_RGB(Theme::bg_color)) |
|||
.cmd(CLEAR(true,true,true)); |
|||
} |
|||
|
|||
if (what & FOREGROUND) { |
|||
CommandProcessor cmd; |
|||
cmd.colors(normal_btn) |
|||
.font(Theme::font_medium) |
|||
.tag(2) .button( STEPS_PER_MM_POS, GET_TEXT_F(MSG_STEPS_PER_MM)) |
|||
.enabled(ENABLED(HAS_TRINAMIC_CONFIG)) |
|||
.tag(3) .button( TMC_CURRENT_POS, GET_TEXT_F(MSG_TMC_CURRENT)) |
|||
.enabled(ENABLED(LIN_ADVANCE)) |
|||
.tag(4) .button(LIN_ADVANCE_POS, GET_TEXT_F(MSG_LINEAR_ADVANCE)) |
|||
.tag(5) .button( VELOCITY_POS, GET_TEXT_F(MSG_VELOCITY)) |
|||
.tag(6) .button( ACCELERATION_POS, GET_TEXT_F(MSG_ACCELERATION)) |
|||
.tag(7) .button( JERK_POS, GET_TEXT_F(TERN(HAS_JUNCTION_DEVIATION, MSG_JUNCTION_DEVIATION, MSG_JERK))) |
|||
.tag(8) .button( ENDSTOPS_POS, GET_TEXT_F(MSG_LCD_ENDSTOPS)) |
|||
.tag(9) .button( INTERFACE_POS, GET_TEXT_F(MSG_INTERFACE)) |
|||
.tag(10).button( DISPLAY_POS, GET_TEXT_F(MSG_DISPLAY_MENU)) |
|||
.enabled(ENABLED(CASE_LIGHT_ENABLE)) |
|||
.tag(11).button( CASE_LIGHT_POS, GET_TEXT_F(MSG_CASE_LIGHT)) |
|||
.tag(12).button( RESTORE_DEFAULTS_POS, GET_TEXT_F(MSG_RESTORE_DEFAULTS)) |
|||
.colors(action_btn) |
|||
.tag(1).button( BACK_POS, GET_TEXT_F(MSG_BACK)); |
|||
} |
|||
} |
|||
|
|||
bool AdvancedSettingsMenu::onTouchEnd(uint8_t tag) { |
|||
switch (tag) { |
|||
case 1: SaveSettingsDialogBox::promptToSaveSettings(); break; |
|||
case 2: GOTO_SCREEN(StepsScreen); break; |
|||
#if HAS_TRINAMIC_CONFIG |
|||
case 3: GOTO_SCREEN(StepperCurrentScreen); break; |
|||
#endif |
|||
#if ENABLED(LIN_ADVANCE) |
|||
case 4: GOTO_SCREEN(LinearAdvanceScreen); break; |
|||
#endif |
|||
case 5: GOTO_SCREEN(MaxVelocityScreen); break; |
|||
case 6: GOTO_SCREEN(DefaultAccelerationScreen); break; |
|||
case 7: GOTO_SCREEN(TERN(HAS_JUNCTION_DEVIATION, JunctionDeviationScreen, JerkScreen)); break; |
|||
case 8: GOTO_SCREEN(EndstopStatesScreen); break; |
|||
case 9: GOTO_SCREEN(InterfaceSettingsScreen); LockScreen::check_passcode(); break; |
|||
case 10: GOTO_SCREEN(DisplayTuningScreen); break; |
|||
#if ENABLED(CASE_LIGHT_ENABLE) |
|||
case 11: GOTO_SCREEN(CaseLightScreen); break; |
|||
#endif |
|||
case 12: GOTO_SCREEN(RestoreFailsafeDialogBox); LockScreen::check_passcode(); break; |
|||
default: return false; |
|||
} |
|||
return true; |
|||
} |
|||
#endif // TOUCH_UI_FTDI_EVE
|
@ -0,0 +1,101 @@ |
|||
/************************************
|
|||
* cocoa_press_unload_cartridge.cpp * |
|||
************************************/ |
|||
|
|||
/****************************************************************************
|
|||
* Written By Mark Pelletier 2017 - Aleph Objects, Inc. * |
|||
* Written By Marcio Teixeira 2018 - Aleph Objects, Inc. * |
|||
* Written By Marcio Teixeira 2020 - Cocoa Press * |
|||
* * |
|||
* This program is free software: you can redistribute it and/or modify * |
|||
* it under the terms of the GNU General Public License as published by * |
|||
* the Free Software Foundation, either version 3 of the License, or * |
|||
* (at your option) any later version. * |
|||
* * |
|||
* This program is distributed in the hope that it will be useful, * |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
|||
* GNU General Public License for more details. * |
|||
* * |
|||
* To view a copy of the GNU General Public License, go to the following * |
|||
* location: <https://www.gnu.org/licenses/>. *
|
|||
****************************************************************************/ |
|||
|
|||
#include "../config.h" |
|||
|
|||
#if ENABLED(TOUCH_UI_FTDI_EVE) && ENABLED(TOUCH_UI_COCOA_PRESS) |
|||
|
|||
#include "screens.h" |
|||
#include "screen_data.h" |
|||
|
|||
using namespace ExtUI; |
|||
using namespace FTDI; |
|||
using namespace Theme; |
|||
|
|||
#define GRID_COLS 2 |
|||
#define GRID_ROWS 6 |
|||
|
|||
#define TITLE_POS BTN_POS(1,1), BTN_SIZE(2,1) |
|||
#define DESCRIPTION_POS BTN_POS(1,2), BTN_SIZE(2,3) |
|||
#define CARTRIDGE_OUT_BTN_POS BTN_POS(1,5), BTN_SIZE(1,1) |
|||
#define CARTRIDGE_IN_BTN_POS BTN_POS(2,5), BTN_SIZE(1,1) |
|||
#define BACK_BTN_POS BTN_POS(1,6), BTN_SIZE(2,1) |
|||
|
|||
void LoadChocolateScreen::onRedraw(draw_mode_t what) { |
|||
CommandProcessor cmd; |
|||
|
|||
if (what & BACKGROUND) { |
|||
cmd.cmd(CLEAR_COLOR_RGB(bg_color)) |
|||
.cmd(CLEAR(true,true,true)) |
|||
.cmd(COLOR_RGB(bg_text_enabled)) |
|||
.tag(0) |
|||
.font(font_large) |
|||
.text(TITLE_POS, GET_TEXT_F(MSG_LOAD_CHOCOLATE)); |
|||
draw_text_box(cmd, DESCRIPTION_POS, F( |
|||
"Drop your chocolate refill into the cartridge. " |
|||
"Press and hold the Cartridge Out button until " |
|||
"the plunger adapter is visible at the bottom of " |
|||
"the extruder. Securely attach a red plunger to " |
|||
"the plunger adapter and load the cartridge onto " |
|||
"the plunger. Press and hold Cartridge In button " |
|||
"until cartridge is fully loaded into the extruder, " |
|||
"and use the buttons to help follow the locking path " |
|||
"to lock"), |
|||
OPT_CENTERY, font_medium); |
|||
} |
|||
|
|||
if (what & FOREGROUND) { |
|||
cmd.font(font_medium) |
|||
.colors(normal_btn) |
|||
.tag(2).button(CARTRIDGE_OUT_BTN_POS, GET_TEXT_F(MSG_CARTRIDGE_OUT)) |
|||
.tag(3).button(CARTRIDGE_IN_BTN_POS, GET_TEXT_F(MSG_CARTRIDGE_IN)) |
|||
.colors(action_btn) |
|||
.tag(1).button(BACK_BTN_POS, GET_TEXT_F(MSG_BACK)); |
|||
} |
|||
} |
|||
|
|||
bool LoadChocolateScreen::onTouchEnd(uint8_t tag) { |
|||
using namespace ExtUI; |
|||
switch (tag) { |
|||
case 1: GOTO_PREVIOUS(); break; |
|||
} |
|||
return true; |
|||
} |
|||
|
|||
bool LoadChocolateScreen::onTouchHeld(uint8_t tag) { |
|||
if (ExtUI::isMoving()) return false; // Don't allow moves to accumulate
|
|||
constexpr float increment = 0.25; |
|||
MoveAxisScreen::setManualFeedrate(E0, increment); |
|||
#define UI_INCREMENT_AXIS(axis) UI_INCREMENT(AxisPosition_mm, axis); |
|||
#define UI_DECREMENT_AXIS(axis) UI_DECREMENT(AxisPosition_mm, axis); |
|||
switch (tag) { |
|||
case 2: UI_DECREMENT_AXIS(E0); break; |
|||
case 3: UI_INCREMENT_AXIS(E0); break; |
|||
default: return false; |
|||
} |
|||
#undef UI_DECREMENT_AXIS |
|||
#undef UI_INCREMENT_AXIS |
|||
return false; |
|||
} |
|||
|
|||
#endif // TOUCH_UI_FTDI_EVE
|
@ -0,0 +1,89 @@ |
|||
/*****************************
|
|||
* cocoa_press_main_menu.cpp * |
|||
*****************************/ |
|||
|
|||
/****************************************************************************
|
|||
* Written By Mark Pelletier 2017 - Aleph Objects, Inc. * |
|||
* Written By Marcio Teixeira 2018 - Aleph Objects, Inc. * |
|||
* Written By Marcio Teixeira 2019 - Cocoa Press * |
|||
* * |
|||
* This program is free software: you can redistribute it and/or modify * |
|||
* it under the terms of the GNU General Public License as published by * |
|||
* the Free Software Foundation, either version 3 of the License, or * |
|||
* (at your option) any later version. * |
|||
* * |
|||
* This program is distributed in the hope that it will be useful, * |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
|||
* GNU General Public License for more details. * |
|||
* * |
|||
* To view a copy of the GNU General Public License, go to the following * |
|||
* location: <https://www.gnu.org/licenses/>. *
|
|||
****************************************************************************/ |
|||
|
|||
#include "../config.h" |
|||
|
|||
#if BOTH(TOUCH_UI_FTDI_EVE, TOUCH_UI_COCOA_PRESS) |
|||
|
|||
#include "screens.h" |
|||
|
|||
using namespace FTDI; |
|||
using namespace Theme; |
|||
|
|||
#define GRID_ROWS 4 |
|||
#define GRID_COLS 2 |
|||
|
|||
#define MOVE_XYZ_POS BTN_POS(1,1), BTN_SIZE(1,1) |
|||
#define TEMPERATURE_POS BTN_POS(2,1), BTN_SIZE(1,1) |
|||
#define ZPROBE_ZOFFSET_POS BTN_POS(1,2), BTN_SIZE(1,1) |
|||
#define MOVE_E_POS BTN_POS(2,2), BTN_SIZE(1,1) |
|||
#define SPEED_POS BTN_POS(1,3), BTN_SIZE(1,1) |
|||
#define ADVANCED_SETTINGS_POS BTN_POS(2,3), BTN_SIZE(1,1) |
|||
#define ABOUT_PRINTER_POS BTN_POS(1,4), BTN_SIZE(1,1) |
|||
#define BACK_POS BTN_POS(2,4), BTN_SIZE(1,1) |
|||
|
|||
void MainMenu::onRedraw(draw_mode_t what) { |
|||
if (what & BACKGROUND) { |
|||
CommandProcessor cmd; |
|||
cmd.cmd(CLEAR_COLOR_RGB(Theme::bg_color)) |
|||
.cmd(CLEAR(true,true,true)); |
|||
} |
|||
|
|||
if (what & FOREGROUND) { |
|||
CommandProcessor cmd; |
|||
cmd.colors(normal_btn) |
|||
.font(Theme::font_medium) |
|||
.tag(2).button( MOVE_XYZ_POS, GET_TEXT_F(MSG_XYZ_MOVE)) |
|||
.tag(3).button( TEMPERATURE_POS, GET_TEXT_F(MSG_TEMPERATURE)) |
|||
.enabled(BOTH(HAS_LEVELING, HAS_BED_PROBE)) |
|||
.tag(4).button( ZPROBE_ZOFFSET_POS, GET_TEXT_F(MSG_ZPROBE_ZOFFSET)) |
|||
.tag(5).button( MOVE_E_POS, GET_TEXT_F(MSG_E_MOVE)) |
|||
.tag(6).button( SPEED_POS, GET_TEXT_F(MSG_PRINT_SPEED)) |
|||
.tag(7).button( ADVANCED_SETTINGS_POS, GET_TEXT_F(MSG_ADVANCED_SETTINGS)) |
|||
.tag(8).button( ABOUT_PRINTER_POS, GET_TEXT_F(MSG_INFO_MENU)) |
|||
.colors(action_btn) |
|||
.tag(1).button( BACK_POS, GET_TEXT_F(MSG_BACK)); |
|||
} |
|||
} |
|||
|
|||
bool MainMenu::onTouchEnd(uint8_t tag) { |
|||
using namespace ExtUI; |
|||
|
|||
switch (tag) { |
|||
case 1: SaveSettingsDialogBox::promptToSaveSettings(); break; |
|||
case 2: GOTO_SCREEN(MoveXYZScreen); break; |
|||
case 3: GOTO_SCREEN(TemperatureScreen); break; |
|||
#if BOTH(HAS_LEVELING, HAS_BED_PROBE) |
|||
case 4: GOTO_SCREEN(ZOffsetScreen); break; |
|||
#endif |
|||
case 5: GOTO_SCREEN(MoveEScreen); break; |
|||
case 6: GOTO_SCREEN(FeedratePercentScreen); break; |
|||
case 7: GOTO_SCREEN(AdvancedSettingsMenu); break; |
|||
case 8: GOTO_SCREEN(AboutScreen); break; |
|||
default: |
|||
return false; |
|||
} |
|||
return true; |
|||
} |
|||
|
|||
#endif // TOUCH_UI_FTDI_EVE
|
@ -0,0 +1,62 @@ |
|||
/*********************************
|
|||
* cocoa_press_move_e_screen.cpp * |
|||
*********************************/ |
|||
|
|||
/****************************************************************************
|
|||
* Written By Mark Pelletier 2017 - Aleph Objects, Inc. * |
|||
* Written By Marcio Teixeira 2018 - Aleph Objects, Inc. * |
|||
* Written By Marcio Teixeira 2019 - Cocoa Press * |
|||
* * |
|||
* This program is free software: you can redistribute it and/or modify * |
|||
* it under the terms of the GNU General Public License as published by * |
|||
* the Free Software Foundation, either version 3 of the License, or * |
|||
* (at your option) any later version. * |
|||
* * |
|||
* This program is distributed in the hope that it will be useful, * |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
|||
* GNU General Public License for more details. * |
|||
* * |
|||
* To view a copy of the GNU General Public License, go to the following * |
|||
* location: <https://www.gnu.org/licenses/>. *
|
|||
****************************************************************************/ |
|||
|
|||
#include "../config.h" |
|||
|
|||
#if BOTH(TOUCH_UI_FTDI_EVE, TOUCH_UI_COCOA_PRESS) |
|||
|
|||
#include "screens.h" |
|||
#include "screen_data.h" |
|||
|
|||
using namespace FTDI; |
|||
using namespace ExtUI; |
|||
|
|||
void MoveEScreen::onRedraw(draw_mode_t what) { |
|||
widgets_t w(what); |
|||
w.precision(1); |
|||
w.units(GET_TEXT_F(MSG_UNITS_MM)); |
|||
w.heading( GET_TEXT_F(MSG_E_MOVE)); |
|||
w.color(Theme::e_axis); |
|||
#if EXTRUDERS == 1 |
|||
w.adjuster( 8, GET_TEXT_F(MSG_AXIS_E), screen_data.MoveAxisScreen.e_rel[0], canMove(E0)); |
|||
#elif HAS_MULTI_EXTRUDER |
|||
w.adjuster( 8, GET_TEXT_F(MSG_AXIS_E1), screen_data.MoveAxisScreen.e_rel[0], canMove(E0)); |
|||
w.adjuster( 10, GET_TEXT_F(MSG_AXIS_E2), screen_data.MoveAxisScreen.e_rel[1], canMove(E1)); |
|||
#if EXTRUDERS > 2 |
|||
w.adjuster( 12, GET_TEXT_F(MSG_AXIS_E3), screen_data.MoveAxisScreen.e_rel[2], canMove(E2)); |
|||
#endif |
|||
#if EXTRUDERS > 3 |
|||
w.adjuster( 14, GET_TEXT_F(MSG_AXIS_E4), screen_data.MoveAxisScreen.e_rel[3], canMove(E3)); |
|||
#endif |
|||
#endif |
|||
w.increments(); |
|||
} |
|||
|
|||
void MoveEScreen::onIdle() { |
|||
if (refresh_timer.elapsed(STATUS_UPDATE_INTERVAL)) { |
|||
onRefresh(); |
|||
refresh_timer.start(); |
|||
} |
|||
BaseScreen::onIdle(); |
|||
} |
|||
#endif // TOUCH_UI_FTDI_EVE
|
@ -0,0 +1,53 @@ |
|||
/************************************
|
|||
* cocoa_press_move_xyz_screen.cpp * |
|||
************************************/ |
|||
|
|||
/****************************************************************************
|
|||
* Written By Mark Pelletier 2017 - Aleph Objects, Inc. * |
|||
* Written By Marcio Teixeira 2018 - Aleph Objects, Inc. * |
|||
* Written By Marcio Teixeira 2019 - Cocoa Press * |
|||
* * |
|||
* This program is free software: you can redistribute it and/or modify * |
|||
* it under the terms of the GNU General Public License as published by * |
|||
* the Free Software Foundation, either version 3 of the License, or * |
|||
* (at your option) any later version. * |
|||
* * |
|||
* This program is distributed in the hope that it will be useful, * |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
|||
* GNU General Public License for more details. * |
|||
* * |
|||
* To view a copy of the GNU General Public License, go to the following * |
|||
* location: <https://www.gnu.org/licenses/>. *
|
|||
****************************************************************************/ |
|||
|
|||
#include "../config.h" |
|||
|
|||
#if BOTH(TOUCH_UI_FTDI_EVE, TOUCH_UI_COCOA_PRESS) |
|||
|
|||
#include "screens.h" |
|||
#include "screen_data.h" |
|||
|
|||
using namespace FTDI; |
|||
using namespace ExtUI; |
|||
|
|||
void MoveXYZScreen::onRedraw(draw_mode_t what) { |
|||
widgets_t w(what); |
|||
w.precision(1); |
|||
w.units(GET_TEXT_F(MSG_UNITS_MM)); |
|||
w.heading( GET_TEXT_F(MSG_XYZ_MOVE)); |
|||
w.home_buttons(20); |
|||
w.color(Theme::x_axis).adjuster( 2, GET_TEXT_F(MSG_AXIS_X), getAxisPosition_mm(X), canMove(X)); |
|||
w.color(Theme::y_axis).adjuster( 4, GET_TEXT_F(MSG_AXIS_Y), getAxisPosition_mm(Y), canMove(Y)); |
|||
w.color(Theme::z_axis).adjuster( 6, GET_TEXT_F(MSG_AXIS_Z), getAxisPosition_mm(Z), canMove(Z)); |
|||
w.increments(); |
|||
} |
|||
|
|||
void MoveXYZScreen::onIdle() { |
|||
if (refresh_timer.elapsed(STATUS_UPDATE_INTERVAL)) { |
|||
onRefresh(); |
|||
refresh_timer.start(); |
|||
} |
|||
BaseScreen::onIdle(); |
|||
} |
|||
#endif // TOUCH_UI_FTDI_EVE
|
@ -0,0 +1,307 @@ |
|||
/*********************************
|
|||
* cocoa_press_status_screen.cpp * |
|||
*********************************/ |
|||
|
|||
/****************************************************************************
|
|||
* Written By Mark Pelletier 2017 - Aleph Objects, Inc. * |
|||
* Written By Marcio Teixeira 2018 - Aleph Objects, Inc. * |
|||
* Written By Marcio Teixeira 2019 - Cocoa Press * |
|||
* * |
|||
* This program is free software: you can redistribute it and/or modify * |
|||
* it under the terms of the GNU General Public License as published by * |
|||
* the Free Software Foundation, either version 3 of the License, or * |
|||
* (at your option) any later version. * |
|||
* * |
|||
* This program is distributed in the hope that it will be useful, * |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
|||
* GNU General Public License for more details. * |
|||
* * |
|||
* To view a copy of the GNU General Public License, go to the following * |
|||
* location: <https://www.gnu.org/licenses/>. *
|
|||
****************************************************************************/ |
|||
|
|||
#include "../config.h" |
|||
|
|||
#if BOTH(TOUCH_UI_FTDI_EVE, TOUCH_UI_COCOA_PRESS) |
|||
|
|||
#include "screens.h" |
|||
|
|||
#include "../ftdi_eve_lib/extras/poly_ui.h" |
|||
|
|||
#include "cocoa_press_ui.h" |
|||
|
|||
#define POLY(A) PolyUI::poly_reader_t(A, sizeof(A)/sizeof(A[0])) |
|||
|
|||
const uint8_t shadow_depth = 5; |
|||
|
|||
using namespace FTDI; |
|||
using namespace Theme; |
|||
using namespace ExtUI; |
|||
|
|||
float StatusScreen::increment; |
|||
|
|||
void StatusScreen::loadBitmaps() { |
|||
constexpr uint32_t base = ftdi_memory_map::RAM_G; |
|||
|
|||
// Load fonts for internationalization
|
|||
#ifdef TOUCH_UI_USE_UTF8 |
|||
load_utf8_data(base + UTF8_FONT_OFFSET); |
|||
#endif |
|||
} |
|||
|
|||
void StatusScreen::draw_progress(draw_mode_t what) { |
|||
CommandProcessor cmd; |
|||
PolyUI ui(cmd, what); |
|||
|
|||
int16_t x, y, h, v; |
|||
|
|||
cmd.cmd(COLOR_RGB(accent_color_1)); |
|||
cmd.font(font_medium); |
|||
|
|||
if (what & BACKGROUND) { |
|||
ui.bounds(POLY(print_time_label), x, y, h, v); |
|||
cmd.text(x, y, h, v, GET_TEXT_F(MSG_ELAPSED_PRINT)); |
|||
} |
|||
|
|||
if (what & FOREGROUND) { |
|||
const uint32_t elapsed = getProgress_seconds_elapsed(); |
|||
const uint8_t hrs = elapsed/3600; |
|||
const uint8_t min = (elapsed/60)%60; |
|||
|
|||
char str[10]; |
|||
sprintf_P(str, PSTR(" %02d : %02d"), hrs, min); |
|||
ui.bounds(POLY(print_time_hms), x, y, h, v); |
|||
cmd.text(x, y, h, v, str); |
|||
|
|||
sprintf_P(str, PSTR("%-3d%%"), getProgress_percent() ); |
|||
ui.bounds(POLY(print_time_percent), x, y, h, v); |
|||
cmd.text(x, y, h, v, str); |
|||
} |
|||
} |
|||
|
|||
void StatusScreen::draw_temperature(draw_mode_t what) { |
|||
CommandProcessor cmd; |
|||
PolyUI ui(cmd, what); |
|||
|
|||
int16_t x, y, h, v; |
|||
|
|||
if (what & BACKGROUND) { |
|||
cmd.cmd(COLOR_RGB(bg_color)); |
|||
|
|||
cmd.cmd(COLOR_RGB(fluid_rgb)); |
|||
cmd.font(font_medium); |
|||
|
|||
ui.bounds(POLY(chocolate_label), x, y, h, v); |
|||
cmd.text(x, y, h, v, GET_TEXT_F(MSG_CHOCOLATE)); |
|||
|
|||
ui.bounds(POLY(h0_label), x, y, h, v); |
|||
cmd.text(x, y, h, v, GET_TEXT_F(MSG_NOZZLE)); |
|||
|
|||
ui.bounds(POLY(h1_label), x, y, h, v); |
|||
cmd.text(x, y, h, v, GET_TEXT_F(MSG_BODY)); |
|||
|
|||
#if ENABLED(COCOA_PRESS_EXTRA_HEATER) |
|||
if (has_extra_heater()) { |
|||
ui.bounds(POLY(h2_label), x, y, h, v); |
|||
cmd.text(x, y, h, v, GET_TEXT_F(MSG_EXTERNAL)); |
|||
} |
|||
#endif |
|||
|
|||
ui.bounds(POLY(h3_label), x, y, h, v); |
|||
cmd.text(x, y, h, v, GET_TEXT_F(MSG_CHAMBER)); |
|||
|
|||
#ifdef TOUCH_UI_USE_UTF8 |
|||
load_utf8_bitmaps(cmd); // Restore font bitmap handles
|
|||
#endif |
|||
} |
|||
|
|||
if (what & FOREGROUND) { |
|||
char str[15]; |
|||
cmd.cmd(COLOR_RGB(fluid_rgb)); |
|||
|
|||
cmd.font(font_large); |
|||
|
|||
format_temp(str, getActualTemp_celsius(E0)); |
|||
ui.bounds(POLY(h0_temp), x, y, h, v); |
|||
cmd.text(x, y, h, v, str); |
|||
|
|||
format_temp(str, getActualTemp_celsius(E1)); |
|||
ui.bounds(POLY(h1_temp), x, y, h, v); |
|||
cmd.text(x, y, h, v, str); |
|||
|
|||
#if ENABLED(COCOA_PRESS_EXTRA_HEATER) |
|||
if (has_extra_heater()) { |
|||
format_temp(str, getActualTemp_celsius(E2)); |
|||
ui.bounds(POLY(h2_temp), x, y, h, v); |
|||
cmd.text(x, y, h, v, str); |
|||
} |
|||
#endif |
|||
|
|||
format_temp(str, getActualTemp_celsius(CHAMBER)); |
|||
ui.bounds(POLY(h3_temp), x, y, h, v); |
|||
cmd.text(x, y, h, v, str); |
|||
} |
|||
} |
|||
|
|||
void StatusScreen::draw_syringe(draw_mode_t what) { |
|||
#if NUM_SERVOS < 2 |
|||
// Note, this requires a new pin 108 to be added to to access ADC9
|
|||
// "ArduinoAddons/arduino-1.8.5/packages/ultimachine/hardware/sam/1.6.9-b/variants/archim/variant.cpp"
|
|||
const int val = analogRead(108); |
|||
const float fill_level = float(val) / 1024; |
|||
#else |
|||
constexpr float fill_level = 1.0f; |
|||
#endif |
|||
|
|||
CommandProcessor cmd; |
|||
PolyUI ui(cmd, what); |
|||
|
|||
if (what & BACKGROUND) { |
|||
// Paint the shadow for the syringe
|
|||
ui.color(shadow_rgb); |
|||
ui.shadow(POLY(syringe_outline), shadow_depth); |
|||
} |
|||
|
|||
if (what & FOREGROUND) { |
|||
int16_t x, y, h, v; |
|||
|
|||
// Paint the syringe icon
|
|||
ui.color(syringe_rgb); |
|||
ui.fill(POLY(syringe_outline)); |
|||
|
|||
ui.color(fluid_rgb); |
|||
ui.bounds(POLY(syringe_fluid), x, y, h, v); |
|||
cmd.cmd(SAVE_CONTEXT()); |
|||
cmd.cmd(SCISSOR_XY(x,y + v * (1.0 - fill_level))); |
|||
cmd.cmd(SCISSOR_SIZE(h, v * fill_level)); |
|||
ui.fill(POLY(syringe_fluid), false); |
|||
cmd.cmd(RESTORE_CONTEXT()); |
|||
|
|||
ui.color(stroke_rgb); |
|||
ui.fill(POLY(syringe)); |
|||
} |
|||
} |
|||
|
|||
void StatusScreen::draw_buttons(draw_mode_t what) { |
|||
int16_t x, y, h, v; |
|||
|
|||
const bool can_print = isMediaInserted() && !isPrintingFromMedia(); |
|||
const bool sdOrHostPrinting = ExtUI::isPrinting(); |
|||
const bool sdOrHostPaused = ExtUI::isPrintingPaused(); |
|||
|
|||
CommandProcessor cmd; |
|||
PolyUI ui(cmd, what); |
|||
|
|||
ui.bounds(POLY(unload_cartridge_btn), x, y, h, v); |
|||
|
|||
cmd.font(font_medium).colors(normal_btn); |
|||
|
|||
ui.bounds(POLY(unload_cartridge_btn), x, y, h, v); |
|||
cmd.tag(1).button(x, y, h, v, GET_TEXT_F(MSG_UNLOAD_CARTRIDGE)); |
|||
|
|||
ui.bounds(POLY(load_chocolate_btn), x, y, h, v); |
|||
cmd.tag(2).button(x, y, h, v, GET_TEXT_F(MSG_LOAD_CHOCOLATE)); |
|||
|
|||
ui.bounds(POLY(preheat_chocolate_btn), x, y, h, v); |
|||
cmd.tag(3).button(x, y, h, v, GET_TEXT_F(MSG_PREHEAT_CHOCOLATE)); |
|||
|
|||
ui.bounds(POLY(menu_btn), x, y, h, v); |
|||
cmd.tag(4).button(x, y, h, v, GET_TEXT_F(MSG_BUTTON_MENU)); |
|||
|
|||
ui.bounds(POLY(pause_btn), x, y, h, v); |
|||
cmd.tag(sdOrHostPaused ? 6 : 5).enabled(sdOrHostPrinting).button(x, y, h, v, sdOrHostPaused ? GET_TEXT_F(MSG_BUTTON_RESUME) : GET_TEXT_F(MSG_BUTTON_PAUSE)); |
|||
|
|||
ui.bounds(POLY(stop_btn), x, y, h, v); |
|||
cmd.tag(7).enabled(sdOrHostPrinting).button(x, y, h, v, GET_TEXT_F(MSG_BUTTON_STOP)); |
|||
|
|||
ui.bounds(POLY(extrude_btn), x, y, h, v); |
|||
cmd.tag(8).button(x, y, h, v, GET_TEXT_F(MSG_EXTRUDE)); |
|||
|
|||
ui.bounds(POLY(print_btn), x, y, h, v); |
|||
cmd.tag(9).colors(action_btn).enabled(can_print).button(x, y, h, v, GET_TEXT_F(MSG_BUTTON_PRINT)); |
|||
} |
|||
|
|||
void StatusScreen::onRedraw(draw_mode_t what) { |
|||
if (what & BACKGROUND) { |
|||
CommandProcessor cmd; |
|||
cmd.cmd(CLEAR_COLOR_RGB(bg_color)) |
|||
.cmd(CLEAR(true,true,true)) |
|||
.tag(0); |
|||
} |
|||
|
|||
draw_progress(what); |
|||
draw_syringe(what); |
|||
draw_temperature(what); |
|||
draw_buttons(what); |
|||
} |
|||
|
|||
bool StatusScreen::onTouchStart(uint8_t) { |
|||
increment = 0; |
|||
return true; |
|||
} |
|||
|
|||
bool StatusScreen::onTouchEnd(uint8_t tag) { |
|||
switch (tag) { |
|||
case 1: GOTO_SCREEN(UnloadCartridgeScreen); break; |
|||
case 2: GOTO_SCREEN(LoadChocolateScreen); break; |
|||
case 3: GOTO_SCREEN(PreheatMenu); break; |
|||
case 4: GOTO_SCREEN(MainMenu); break; |
|||
case 5: |
|||
sound.play(twinkle, PLAY_ASYNCHRONOUS); |
|||
if (ExtUI::isPrintingFromMedia()) |
|||
ExtUI::pausePrint(); |
|||
#ifdef ACTION_ON_PAUSE |
|||
else host_action_pause(); |
|||
#endif |
|||
GOTO_SCREEN(StatusScreen); |
|||
break; |
|||
case 6: |
|||
sound.play(twinkle, PLAY_ASYNCHRONOUS); |
|||
if (ExtUI::isPrintingFromMedia()) |
|||
ExtUI::resumePrint(); |
|||
#ifdef ACTION_ON_RESUME |
|||
else host_action_resume(); |
|||
#endif |
|||
GOTO_SCREEN(StatusScreen); |
|||
break; |
|||
case 7: |
|||
GOTO_SCREEN(ConfirmAbortPrintDialogBox); |
|||
current_screen.forget(); |
|||
PUSH_SCREEN(StatusScreen); |
|||
break; |
|||
case 9: GOTO_SCREEN(FilesScreen); break; |
|||
default: return false; |
|||
} |
|||
// If a passcode is enabled, the LockScreen will prevent the
|
|||
// user from proceeding.
|
|||
LockScreen::check_passcode(); |
|||
return true; |
|||
} |
|||
|
|||
bool StatusScreen::onTouchHeld(uint8_t tag) { |
|||
if (tag == 8 && !ExtUI::isMoving()) { |
|||
increment = 0.05; |
|||
MoveAxisScreen::setManualFeedrate(E0, increment); |
|||
UI_INCREMENT(AxisPosition_mm, E0); |
|||
current_screen.onRefresh(); |
|||
} |
|||
return false; |
|||
} |
|||
|
|||
void StatusScreen::setStatusMessage(progmem_str) { |
|||
} |
|||
|
|||
void StatusScreen::setStatusMessage(const char * const) { |
|||
} |
|||
|
|||
void StatusScreen::onIdle() { |
|||
reset_menu_timeout(); |
|||
if (refresh_timer.elapsed(STATUS_UPDATE_INTERVAL)) { |
|||
if (!EventLoop::is_touch_held()) |
|||
onRefresh(); |
|||
refresh_timer.start(); |
|||
} |
|||
} |
|||
|
|||
#endif // TOUCH_UI_FTDI_EVE
|
@ -0,0 +1,54 @@ |
|||
|
|||
/****************************************************************************
|
|||
* This program is free software: you can redistribute it and/or modify * |
|||
* it under the terms of the GNU General Public License as published by * |
|||
* the Free Software Foundation, either version 3 of the License, or * |
|||
* (at your option) any later version. * |
|||
* * |
|||
* This program is distributed in the hope that it will be useful, * |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
|||
* GNU General Public License for more details. * |
|||
* * |
|||
* To view a copy of the GNU General Public License, go to the following * |
|||
* location: <https://www.gnu.org/licenses/>. *
|
|||
****************************************************************************/ |
|||
|
|||
/**
|
|||
* This file was auto-generated using "svg2cpp.py" |
|||
* |
|||
* The encoding consists of x,y pairs with the min and max scaled to |
|||
* 0x0000 and 0xFFFE. A single 0xFFFF in the data stream indicates the |
|||
* start of a new closed path. |
|||
*/ |
|||
|
|||
#pragma once |
|||
|
|||
constexpr float x_min = 0.000000; |
|||
constexpr float x_max = 480.000000; |
|||
constexpr float y_min = 0.000000; |
|||
constexpr float y_max = 272.000000; |
|||
|
|||
const PROGMEM uint16_t syringe_outline[] = {0xED96, 0x14F0, 0xE65D, 0x10E9, 0xDED2, 0x0F9C, 0xD74B, 0x110E, 0xD01B, 0x1543, 0xCE80, 0x1836, 0xCE0A, 0x1C3A, 0xCE0F, 0x27AD, 0xCF0A, 0x2BD3, 0xD127, 0x2E5B, 0xD2A1, 0x2FF0, 0xD2A2, 0x9FC9, 0xD407, 0xA97A, 0xD7B9, 0xB10C, 0xD7BF, 0xBB58, 0xD978, 0xC2BE, 0xDD55, 0xC6EB, 0xDD58, 0xD159, 0xDE3B, 0xD3A8, 0xDFCF, 0xD3AF, 0xE0B8, 0xD04C, 0xE0B8, 0xC6EB, 0xE4A7, 0xC299, 0xE652, 0xBAF6, 0xE652, 0xB10C, 0xEA2E, 0xA8EA, 0xEB6C, 0x9E86, 0xEB6C, 0x2F58, 0xEF3C, 0x2B4E, 0xF003, 0x2583, 0xEFFD, 0x1AC2, 0xED96, 0x14F0, 0xED96, 0x14F0}; |
|||
const PROGMEM uint16_t syringe_fluid[] = {0xDE73, 0x2512, 0xDA0C, 0x261D, 0xD5B8, 0x29A0, 0xD4AE, 0x2D87, 0xD4AE, 0x9F60, 0xD585, 0xA63B, 0xDE44, 0xA9DE, 0xE32A, 0xA942, 0xE7E3, 0xA6A5, 0xE930, 0xA342, 0xE95D, 0x9C1D, 0xE95B, 0x31B8, 0xE955, 0x2B63, 0xE867, 0x2A67, 0xE790, 0x28DE, 0xE342, 0x25CB, 0xDE73, 0x2512}; |
|||
const PROGMEM uint16_t syringe[] = {0xED91, 0x1502, 0xE658, 0x10FB, 0xDECE, 0x0FAE, 0xD746, 0x1120, 0xD016, 0x1555, 0xCE7B, 0x1848, 0xCE05, 0x1C4D, 0xCE0A, 0x27BF, 0xCF05, 0x2BE5, 0xD122, 0x2E6E, 0xD29C, 0x3002, 0xD29D, 0x9FDB, 0xD402, 0xA98C, 0xD7B4, 0xB11F, 0xD7BA, 0xBB6A, 0xD973, 0xC2D1, 0xDD50, 0xC6FD, 0xDD53, 0xD16C, 0xDE36, 0xD3BA, 0xDFCA, 0xD3C2, 0xE0B3, 0xD05E, 0xE0B3, 0xC6FD, 0xE4A2, 0xC2AB, 0xE64D, 0xBB09, 0xE64D, 0xB11F, 0xEA29, 0xA8FC, 0xEB67, 0x9E98, 0xEB67, 0x2F6B, 0xEF37, 0x2B60, 0xEFFE, 0x2595, 0xEFF8, 0x1AD5, 0xED91, 0x1502, 0xED91, 0x1502, 0xFFFF, 0xD1CF, 0x1A7E, 0xD84F, 0x16DB, 0xDF19, 0x15A9, 0xE5E0, 0x16EA, 0xEC5B, 0x1AA4, 0xEC9D, 0x1D34, 0xEC9D, 0x20CC, 0xE5F1, 0x1D41, 0xDF02, 0x1C12, 0xD812, 0x1D41, 0xD166, 0x20CC, 0xD16C, 0x1B45, 0xD1CF, 0x1A7E, 0xFFFF, 0xE3BD, 0xACFD, 0xDE8E, 0xAF4F, 0xD988, 0xAC0F, 0xD7CC, 0xA8CD, 0xDD1C, 0xAAA9, 0xE287, 0xAA5B, 0xE655, 0xA8BE, 0xE3BD, 0xACFD, 0xFFFF, 0xE802, 0x2DC5, 0xE809, 0x343C, 0xE808, 0x9FC8, 0xE7E3, 0xA296, 0xE70D, 0xA4B1, 0xE2C9, 0xA70E, 0xDE4E, 0xA790, 0xD6A1, 0xA457, 0xD5FF, 0x9F2B, 0xD5FF, 0x2DFD, 0xD6B2, 0x2B72, 0xDA78, 0x2861, 0xDE9D, 0x276F, 0xE300, 0x2824, 0xE70D, 0x2B13, 0xE7FF, 0x2DB6, 0xE800, 0x2DC5, 0xE802, 0x2DC5, 0xFFFF, 0xE2ED, 0xBA8B, 0xE1CC, 0xBF52, 0xDF1C, 0xC165, 0xDC64, 0xBF99, 0xDB1B, 0xBAFF, 0xDB19, 0xB433, 0xDF04, 0xB552, 0xE2EF, 0xB438, 0xE2ED, 0xBA8B, 0xFFFF, 0xEC09, 0x2893, 0xE925, 0x2A08, 0xE57D, 0x261D, 0xE149, 0x246F, 0xDBDE, 0x24A0, 0xD6BC, 0x2795, 0xD484, 0x2A46, 0xD1C0, 0x2853, 0xD166, 0x251E, 0xD80D, 0x2151, 0xDF02, 0x200C, 0xE5F6, 0x2151, 0xEC9D, 0x251E, 0xEC09, 0x2893}; |
|||
const PROGMEM uint16_t unload_cartridge_btn[] = {0x0AAA, 0x0E1E, 0x57FF, 0x0E1E, 0x57FF, 0x33C3, 0x0AAA, 0x33C3, 0x0AAA, 0x0E1E}; |
|||
const PROGMEM uint16_t pause_btn[] = {0x47FF, 0xCA58, 0x7FFF, 0xCA58, 0x7FFF, 0xEFFE, 0x47FF, 0xEFFE, 0x47FF, 0xCA58}; |
|||
const PROGMEM uint16_t load_chocolate_btn[] = {0x0AAA, 0x3D2C, 0x57FF, 0x3D2C, 0x57FF, 0x62D2, 0x0AAA, 0x62D2, 0x0AAA, 0x3D2C}; |
|||
const PROGMEM uint16_t preheat_chocolate_btn[] = {0x0AAA, 0x6C3B, 0x57FF, 0x6C3B, 0x57FF, 0x91E0, 0x0AAA, 0x91E0, 0x0AAA, 0x6C3B}; |
|||
const PROGMEM uint16_t menu_btn[] = {0x0AAA, 0x9B4A, 0x57FF, 0x9B4A, 0x57FF, 0xC0EF, 0x0AAA, 0xC0EF, 0x0AAA, 0x9B4A}; |
|||
const PROGMEM uint16_t print_btn[] = {0x0AAA, 0xCA58, 0x42AA, 0xCA58, 0x42AA, 0xEFFE, 0x0AAA, 0xEFFE, 0x0AAA, 0xCA58}; |
|||
const PROGMEM uint16_t stop_btn[] = {0x8554, 0xCA58, 0xBD53, 0xCA58, 0xBD53, 0xEFFE, 0x8554, 0xEFFE, 0x8554, 0xCA58}; |
|||
const PROGMEM uint16_t print_time_hms[] = {0x62A9, 0xA968, 0x8FFE, 0xA968, 0x8FFE, 0xC0EF, 0x62A9, 0xC0EF, 0x62A9, 0xA968}; |
|||
const PROGMEM uint16_t print_time_percent[] = {0x8FFE, 0xA968, 0xBD53, 0xA968, 0xBD53, 0xC0EF, 0x8FFE, 0xC0EF, 0x8FFE, 0xA968}; |
|||
const PROGMEM uint16_t print_time_label[] = {0x62A9, 0x91E0, 0xBD53, 0x91E0, 0xBD53, 0xA986, 0x62A9, 0xA986, 0x62A9, 0x91E0}; |
|||
const PROGMEM uint16_t h3_temp[] = {0x62A9, 0x75A4, 0x8FFE, 0x75A4, 0x8FFE, 0x8D2C, 0x62A9, 0x8D2C, 0x62A9, 0x75A4}; |
|||
const PROGMEM uint16_t h3_label[] = {0x62A9, 0x5E1D, 0x8FFE, 0x5E1D, 0x8FFE, 0x75A4, 0x62A9, 0x75A4, 0x62A9, 0x5E1D}; |
|||
const PROGMEM uint16_t chocolate_label[] = {0x62A9, 0x12D2, 0xBD53, 0x12D2, 0xBD53, 0x2A5A, 0x62A9, 0x2A5A, 0x62A9, 0x12D2}; |
|||
const PROGMEM uint16_t h0_label[] = {0x62A9, 0x2A5A, 0x8FFE, 0x2A5A, 0x8FFE, 0x41E1, 0x62A9, 0x41E1, 0x62A9, 0x2A5A}; |
|||
const PROGMEM uint16_t h0_temp[] = {0x62A9, 0x41E1, 0x8FFE, 0x41E1, 0x8FFE, 0x5968, 0x62A9, 0x5968, 0x62A9, 0x41E1}; |
|||
const PROGMEM uint16_t h1_label[] = {0x8FFE, 0x2A5A, 0xBD53, 0x2A5A, 0xBD53, 0x41E1, 0x8FFE, 0x41E1, 0x8FFE, 0x2A5A}; |
|||
const PROGMEM uint16_t h1_temp[] = {0x8FFE, 0x41E1, 0xBD53, 0x41E1, 0xBD53, 0x5968, 0x8FFE, 0x5968, 0x8FFE, 0x41E1}; |
|||
const PROGMEM uint16_t extrude_btn[] = {0xC859, 0xDD2B, 0xF5AE, 0xDD2B, 0xF5AE, 0xEFFE, 0xC859, 0xEFFE, 0xC859, 0xDD2B}; |
|||
const PROGMEM uint16_t h2_label[] = {0x8FFE, 0x5E1D, 0xBD53, 0x5E1D, 0xBD53, 0x75A4, 0x8FFE, 0x75A4, 0x8FFE, 0x5E1D}; |
|||
const PROGMEM uint16_t h2_temp[] = {0x8FFE, 0x75A4, 0xBD53, 0x75A4, 0xBD53, 0x8D2C, 0x8FFE, 0x8D2C, 0x8FFE, 0x75A4}; |
@ -0,0 +1,101 @@ |
|||
/************************************
|
|||
* cocoa_press_unload_cartridge.cpp * |
|||
************************************/ |
|||
|
|||
/****************************************************************************
|
|||
* Written By Mark Pelletier 2017 - Aleph Objects, Inc. * |
|||
* Written By Marcio Teixeira 2018 - Aleph Objects, Inc. * |
|||
* Written By Marcio Teixeira 2020 - Cocoa Press * |
|||
* * |
|||
* This program is free software: you can redistribute it and/or modify * |
|||
* it under the terms of the GNU General Public License as published by * |
|||
* the Free Software Foundation, either version 3 of the License, or * |
|||
* (at your option) any later version. * |
|||
* * |
|||
* This program is distributed in the hope that it will be useful, * |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
|||
* GNU General Public License for more details. * |
|||
* * |
|||
* To view a copy of the GNU General Public License, go to the following * |
|||
* location: <https://www.gnu.org/licenses/>. *
|
|||
****************************************************************************/ |
|||
|
|||
#include "../config.h" |
|||
|
|||
#if ENABLED(TOUCH_UI_FTDI_EVE) && ENABLED(TOUCH_UI_COCOA_PRESS) |
|||
|
|||
#include "screens.h" |
|||
#include "screen_data.h" |
|||
|
|||
using namespace ExtUI; |
|||
using namespace FTDI; |
|||
using namespace Theme; |
|||
|
|||
#define GRID_COLS 2 |
|||
#define GRID_ROWS 6 |
|||
|
|||
#define TITLE_POS BTN_POS(1,1), BTN_SIZE(2,1) |
|||
#define DESCRIPTION_POS BTN_POS(1,2), BTN_SIZE(2,3) |
|||
#define CARTRIDGE_OUT_BTN_POS BTN_POS(1,5), BTN_SIZE(1,1) |
|||
#define CARTRIDGE_IN_BTN_POS BTN_POS(2,5), BTN_SIZE(1,1) |
|||
#define BACK_BTN_POS BTN_POS(1,6), BTN_SIZE(2,1) |
|||
|
|||
void UnloadCartridgeScreen::onRedraw(draw_mode_t what) { |
|||
CommandProcessor cmd; |
|||
|
|||
if (what & BACKGROUND) { |
|||
cmd.cmd(CLEAR_COLOR_RGB(bg_color)) |
|||
.cmd(CLEAR(true,true,true)) |
|||
.cmd(COLOR_RGB(bg_text_enabled)) |
|||
.tag(0) |
|||
.font(font_large) |
|||
.text(TITLE_POS, GET_TEXT_F(MSG_UNLOAD_CARTRIDGE)); |
|||
draw_text_box(cmd, DESCRIPTION_POS, F( |
|||
"Press and hold the buttons below to help " |
|||
"you unlock the cartridge. After unlocking, " |
|||
"press and hold the Cartridge Out button " |
|||
"until the cartridge is sticking out of the " |
|||
"extruder enough to grip and remove. After " |
|||
"removing the cartridge, continue holding the " |
|||
"Cartridge Out button until the plunger adapter is " |
|||
"visible at the bottom of the extruder." |
|||
), |
|||
OPT_CENTERY, font_medium); |
|||
} |
|||
|
|||
if (what & FOREGROUND) { |
|||
cmd.font(font_medium) |
|||
.colors(normal_btn) |
|||
.tag(2).button(CARTRIDGE_OUT_BTN_POS, GET_TEXT_F(MSG_CARTRIDGE_OUT)) |
|||
.tag(3).button(CARTRIDGE_IN_BTN_POS, GET_TEXT_F(MSG_CARTRIDGE_IN)) |
|||
.colors(action_btn) |
|||
.tag(1).button(BACK_BTN_POS, GET_TEXT_F(MSG_BACK)); |
|||
} |
|||
} |
|||
|
|||
bool UnloadCartridgeScreen::onTouchEnd(uint8_t tag) { |
|||
using namespace ExtUI; |
|||
switch (tag) { |
|||
case 1: GOTO_PREVIOUS(); break; |
|||
} |
|||
return true; |
|||
} |
|||
|
|||
bool UnloadCartridgeScreen::onTouchHeld(uint8_t tag) { |
|||
if (ExtUI::isMoving()) return false; // Don't allow moves to accumulate
|
|||
constexpr float increment = 0.25; |
|||
MoveAxisScreen::setManualFeedrate(E0, increment); |
|||
#define UI_INCREMENT_AXIS(axis) UI_INCREMENT(AxisPosition_mm, axis); |
|||
#define UI_DECREMENT_AXIS(axis) UI_DECREMENT(AxisPosition_mm, axis); |
|||
switch (tag) { |
|||
case 2: UI_DECREMENT_AXIS(E0); break; |
|||
case 3: UI_INCREMENT_AXIS(E0); break; |
|||
default: return false; |
|||
} |
|||
#undef UI_DECREMENT_AXIS |
|||
#undef UI_INCREMENT_AXIS |
|||
return false; |
|||
} |
|||
|
|||
#endif // TOUCH_UI_FTDI_EVE
|
Loading…
Reference in new issue