1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-24 12:35:51 +00:00

Enhance and fix FTDI Touch UI (#21148)

This commit is contained in:
Marcio T 2021-02-21 03:05:59 -07:00 committed by Scott Lahteine
parent dc11874abe
commit a19c79d714
16 changed files with 272 additions and 107 deletions

View File

@ -157,13 +157,13 @@ namespace Language_en {
#ifdef TOUCH_UI_COCOA_PRESS
PROGMEM Language_Str MSG_BODY = u8"Body";
PROGMEM Language_Str MSG_INTERNAL = u8"Internal";
PROGMEM Language_Str MSG_SELECT_CHOCOLATE_TYPE = u8"Select Chocolate Type";
PROGMEM Language_Str MSG_EXTERNAL = u8"External";
PROGMEM Language_Str MSG_CHOCOLATE = u8"Chocolate";
PROGMEM Language_Str MSG_UNLOAD_CARTRIDGE = u8"Unload Cartridge";
PROGMEM Language_Str MSG_LOAD_CHOCOLATE = u8"Load Chocolate";
PROGMEM Language_Str MSG_CARTRIDGE_IN = u8"Cartridge In";
PROGMEM Language_Str MSG_CARTRIDGE_OUT = u8"Cartridge Out";
PROGMEM Language_Str MSG_LOAD_UNLOAD = u8"Load/Unload";
PROGMEM Language_Str MSG_FULL_LOAD = u8"Full Load";
PROGMEM Language_Str MSG_FULL_UNLOAD = u8"Full Unload";
PROGMEM Language_Str MSG_PREHEAT_CHOCOLATE = u8"Preheat Chocolate";
PROGMEM Language_Str MSG_PREHEAT_FINISHED = u8"Preheat finished";
PROGMEM Language_Str MSG_PREHEAT = u8"Preheat";

View File

@ -271,7 +271,7 @@ void BedMeshScreen::onRedraw(draw_mode_t what) {
.cmd(CLEAR(true,true,true));
// Draw the shadow and tags
cmd.cmd(COLOR_RGB(0x444444));
cmd.cmd(COLOR_RGB(Theme::bed_mesh_shadow_rgb));
BedMeshScreen::drawMesh(INSET_POS(MESH_POS), nullptr, USE_POINTS | USE_TAGS);
cmd.cmd(COLOR_RGB(bg_text_enabled));
}
@ -282,6 +282,8 @@ void BedMeshScreen::onRedraw(draw_mode_t what) {
if (gotAllPoints) {
drawHighlightedPointValue();
}
CommandProcessor cmd;
cmd.cmd(COLOR_RGB(Theme::bed_mesh_lines_rgb));
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),

View File

@ -27,69 +27,179 @@
#ifdef FTDI_COCOA_LOAD_CHOCOLATE_SCREEN
#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 ExtUI;
using namespace FTDI;
using namespace Theme;
#define GRID_COLS 2
#define GRID_ROWS 6
constexpr static LoadChocolateScreenData &mydata = screen_data.LoadChocolateScreen;
#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::draw_syringe(draw_mode_t what) {
#if ENABLED(COCOA_PRESS_CHOCOLATE_LEVEL_SENSOR)
const float fill_level = get_chocolate_fill_level();
#else
constexpr float fill_level = 1.0f;
#endif
void LoadChocolateScreen::onRedraw(draw_mode_t what) {
CommandProcessor cmd;
PolyUI ui(cmd, what);
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);
// Paint the shadow for the syringe
ui.color(shadow_rgb);
ui.shadow(POLY(syringe_outline), shadow_depth);
}
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));
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 LoadChocolateScreen::draw_buttons(draw_mode_t what) {
int16_t x, y, h, v;
CommandProcessor cmd;
PolyUI ui(cmd, what);
cmd.font(font_medium).colors(normal_btn);
ui.bounds(POLY(load_screen_unload_btn), x, y, h, v);
cmd.tag(2).button(x, y, h, v, GET_TEXT_F(MSG_FULL_UNLOAD));
ui.bounds(POLY(load_screen_load_btn), x, y, h, v);
cmd.tag(3).button(x, y, h, v, GET_TEXT_F(MSG_FULL_LOAD));
ui.bounds(POLY(load_screen_back_btn), x, y, h, v);
cmd.tag(1).colors(action_btn).button(x, y, h, v, GET_TEXT_F(MSG_BACK));
}
void LoadChocolateScreen::draw_text(draw_mode_t what) {
if (what & BACKGROUND) {
int16_t x, y, h, v;
CommandProcessor cmd;
PolyUI ui(cmd, what);
cmd.font(font_medium).cmd(COLOR_RGB(bg_text_enabled));
ui.bounds(POLY(load_sreen_title), x, y, h, v);
cmd.tag(2).text(x, y, h, v, GET_TEXT_F(MSG_LOAD_UNLOAD));
ui.bounds(POLY(load_screen_increment), x, y, h, v);
cmd.tag(3).text(x, y, h, v, GET_TEXT_F(MSG_INCREMENT));
}
}
void LoadChocolateScreen::draw_arrows(draw_mode_t what) {
CommandProcessor cmd;
PolyUI ui(cmd, what);
ui.button_fill (fill_rgb);
ui.button_stroke(stroke_rgb, 28);
ui.button_shadow(shadow_rgb, shadow_depth);
constexpr uint8_t style = PolyUI::REGULAR;
ui.button(4, POLY(load_screen_extrude), style);
ui.button(5, POLY(load_screen_retract), style);
}
void LoadChocolateScreen::onEntry() {
mydata.repeat_tag = 0;
}
void LoadChocolateScreen::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_syringe(what);
draw_arrows(what);
draw_buttons(what);
draw_text(what);
}
bool LoadChocolateScreen::onTouchStart(uint8_t) {
mydata.repeat_tag = 0;
return true;
}
bool LoadChocolateScreen::onTouchEnd(uint8_t tag) {
using namespace ExtUI;
switch (tag) {
case 2:
mydata.repeat_tag = (mydata.repeat_tag == 2) ? 0 : 2;
break;
case 3:
mydata.repeat_tag = (mydata.repeat_tag == 3) ? 0 : 3;
break;
case 1: GOTO_PREVIOUS(); break;
}
return true;
}
void LoadChocolateScreen::setManualFeedrateAndIncrement(float feedrate_mm_s, float &increment_mm) {
// Compute increment so feedrate so that the tool lags the adjuster when it is
// being held down, this allows enough margin for the planner to
// connect segments and even out the motion.
ExtUI::setFeedrate_mm_s(feedrate_mm_s);
increment_mm = feedrate_mm_s / ((TOUCH_REPEATS_PER_SECOND) * 0.80f);
}
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);
float increment;
setManualFeedrateAndIncrement(20, 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;
case 2: {
if (get_chocolate_fill_level() < 0.1) {
mydata.repeat_tag = 0;
return false;
}
UI_INCREMENT_AXIS(E0);
break;
}
case 3: {
if (get_chocolate_fill_level() > 0.9) {
mydata.repeat_tag = 0;
return false;
}
UI_DECREMENT_AXIS(E0);
break;
}
case 4:
UI_INCREMENT_AXIS(E0);
break;
case 5:
UI_DECREMENT_AXIS(E0);
break;
default: return false;
}
#undef UI_DECREMENT_AXIS
@ -97,4 +207,14 @@ bool LoadChocolateScreen::onTouchHeld(uint8_t tag) {
return false;
}
void LoadChocolateScreen::onIdle() {
reset_menu_timeout();
if (mydata.repeat_tag) onTouchHeld(mydata.repeat_tag);
if (refresh_timer.elapsed(STATUS_UPDATE_INTERVAL)) {
if (!EventLoop::is_touch_held())
onRefresh();
refresh_timer.start();
}
BaseScreen::onIdle();
}
#endif // FTDI_COCOA_LOAD_CHOCOLATE_SCREEN

