🎨 Fix and improve FTDI Eve Touch UI (#22093)

This commit is contained in:
Marcio T 2021-06-10 02:17:39 -06:00 committed by Scott Lahteine
parent b27447ef48
commit 507e1e436e
9 changed files with 28 additions and 19 deletions

View file

@ -27,9 +27,7 @@
#if ENABLED(SDSUPPORT)
bool MediaFileReader::open(const char *filename) {
card.init(SD_SPI_SPEED, SDSS);
volume.init(&card);
root.openRoot(&volume);
root = CardReader::getroot();
return file.open(&root, filename, O_READ);
}

View file

@ -82,8 +82,8 @@ namespace FTDI {
box_width = w;
measure_text_box(fm, str, box_width, box_height);
if (box_width <= (uint16_t)w && box_height <= (uint16_t)h) break;
fm.load(--font);
if (font == 26) break;
fm.load(--font);
}
const uint16_t dx = (options & OPT_RIGHTX) ? w :

View file

@ -26,7 +26,7 @@
#ifdef FTDI_ABOUT_SCREEN
#define GRID_COLS 4
#define GRID_ROWS 7
#define GRID_ROWS 8
using namespace FTDI;
using namespace Theme;
@ -47,9 +47,9 @@ void AboutScreen::onRedraw(draw_mode_t) {
#define HEADING_POS BTN_POS(1,2), BTN_SIZE(4,1)
#define FW_VERS_POS BTN_POS(1,3), BTN_SIZE(4,1)
#define FW_INFO_POS BTN_POS(1,4), BTN_SIZE(4,1)
#define LICENSE_POS BTN_POS(1,5), BTN_SIZE(4,2)
#define STATS_POS BTN_POS(1,7), BTN_SIZE(2,1)
#define BACK_POS BTN_POS(3,7), BTN_SIZE(2,1)
#define LICENSE_POS BTN_POS(1,5), BTN_SIZE(4,3)
#define STATS_POS BTN_POS(1,8), BTN_SIZE(2,1)
#define BACK_POS BTN_POS(3,8), BTN_SIZE(2,1)
#define _INSET_POS(x,y,w,h) x + w/10, y, w - w/5, h
#define INSET_POS(pos) _INSET_POS(pos)

View file

@ -69,7 +69,7 @@ void BedMeshViewScreen::onEntry() {
void BedMeshViewScreen::drawHighlightedPointValue() {
CommandProcessor cmd;
cmd.font(Theme::font_medium)
.colors(normal_btn)
.cmd(COLOR_RGB(bg_text_enabled))
.text(Z_LABEL_POS, GET_TEXT_F(MSG_MESH_EDIT_Z))
.font(font_small);
@ -161,7 +161,7 @@ void BedMeshViewScreen::doProbe() {
void BedMeshViewScreen::doMeshValidation() {
mydata.count = 0;
GOTO_SCREEN(StatusScreen);
injectCommands_P(PSTR("G28 O\nM117 Heating...\nG26 R X0 Y0"));
injectCommands_P(PSTR("M75\nG28 O\nM117 Heating...\nG26 R X0 Y0\nG27\nM77"));
}
void BedMeshViewScreen::show() {

View file

@ -46,17 +46,22 @@ void ZOffsetScreen::onRedraw(draw_mode_t what) {
w.heading( GET_TEXT_F(MSG_ZPROBE_ZOFFSET));
w.color(z_axis).adjuster(4, GET_TEXT_F(MSG_ZPROBE_ZOFFSET), getZOffset_mm());
w.increments();
w.button( 2, GET_TEXT_F(MSG_PROBE_WIZARD));
w.button(2, GET_TEXT_F(MSG_PROBE_WIZARD), !isPrinting());
}
void ZOffsetScreen::move(float inc) {
void ZOffsetScreen::move(float mm, int16_t steps) {
// We can't store state after the call to the AlertBox, so
// check whether the current position equal mydata.z in order
// to know whether the user started the wizard.
if (getAxisPosition_mm(Z) == mydata.z) {
mydata.z += inc;
// In the wizard
mydata.z += mm;
setAxisPosition_mm(mydata.z, Z);
}
else {
// Otherwise doing a manual adjustment, possibly during a print.
babystepAxis_steps(steps, Z);
}
}
void ZOffsetScreen::runWizard() {
@ -80,11 +85,12 @@ void ZOffsetScreen::runWizard() {
}
bool ZOffsetScreen::onTouchHeld(uint8_t tag) {
const float increment = getIncrement();
const int16_t steps = mmToWholeSteps(getIncrement(), Z);
const float increment = mmFromWholeSteps(steps, Z);
switch (tag) {
case 2: runWizard(); break;
case 4: UI_DECREMENT(ZOffset_mm); move(-increment); break;
case 5: UI_INCREMENT(ZOffset_mm); move( increment); break;
case 4: UI_DECREMENT(ZOffset_mm); move(-increment, -steps); break;
case 5: UI_INCREMENT(ZOffset_mm); move( increment, steps); break;
default:
return false;
}

View file

@ -31,7 +31,7 @@ struct ZOffsetScreenData : public BaseNumericAdjustmentScreenData {
class ZOffsetScreen : public BaseNumericAdjustmentScreen, public CachedScreen<ZOFFSET_SCREEN_CACHE> {
private:
static void move(float inc);
static void move(float mm, int16_t steps);
static void runWizard();
public:
static void onEntry();

View file

@ -70,7 +70,7 @@ namespace Language_en {
PROGMEM Language_Str MSG_ABOUT_TOUCH_PANEL_2 = WEBSITE_URL;
PROGMEM Language_Str MSG_LICENSE = u8"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.\n\nTo view a copy of the GNU General "
"of the License, or (at your option) any later version. To view a copy of the GNU General "
"Public License, go to the following location: https://www.gnu.org/licenses.";
PROGMEM Language_Str MSG_RUNOUT_1 = u8"Runout 1";
PROGMEM Language_Str MSG_RUNOUT_2 = u8"Runout 2";
@ -130,7 +130,7 @@ namespace Language_en {
PROGMEM Language_Str MSG_EEPROM_RESTORED = u8"Settings restored from backup";
PROGMEM Language_Str MSG_EEPROM_RESET = u8"Settings restored to default";
PROGMEM Language_Str MSG_EEPROM_SAVED = u8"Settings saved!";
PROGMEM Language_Str MSG_EEPROM_SAVE_PROMPT = u8"Do you wish to save these settings as defaults?";
PROGMEM Language_Str MSG_EEPROM_SAVE_PROMPT = u8"Do you wish to save these settings for next power-on?";
PROGMEM Language_Str MSG_EEPROM_RESET_WARNING = u8"Are you sure? Customizations will be lost.";
PROGMEM Language_Str MSG_PASSCODE_REJECTED = u8"Wrong passcode!";

View file

@ -767,6 +767,10 @@ namespace ExtUI {
return steps > 0 ? CEIL(steps) : FLOOR(steps);
}
float mmFromWholeSteps(int16_t steps, const axis_t axis) {
return steps * planner.steps_to_mm[axis];
}
#endif // BABYSTEPPING
float getZOffset_mm() {

View file

@ -239,6 +239,7 @@ namespace ExtUI {
#if ENABLED(BABYSTEPPING)
int16_t mmToWholeSteps(const_float_t mm, const axis_t axis);
float mmFromWholeSteps(int16_t steps, const axis_t axis);
bool babystepAxis_steps(const int16_t steps, const axis_t axis);
void smartAdjustAxis_steps(const int16_t steps, const axis_t axis, bool linked_nozzles);