Skip to content

Commit

Permalink
Merge branch '2023-August-B' HC32-August-B
Browse files Browse the repository at this point in the history
  • Loading branch information
classicrocker883 committed Sep 26, 2023
2 parents 3f69bcc + a61efb0 commit ed3ed51
Show file tree
Hide file tree
Showing 29 changed files with 117 additions and 117 deletions.
7 changes: 4 additions & 3 deletions Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -3408,6 +3408,7 @@
// Ender-3 v2 OEM display. A DWIN display with Rotary Encoder.
//
// DWIN / DACAI LCD 4.3" 480x272
//#define DWIN_CREALITY_LCD_JYERSUI // Jyers UI by Jacob Myers

#define DWIN_CREALITY_LCD_JYERSUI // Jyers UI by Jacob Myers
//#define HAS_GCODE_PREVIEW 1
Expand All @@ -3424,9 +3425,9 @@
#define TRAMWIZ_MENU_ITEM // Menu item: enable Tramming Wizard (2304 bytes of flash)
#endif
//#define DISABLE_TUNING_GRAPH 0// Temp plot graph - PID/MPC Tuning (1624 bytes of flash)
//#define HAS_ESDIAG 1 // View End-stop switch continuity (560 bytes of flash)
//#define HAS_CGCODE 1 // Extra Gcode options (3320 bytes of flash)
//#define HAS_LOCKSCREEN 1 // Simple lockscreen as to not accidentally change something (568 bytes of flash)
//#define HAS_ESDIAG 1 // View End-stop switch continuity (560 bytes of flash)
//#define HAS_CGCODE 1 // Extra Gcode options (3320 bytes of flash)
//#define HAS_LOCKSCREEN 1 // Simple lockscreen as to not accidentally change something (568 bytes of flash)
#define HAS_SD_EXTENDER 1 // Enable to support SD card extender cables (48 bytes of flash)
#define USE_GRID_MESHVIEWER 1 // Enable two mesh graph types : one (1728 bytes of flash)
//#define HAS_CUSTOM_COLORS 1 // Able to change display colors (2040 bytes of flash)
Expand Down
2 changes: 1 addition & 1 deletion Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -3843,7 +3843,7 @@
// @section reporting

// Extra options for the M114 "Current Position" report
#define M114_DETAIL // Use 'M114' for details to check planner calculations (600 bytes of flash)
//#define M114_DETAIL // Use 'M114' for details to check planner calculations (600 bytes of flash)
//#define M114_REALTIME // Real current position based on forward kinematics (80 bytes of flash)
//#define M114_LEGACY // M114 used to synchronize on every call. Enable if needed.

Expand Down
Binary file modified Marlin/lib/proui/stm32f1/libproui_abl.a
Binary file not shown.
Binary file modified Marlin/lib/proui/stm32f1/libproui_mbl.a
Binary file not shown.
Binary file modified Marlin/lib/proui/stm32f1/libproui_ubl.a
Binary file not shown.
Binary file modified Marlin/lib/proui/stm32f4/libproui_abl.a
Binary file not shown.
Binary file modified Marlin/lib/proui/stm32f4/libproui_mbl.a
Binary file not shown.
Binary file modified Marlin/lib/proui/stm32f4/libproui_ubl.a
Binary file not shown.
Binary file modified Marlin/lib/proui/stm32g0/libproui_abl.a
Binary file not shown.
Binary file modified Marlin/lib/proui/stm32g0/libproui_mbl.a
Binary file not shown.
Binary file modified Marlin/lib/proui/stm32g0/libproui_ubl.a
Binary file not shown.
2 changes: 1 addition & 1 deletion Marlin/src/core/serial_hook.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ struct RuntimeSerial : public SerialBase< RuntimeSerial<SerialT> >, public Seria
// Append Hookable for this class
SerialFeature features(serial_index_t index) const { return SerialFeature::Hookable | CALL_IF_EXISTS(SerialFeature, static_cast<const SerialT*>(this), features, index); }