View File

@ -26,9 +26,22 @@
#define FTDI_COCOA_LOAD_CHOCOLATE_SCREEN
#define FTDI_COCOA_LOAD_CHOCOLATE_SCREEN_CLASS LoadChocolateScreen
struct LoadChocolateScreenData {
uint8_t repeat_tag;
};
class LoadChocolateScreen : public BaseScreen, public CachedScreen<LOAD_CHOCOLATE_SCREEN_CACHE> {
private:
static void setManualFeedrateAndIncrement(float feedrate_mm_s, float &increment);
static void draw_syringe(draw_mode_t what);
static void draw_arrows(draw_mode_t what);
static void draw_buttons(draw_mode_t what);
static void draw_text(draw_mode_t what);
public:
static void onEntry();
static void onIdle();
static void onRedraw(draw_mode_t);
static bool onTouchStart(uint8_t tag);
static bool onTouchEnd(uint8_t tag);
static bool onTouchHeld(uint8_t tag);
};

View File

@ -29,17 +29,19 @@
using namespace FTDI;
using namespace Theme;
#define GRID_ROWS 4
#define GRID_ROWS 5
#define GRID_COLS 2
#define MOVE_XYZ_POS BTN_POS(1,1), BTN_SIZE(1,1)
#define ZPROBE_ZOFFSET_POS BTN_POS(1,1), BTN_SIZE(1,1)
#define MOVE_XYZ_POS BTN_POS(1,2), 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)
#define DISABLE_STEPPERS_POS BTN_POS(1,4), BTN_SIZE(1,1)
#define LEVELING_POS BTN_POS(2,4), BTN_SIZE(1,1)
#define ABOUT_PRINTER_POS BTN_POS(1,5), BTN_SIZE(1,1)
#define BACK_POS BTN_POS(2,5), BTN_SIZE(1,1)
void MainMenu::onRedraw(draw_mode_t what) {
if (what & BACKGROUND) {
@ -52,16 +54,19 @@ void MainMenu::onRedraw(draw_mode_t what) {
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))
.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))
.tag( 4).button(ZPROBE_ZOFFSET_POS, GET_TEXT_F(MSG_ZPROBE_ZOFFSET))
.tag( 5).button(MOVE_E_POS, GET_TEXT_F(MSG_E_MOVE))
.tag( 6).button(SPEED_POS, GET_TEXT_F(MSG_PRINT_SPEED))
.tag( 7).button(ADVANCED_SETTINGS_POS, GET_TEXT_F(MSG_ADVANCED_SETTINGS))
.tag( 8).button(DISABLE_STEPPERS_POS, GET_TEXT_F(MSG_DISABLE_STEPPERS))
.enabled(HAS_LEVELING)
.tag( 9).button(LEVELING_POS, GET_TEXT_F(MSG_LEVELING))
.tag(10).button(ABOUT_PRINTER_POS, GET_TEXT_F(MSG_INFO_MENU))
.colors(action_btn)
.tag(1).button(BACK_POS, GET_TEXT_F(MSG_BACK));
.tag(1).button(BACK_POS, GET_TEXT_F(MSG_BACK));
}
}
@ -69,16 +74,20 @@ 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;
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;
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;
case 5: GOTO_SCREEN(MoveEScreen); break;
case 6: GOTO_SCREEN(FeedratePercentScreen); break;
case 7: GOTO_SCREEN(AdvancedSettingsMenu); break;
case 8: injectCommands_P(PSTR("M84")); break;
#if HAS_LEVELING
case 9: GOTO_SCREEN(LevelingMenu); break;
#endif
case 10: GOTO_SCREEN(AboutScreen); break;
default:
return false;
}

