diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/leveling_menu.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/leveling_menu.cpp
new file mode 100644
index 0000000000..57c8a7505c
--- /dev/null
+++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/leveling_menu.cpp
@@ -0,0 +1,91 @@
+/*********************************
+ * cocoa_press/leveling_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: . *
+ ****************************************************************************/
+
+#include "../config.h"
+#include "../screens.h"
+
+#ifdef COCOA_LEVELING_MENU
+
+#if BOTH(HAS_BED_PROBE,BLTOUCH)
+ #include "../../../../feature/bltouch.h"
+#endif
+
+using namespace FTDI;
+using namespace ExtUI;
+using namespace Theme;
+
+#define GRID_ROWS 5
+#define GRID_COLS 3
+#define BED_MESH_TITLE_POS BTN_POS(1,1), BTN_SIZE(3,1)
+#define PROBE_BED_POS BTN_POS(1,2), BTN_SIZE(1,1)
+#define SHOW_MESH_POS BTN_POS(2,2), BTN_SIZE(1,1)
+#define EDIT_MESH_POS BTN_POS(3,2), BTN_SIZE(1,1)
+#define BLTOUCH_TITLE_POS BTN_POS(1,3), BTN_SIZE(3,1)
+#define BLTOUCH_RESET_POS BTN_POS(1,4), BTN_SIZE(1,1)
+#define BLTOUCH_TEST_POS BTN_POS(2,4), BTN_SIZE(1,1)
+#define BACK_POS BTN_POS(1,5), BTN_SIZE(3,1)
+
+void LevelingMenu::onRedraw(draw_mode_t what) {
+ if (what & BACKGROUND) {
+ CommandProcessor cmd;
+ cmd.cmd(CLEAR_COLOR_RGB(Theme::bg_color))
+ .cmd(CLEAR(true,true,true))
+ .tag(0);
+ }
+
+ if (what & FOREGROUND) {
+ CommandProcessor cmd;
+ cmd.font(font_large)
+ .cmd(COLOR_RGB(bg_text_enabled))
+ .text(BED_MESH_TITLE_POS, GET_TEXT_F(MSG_BED_LEVELING))
+ .text(BLTOUCH_TITLE_POS, GET_TEXT_F(MSG_BLTOUCH))
+ .font(font_medium).colors(normal_btn)
+ .tag(2).button(PROBE_BED_POS, GET_TEXT_F(MSG_PROBE_BED))
+ .enabled(ENABLED(HAS_MESH))
+ .tag(3).button(SHOW_MESH_POS, GET_TEXT_F(MSG_SHOW_MESH))
+ .enabled(ENABLED(HAS_MESH))
+ .tag(4).button(EDIT_MESH_POS, GET_TEXT_F(MSG_EDIT_MESH))
+ #undef GRID_COLS
+ #define GRID_COLS 2
+ .tag(5).button(BLTOUCH_RESET_POS, GET_TEXT_F(MSG_BLTOUCH_RESET))
+ .tag(6).button(BLTOUCH_TEST_POS, GET_TEXT_F(MSG_BLTOUCH_SELFTEST))
+ #undef GRID_COLS
+ #define GRID_COLS 3
+ .colors(action_btn)
+ .tag(1).button(BACK_POS, GET_TEXT_F(MSG_BACK));
+ }
+}
+
+bool LevelingMenu::onTouchEnd(uint8_t tag) {
+ switch (tag) {
+ case 1: GOTO_PREVIOUS(); break;
+ case 2: BedMeshViewScreen::doProbe(); break;
+ case 3: BedMeshViewScreen::show(); break;
+ case 4: BedMeshEditScreen::show(); 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;
+ default: return false;
+ }
+ return true;
+}
+
+#endif // COCOA_LEVELING_MENU
diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/leveling_menu.h b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/leveling_menu.h
new file mode 100644
index 0000000000..8275380249
--- /dev/null
+++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/leveling_menu.h
@@ -0,0 +1,32 @@
+/*******************************
+ * cocoa_press/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 COCOA_LEVELING_MENU
+#define COCOA_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/ftdi_eve_touch_ui/cocoa_press/main_menu.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/main_menu.cpp
index 28dad42b13..a990717fb3 100644
--- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/main_menu.cpp
+++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/cocoa_press/main_menu.cpp
@@ -88,7 +88,7 @@ bool MainMenu::onTouchEnd(uint8_t tag) {
case 8: GOTO_SCREEN(AdvancedSettingsMenu); break;
case 9: injectCommands_P(PSTR("M84")); break;
#if HAS_LEVELING
- case 10: GOTO_SCREEN(LevelingMenu); break;
+ case 10: GOTO_SCREEN(LevelingMenu); break;
#endif
case 11: GOTO_SCREEN(AboutScreen); break;
default:
diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/leveling_menu.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/leveling_menu.cpp
index 93f9c4c228..826e01a9cf 100644
--- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/leveling_menu.cpp
+++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/leveling_menu.cpp
@@ -132,4 +132,3 @@ bool LevelingMenu::onTouchEnd(uint8_t tag) {
}
#endif // FTDI_LEVELING_MENU
-
diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/string_format.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/string_format.cpp
index 09f0bb6089..1f3640e3a1 100644
--- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/string_format.cpp
+++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/string_format.cpp
@@ -34,28 +34,53 @@
* Formats a temperature string (e.g. "100°C")
*/
void format_temp(char *str, const_celsius_float_t t1) {
- sprintf_P(str, PSTR("%3d" S_FMT), ROUND(t1), GET_TEXT(MSG_UNITS_C));
+ #ifdef TOUCH_UI_LCD_TEMP_PRECISION
+ char num1[7];
+ dtostrf(t1, 4 + TOUCH_UI_LCD_TEMP_PRECISION, TOUCH_UI_LCD_TEMP_PRECISION, num1);
+ sprintf_P(str, PSTR("%s" S_FMT), num1, GET_TEXT(MSG_UNITS_C));
+ #else
+ sprintf_P(str, PSTR("%3d" S_FMT), ROUND(t1), GET_TEXT(MSG_UNITS_C));
+ #endif
}
/**
* Formats a temperature string for an idle heater (e.g. "100 °C / idle")
*/
void format_temp_and_idle(char *str, const_celsius_float_t t1) {
- sprintf_P(str, PSTR("%3d" S_FMT " / " S_FMT), ROUND(t1), GET_TEXT(MSG_UNITS_C), GET_TEXT(MSG_IDLE));
+ #ifdef TOUCH_UI_LCD_TEMP_PRECISION
+ char num1[7];
+ dtostrf(t1, 4 + TOUCH_UI_LCD_TEMP_PRECISION, TOUCH_UI_LCD_TEMP_PRECISION, num1);
+ sprintf_P(str, PSTR("%s" S_FMT " / " S_FMT), num1, GET_TEXT(MSG_UNITS_C), GET_TEXT(MSG_IDLE));
+ #else
+ sprintf_P(str, PSTR("%3d" S_FMT " / " S_FMT), ROUND(t1), GET_TEXT(MSG_UNITS_C), GET_TEXT(MSG_IDLE));
+ #endif
}
/**
* Formats a temperature string for an active heater (e.g. "100 / 200°C")
*/
void format_temp_and_temp(char *str, const_celsius_float_t t1, const_celsius_float_t t2) {
- sprintf_P(str, PSTR("%3d / %3d" S_FMT), ROUND(t1), ROUND(t2), GET_TEXT(MSG_UNITS_C));
+ #ifdef TOUCH_UI_LCD_TEMP_PRECISION
+ char num1[7], num2[7];
+ dtostrf(t1, 4 + TOUCH_UI_LCD_TEMP_PRECISION, TOUCH_UI_LCD_TEMP_PRECISION, num1);
+ dtostrf(t2, 4 + TOUCH_UI_LCD_TEMP_PRECISION, TOUCH_UI_LCD_TEMP_PRECISION, num2);
+ sprintf_P(str, PSTR("%s / %s" S_FMT), num1, num2, GET_TEXT(MSG_UNITS_C));
+ #else
+ sprintf_P(str, PSTR("%3d / %3d" S_FMT), ROUND(t1), ROUND(t2), GET_TEXT(MSG_UNITS_C));
+ #endif
}
/**
* Formats a temperature string for a material (e.g. "100°C (PLA)")
*/
void format_temp_and_material(char *str, const_celsius_float_t t1, const char *material) {
- sprintf_P(str, PSTR("%3d" S_FMT " (" S_FMT ")"), ROUND(t1), GET_TEXT(MSG_UNITS_C), material);
+ #ifdef TOUCH_UI_LCD_TEMP_PRECISION
+ char num1[7];
+ dtostrf(t1, 4 + TOUCH_UI_LCD_TEMP_PRECISION, TOUCH_UI_LCD_TEMP_PRECISION, num1);
+ sprintf_P(str, PSTR("%s" S_FMT " (" S_FMT ")"), num1, GET_TEXT(MSG_UNITS_C), material);
+ #else
+ sprintf_P(str, PSTR("%3d" S_FMT " (" S_FMT ")"), ROUND(t1), GET_TEXT(MSG_UNITS_C), material);
+ #endif
}
/**
diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/z_offset_screen.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/z_offset_screen.cpp
index 8d886c704a..073665e586 100644
--- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/z_offset_screen.cpp
+++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/z_offset_screen.cpp
@@ -36,7 +36,14 @@ constexpr static ZOffsetScreenData &mydata = screen_data.ZOffsetScreen;
void ZOffsetScreen::onEntry() {
mydata.z = SHEET_THICKNESS;
+ mydata.softEndstopState = getSoftEndstopState();
BaseNumericAdjustmentScreen::onEntry();
+ if (wizardRunning())
+ setSoftEndstopState(false);
+}
+
+void ZOffsetScreen::onExit() {
+ setSoftEndstopState(mydata.softEndstopState);
}
void ZOffsetScreen::onRedraw(draw_mode_t what) {
@@ -50,17 +57,13 @@ void ZOffsetScreen::onRedraw(draw_mode_t what) {
}
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) {
- // In the wizard
+ if (wizardRunning()) {
mydata.z += mm;
setAxisPosition_mm(mydata.z, Z);
}
else {
// Otherwise doing a manual adjustment, possibly during a print.
- babystepAxis_steps(steps, Z);
+ TERN(BABYSTEPPING, babystepAxis_steps(steps, Z), UNUSED(steps));
}
}
@@ -84,9 +87,16 @@ void ZOffsetScreen::runWizard() {
AlertDialogBox::show(PSTR("After the printer finishes homing, adjust the Z Offset so that a sheet of paper can pass between the nozzle and bed with slight resistance."));
}
+bool ZOffsetScreen::wizardRunning() {
+ // We can't store state after the call to the AlertBox, so
+ // check whether the current Z position equals mydata.z in order
+ // to know whether the user started the wizard.
+ return getAxisPosition_mm(Z) == mydata.z;
+}
+
bool ZOffsetScreen::onTouchHeld(uint8_t tag) {
- const int16_t steps = mmToWholeSteps(getIncrement(), Z);
- const float increment = mmFromWholeSteps(steps, Z);
+ const int16_t steps = TERN(BABYSTEPPING, mmToWholeSteps(getIncrement(), Z), 0);
+ const float increment = TERN(BABYSTEPPING, mmFromWholeSteps(steps, Z), getIncrement());
switch (tag) {
case 2: runWizard(); break;
case 4: UI_DECREMENT(ZOffset_mm); move(-increment, -steps); break;
diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/z_offset_screen.h b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/z_offset_screen.h
index 067687f315..0df9209b1f 100644
--- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/z_offset_screen.h
+++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/z_offset_screen.h
@@ -27,14 +27,17 @@
struct ZOffsetScreenData : public BaseNumericAdjustmentScreenData {
float z;
+ bool softEndstopState;
};
class ZOffsetScreen : public BaseNumericAdjustmentScreen, public CachedScreen {
private:
static void move(float mm, int16_t steps);
static void runWizard();
+ static bool wizardRunning();
public:
static void onEntry();
+ static void onExit();
static void onRedraw(draw_mode_t);
static bool onTouchHeld(uint8_t tag);
};
diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/screens.cpp b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/screens.cpp
index e1900ac793..ec627e313b 100644
--- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/screens.cpp
+++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/screens.cpp
@@ -113,6 +113,7 @@ SCREEN_TABLE {
DECL_SCREEN_IF_INCLUDED(COCOA_PREHEAT_MENU)
DECL_SCREEN_IF_INCLUDED(COCOA_PREHEAT_SCREEN)
DECL_SCREEN_IF_INCLUDED(COCOA_LOAD_CHOCOLATE_SCREEN)
+ DECL_SCREEN_IF_INCLUDED(COCOA_LEVELING_MENU)
DECL_SCREEN_IF_INCLUDED(COCOA_MOVE_XYZ_SCREEN)
DECL_SCREEN_IF_INCLUDED(COCOA_MOVE_E_SCREEN)
};
diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/screens.h b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/screens.h
index f5e2160d10..51e472496a 100644
--- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/screens.h
+++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/screens.h
@@ -157,6 +157,7 @@ enum {
#include "cocoa_press/load_chocolate.h"
#include "cocoa_press/move_xyz_screen.h"
#include "cocoa_press/move_e_screen.h"
+ #include "cocoa_press/leveling_menu.h"
#else
#include "generic/status_screen.h"
@@ -206,7 +207,9 @@ enum {
#endif
#if HAS_LEVELING
- #include "generic/leveling_menu.h"
+ #if DISABLED(TOUCH_UI_COCOA_PRESS)
+ #include "generic/leveling_menu.h"
+ #endif
#if HAS_BED_PROBE
#include "generic/z_offset_screen.h"
#endif
diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/theme/colors.h b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/theme/colors.h
index 1649675122..995379fcda 100644
--- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/theme/colors.h
+++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/theme/colors.h
@@ -108,6 +108,7 @@ namespace Theme {
constexpr uint32_t bed_mesh_lines_rgb = accent_color_6;
constexpr uint32_t bed_mesh_shadow_rgb = 0x444444;
+ #define BED_MESH_POINTS_GRAY
#else
constexpr uint32_t theme_darkest = gray_color_1;
constexpr uint32_t theme_dark = gray_color_2;
diff --git a/Marlin/src/lcd/extui/ui_api.cpp b/Marlin/src/lcd/extui/ui_api.cpp
index ddeb02e3be..53eb6d399e 100644
--- a/Marlin/src/lcd/extui/ui_api.cpp
+++ b/Marlin/src/lcd/extui/ui_api.cpp
@@ -1033,10 +1033,10 @@ namespace ExtUI {
}
bool isPrintingFromMediaPaused() {
- return TERN0(SDSUPPORT, isPrintingFromMedia() && printingIsPaused());
+ return TERN0(SDSUPPORT, IS_SD_PAUSED());
}
- bool isPrintingFromMedia() { return IS_SD_PRINTING(); }
+ bool isPrintingFromMedia() { return TERN0(SDSUPPORT, IS_SD_PRINTING() || IS_SD_PAUSED()); }
bool isPrinting() {
return commandsInQueue() || isPrintingFromMedia() || printJobOngoing() || printingIsPaused();