Browse Source

Improvement and fixes to FTDI touch UI

- Fixed incorrect LCD text string
- Fixed incorrect refresh of filament change screens
- Allow host control via touch UI
- Updates to leveling menu
- Modified ExtUI::isPrinting() to check if the job timer is running
- Added ExtUI method to check whether a host print is paused
vanilla_fb_2.0.x
Marcio Teixeira 4 years ago
committed by Scott Lahteine
parent
commit
b6856dcb99
  1. 2
      Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/language/language_en.h
  2. 1
      Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/change_filament_screen.cpp
  3. 8
      Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/confirm_abort_print_dialog_box.cpp
  4. 73
      Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/leveling_menu.cpp
  5. 3
      Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screens.h
  6. 55
      Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/tune_menu.cpp
  7. 6
      Marlin/src/lcd/extui/ui_api.cpp
  8. 1
      Marlin/src/lcd/extui/ui_api.h

2
Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/language/language_en.h

@ -119,7 +119,7 @@ namespace Language_en {
PROGMEM Language_Str MSG_CAUTION = u8"Caution:";
PROGMEM Language_Str MSG_HOT = u8"Hot!";
PROGMEM Language_Str MSG_UNLOAD_FILAMENT = u8"Unload/Retract";
PROGMEM Language_Str MSG_LOAD_FILAMENT = u8"Load/Extruder";
PROGMEM Language_Str MSG_LOAD_FILAMENT = u8"Load/Extrude";
PROGMEM Language_Str MSG_MOMENTARY = u8"Momentary";
PROGMEM Language_Str MSG_CONTINUOUS = u8"Continuous";
PROGMEM Language_Str MSG_PLEASE_WAIT = u8"Please wait...";

1
Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/change_filament_screen.cpp

@ -84,6 +84,7 @@ void ChangeFilamentScreen::drawTempGradient(uint16_t x, uint16_t y, uint16_t w,
}
void ChangeFilamentScreen::onEntry() {
BaseScreen::onEntry();
screen_data.ChangeFilamentScreen.e_tag = ExtUI::getActiveTool() + 10;
screen_data.ChangeFilamentScreen.t_tag = 0;
screen_data.ChangeFilamentScreen.repeat_tag = 0;

8
Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/confirm_abort_print_dialog_box.cpp

@ -26,6 +26,8 @@
#include "screens.h"
#include "../../../../../feature/host_actions.h"
using namespace ExtUI;
void ConfirmAbortPrintDialogBox::onRedraw(draw_mode_t) {
@ -37,7 +39,11 @@ bool ConfirmAbortPrintDialogBox::onTouchEnd(uint8_t tag) {
switch (tag) {
case 1:
GOTO_PREVIOUS();
stopPrint();
if (ExtUI::isPrintingFromMedia())
ExtUI::stopPrint();
#ifdef ACTION_ON_CANCEL
else host_action_cancel();
#endif
return true;
default:
return DialogBoxBaseClass::onTouchEnd(tag);

73
Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/leveling_menu.cpp

@ -35,29 +35,27 @@ using namespace ExtUI;
using namespace Theme;
#ifdef TOUCH_UI_PORTRAIT
#define GRID_ROWS 10
#define GRID_ROWS 9
#define GRID_COLS 2
#define TITLE_POS BTN_POS(1,1), BTN_SIZE(2,1)
#define LEVEL_BED_POS BTN_POS(1,2), BTN_SIZE(2,1)
#define LEVEL_AXIS_POS BTN_POS(1,3), BTN_SIZE(2,1)
#define Z_AUTO_ALIGN_POS BTN_POS(1,4), BTN_SIZE(2,1)
#define SHOW_MESH_POS BTN_POS(1,5), BTN_SIZE(2,1)
#define BLTOUCH_TITLE_POS BTN_POS(1,7), BTN_SIZE(2,1)
#define BLTOUCH_RESET_POS BTN_POS(1,8), BTN_SIZE(1,1)
#define BLTOUCH_TEST_POS BTN_POS(2,8), BTN_SIZE(1,1)
#define BACK_POS BTN_POS(1,10), BTN_SIZE(2,1)
#else
#define GRID_ROWS 8
#define GRID_COLS 2
#define TITLE_POS BTN_POS(1,1), BTN_SIZE(2,1)
#define LEVEL_BED_POS BTN_POS(1,2), BTN_SIZE(2,1)
#define LEVEL_AXIS_POS BTN_POS(1,3), BTN_SIZE(2,1)
#define Z_AUTO_ALIGN_POS BTN_POS(1,4), BTN_SIZE(2,1)
#define SHOW_MESH_POS BTN_POS(1,5), BTN_SIZE(2,1)
#define LEVEL_AXIS_POS BTN_POS(1,2), BTN_SIZE(2,1)
#define LEVEL_BED_POS BTN_POS(1,3), BTN_SIZE(2,1)
#define SHOW_MESH_POS BTN_POS(1,4), BTN_SIZE(2,1)
#define BLTOUCH_TITLE_POS BTN_POS(1,6), BTN_SIZE(2,1)
#define BLTOUCH_RESET_POS BTN_POS(1,7), BTN_SIZE(1,1)
#define BLTOUCH_TEST_POS BTN_POS(2,7), BTN_SIZE(1,1)
#define BACK_POS BTN_POS(1,8), BTN_SIZE(2,1)
#define BACK_POS BTN_POS(1,9), BTN_SIZE(2,1)
#else
#define GRID_ROWS 7
#define GRID_COLS 2
#define TITLE_POS BTN_POS(1,1), BTN_SIZE(2,1)
#define LEVEL_AXIS_POS BTN_POS(1,2), BTN_SIZE(2,1)
#define LEVEL_BED_POS BTN_POS(1,3), BTN_SIZE(2,1)
#define SHOW_MESH_POS BTN_POS(1,4), BTN_SIZE(2,1)
#define BLTOUCH_TITLE_POS BTN_POS(1,5), BTN_SIZE(2,1)
#define BLTOUCH_RESET_POS BTN_POS(1,6), BTN_SIZE(1,1)
#define BLTOUCH_TEST_POS BTN_POS(2,6), BTN_SIZE(1,1)
#define BACK_POS BTN_POS(1,7), BTN_SIZE(2,1)
#endif
void LevelingMenu::onRedraw(draw_mode_t what) {
@ -73,21 +71,16 @@ void LevelingMenu::onRedraw(draw_mode_t what) {
cmd.font(font_large)
.text(TITLE_POS, GET_TEXT_F(MSG_LEVELING))
.font(font_medium).colors(normal_btn)
.tag(2).button(LEVEL_BED_POS, GET_TEXT_F(MSG_LEVEL_BED))
.enabled(
#ifdef AXIS_LEVELING_COMMANDS
1
#endif
)
.tag(3).button(LEVEL_AXIS_POS, GET_TEXT_F(MSG_AUTOLEVEL_X_AXIS))
.enabled(ENABLED(Z_STEPPER_AUTO_ALIGN))
.tag(4).button(Z_AUTO_ALIGN_POS, GET_TEXT_F(MSG_AUTO_Z_ALIGN))
#if EITHER(Z_STEPPER_AUTO_ALIGN,MECHANICAL_GANTRY_CALIBRATION)
.tag(2).button(LEVEL_AXIS_POS, GET_TEXT_F(MSG_AUTOLEVEL_X_AXIS))
#endif
.tag(3).button(LEVEL_BED_POS, GET_TEXT_F(MSG_LEVEL_BED))
.enabled(ENABLED(HAS_MESH))
.tag(5).button(SHOW_MESH_POS, GET_TEXT_F(MSG_SHOW_MESH));
.tag(4).button(SHOW_MESH_POS, GET_TEXT_F(MSG_SHOW_MESH));
#if ENABLED(BLTOUCH)
cmd.text(BLTOUCH_TITLE_POS, GET_TEXT_F(MSG_BLTOUCH))
.tag(6).button(BLTOUCH_RESET_POS, GET_TEXT_F(MSG_BLTOUCH_RESET))
.tag(7).button(BLTOUCH_TEST_POS, GET_TEXT_F(MSG_BLTOUCH_SELFTEST));
.tag(5).button(BLTOUCH_RESET_POS, GET_TEXT_F(MSG_BLTOUCH_RESET))
.tag(6).button(BLTOUCH_TEST_POS, GET_TEXT_F(MSG_BLTOUCH_SELFTEST));
#endif
cmd.colors(action_btn)
.tag(1).button(BACK_POS, GET_TEXT_F(MSG_BACK));
@ -97,25 +90,25 @@ void LevelingMenu::onRedraw(draw_mode_t what) {
bool LevelingMenu::onTouchEnd(uint8_t tag) {
switch (tag) {
case 1: GOTO_PREVIOUS(); break;
case 2:
#if EITHER(Z_STEPPER_AUTO_ALIGN,MECHANICAL_GANTRY_CALIBRATION)
case 2: SpinnerDialogBox::enqueueAndWait_P(F("G34")); break;
#endif
case 3:
#ifndef BED_LEVELING_COMMANDS
#define BED_LEVELING_COMMANDS "G29"
#endif
#if HAS_MESH
BedMeshScreen::startMeshProbe();
#else
SpinnerDialogBox::enqueueAndWait_P(F(BED_LEVELING_COMMANDS));
#endif
break;
#ifdef AXIS_LEVELING_COMMANDS
case 3: SpinnerDialogBox::enqueueAndWait_P(F(AXIS_LEVELING_COMMANDS)); break;
#endif
#if ENABLED(Z_STEPPER_AUTO_ALIGN)
case 4: SpinnerDialogBox::enqueueAndWait_P(F("G34")); break;
#endif
#if HAS_MESH
case 5: GOTO_SCREEN(BedMeshScreen); break;
case 4: GOTO_SCREEN(BedMeshScreen); break;
#endif
#if ENABLED(BLTOUCH)
case 6: injectCommands_P(PSTR("M280 P0 S60")); break;
case 7: SpinnerDialogBox::enqueueAndWait_P(F("M280 P0 S90\nG4 P100\nM280 P0 S120")); break;
case 5: injectCommands_P(PSTR("M280 P0 S60")); break;
case 6: SpinnerDialogBox::enqueueAndWait_P(F("M280 P0 S90\nG4 P100\nM280 P0 S120")); break;
#endif
default: return false;
}

3
Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screens.h

@ -365,6 +365,9 @@ class MainMenu : public BaseScreen, public CachedScreen<MENU_SCREEN_CACHE> {
};
class TuneMenu : public BaseScreen, public CachedScreen<TUNE_SCREEN_CACHE> {
private:
static void pausePrint();
static void resumePrint();
public:
static void onRedraw(draw_mode_t);
static bool onTouchEnd(uint8_t tag);

55
Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/tune_menu.cpp

@ -26,6 +26,8 @@
#include "screens.h"
#include "../../../../../feature/host_actions.h"
using namespace FTDI;
using namespace Theme;
@ -63,23 +65,24 @@ void TuneMenu::onRedraw(draw_mode_t what) {
#endif
if (what & FOREGROUND) {
using namespace ExtUI;
const bool sdOrHostPrinting = ExtUI::isPrinting();
const bool sdOrHostPaused = ExtUI::isPrintingPaused();
CommandProcessor cmd;
cmd.colors(normal_btn)
.font(font_medium)
.tag(2).button( TEMPERATURE_POS, GET_TEXT_F(MSG_TEMPERATURE))
.enabled(!isPrinting() || isPrintingFromMediaPaused())
.enabled(!sdOrHostPrinting || sdOrHostPaused)
.tag(3).button( FIL_CHANGE_POS, GET_TEXT_F(MSG_FILAMENTCHANGE))
.enabled(EITHER(LIN_ADVANCE, FILAMENT_RUNOUT_SENSOR))
.tag(9).button( FILAMENT_POS, GET_TEXT_F(MSG_FILAMENT))
.enabled(EITHER(HAS_BED_PROBE, BABYSTEPPING))
.tag(4).button( NUDGE_NOZ_POS, GET_TEXT_F(TERN(BABYSTEPPING, MSG_NUDGE_NOZZLE, MSG_ZPROBE_ZOFFSET)))
.tag(5).button( SPEED_POS, GET_TEXT_F(MSG_PRINT_SPEED))
.tag(isPrintingFromMediaPaused() ? 7 : 6)
.enabled(TERN0(SDSUPPORT, isPrintingFromMedia()))
.button( PAUSE_POS, isPrintingFromMediaPaused() ? GET_TEXT_F(MSG_RESUME_PRINT) : GET_TEXT_F(MSG_PAUSE_PRINT))
.enabled(TERN0(SDSUPPORT, isPrintingFromMedia()))
.enabled(sdOrHostPrinting)
.tag(sdOrHostPaused ? 7 : 6)
.button( PAUSE_POS, sdOrHostPaused ? GET_TEXT_F(MSG_RESUME_PRINT) : GET_TEXT_F(MSG_PAUSE_PRINT))
.enabled(sdOrHostPrinting)
.tag(8).button( STOP_POS, GET_TEXT_F(MSG_STOP_PRINT))
.enabled(ENABLED(CASE_LIGHT_ENABLE))
.tag(10).button( CASE_LIGHT_POS, GET_TEXT_F(MSG_CASE_LIGHT))
@ -94,26 +97,26 @@ bool TuneMenu::onTouchEnd(uint8_t tag) {
using namespace Theme;
using namespace ExtUI;
switch (tag) {
case 1: GOTO_PREVIOUS(); break;
case 2: GOTO_SCREEN(TemperatureScreen); break;
case 3: GOTO_SCREEN(ChangeFilamentScreen); break;
case 4:
case 1: GOTO_PREVIOUS(); break;
case 2: GOTO_SCREEN(TemperatureScreen); break;
case 3: GOTO_SCREEN(ChangeFilamentScreen); break;
case 4:
#if ENABLED(BABYSTEPPING)
GOTO_SCREEN(NudgeNozzleScreen);
#elif HAS_BED_PROBE
GOTO_SCREEN(ZOffsetScreen);
#endif
break;
case 5: GOTO_SCREEN(FeedratePercentScreen); break;
case 6: sound.play(twinkle, PLAY_ASYNCHRONOUS); ExtUI::pausePrint(); GOTO_SCREEN(StatusScreen); break;
case 7: sound.play(twinkle, PLAY_ASYNCHRONOUS); ExtUI::resumePrint(); GOTO_SCREEN(StatusScreen); break;
case 8:
case 5: GOTO_SCREEN(FeedratePercentScreen); break;
case 6: pausePrint(); break;
case 7: resumePrint(); break;
case 8:
GOTO_SCREEN(ConfirmAbortPrintDialogBox);
current_screen.forget();
PUSH_SCREEN(StatusScreen);
break;
#if EITHER(LIN_ADVANCE, FILAMENT_RUNOUT_SENSOR)
case 9: GOTO_SCREEN(FilamentMenu); break;
case 9: GOTO_SCREEN(FilamentMenu); break;
#endif
#if ENABLED(CASE_LIGHT_ENABLE)
case 10: GOTO_SCREEN(CaseLightScreen); break;
@ -124,4 +127,24 @@ bool TuneMenu::onTouchEnd(uint8_t tag) {
return true;
}
#endif // TOUCH_UI_FTDI_EVE
void TuneMenu::pausePrint() {
sound.play(twinkle, PLAY_ASYNCHRONOUS);
if (ExtUI::isPrintingFromMedia())
ExtUI::pausePrint();
#ifdef ACTION_ON_PAUSE
else host_action_pause();
#endif
GOTO_SCREEN(StatusScreen);
}
void TuneMenu::resumePrint() {
sound.play(twinkle, PLAY_ASYNCHRONOUS);
if (ExtUI::isPrintingFromMedia())
ExtUI::resumePrint();
#ifdef ACTION_ON_RESUME
else host_action_resume();
#endif
GOTO_SCREEN(StatusScreen);
}
#endif // TOUCH_UI_FTDI_EVE && !TOUCH_UI_LULZBOT_BIO

6
Marlin/src/lcd/extui/ui_api.cpp

@ -972,7 +972,11 @@ namespace ExtUI {
}
bool isPrinting() {
return (commandsInQueue() || isPrintingFromMedia() || IFSD(IS_SD_PRINTING(), false));
return (commandsInQueue() || isPrintingFromMedia() || IFSD(IS_SD_PRINTING(), false)) || print_job_timer.isRunning() || print_job_timer.isPaused();
}
bool isPrintingPaused() {
return isPrinting() && (isPrintingFromMediaPaused() || print_job_timer.isPaused());
}
bool isMediaInserted() {

1
Marlin/src/lcd/extui/ui_api.h

@ -302,6 +302,7 @@ namespace ExtUI {
bool isPrintingFromMediaPaused();
bool isPrintingFromMedia();
bool isPrinting();
bool isPrintingPaused();
void printFile(const char *filename);
void stopPrint();

Loading…
Cancel
Save