View File

@ -30,6 +30,8 @@
using namespace FTDI;
using namespace ExtUI;
constexpr static MoveAxisScreenData &mydata = screen_data.MoveAxisScreen;
void MoveEScreen::onRedraw(draw_mode_t what) {
widgets_t w(what);
w.precision(1);
@ -37,15 +39,15 @@ void MoveEScreen::onRedraw(draw_mode_t what) {
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.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();

View File

@ -32,7 +32,7 @@ using namespace Theme;
#define GRID_COLS 2
void PreheatMenu::onRedraw(draw_mode_t what) {
const int16_t w = has_extra_heater() ? BTN_W(1) : BTN_W(2);
const int16_t w = TERN0(COCOA_PRESS_EXTRA_HEATER, has_extra_heater() ? BTN_W(1) : BTN_W(2));
const int16_t h = BTN_H(1);
if (what & BACKGROUND) {
@ -42,10 +42,12 @@ void PreheatMenu::onRedraw(draw_mode_t what) {
.tag(0)
.cmd(COLOR_RGB(bg_text_enabled))
.font(Theme::font_medium)
.text ( BTN_POS(1,1), w, h, GET_TEXT_F(MSG_INTERNAL));
if (has_extra_heater()) {
.text( BTN_POS(1,1), w, h, GET_TEXT_F(MSG_SELECT_CHOCOLATE_TYPE));
#if ENABLED(COCOA_PRESS_EXTRA_HEATER)
if (has_extra_heater()) {
cmd.text( BTN_POS(2,1), w, h, GET_TEXT_F(MSG_EXTERNAL));
}
}
#endif
}
if (what & FOREGROUND) {
@ -55,11 +57,13 @@ void PreheatMenu::onRedraw(draw_mode_t what) {
.tag(2).button(BTN_POS(1,2), w, h, F("Dark Chocolate"))
.tag(3).button(BTN_POS(1,3), w, h, F("Milk Chocolate"))
.tag(4).button(BTN_POS(1,4), w, h, F("White Chocolate"));
if (has_extra_heater()) {
#if ENABLED(COCOA_PRESS_EXTRA_HEATER)
if (has_extra_heater()) {
cmd.tag(5).button(BTN_POS(2,2), w, h, F("Dark Chocolate"))
.tag(6).button(BTN_POS(2,3), w, h, F("Milk Chocolate"))
.tag(7).button(BTN_POS(2,4), w, h, F("White Chocolate"));
}
}
#endif
cmd.colors(action_btn)
.tag(1) .button(BTN_POS(1,5), BTN_SIZE(2,1), GET_TEXT_F(MSG_BACK));
}

View File

@ -101,7 +101,7 @@ void PreheatTimerScreen::draw_adjuster(draw_mode_t what, uint8_t tag, progmem_st
cmd.tag(0)
.font(font_small);
if (what & BACKGROUND) {
cmd.text( SUB_POS(1,1), SUB_SIZE(9,1), label)
cmd.text( SUB_POS(1,1), SUB_SIZE(9,1), label)
.button(SUB_POS(1,2), SUB_SIZE(5,1), F(""), OPT_FLAT);
}
@ -126,20 +126,20 @@ void PreheatTimerScreen::onRedraw(draw_mode_t what) {
draw_message(what);
draw_time_remaining(what);
draw_interaction_buttons(what);
draw_adjuster(what, 1, GET_TEXT_F(MSG_NOZZLE), getTargetTemp_celsius(E0), NOZZLE_ADJ_POS);
draw_adjuster(what, 3, GET_TEXT_F(MSG_BODY), getTargetTemp_celsius(E1), BODY_ADJ_POS);
draw_adjuster(what, 5, GET_TEXT_F(MSG_CHAMBER), getTargetTemp_celsius(CHAMBER), CHAMBER_ADJ_POS);
draw_adjuster(what, 2, GET_TEXT_F(MSG_NOZZLE), getTargetTemp_celsius(E0), NOZZLE_ADJ_POS);
draw_adjuster(what, 4, GET_TEXT_F(MSG_BODY), getTargetTemp_celsius(E1), BODY_ADJ_POS);
draw_adjuster(what, 6, GET_TEXT_F(MSG_CHAMBER), getTargetTemp_celsius(CHAMBER), CHAMBER_ADJ_POS);
}
bool PreheatTimerScreen::onTouchHeld(uint8_t tag) {
const float increment = (tag == 5 || tag == 6) ? 1 : 0.1;
const float increment = (tag == 6 || tag == 7) ? 1 : 0.1;
switch (tag) {
case 1: UI_DECREMENT(TargetTemp_celsius, E0); break;
case 2: UI_INCREMENT(TargetTemp_celsius, E0); break;
case 3: UI_DECREMENT(TargetTemp_celsius, E1); break;
case 4: UI_INCREMENT(TargetTemp_celsius, E1); break;
case 5: UI_DECREMENT(TargetTemp_celsius, CHAMBER); break;
case 6: UI_INCREMENT(TargetTemp_celsius, CHAMBER); break;
case 2: UI_DECREMENT(TargetTemp_celsius, E0); break;
case 3: UI_INCREMENT(TargetTemp_celsius, E0); break;
case 4: UI_DECREMENT(TargetTemp_celsius, E1); break;
case 5: UI_INCREMENT(TargetTemp_celsius, E1); break;
case 6: UI_DECREMENT(TargetTemp_celsius, CHAMBER); break;
case 7: UI_INCREMENT(TargetTemp_celsius, CHAMBER); break;
default:
return false;
}
@ -149,7 +149,7 @@ bool PreheatTimerScreen::onTouchHeld(uint8_t tag) {
bool PreheatTimerScreen::onTouchEnd(uint8_t tag) {
switch (tag) {
case 1: GOTO_PREVIOUS(); return true;
default: break;
default: return current_screen.onTouchHeld(tag);
}
return false;
}

View File

@ -86,10 +86,8 @@ void StatusScreen::draw_temperature(draw_mode_t 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);
cmd.font(font_medium).tag(10);
ui.bounds(POLY(chocolate_label), x, y, h, v);
cmd.text(x, y, h, v, GET_TEXT_F(MSG_CHOCOLATE));
@ -119,7 +117,7 @@ void StatusScreen::draw_temperature(draw_mode_t what) {
char str[15];
cmd.cmd(COLOR_RGB(fluid_rgb));
cmd.font(font_large);
cmd.font(font_large).tag(10);
format_temp(str, getActualTemp_celsius(E0));
ui.bounds(POLY(h0_temp), x, y, h, v);
@ -144,11 +142,8 @@ void StatusScreen::draw_temperature(draw_mode_t what) {
}
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;
#if ENABLED(COCOA_PRESS_CHOCOLATE_LEVEL_SENSOR)
const float fill_level = get_chocolate_fill_level();
#else
constexpr float fill_level = 1.0f;
#endif
@ -192,15 +187,13 @@ void StatusScreen::draw_buttons(draw_mode_t what) {
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(park_btn), x, y, h, v);
cmd.tag(1).button(x, y, h, v, GET_TEXT_F(MSG_FILAMENT_PARK_ENABLED));
ui.bounds(POLY(load_chocolate_btn), x, y, h, v);
cmd.tag(2).button(x, y, h, v, GET_TEXT_F(MSG_LOAD_CHOCOLATE));
cmd.tag(2).button(x, y, h, v, GET_TEXT_F(MSG_LOAD_UNLOAD));
ui.bounds(POLY(preheat_chocolate_btn), x, y, h, v);
cmd.tag(3).button(x, y, h, v, GET_TEXT_F(MSG_PREHEAT_CHOCOLATE));
@ -242,7 +235,7 @@ bool StatusScreen::onTouchStart(uint8_t) {
bool StatusScreen::onTouchEnd(uint8_t tag) {
switch (tag) {
case 1: GOTO_SCREEN(UnloadCartridgeScreen); break;
case 1: SpinnerDialogBox::enqueueAndWait_P(F("G0 X0 Y0")); break;
case 2: GOTO_SCREEN(LoadChocolateScreen); break;
case 3: GOTO_SCREEN(PreheatMenu); break;
case 4: GOTO_SCREEN(MainMenu); break;
@ -270,6 +263,7 @@ bool StatusScreen::onTouchEnd(uint8_t tag) {
PUSH_SCREEN(StatusScreen);
break;
case 9: GOTO_SCREEN(FilesScreen); break;
case 10: GOTO_SCREEN(TemperatureScreen); break;
default: return false;
}
// If a passcode is enabled, the LockScreen will prevent the

View File

@ -11,7 +11,7 @@
* 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/>. *
* location: <https://www.gnu.org/licenses/>. *
****************************************************************************/
/**
@ -32,7 +32,7 @@ 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 park_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};
@ -49,6 +49,13 @@ const PROGMEM uint16_t h0_label[] = {0x62A9, 0x2A5A, 0x8FFE, 0x2A5A, 0x8FFE, 0x4
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};
const PROGMEM uint16_t extrude_btn[] = {0xC859, 0xDD2B, 0xF5AE, 0xDD2B, 0xF5AE, 0xEFFE, 0xC859, 0xEFFE, 0xC859, 0xDD2B};
const PROGMEM uint16_t load_screen_extrude[] = {0x25FB, 0x89AE, 0x2F58, 0x89AE, 0x2F58, 0xAAF6, 0x3406, 0xAAF6, 0x2AAA, 0xBB9A, 0x214D, 0xAAF6, 0x25FB, 0xAAF6, 0x25FB, 0x89AE};
const PROGMEM uint16_t load_screen_retract[] = {0x25FC, 0x790A, 0x2F58, 0x790A, 0x2F58, 0x57C2, 0x3406, 0x57C2, 0x2AAA, 0x471D, 0x214D, 0x57C2, 0x25FC, 0x57C2, 0x25FC, 0x790A};
const PROGMEM uint16_t load_screen_back_btn[] = {0x1555, 0xCA58, 0xC553, 0xCA58, 0xC553, 0xEFFE, 0x1555, 0xEFFE, 0x1555, 0xCA58};
const PROGMEM uint16_t load_screen_unload_btn[] = {0x4AAA, 0x8EBD, 0xC553, 0x8EBD, 0xC553, 0xB463, 0x4AAA, 0xB463, 0x4AAA, 0x8EBD};
const PROGMEM uint16_t load_screen_load_btn[] = {0x4AAA, 0x5322, 0xC553, 0x5322, 0xC553, 0x78C7, 0x4AAA, 0x78C7, 0x4AAA, 0x5322};
const PROGMEM uint16_t load_sreen_title[] = {0x4AAA, 0x1787, 0xC553, 0x1787, 0xC553, 0x3D2C, 0x4AAA, 0x3D2C, 0x4AAA, 0x1787};
const PROGMEM uint16_t load_screen_increment[] = {0x1555, 0x2E1D, 0x3FFF, 0x2E1D, 0x3FFF, 0x3D2C, 0x1555, 0x3D2C, 0x1555, 0x2E1D};

View File

@ -50,6 +50,12 @@ bool ConfirmUserRequestAlertBox::onTouchEnd(uint8_t tag) {
}
}
void ConfirmUserRequestAlertBox::onIdle() {
if (!ExtUI::awaitingUserConfirm()) {
hide();
}
}
void ConfirmUserRequestAlertBox::show(const char* msg) {
drawMessage(msg);
storeBackground();

View File

@ -70,8 +70,8 @@ void MoveAxisScreen::onRedraw(draw_mode_t what) {
}
bool BaseMoveAxisScreen::onTouchHeld(uint8_t tag) {
#define UI_INCREMENT_AXIS(axis) UI_INCREMENT(AxisPosition_mm, axis);
#define UI_DECREMENT_AXIS(axis) UI_DECREMENT(AxisPosition_mm, axis);
#define UI_INCREMENT_AXIS(axis) setManualFeedrate(axis, increment); UI_INCREMENT(AxisPosition_mm, axis);
#define UI_DECREMENT_AXIS(axis) setManualFeedrate(axis, increment); UI_DECREMENT(AxisPosition_mm, axis);
const float increment = getIncrement();
switch (tag) {
case 2: UI_DECREMENT_AXIS(X); break;

View File

@ -58,6 +58,7 @@ union screen_data_t {
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_COCOA_LOAD_CHOCOLATE_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)

View File

@ -98,6 +98,8 @@ SCREEN_TABLE {
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_STATUS_SCREEN)
DECL_SCREEN_IF_INCLUDED(FTDI_COCOA_MAIN_MENU)
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)

View File

@ -100,7 +100,6 @@ enum {
#if ENABLED(TOUCH_UI_COCOA_PRESS)
PREHEAT_MENU_CACHE,
PREHEAT_TIMER_SCREEN_CACHE,
UNLOAD_CARTRIDGE_SCREEN_CACHE,
LOAD_CHOCOLATE_SCREEN_CACHE,
MOVE_XYZ_SCREEN_CACHE,
MOVE_E_SCREEN_CACHE,
@ -145,11 +144,11 @@ enum {
#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_advanced_settings_menu.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 "move_axis_screen.h"
#include "cocoa_press_move_xyz_screen.h"
#include "cocoa_press_move_e_screen.h"
#include "tune_menu.h"

View File

@ -85,6 +85,9 @@ namespace Theme {
constexpr uint32_t logo_bg_rgb = accent_color_1;
constexpr uint32_t logo_fill_rgb = accent_color_0;
constexpr uint32_t logo_stroke_rgb = accent_color_4;
constexpr uint32_t bed_mesh_lines_rgb = 0xFFFFFF;
constexpr uint32_t bed_mesh_shadow_rgb = 0x444444;
#elif ANY(TOUCH_UI_COCOA_THEME, TOUCH_UI_FROZEN_THEME)
constexpr uint32_t theme_darkest = accent_color_1;
constexpr uint32_t theme_dark = accent_color_4;
@ -102,6 +105,9 @@ namespace Theme {
constexpr uint32_t logo_bg_rgb = accent_color_5;
constexpr uint32_t logo_fill_rgb = accent_color_6;
constexpr uint32_t logo_stroke_rgb = accent_color_2;
constexpr uint32_t bed_mesh_lines_rgb = accent_color_6;
constexpr uint32_t bed_mesh_shadow_rgb = 0x444444;
#else
constexpr uint32_t theme_darkest = gray_color_1;
constexpr uint32_t theme_dark = gray_color_2;