Ender 3 V2 Status Line (#21369)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
Miguel Risco-Castillo 2021-03-24 10:12:57 -05:00 committed by Scott Lahteine
parent 2a32d14dc4
commit 3c9ffa77f9
20 changed files with 66 additions and 47 deletions

View File

@ -76,7 +76,6 @@
#if ENABLED(DWIN_CREALITY_LCD)
#include "lcd/dwin/e3v2/dwin.h"
#include "lcd/dwin/dwin_lcd.h"
#include "lcd/dwin/e3v2/rotary_encoder.h"
#endif
@ -1476,7 +1475,9 @@ void setup() {
#if ENABLED(DWIN_CREALITY_LCD)
Encoder_Configuration();
HMI_Init();
DWIN_JPG_CacheTo1(Language_English);
HMI_StartFrame(true);
DWIN_StatusChanged(GET_TEXT(WELCOME_MSG));
#endif
#if HAS_SERVICE_INTERVALS && DISABLED(DWIN_CREALITY_LCD)

View File

@ -733,7 +733,7 @@ void unified_bed_leveling::shift_mesh_height() {
const int point_num = (GRID_MAX_POINTS) - count + 1;
SERIAL_ECHOLNPAIR("Probing mesh point ", point_num, "/", GRID_MAX_POINTS, ".");
TERN_(HAS_DISPLAY, ui.status_printf_P(0, PSTR(S_FMT " %i/%i"), GET_TEXT(MSG_PROBING_MESH), point_num, int(GRID_MAX_POINTS)));
TERN_(HAS_STATUS_MESSAGE, ui.status_printf_P(0, PSTR(S_FMT " %i/%i"), GET_TEXT(MSG_PROBING_MESH), point_num, int(GRID_MAX_POINTS)));
#if HAS_LCD_MENU
if (ui.button_pressed()) {
@ -1440,7 +1440,7 @@ void unified_bed_leveling::smart_fill_mesh() {
if (do_3_pt_leveling) {
SERIAL_ECHOLNPGM("Tilting mesh (1/3)");
TERN_(HAS_DISPLAY, ui.status_printf_P(0, PSTR(S_FMT " 1/3"), GET_TEXT(MSG_LCD_TILTING_MESH)));
TERN_(HAS_STATUS_MESSAGE, ui.status_printf_P(0, PSTR(S_FMT " 1/3"), GET_TEXT(MSG_LCD_TILTING_MESH)));
measured_z = probe.probe_at_point(points[0], PROBE_PT_RAISE, param.V_verbosity);
if (isnan(measured_z))
@ -1459,7 +1459,7 @@ void unified_bed_leveling::smart_fill_mesh() {
if (!abort_flag) {
SERIAL_ECHOLNPGM("Tilting mesh (2/3)");
TERN_(HAS_DISPLAY, ui.status_printf_P(0, PSTR(S_FMT " 2/3"), GET_TEXT(MSG_LCD_TILTING_MESH)));
TERN_(HAS_STATUS_MESSAGE, ui.status_printf_P(0, PSTR(S_FMT " 2/3"), GET_TEXT(MSG_LCD_TILTING_MESH)));
measured_z = probe.probe_at_point(points[1], PROBE_PT_RAISE, param.V_verbosity);
#ifdef VALIDATE_MESH_TILT
@ -1479,7 +1479,7 @@ void unified_bed_leveling::smart_fill_mesh() {
if (!abort_flag) {
SERIAL_ECHOLNPGM("Tilting mesh (3/3)");
TERN_(HAS_DISPLAY, ui.status_printf_P(0, PSTR(S_FMT " 3/3"), GET_TEXT(MSG_LCD_TILTING_MESH)));
TERN_(HAS_STATUS_MESSAGE, ui.status_printf_P(0, PSTR(S_FMT " 3/3"), GET_TEXT(MSG_LCD_TILTING_MESH)));
measured_z = probe.probe_at_point(points[2], PROBE_PT_STOW, param.V_verbosity);
#ifdef VALIDATE_MESH_TILT
@ -1520,7 +1520,7 @@ void unified_bed_leveling::smart_fill_mesh() {
if (!abort_flag) {
SERIAL_ECHOLNPAIR("Tilting mesh point ", point_num, "/", total_points, "\n");
TERN_(HAS_DISPLAY, ui.status_printf_P(0, PSTR(S_FMT " %i/%i"), GET_TEXT(MSG_LCD_TILTING_MESH), point_num, total_points));
TERN_(HAS_STATUS_MESSAGE, ui.status_printf_P(0, PSTR(S_FMT " %i/%i"), GET_TEXT(MSG_LCD_TILTING_MESH), point_num, total_points));
measured_z = probe.probe_at_point(rpos, parser.seen('E') ? PROBE_PT_STOW : PROBE_PT_RAISE, param.V_verbosity); // TODO: Needs error handling

View File

@ -43,7 +43,7 @@ void CancelObject::set_active_object(const int8_t obj) {
else
skipping = false;
#if HAS_DISPLAY
#if HAS_STATUS_MESSAGE
if (active_object >= 0)
ui.status_printf_P(0, PSTR(S_FMT " %i"), GET_TEXT(MSG_PRINTING_OBJECT), int(active_object));
else

View File

@ -652,7 +652,7 @@ void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_le
// Resume the print job timer if it was running
if (print_job_timer.isPaused()) print_job_timer.start();
TERN_(HAS_DISPLAY, ui.reset_status());
TERN_(HAS_STATUS_MESSAGE, ui.reset_status());
TERN_(HAS_LCD_MENU, ui.return_to_status());
}

View File

@ -41,7 +41,7 @@
#include "../../../module/temperature.h"
#endif
#if HAS_DISPLAY
#if HAS_STATUS_MESSAGE
#include "../../../lcd/marlinui.h"
#endif
@ -638,7 +638,7 @@ G29_TYPE GcodeSuite::G29() {
if (TERN0(IS_KINEMATIC, !probe.can_reach(probePos))) continue;
if (verbose_level) SERIAL_ECHOLNPAIR("Probing mesh point ", pt_index, "/", abl_points, ".");
TERN_(HAS_DISPLAY, ui.status_printf_P(0, PSTR(S_FMT " %i/%i"), GET_TEXT(MSG_PROBING_MESH), int(pt_index), int(abl_points)));
TERN_(HAS_STATUS_MESSAGE, ui.status_printf_P(0, PSTR(S_FMT " %i/%i"), GET_TEXT(MSG_PROBING_MESH), int(pt_index), int(abl_points)));
measured_z = faux ? 0.001f * random(-100, 101) : probe.probe_at_point(probePos, raise_after, verbose_level);
@ -683,7 +683,7 @@ G29_TYPE GcodeSuite::G29() {
LOOP_L_N(i, 3) {
if (verbose_level) SERIAL_ECHOLNPAIR("Probing point ", i + 1, "/3.");
TERN_(HAS_DISPLAY, ui.status_printf_P(0, PSTR(S_FMT " %i/3"), GET_TEXT(MSG_PROBING_MESH), int(i + 1)));
TERN_(HAS_STATUS_MESSAGE, ui.status_printf_P(0, PSTR(S_FMT " %i/3"), GET_TEXT(MSG_PROBING_MESH), int(i + 1)));
// Retain the last probe position
probePos = points[i];
@ -706,7 +706,7 @@ G29_TYPE GcodeSuite::G29() {
#endif // AUTO_BED_LEVELING_3POINT
TERN_(HAS_DISPLAY, ui.reset_status());
TERN_(HAS_STATUS_MESSAGE, ui.reset_status());
// Stow the probe. No raise for FIX_MOUNTED_PROBE.
if (probe.stow()) {

View File

@ -122,6 +122,7 @@ void GcodeSuite::G29() {
// After recording the last point, activate home and activate
mbl_probe_index = -1;
SERIAL_ECHOLNPGM("Mesh probing done.");
TERN_(HAS_STATUS_MESSAGE, ui.set_status(GET_TEXT(MSG_MESH_DONE)));
BUZZ(100, 659);
BUZZ(100, 698);
@ -180,8 +181,10 @@ void GcodeSuite::G29() {
} // switch(state)
if (state == MeshNext)
if (state == MeshNext) {
SERIAL_ECHOLNPAIR("MBL G29 point ", _MIN(mbl_probe_index, GRID_MAX_POINTS), " of ", GRID_MAX_POINTS);
if (mbl_probe_index > 0) TERN_(HAS_STATUS_MESSAGE, ui.status_printf_P(0, PSTR(S_FMT " %i/%i"), GET_TEXT(MSG_PROBING_MESH), _MIN(mbl_probe_index, GRID_MAX_POINTS), int(GRID_MAX_POINTS)));
}
report_current_position();
}

View File

@ -190,7 +190,7 @@ void GcodeSuite::G34() {
bool adjustment_reverse = false;
#endif
#if HAS_DISPLAY
#if HAS_STATUS_MESSAGE
PGM_P const msg_iteration = GET_TEXT(MSG_ITERATION);
const uint8_t iter_str_len = strlen_P(msg_iteration);
#endif
@ -204,7 +204,7 @@ void GcodeSuite::G34() {
const int iter = iteration + 1;
SERIAL_ECHOLNPAIR("\nG34 Iteration: ", iter);
#if HAS_DISPLAY
#if HAS_STATUS_MESSAGE
char str[iter_str_len + 2 + 1];
sprintf_P(str, msg_iteration, iter);
ui.set_status(str);
@ -290,7 +290,7 @@ void GcodeSuite::G34() {
, " Z3-Z1=", ABS(z_measured[2] - z_measured[0])
#endif
);
#if HAS_DISPLAY
#if HAS_STATUS_MESSAGE
char fstr1[10];
#if NUM_Z_STEPPER_DRIVERS == 2
char msg[6 + (6 + 5) * 1 + 1];

View File

@ -142,7 +142,7 @@ void GcodeSuite::M48() {
float sample_sum = 0.0;
LOOP_L_N(n, n_samples) {
#if HAS_WIRED_LCD
#if HAS_STATUS_MESSAGE
// Display M48 progress in the status bar
ui.status_printf_P(0, PSTR(S_FMT ": %d/%d"), GET_TEXT(MSG_M48_POINT), int(n + 1), int(n_samples));
#endif
@ -257,7 +257,7 @@ void GcodeSuite::M48() {
SERIAL_ECHOLNPGM("Finished!");
dev_report(verbose_level > 0, mean, sigma, min, max, true);
#if HAS_WIRED_LCD
#if HAS_STATUS_MESSAGE
// Display M48 results in the status bar
char sigma_str[8];
ui.status_printf_P(0, PSTR(S_FMT ": %s"), GET_TEXT(MSG_M48_DEVIATION), dtostrf(sigma, 2, 6, sigma_str));

View File

@ -185,7 +185,7 @@ void GcodeSuite::M109() {
thermalManager.auto_job_check_timer(true, true);
#endif
#if HAS_DISPLAY
#if HAS_STATUS_MESSAGE
if (thermalManager.isHeatingHotend(target_extruder) || !no_wait_for_cooling)
thermalManager.set_heating_message(target_extruder);
#endif

View File

@ -481,7 +481,7 @@
#endif
#endif
#if EITHER(HAS_DISPLAY, GLOBAL_STATUS_MESSAGE)
#if ANY(HAS_DISPLAY, DWIN_CREALITY_LCD, GLOBAL_STATUS_MESSAGE)
#define HAS_STATUS_MESSAGE 1
#endif

View File

@ -402,7 +402,7 @@ void Draw_Title(const __FlashStringHelper * title) {
}
void Clear_Menu_Area() {
DWIN_Draw_Rectangle(1, Color_Bg_Black, 0, 31, DWIN_WIDTH, STATUS_Y);
DWIN_Draw_Rectangle(1, Color_Bg_Black, 0, 31, DWIN_WIDTH, STATUS_Y - 1);
}
void Clear_Main_Window() {
@ -3794,4 +3794,11 @@ void DWIN_CompletedLeveling() {
if (checkkey == Leveling) Goto_MainMenu();
}
void DWIN_StatusChanged(const char *text) {
DWIN_Draw_Rectangle(1, Color_Bg_Blue, 0, STATUS_Y, DWIN_WIDTH, STATUS_Y + 20);
const int8_t x = _MAX(0U, DWIN_WIDTH - strlen_P(text) * MENU_CHR_W) / 2;
DWIN_Draw_String(false, false, font8x16, Color_White, Color_Bg_Blue, x, STATUS_Y + 2, F(text));
DWIN_UpdateLCD();
}
#endif // DWIN_CREALITY_LCD

View File

@ -377,6 +377,7 @@ void HMI_Init();
void DWIN_Update();
void EachMomentUpdate();
void DWIN_HandleScreen();
void DWIN_StatusChanged(const char *text);
inline void DWIN_StartHoming() { HMI_flag.home_flag = true; }

View File

@ -522,6 +522,7 @@ namespace Language_en {
PROGMEM Language_Str MSG_BILINEAR_LEVELING = _UxGT("Bilinear Leveling");
PROGMEM Language_Str MSG_UBL_LEVELING = _UxGT("Unified Bed Leveling");
PROGMEM Language_Str MSG_MESH_LEVELING = _UxGT("Mesh Leveling");
PROGMEM Language_Str MSG_MESH_DONE = _UxGT("Mesh probing done");
PROGMEM Language_Str MSG_INFO_STATS_MENU = _UxGT("Printer Stats");
PROGMEM Language_Str MSG_INFO_BOARD_MENU = _UxGT("Board Info");
PROGMEM Language_Str MSG_INFO_THERMISTOR_MENU = _UxGT("Thermistors");

View File

@ -105,7 +105,6 @@
#define SETCURSOR_RJ(len, row) lcd_moveto(LCD_COL_X_RJ(len), LCD_ROW_Y(row))
#define SETCURSOR_X(col) SETCURSOR(col, _lcdLineNr)
#define SETCURSOR_X_RJ(len) SETCURSOR_RJ(len, _lcdLineNr)
#define START_OF_UTF8_CHAR(C) (((C) & 0xC0u) != 0x80U)
int lcd_glyph_height();

View File

@ -44,9 +44,16 @@ MarlinUI ui;
#include "../gcode/queue.h"
#include "fontutils.h"
#include "../sd/cardreader.h"
#if EITHER(EXTENSIBLE_UI, DWIN_CREALITY_LCD)
#define START_OF_UTF8_CHAR(C) (((C) & 0xC0u) != 0x80U)
#endif
#if ENABLED(DWIN_CREALITY_LCD)
#include "../module/printcounter.h"
#include "../MarlinCore.h"
#include "dwin/e3v2/dwin.h"
#endif
#if HAS_STATUS_MESSAGE
#define START_OF_UTF8_CHAR(C) (((C) & 0xC0u) != 0x80U)
#endif
#if LCD_HAS_WAIT_FOR_MOVE
@ -55,6 +62,7 @@ MarlinUI ui;
constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
#if HAS_STATUS_MESSAGE
#if HAS_WIRED_LCD
#if ENABLED(STATUS_MESSAGE_SCROLLING)
uint8_t MarlinUI::status_scroll_offset; // = 0
@ -62,18 +70,16 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
#else
constexpr uint8_t MAX_MESSAGE_LENGTH = MAX_LANG_CHARSIZE * (LCD_WIDTH);
#endif
#elif EITHER(EXTENSIBLE_UI, DWIN_CREALITY_LCD)
#else
constexpr uint8_t MAX_MESSAGE_LENGTH = 63;
#endif
#if EITHER(HAS_WIRED_LCD, EXTENSIBLE_UI)
uint8_t MarlinUI::alert_level; // = 0
char MarlinUI::status_message[MAX_MESSAGE_LENGTH + 1];
uint8_t MarlinUI::alert_level; // = 0
#endif
#if ENABLED(LCD_SET_PROGRESS_MANUALLY)
MarlinUI::progress_t MarlinUI::progress_override; // = 0
#if BOTH(LCD_SET_PROGRESS_MANUALLY, USE_M73_REMAINING_TIME)
#if ENABLED(USE_M73_REMAINING_TIME)
uint32_t MarlinUI::remaining_time;
#endif
#endif
@ -1461,6 +1467,7 @@ void MarlinUI::update() {
#endif
TERN_(EXTENSIBLE_UI, ExtUI::onStatusChanged(status_message));
TERN_(DWIN_CREALITY_LCD, DWIN_StatusChanged(status_message));
}
#if ENABLED(STATUS_MESSAGE_SCROLLING)
@ -1581,7 +1588,7 @@ void MarlinUI::update() {
#endif
#else // !HAS_DISPLAY
#elif !HAS_STATUS_MESSAGE // && !HAS_DISPLAY
//
// Send the status line as a host notification
@ -1596,7 +1603,7 @@ void MarlinUI::update() {
TERN(HOST_PROMPT_SUPPORT, host_action_notify_P(message), UNUSED(message));
}
#endif // !HAS_DISPLAY
#endif // !HAS_DISPLAY && !HAS_STATUS_MESSAGE
#if ENABLED(SDSUPPORT)

View File

@ -360,7 +360,7 @@ void Endstops::event_handler() {
if (hit_state == prev_hit_state) return;
prev_hit_state = hit_state;
if (hit_state) {
#if HAS_WIRED_LCD
#if HAS_STATUS_MESSAGE
char chrX = ' ', chrY = ' ', chrZ = ' ', chrP = ' ';
#define _SET_STOP_CHAR(A,C) (chr## A = C)
#else
@ -391,7 +391,7 @@ void Endstops::event_handler() {
#endif
SERIAL_EOL();
TERN_(HAS_WIRED_LCD, ui.status_printf_P(0, PSTR(S_FMT " %c %c %c %c"), GET_TEXT(MSG_LCD_ENDSTOPS), chrX, chrY, chrZ, chrP));
TERN_(HAS_STATUS_MESSAGE, ui.status_printf_P(0, PSTR(S_FMT " %c %c %c %c"), GET_TEXT(MSG_LCD_ENDSTOPS), chrX, chrY, chrZ, chrP));
#if BOTH(SD_ABORT_ON_ENDSTOP_HIT, SDSUPPORT)
if (planner.abort_on_endstop_hit) {

View File

@ -51,7 +51,7 @@
#include "../feature/bltouch.h"
#endif
#if HAS_DISPLAY
#if HAS_STATUS_MESSAGE
#include "../lcd/marlinui.h"
#endif
@ -1144,7 +1144,7 @@ void prepare_line_to_destination() {
);
SERIAL_ECHO_START();
SERIAL_ECHOLN(msg);
TERN_(HAS_DISPLAY, ui.set_status(msg));
TERN_(HAS_STATUS_MESSAGE, ui.set_status(msg));
return true;
}
return false;

View File

@ -2495,7 +2495,7 @@ void Temperature::disable_all_heaters() {
if (singlenozzle_temp[new_tool] && singlenozzle_temp[new_tool] != singlenozzle_temp[old_tool]) {
setTargetHotend(singlenozzle_temp[new_tool], 0);
TERN_(AUTOTEMP, planner.autotemp_update());
TERN_(HAS_DISPLAY, set_heating_message(0));
TERN_(HAS_STATUS_MESSAGE, set_heating_message(0));
(void)wait_for_hotend(0, false); // Wait for heating or cooling
}
}
@ -3492,7 +3492,7 @@ void Temperature::tick() {
}
#endif
#if HAS_HOTEND && HAS_DISPLAY
#if HAS_HOTEND && HAS_STATUS_MESSAGE
void Temperature::set_heating_message(const uint8_t e) {
const bool heating = isHeatingHotend(e);
ui.status_printf_P(0,

View File

@ -877,7 +877,7 @@ class Temperature {
#endif
#endif
#if ENABLED(HAS_DISPLAY)
#if HAS_STATUS_MESSAGE
static void set_heating_message(const uint8_t e);
#endif

View File

@ -1262,7 +1262,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
#if HAS_MULTI_HOTEND
thermalManager.setTargetHotend(thermalManager.temp_hotend[active_extruder].target, migration_extruder);
TERN_(AUTOTEMP, planner.autotemp_update());
TERN_(HAS_DISPLAY, thermalManager.set_heating_message(0));
TERN_(HAS_STATUS_MESSAGE, thermalManager.set_heating_message(0));
thermalManager.wait_for_hotend(active_extruder);
#endif