void setHook(WriteHook writeHook = 0, EndOfMessageHook eofHook = 0, void * userPointer = 0) {
void setHook(WriteHook writeHook=0, EndOfMessageHook eofHook=0, void * userPointer=0) {
// Order is important here as serial code can be called inside interrupts
// When setting a hook, the user pointer must be set first so if writeHook is called as soon as it's set, it'll be valid
if (userPointer) this->userPointer = userPointer;
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/e3v2/proui/custom_gcodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#include "file_header.h"
#endif

#if ENABLED(LCD_BED_TRAMMING)
#if ENABLED(TRAMWIZ_MENU_ITEM)
#include "bed_tramming.h"
#endif

Expand Down
38 changes: 22 additions & 16 deletions Marlin/src/lcd/e3v2/proui/dwin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -575,9 +575,9 @@ void drawPrintDone() {
DWINUI::clearMainArea();
dwinPrintHeader(nullptr);
#if HAS_GCODE_PREVIEW
const bool haspreview = previewValid();
const bool haspreview = gPreview.isValid();
if (haspreview) {
previewShow();
gPreview.show();
DWINUI::drawButton(BTN_Continue, 86, 295);
}
#else
Expand Down Expand Up @@ -659,12 +659,12 @@ void _drawIconBlink(bool &flag, const bool sensor, const uint8_t icon1, const ui
if (flag != sensor) {
flag = sensor;
if (!flag) {
dwinDrawBox(1, hmiData.colorBackground, x-1, y-1, 21, 21);
dwinDrawBox(1, hmiData.colorBackground, x-1, y-1, 22, 22);
DWINUI::drawIcon(icon1, x, y);
}
}
if (flag) {
dwinDrawBox(1, blink ? hmiData.colorSplitLine : hmiData.colorBackground, x-1, y-1, 21, 21);
dwinDrawBox(1, blink ? hmiData.colorSplitLine : hmiData.colorBackground, x-1, y-1, 22, 22);
DWINUI::drawIcon(icon2, x, y);
}
#else
Expand Down Expand Up @@ -1457,7 +1457,7 @@ void dwinLevelingStart() {
TERN_(PROUI_EX,hmiFlag.cancel_abl = 0);
title.showCaption(GET_TEXT_F(MSG_BED_LEVELING));
#if PROUI_EX
meshViewer.drawMeshGrid(GRID_MAX_POINTS_X, GRID_MAX_POINTS_Y);
meshViewer.drawBackground(GRID_MAX_POINTS_X, GRID_MAX_POINTS_Y);
DWINUI::drawButton(BTN_Cancel, 86, 305);
#else
dwinShowPopup(ICON_AutoLeveling, GET_TEXT_F(MSG_BED_LEVELING), GET_TEXT_F(MSG_PLEASE_WAIT), TERN(PROUI_EX, BTN_Cancel, 0));
Expand Down Expand Up @@ -1666,7 +1666,7 @@ void dwinLevelingDone() {
// Started a Print Job
void dwinPrintStarted() {
DEBUG_ECHOLNPGM("dwinPrintStarted: ", sdPrinting());
TERN_(HAS_GCODE_PREVIEW, if (hostPrinting()) previewInvalidate());
TERN_(HAS_GCODE_PREVIEW, if (hostPrinting()) gPreview.invalidate());
TERN_(SET_PROGRESS_PERCENT, ui.progress_reset());
TERN_(SET_REMAINING_TIME, ui.reset_remaining_time());
hmiFlag.pause_flag = false;
Expand Down Expand Up @@ -1708,14 +1708,21 @@ void dwinPrintFinished() {
// Print was aborted
void dwinPrintAborted() {
DEBUG_ECHOLNPGM("dwinPrintAborted");
#if PROUI_EX
if (all_axes_homed()) {
const int16_t zpos = current_position.z + PRO_data.Park_point.z;
MString<25> cmd;
cmd.setf(cmd, F("G0Z%i\nG0F2000Y%i"), zpos, PRO_data.Park_point.y);
queue.inject(&cmd);
}
#if DISABLED(PROUI_EX) && ENABLED(NOZZLE_PARK_FEATURE)
const xyz_pos_t park_pos = NOZZLE_PARK_POINT;
#endif
if (all_axes_homed()) {
const int16_t zpos = current_position.z + TERN(NOZZLE_PARK_FEATURE,
TERN(PROUI_EX, PRO_data.Park_point.z, NOZZLE_PARK_Z_RAISE_MIN), Z_POST_CLEARANCE);
_MIN(zpos, Z_MAX_POS);
MString<25> cmd;
cmd.setf(cmd, F("G0Z%i\nG0F2000Y%i"), zpos, TERN(NOZZLE_PARK_FEATURE, TERN(PROUI_EX, PRO_data.Park_point.y, park_pos.y), 200));
queue.inject(&cmd);
}
#ifdef SD_FINISHED_RELEASECOMMAND
queue.inject(SD_FINISHED_RELEASECOMMAND);
#endif

hostui.notify("Print Aborted");
dwinPrintFinished();
}
Expand Down Expand Up @@ -1802,7 +1809,6 @@ void dwinSetDataDefaults() {
PRO_data.mesh_max_y = DEF_MESH_MAX_Y;
#endif
#if HAS_BED_PROBE
PRO_data.probezfix = DEF_PROBEZFIX;
PRO_data.zprobefeedslow = DEF_Z_PROBE_FEEDRATE_SLOW;
PRO_data.multiple_probing = MULTIPLE_PROBING;
#endif
Expand Down Expand Up @@ -1984,7 +1990,7 @@ void dwinRedrawScreen() {
dwinPopupContinue(ICON_BLTouch, GET_TEXT_F(MSG_MESH_VIEWER), GET_TEXT_F(MSG_NO_VALID_MESH));
else {
hmiSaveProcessID(ID_WaitResponse);
meshViewer.draw(false, true);
meshViewer.drawViewer(false, true);
}
}
#endif // HAS_MESH
Expand Down Expand Up @@ -2056,7 +2062,7 @@ void gotoConfirmToPrint() {
laserOn(false); // If it is not laser file turn off laser mode
#endif
#if HAS_GCODE_PREVIEW
if (hmiData.enablePreview) return gotoPopup(previewDrawFromSD, onClickConfirmToPrint);
if (hmiData.enablePreview) return gotoPopup(gPreview.draw, onClickConfirmToPrint);
#endif
#if ENABLED(ONE_CLICK_PRINT)
return gotoPopup(confirmToPrintPopup, onClickConfirmToPrint);
Expand Down
4 changes: 0 additions & 4 deletions Marlin/src/lcd/e3v2/proui/dwin.h
Original file line number Diff line number Diff line change
Expand Up @@ -305,10 +305,6 @@ void drawAdvancedSettingsMenu();
void drawPrepareMenu();
void drawMoveMenu();

#if ENABLED(LCD_BED_TRAMMING)
//void drawTrammingMenu();
#endif

#if HAS_HOME_OFFSET
void drawHomeOffsetMenu();
#endif
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/lcd/e3v2/proui/dwin_popup.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ void dwinDrawPopup(const uint8_t icon, T amsg1=nullptr, U amsg2=nullptr, uint8_t
uint8_t xpos = 81;
uint8_t ypos = 90;
switch (icon) {
case 17 ... 24: xpos = 96; break; // Icon#:17-24; W:80px|H:100px
case 78 ... 81: xpos = 100; ypos = 107; break; // Icon#:78-81; W:73px|H:66px
default: xpos = 81; ypos = 90; break;
case 17 ... 24: xpos = 96; break; // Icon#:17-24; W: 80px|H:100px
case 78 ... 81: xpos = 100; ypos = 107; break; // Icon#:78-81; W: 73px|H: 66px
default: xpos = 81; ypos = 90; break; // Icon#:1-8,90-91; W:110px|H:100px
}
DWINUI::clearMainArea();
drawPopupBkgd();
Expand Down
13 changes: 9 additions & 4 deletions Marlin/src/lcd/e3v2/proui/gcode_preview.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@

#pragma once

void previewDrawFromSD();
void previewInvalidate();
bool previewValid();
void previewShow();
class GPreview {
public:
static bool isValid();
static void invalidate();
static void draw();
static void show();
};

extern GPreview gPreview;
68 changes: 21 additions & 47 deletions Marlin/src/lcd/e3v2/proui/meshviewer.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**
* Mesh Viewer for PRO UI
* Author: Miguel A. Risco-Castillo (MRISCOC)
* version: 5.1.1
* Date: 2023/07/12
* version: 5.2.1
* Date: 2023/08/19
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Expand All @@ -21,7 +21,7 @@

#include "../../../inc/MarlinConfigPre.h"

#if ALL(DWIN_LCD_PROUI, HAS_MESH)
#if ALL(DWIN_LCD_PROUI, HAS_MESH) && DISABLED(PROUI_EX)

#include "../../../core/types.h"
#include "../../marlinui.h"
Expand All @@ -30,10 +30,6 @@
#include "../../../feature/bedlevel/bedlevel.h"
#include "meshviewer.h"

#if ENABLED(USE_GRID_MESHVIEWER)
#include "bedlevel_tools.h"
#endif

bool meshredraw; // Redraw mesh points
uint8_t sizex, sizey; // Mesh XY size
uint8_t rmax; // Maximum radius
Expand All @@ -46,13 +42,17 @@ uint8_t rmax; // Maximum radius
#define px(xp) (margin + (xp) * (width) / (sizex - 1))
#define py(yp) (30 + DWIN_WIDTH - margin - (yp) * (width) / (sizey - 1))

constexpr uint8_t meshfont = TERN(TJC_DISPLAY, font8x16, font6x12);
#if ENABLED(TJC_DISPLAY)
#define meshfont font8x16
#else
#define meshfont font6x12
#endif

MeshViewer meshViewer;

float MeshViewer::max, MeshViewer::min;

void MeshViewer::drawMeshGrid(const uint8_t csizex, const uint8_t csizey) {
void MeshViewer::drawBackground(const uint8_t csizex, const uint8_t csizey) {
sizex = csizex;
sizey = csizey;
rmax = _MIN(margin - 2, 0.5 * (width) / (sizex - 1));
Expand All @@ -64,7 +64,7 @@ void MeshViewer::drawMeshGrid(const uint8_t csizex, const uint8_t csizey) {
for (uint8_t y = 1; y < sizey - 1; ++y) dwinDrawHLine(hmiData.colorPopupBg, px(0), py(y), width);
}

void MeshViewer::drawMeshPoint(const uint8_t x, const uint8_t y, const float z) {
void MeshViewer::drawPoint(const uint8_t x, const uint8_t y, const float z) {
if (isnan(z)) return;
#if LCD_BACKLIGHT_TIMEOUT_MINS
ui.refresh_backlight_timeout();
Expand Down Expand Up @@ -94,62 +94,36 @@ void MeshViewer::drawMeshPoint(const uint8_t x, const uint8_t y, const float z)
dwinDrawString(false, meshfont, DWINUI::textColor, DWINUI::backColor, px(x) - 2 * fs, fy, msg);
}
SERIAL_FLUSH();
}
TERN_(TJC_DISPLAY, delay(100));
}

void MeshViewer::drawMesh(const bed_mesh_t zval, const uint8_t csizex, const uint8_t csizey) {
drawMeshGrid(csizex, csizey);
drawBackground(csizex, csizey);
for (uint8_t y = 0; y < csizey; ++y) {
hal.watchdog_refresh();
for (uint8_t x = 0; x < csizex; ++x) drawMeshPoint(x, y, zval[x][y]);
for (uint8_t x = 0; x < csizex; ++x) drawPoint(x, y, zval[x][y]);
}
}

void MeshViewer::draw(const bool withsave/*=false*/, const bool redraw/*=true*/) {
void MeshViewer::drawViewer(const bool withsave/*=false*/, const bool redraw/*=true*/) {
title.showCaption(GET_TEXT_F(MSG_MESH_VIEWER));
#if ENABLED(USE_GRID_MESHVIEWER)
if(bedLevelTools.view_mesh) {
DWINUI::clearMainArea();
bedLevelTools.viewer_print_value = true;
bedLevelTools.drawBedMesh(-1, 1, 8, 10 + TITLE_HEIGHT);
}
else {
if (redraw) drawMesh(bedlevel.z_values, GRID_MAX_POINTS_X, GRID_MAX_POINTS_Y); // Draw complete mesh viewer
else DWINUI::drawBox(1, hmiData.colorBackground, { 89, 305, 99, 38 }); // Erase "Continue" button
}
#else
if (redraw) drawMesh(bedlevel.z_values, GRID_MAX_POINTS_X, GRID_MAX_POINTS_Y); // Draw complete mesh viewer
else DWINUI::drawBox(1, hmiData.colorBackground, { 89, 305, 99, 38 }); // Erase "Continue" button
#endif
if (redraw) drawMesh(bedlevel.z_values, GRID_MAX_POINTS_X, GRID_MAX_POINTS_Y); // Draw complete mesh viewer
else DWINUI::drawBox(1, hmiData.colorBackground, { 89, 305, 99, 38 }); // Erase "Continue" button
if (withsave) {
dwinDrawBox(1, hmiData.colorBackground, 120, 300, 31, 42); // draw black box to fill previous button select_box
DWINUI::drawButton(BTN_Save, 26, 305);
DWINUI::drawButton(BTN_Continue, 146, 305);
drawSelectHighlight(hmiFlag.select_flag, 305);
}
else
DWINUI::drawButton(BTN_Continue, 86, 305);

#if ENABLED(USE_GRID_MESHVIEWER)
if(bedLevelTools.view_mesh) {
bedLevelTools.setMeshViewerStatus();
}
else {
char str_1[6], str_2[6] = "";
ui.status_printf(0, F("minZ: %s | maxZ: +%s"),
dtostrf(min, 1, 3, str_1),
dtostrf(max, 1, 3, str_2)
);
}
#else
char str_1[6], str_2[6] = "";
else DWINUI::drawButton(BTN_Continue, 86, 305);
char str_1[6], str_2[6] = "";
ui.status_printf(0, F("minZ: %s | maxZ: +%s"),
dtostrf(min, 1, 3, str_1),
dtostrf(max, 1, 3, str_2)
);
#endif
}

void drawMeshViewer() { meshViewer.draw(true, meshredraw); }
void drawMeshViewer() { meshViewer.drawViewer(true, meshredraw); }

void onClick_MeshViewer() { if (hmiFlag.select_flag) saveMesh(); hmiReturnScreen(); }

Expand All @@ -159,4 +133,4 @@ void gotoMeshViewer(const bool redraw) {
else hmiReturnScreen();
}

#endif // DWIN_LCD_PROUI && HAS_MESH
#endif // DWIN_LCD_PROUI && HAS_MESH && DISABLED(PROUI_EX)
39 changes: 28 additions & 11 deletions Marlin/src/lcd/e3v2/proui/meshviewer.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**
* Mesh Viewer for PRO UI
* Author: Miguel A. Risco-Castillo (MRISCOC)
* version: 5.1.1
* Date: 2023/07/12
* version: 6.1.1
* Date: 2023/08/20
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Expand All @@ -20,15 +20,32 @@
*/
#pragma once

class MeshViewer {
public:
static float max, min;
static void drawMeshGrid(const uint8_t csizex, const uint8_t csizey);
static void drawMeshPoint(const uint8_t x, const uint8_t y, const float z);
static void draw(const bool withsave=false, const bool redraw=true);
static void drawMesh(const bed_mesh_t zval, const uint8_t csizex, const uint8_t csizey);
};
#include "../../../inc/MarlinConfig.h"

extern MeshViewer meshViewer;
//#define USE_GRID_MESHVIEWER

#if ENABLED(PROUI_EX)
class MeshViewerPro {
public:
static float max, min;
static uint8_t meshfont;
static bool meshmode;
static void drawBackground(const uint8_t csizex, const uint8_t csizey);
static void drawPoint(const uint8_t x, const uint8_t y, const float z);
static void drawMesh(const bed_mesh_t zval, const uint8_t csizex, const uint8_t csizey);
static void drawViewer(const bool withsave=false, const bool redraw=true);
};
extern MeshViewerPro meshViewer;
#else
class MeshViewer {
public:
static float max, min;
static void drawBackground(const uint8_t csizex, const uint8_t csizey);
static void drawPoint(const uint8_t x, const uint8_t y, const float z);
static void drawMesh(const bed_mesh_t zval, const uint8_t csizex, const uint8_t csizey);
static void drawViewer(const bool withsave=false, const bool redraw=true);
};
extern MeshViewer meshViewer;
#endif

void gotoMeshViewer(const bool redraw);
2 changes: 0 additions & 2 deletions Marlin/src/lcd/e3v2/proui/proui.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ constexpr int16_t DEF_MESH_MAX_Y = MESH_MAX_Y;
constexpr int16_t DEF_PROBING_MARGIN = PROBING_MARGIN;
#define MIN_PROBE_MARGIN 0
#define MAX_PROBE_MARGIN 60
#define DEF_PROBEZFIX -0.00125 // 0.5*1/DEFAULT_AXIS_STEPS_PER_UNIT[Z_AXIS]
constexpr int16_t DEF_Z_PROBE_FEEDRATE_SLOW = Z_PROBE_FEEDRATE_SLOW;
#ifndef MULTIPLE_PROBING
#define MULTIPLE_PROBING 0
Expand All @@ -99,7 +98,6 @@ typedef struct {
float mesh_max_x = DEF_MESH_MAX_X;
float mesh_min_y = DEF_MESH_MIN_Y;
float mesh_max_y = DEF_MESH_MAX_Y;
float probezfix = DEF_PROBEZFIX;
uint16_t zprobefeedslow = DEF_Z_PROBE_FEEDRATE_SLOW;
uint8_t multiple_probing = MULTIPLE_PROBING;
bool Invert_E0 = DEF_INVERT_E0_DIR;
Expand Down
Loading

0 comments on commit ed3ed51

Please sign in to comment.