mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2025-01-19 08:08:25 +00:00
🚸 ProUI updates (#25176)
This commit is contained in:
parent
7ca6650c77
commit
c66b3cf8a4
38 changed files with 1308 additions and 1390 deletions
|
@ -410,7 +410,6 @@ bool pause_print(const_float_t retract, const xyz_pos_t &park_point, const bool
|
|||
#endif
|
||||
|
||||
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_open(PROMPT_INFO, F("Pause"), FPSTR(DISMISS_STR)));
|
||||
TERN_(DWIN_LCD_PROUI, DWIN_Print_Pause());
|
||||
|
||||
// Indicate that the printer is paused
|
||||
++did_pause_print;
|
||||
|
@ -461,6 +460,7 @@ bool pause_print(const_float_t retract, const xyz_pos_t &park_point, const bool
|
|||
|
||||
// If axes don't need to home then the nozzle can park
|
||||
if (do_park) nozzle.park(0, park_point); // Park the nozzle by doing a Minimum Z Raise followed by an XY Move
|
||||
TERN_(DWIN_LCD_PROUI, if (!do_park) ui.set_status(GET_TEXT_F(MSG_PARK_FAILED)));
|
||||
|
||||
#if ENABLED(DUAL_X_CARRIAGE)
|
||||
const int8_t saved_ext = active_extruder;
|
||||
|
@ -710,13 +710,8 @@ void resume_print(const_float_t slow_load_length/*=0*/, const_float_t fast_load_
|
|||
|
||||
TERN_(HAS_FILAMENT_SENSOR, runout.reset());
|
||||
|
||||
#if ENABLED(DWIN_LCD_PROUI)
|
||||
DWIN_Print_Resume();
|
||||
HMI_ReturnScreen();
|
||||
#else
|
||||
ui.reset_status();
|
||||
ui.return_to_status();
|
||||
#endif
|
||||
ui.reset_status();
|
||||
ui.return_to_status();
|
||||
}
|
||||
|
||||
#endif // ADVANCED_PAUSE_FEATURE
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "../../module/temperature.h"
|
||||
|
||||
#if ENABLED(DWIN_LCD_PROUI)
|
||||
#include "../../lcd/e3v2/proui/dwin_defines.h"
|
||||
#include "../../lcd/e3v2/proui/dwin.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
|
|
@ -47,7 +47,7 @@ void GcodeSuite::M145() {
|
|||
preheat_t &mat = ui.material_preset[material];
|
||||
#if HAS_HOTEND
|
||||
if (parser.seenval('H'))
|
||||
mat.hotend_temp = constrain(parser.value_int(), EXTRUDE_MINTEMP, thermalManager.hotend_max_target(0));
|
||||
mat.hotend_temp = constrain(parser.value_int(), thermalManager.extrude_min_temp, thermalManager.hotend_max_target(0));
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
if (parser.seenval('B'))
|
||||
|
|
|
@ -109,7 +109,6 @@ void GcodeSuite::M1001() {
|
|||
#endif
|
||||
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onPrintDone());
|
||||
TERN_(DWIN_LCD_PROUI, DWIN_Print_Finished());
|
||||
|
||||
// Re-select the last printed file in the UI
|
||||
TERN_(SD_REPRINT_LAST_SELECTED_FILE, ui.reselect_last_file());
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "../../sd/cardreader.h"
|
||||
|
||||
#if ENABLED(DWIN_LCD_PROUI)
|
||||
#include "../../lcd/e3v2/proui/dwin.h"
|
||||
#include "../../lcd/marlinui.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -38,7 +38,7 @@ void GcodeSuite::M524() {
|
|||
|
||||
#if ENABLED(DWIN_LCD_PROUI)
|
||||
|
||||
HMI_flag.abort_flag = true; // The LCD will handle it
|
||||
ui.abort_print();
|
||||
|
||||
#else
|
||||
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
void GcodeSuite::M75() {
|
||||
startOrResumeJob();
|
||||
#if ENABLED(DWIN_LCD_PROUI)
|
||||
DWIN_Print_Started(false);
|
||||
if (!IS_SD_PRINTING()) DWIN_Print_Header(parser.string_arg && parser.string_arg[0] ? parser.string_arg : GET_TEXT(MSG_HOST_START_PRINT));
|
||||
#endif
|
||||
}
|
||||
|
@ -48,9 +47,8 @@ void GcodeSuite::M75() {
|
|||
* M76: Pause print timer
|
||||
*/
|
||||
void GcodeSuite::M76() {
|
||||
print_job_timer.pause();
|
||||
TERN(DWIN_LCD_PROUI, ui.pause_print(), print_job_timer.pause());
|
||||
TERN_(HOST_PAUSE_M76, hostui.pause());
|
||||
TERN_(DWIN_LCD_PROUI, DWIN_Print_Pause());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -58,7 +56,6 @@ void GcodeSuite::M76() {
|
|||
*/
|
||||
void GcodeSuite::M77() {
|
||||
print_job_timer.stop();
|
||||
TERN_(DWIN_LCD_PROUI, DWIN_Print_Finished());
|
||||
}
|
||||
|
||||
#if ENABLED(PRINTCOUNTER)
|
||||
|
|
|
@ -86,7 +86,7 @@ void GcodeSuite::M303() {
|
|||
|
||||
#if ENABLED(DWIN_LCD_PROUI)
|
||||
if (seenC) HMI_data.PidCycles = c;
|
||||
if (seenS) { if (hid == H_BED) HMI_data.BedPidT = temp; else HMI_data.HotendPidT = temp; }
|
||||
if (seenS) { if (hid == H_BED) HMI_data.BedPidT = temp; else TERN_(PIDTEMP, HMI_data.HotendPidT = temp); }
|
||||
#endif
|
||||
|
||||
#if DISABLED(BUSY_WHILE_HEATING)
|
||||
|
|
|
@ -2472,6 +2472,7 @@
|
|||
#define BED_MAX_TARGET (BED_MAXTEMP - (BED_OVERSHOOT))
|
||||
#else
|
||||
#undef PIDTEMPBED
|
||||
#undef PREHEAT_BEFORE_LEVELING
|
||||
#endif
|
||||
|
||||
#if HAS_TEMP_COOLER && PIN_EXISTS(COOLER)
|
||||
|
|
|
@ -940,8 +940,8 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
|
|||
#error "SD_REPRINT_LAST_SELECTED_FILE currently requires a Marlin-native LCD menu."
|
||||
#endif
|
||||
|
||||
#if ANY(HAS_MARLINUI_MENU, TOUCH_UI_FTDI_EVE, EXTENSIBLE_UI) && !defined(MANUAL_FEEDRATE)
|
||||
#error "MANUAL_FEEDRATE is required for MarlinUI, ExtUI, or FTDI EVE Touch UI."
|
||||
#if ANY(HAS_MARLINUI_MENU, TOUCH_UI_FTDI_EVE, EXTENSIBLE_UI, DWIN_LCD_PROUI) && !defined(MANUAL_FEEDRATE)
|
||||
#error "MANUAL_FEEDRATE is required for ProUI, MarlinUI, ExtUI, or FTDI EVE Touch UI."
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
|
|
@ -19,27 +19,37 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Bed Level Tools for Pro UI
|
||||
* Extended by: Miguel A. Risco-Castillo (MRISCOC)
|
||||
* Version: 2.0.0
|
||||
* Date: 2022/05/23
|
||||
*
|
||||
* Version: 2.1.0
|
||||
* Date: 2022/08/27
|
||||
*
|
||||
* Based on the original work of: Henri-J-Norden
|
||||
* https://github.com/Jyers/Marlin/pull/126
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../../../inc/MarlinConfigPre.h"
|
||||
#include "bedlevel_tools.h"
|
||||
|
||||
#if BOTH(DWIN_LCD_PROUI, HAS_LEVELING)
|
||||
|
||||
#include "../../marlinui.h"
|
||||
#include "../../../core/types.h"
|
||||
#include "dwin.h"
|
||||
#include "dwinui.h"
|
||||
#include "dwin_popup.h"
|
||||
#include "../../../feature/bedlevel/bedlevel.h"
|
||||
#include "../../../module/probe.h"
|
||||
#include "../../../gcode/gcode.h"
|
||||
|
@ -48,9 +58,14 @@
|
|||
#include "../../../libs/least_squares_fit.h"
|
||||
#include "../../../libs/vector_3.h"
|
||||
|
||||
BedLevelToolsClass BedLevelTools;
|
||||
#include "dwin.h"
|
||||
#include "dwinui.h"
|
||||
#include "dwin_popup.h"
|
||||
#include "bedlevel_tools.h"
|
||||
|
||||
#if USE_UBL_VIEWER
|
||||
BedLevelToolsClass bedLevelTools;
|
||||
|
||||
#if ENABLED(USE_UBL_VIEWER)
|
||||
bool BedLevelToolsClass::viewer_asymmetric_range = false;
|
||||
bool BedLevelToolsClass::viewer_print_value = false;
|
||||
#endif
|
||||
|
@ -153,26 +168,30 @@ void BedLevelToolsClass::manual_move(const uint8_t mesh_x, const uint8_t mesh_y,
|
|||
}
|
||||
}
|
||||
|
||||
// Move / Probe methods. As examples, not yet used.
|
||||
void BedLevelToolsClass::MoveToXYZ() {
|
||||
BedLevelTools.goto_mesh_value = true;
|
||||
BedLevelTools.manual_move(BedLevelTools.mesh_x, BedLevelTools.mesh_y, false);
|
||||
bedLevelTools.goto_mesh_value = true;
|
||||
bedLevelTools.manual_move(bedLevelTools.mesh_x, bedLevelTools.mesh_y, false);
|
||||
}
|
||||
void BedLevelToolsClass::MoveToXY() {
|
||||
BedLevelTools.goto_mesh_value = false;
|
||||
BedLevelTools.manual_move(BedLevelTools.mesh_x, BedLevelTools.mesh_y, false);
|
||||
bedLevelTools.goto_mesh_value = false;
|
||||
bedLevelTools.manual_move(bedLevelTools.mesh_x, bedLevelTools.mesh_y, false);
|
||||
}
|
||||
void BedLevelToolsClass::MoveToZ() {
|
||||
BedLevelTools.goto_mesh_value = true;
|
||||
BedLevelTools.manual_move(BedLevelTools.mesh_x, BedLevelTools.mesh_y, true);
|
||||
bedLevelTools.goto_mesh_value = true;
|
||||
bedLevelTools.manual_move(bedLevelTools.mesh_x, bedLevelTools.mesh_y, true);
|
||||
}
|
||||
void BedLevelToolsClass::ProbeXY() {
|
||||
sprintf_P(cmd, PSTR("G30X%sY%s"),
|
||||
dtostrf(bedlevel.get_mesh_x(BedLevelTools.mesh_x), 1, 2, str_1),
|
||||
dtostrf(bedlevel.get_mesh_y(BedLevelTools.mesh_y), 1, 2, str_2)
|
||||
const uint16_t Clear = Z_CLEARANCE_DEPLOY_PROBE;
|
||||
sprintf_P(cmd, PSTR("G0Z%i\nG30X%sY%s"),
|
||||
Clear,
|
||||
dtostrf(bedlevel.get_mesh_x(bedLevelTools.mesh_x), 1, 2, str_1),
|
||||
dtostrf(bedlevel.get_mesh_y(bedLevelTools.mesh_y), 1, 2, str_2)
|
||||
);
|
||||
gcode.process_subcommands_now(cmd);
|
||||
}
|
||||
|
||||
// Accessors
|
||||
float BedLevelToolsClass::get_max_value() {
|
||||
float max = __FLT_MAX__ * -1;
|
||||
GRID_LOOP(x, y) {
|
||||
|
@ -191,18 +210,16 @@ float BedLevelToolsClass::get_min_value() {
|
|||
return min;
|
||||
}
|
||||
|
||||
// Return 'true' if mesh is good and within LCD limits
|
||||
bool BedLevelToolsClass::meshvalidate() {
|
||||
float min = __FLT_MAX__, max = __FLT_MAX__ * -1;
|
||||
|
||||
GRID_LOOP(x, y) {
|
||||
if (isnan(bedlevel.z_values[x][y])) return false;
|
||||
if (bedlevel.z_values[x][y] < min) min = bedlevel.z_values[x][y];
|
||||
if (bedlevel.z_values[x][y] > max) max = bedlevel.z_values[x][y];
|
||||
const float v = bedlevel.z_values[x][y];
|
||||
if (isnan(v) || !WITHIN(v, UBL_Z_OFFSET_MIN, UBL_Z_OFFSET_MAX)) return false;
|
||||
}
|
||||
return WITHIN(max, MESH_Z_OFFSET_MIN, MESH_Z_OFFSET_MAX);
|
||||
return true;
|
||||
}
|
||||
|
||||
#if USE_UBL_VIEWER
|
||||
#if ENABLED(USE_UBL_VIEWER)
|
||||
|
||||
void BedLevelToolsClass::Draw_Bed_Mesh(int16_t selected /*= -1*/, uint8_t gridline_width /*= 1*/, uint16_t padding_x /*= 8*/, uint16_t padding_y_top /*= 40 + 53 - 7*/) {
|
||||
drawing_mesh = true;
|
||||
|
|
|
@ -23,27 +23,38 @@
|
|||
/**
|
||||
* Bed Level Tools for Pro UI
|
||||
* Extended by: Miguel A. Risco-Castillo (MRISCOC)
|
||||
* Version: 2.0.0
|
||||
* Date: 2022/05/23
|
||||
*
|
||||
* Version: 2.1.0
|
||||
* Date: 2022/08/27
|
||||
*
|
||||
* Based on the original work of: Henri-J-Norden
|
||||
* https://github.com/Jyers/Marlin/pull/126
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
||||
//#define USE_UBL_VIEWER 1
|
||||
#endif
|
||||
//#define USE_UBL_VIEWER 1
|
||||
|
||||
#define MESH_Z_OFFSET_MIN -3.0
|
||||
#define MESH_Z_OFFSET_MAX 3.0
|
||||
#define UBL_Z_OFFSET_MIN -3.0
|
||||
#define UBL_Z_OFFSET_MAX 3.0
|
||||
|
||||
class BedLevelToolsClass {
|
||||
public:
|
||||
#if USE_UBL_VIEWER
|
||||
#if ENABLED(USE_UBL_VIEWER)
|
||||
static bool viewer_asymmetric_range;
|
||||
static bool viewer_print_value;
|
||||
#endif
|
||||
|
@ -66,12 +77,10 @@ public:
|
|||
static float get_max_value();
|
||||
static float get_min_value();
|
||||
static bool meshvalidate();
|
||||
#if USE_UBL_VIEWER
|
||||
#if ENABLED(USE_UBL_VIEWER)
|
||||
static void Draw_Bed_Mesh(int16_t selected = -1, uint8_t gridline_width = 1, uint16_t padding_x = 8, uint16_t padding_y_top = 40 + 53 - 7);
|
||||
static void Set_Mesh_Viewer_Status();
|
||||
#endif
|
||||
};
|
||||
|
||||
extern BedLevelToolsClass BedLevelTools;
|
||||
|
||||
void Goto_MeshViewer();
|
||||
extern BedLevelToolsClass bedLevelTools;
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -24,16 +24,25 @@
|
|||
/**
|
||||
* DWIN Enhanced implementation for PRO UI
|
||||
* Author: Miguel A. Risco-Castillo (MRISCOC)
|
||||
* Version: 3.17.2
|
||||
* Date: 2022/04/08
|
||||
* Version: 3.21.2
|
||||
* Date: 2022/12/02
|
||||
*/
|
||||
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#include "dwin_defines.h"
|
||||
#include "dwinui.h"
|
||||
#include "../common/encoder.h"
|
||||
#include "../../../libs/BL24CXX.h"
|
||||
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
namespace GET_LANG(LCD_LANGUAGE) {
|
||||
#define _MSG_PREHEAT(N) \
|
||||
LSTR MSG_PREHEAT_##N = _UxGT("Preheat ") PREHEAT_## N ##_LABEL; \
|
||||
LSTR MSG_PREHEAT_## N ##_SETTINGS = _UxGT("Preheat ") PREHEAT_## N ##_LABEL _UxGT(" Conf");
|
||||
#if PREHEAT_COUNT > 3
|
||||
REPEAT_S(4, PREHEAT_COUNT, _MSG_PREHEAT)
|
||||
#endif
|
||||
}
|
||||
|
||||
enum processID : uint8_t {
|
||||
// Process ID
|
||||
|
@ -44,7 +53,6 @@ enum processID : uint8_t {
|
|||
SetIntNoDraw,
|
||||
SetFloat,
|
||||
SetPFloat,
|
||||
SelectFile,
|
||||
PrintProcess,
|
||||
Popup,
|
||||
Leveling,
|
||||
|
@ -59,33 +67,88 @@ enum processID : uint8_t {
|
|||
};
|
||||
|
||||
enum pidresult_t : uint8_t {
|
||||
PIDTEMP_START = 0,
|
||||
PIDTEMPBED_START,
|
||||
PID_BAD_EXTRUDER_NUM,
|
||||
PID_TEMP_TOO_HIGH,
|
||||
PID_TUNING_TIMEOUT,
|
||||
PID_EXTR_START,
|
||||
PID_BED_START,
|
||||
PID_DONE
|
||||
PID_DONE,
|
||||
};
|
||||
|
||||
#define DWIN_CHINESE 123
|
||||
#define DWIN_ENGLISH 0
|
||||
|
||||
typedef struct {
|
||||
// Color settings
|
||||
uint16_t Background_Color;
|
||||
uint16_t Cursor_Color;
|
||||
uint16_t TitleBg_Color;
|
||||
uint16_t TitleTxt_Color;
|
||||
uint16_t Text_Color;
|
||||
uint16_t Selected_Color;
|
||||
uint16_t SplitLine_Color;
|
||||
uint16_t Highlight_Color;
|
||||
uint16_t StatusBg_Color;
|
||||
uint16_t StatusTxt_Color;
|
||||
uint16_t PopupBg_Color;
|
||||
uint16_t PopupTxt_Color;
|
||||
uint16_t AlertBg_Color;
|
||||
uint16_t AlertTxt_Color;
|
||||
uint16_t PercentTxt_Color;
|
||||
uint16_t Barfill_Color;
|
||||
uint16_t Indicator_Color;
|
||||
uint16_t Coordinate_Color;
|
||||
|
||||
// Temperatures
|
||||
#if ENABLED(PIDTEMP)
|
||||
int16_t HotendPidT = DEF_HOTENDPIDT;
|
||||
#endif
|
||||
#if ENABLED(PIDTEMPBED)
|
||||
int16_t BedPidT = DEF_BEDPIDT;
|
||||
#endif
|
||||
#if (HAS_HOTEND || HAS_HEATED_BED) && HAS_PID_HEATING
|
||||
int16_t PidCycles = DEF_PIDCYCLES;
|
||||
#endif
|
||||
#if ENABLED(PREVENT_COLD_EXTRUSION)
|
||||
int16_t ExtMinT = EXTRUDE_MINTEMP;
|
||||
#endif
|
||||
#if ENABLED(PREHEAT_BEFORE_LEVELING)
|
||||
int16_t BedLevT = LEVELING_BED_TEMP;
|
||||
#endif
|
||||
#if ENABLED(BAUD_RATE_GCODE)
|
||||
bool Baud115K = false;
|
||||
#endif
|
||||
bool FullManualTramming = false;
|
||||
bool MediaAutoMount = ENABLED(HAS_SD_EXTENDER);
|
||||
#if BOTH(INDIVIDUAL_AXIS_HOMING_SUBMENU, MESH_BED_LEVELING)
|
||||
uint8_t z_after_homing = DEF_Z_AFTER_HOMING;
|
||||
#endif
|
||||
#if ENABLED(MESH_BED_LEVELING)
|
||||
float ManualZOffset = 0;
|
||||
#endif
|
||||
// Led
|
||||
#if BOTH(LED_CONTROL_MENU, HAS_COLOR_LEDS)
|
||||
LEDColor Led_Color = Def_Leds_Color;
|
||||
#endif
|
||||
} HMI_data_t;
|
||||
|
||||
extern HMI_data_t HMI_data;
|
||||
static constexpr size_t eeprom_data_size = sizeof(HMI_data_t);
|
||||
|
||||
typedef struct {
|
||||
int8_t Color[3]; // Color components
|
||||
pidresult_t pidresult = PID_DONE;
|
||||
TERN_(HAS_PID_HEATING, pidresult_t pidresult = PID_DONE);
|
||||
uint8_t Select = 0; // Auxiliary selector variable
|
||||
AxisEnum axis = X_AXIS; // Axis Select
|
||||
} HMI_value_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t language;
|
||||
bool printing_flag:1; // sd or host printing
|
||||
bool abort_flag:1; // sd or host was aborted
|
||||
bool pause_flag:1; // printing is paused
|
||||
bool percent_flag:1; // percent was override by M73
|
||||
bool remain_flag:1; // remain was override by M73
|
||||
bool pause_flag:1; // printing is paused
|
||||
bool pause_action:1; // flag a pause action
|
||||
bool abort_flag:1; // printing is aborting
|
||||
bool abort_action:1; // flag a aborting action
|
||||
bool print_finish:1; // print was finished
|
||||
bool select_flag:1; // Popup button selected
|
||||
bool home_flag:1; // homing in course
|
||||
bool heat_flag:1; // 0: heating done 1: during heating
|
||||
|
@ -105,6 +168,7 @@ extern millis_t dwin_heat_time;
|
|||
#endif
|
||||
|
||||
// Tool Functions
|
||||
uint32_t GetHash(char * str);
|
||||
#if ENABLED(EEPROM_SETTINGS)
|
||||
void WriteEeprom();
|
||||
void ReadEeprom();
|
||||
|
@ -118,15 +182,14 @@ void DisableMotors();
|
|||
void AutoLev();
|
||||
void AutoHome();
|
||||
#if HAS_PREHEAT
|
||||
void DoPreheat0();
|
||||
void DoPreheat1();
|
||||
void DoPreheat2();
|
||||
#define _DOPREHEAT(N) void DoPreheat##N();
|
||||
REPEAT_1(PREHEAT_COUNT, _DOPREHEAT)
|
||||
#endif
|
||||
void DoCoolDown();
|
||||
#if HAS_HOTEND
|
||||
#if ENABLED(PIDTEMP)
|
||||
void HotendPID();
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
#if ENABLED(PIDTEMPBED)
|
||||
void BedPID();
|
||||
#endif
|
||||
#if ENABLED(BAUD_RATE_GCODE)
|
||||
|
@ -151,6 +214,12 @@ void ParkHead();
|
|||
void UBLSaveMesh();
|
||||
void UBLLoadMesh();
|
||||
#endif
|
||||
#if ENABLED(HOST_SHUTDOWN_MENU_ITEM) && defined(SHUTDOWN_ACTION)
|
||||
void HostShutDown();
|
||||
#endif
|
||||
#if !HAS_BED_PROBE
|
||||
void HomeZandDisable();
|
||||
#endif
|
||||
|
||||
// Other
|
||||
void Goto_PrintProcess();
|
||||
|
@ -160,7 +229,7 @@ void Goto_PowerLossRecovery();
|
|||
void Goto_ConfirmToPrint();
|
||||
void DWIN_Draw_Dashboard(const bool with_update); // Status Area
|
||||
void Draw_Main_Area(); // Redraw main area
|
||||
void DWIN_DrawStatusLine(); // Draw simple status text
|
||||
void DWIN_DrawStatusLine(const char *text = ""); // Draw simple status text
|
||||
void DWIN_RedrawDash(); // Redraw Dash and Status line
|
||||
void DWIN_RedrawScreen(); // Redraw all screen elements
|
||||
void HMI_MainMenu(); // Main process screen
|
||||
|
@ -169,7 +238,6 @@ void HMI_Printing(); // Print page
|
|||
void HMI_ReturnScreen(); // Return to previous screen before popups
|
||||
void HMI_WaitForUser();
|
||||
void HMI_SaveProcessID(const uint8_t id);
|
||||
void HMI_SDCardInit();
|
||||
void HMI_SDCardUpdate();
|
||||
void EachMomentUpdate();
|
||||
void update_variable();
|
||||
|
@ -179,12 +247,11 @@ void DWIN_CheckStatusMessage();
|
|||
void DWIN_HomingStart();
|
||||
void DWIN_HomingDone();
|
||||
#if HAS_MESH
|
||||
void DWIN_MeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval);
|
||||
void DWIN_MeshUpdate(const int8_t cpos, const int8_t tpos, const_float_t zval);
|
||||
#endif
|
||||
void DWIN_LevelingStart();
|
||||
void DWIN_LevelingDone();
|
||||
void DWIN_PidTuning(pidresult_t result);
|
||||
void DWIN_Print_Started(const bool sd=false);
|
||||
void DWIN_Print_Started();
|
||||
void DWIN_Print_Pause();
|
||||
void DWIN_Print_Resume();
|
||||
void DWIN_Print_Finished();
|
||||
|
@ -228,6 +295,7 @@ void DWIN_RebootScreen();
|
|||
#endif
|
||||
|
||||
// Menu drawing functions
|
||||
void Draw_Print_File_Menu();
|
||||
void Draw_Control_Menu();
|
||||
void Draw_AdvancedSettings_Menu();
|
||||
void Draw_Prepare_Menu();
|
||||
|
@ -260,14 +328,6 @@ void Draw_Motion_Menu();
|
|||
#if ENABLED(MESH_BED_LEVELING)
|
||||
void Draw_ManualMesh_Menu();
|
||||
#endif
|
||||
#if HAS_HOTEND
|
||||
void Draw_Preheat1_Menu();
|
||||
void Draw_Preheat2_Menu();
|
||||
void Draw_Preheat3_Menu();
|
||||
#if ENABLED(PIDTEMP)
|
||||
void Draw_HotendPID_Menu();
|
||||
#endif
|
||||
#endif
|
||||
void Draw_Temperature_Menu();
|
||||
void Draw_MaxSpeed_Menu();
|
||||
void Draw_MaxAccel_Menu();
|
||||
|
@ -275,9 +335,6 @@ void Draw_MaxAccel_Menu();
|
|||
void Draw_MaxJerk_Menu();
|
||||
#endif
|
||||
void Draw_Steps_Menu();
|
||||
#if ENABLED(PIDTEMPBED)
|
||||
void Draw_BedPID_Menu();
|
||||
#endif
|
||||
#if EITHER(HAS_BED_PROBE, BABYSTEPPING)
|
||||
void Draw_ZOffsetWiz_Menu();
|
||||
#endif
|
||||
|
@ -293,3 +350,12 @@ void Draw_Steps_Menu();
|
|||
void Draw_EditMesh_Menu();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// PID
|
||||
void DWIN_PidTuning(pidresult_t result);
|
||||
#if ENABLED(PIDTEMP)
|
||||
void Draw_HotendPID_Menu();
|
||||
#endif
|
||||
#if ENABLED(PIDTEMPBED)
|
||||
void Draw_BedPID_Menu();
|
||||
#endif
|
||||
|
|
|
@ -19,44 +19,45 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* DWIN general defines and data structs for PRO UI
|
||||
* Author: Miguel A. Risco-Castillo (MRISCOC)
|
||||
* Version: 3.11.2
|
||||
* Date: 2022/02/28
|
||||
* Version: 3.12.2
|
||||
* Date: 2022/08/08
|
||||
*/
|
||||
|
||||
#define HAS_GCODE_PREVIEW 1
|
||||
#define HAS_PIDPLOT 1
|
||||
#define HAS_ESDIAG 1
|
||||
#define HAS_LOCKSCREEN 1
|
||||
#pragma once
|
||||
|
||||
//#define DEBUG_DWIN 1
|
||||
//#define NEED_HEX_PRINT 1
|
||||
|
||||
#include "../../../inc/MarlinConfigPre.h"
|
||||
#include "../common/dwin_color.h"
|
||||
#if ENABLED(LED_CONTROL_MENU)
|
||||
#include "../../../feature/leds/leds.h"
|
||||
#endif
|
||||
#include <stddef.h>
|
||||
|
||||
#if defined(__STM32F1__) || defined(STM32F1)
|
||||
#define DASH_REDRAW 1
|
||||
#endif
|
||||
|
||||
#if DISABLED(PROBE_MANUALLY) && ANY(AUTO_BED_LEVELING_BILINEAR, AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL)
|
||||
#define HAS_ONESTEP_LEVELING 1
|
||||
#endif
|
||||
|
||||
#if !HAS_BED_PROBE && ENABLED(BABYSTEPPING)
|
||||
#define JUST_BABYSTEP 1
|
||||
#endif
|
||||
|
||||
#if ANY(BABYSTEPPING, HAS_BED_PROBE, HAS_WORKSPACE_OFFSET)
|
||||
#define HAS_ZOFFSET_ITEM 1
|
||||
#endif
|
||||
|
||||
#define Def_Background_Color RGB( 1, 12, 8)
|
||||
#define Def_Cursor_color RGB(20, 49, 31)
|
||||
#define Def_TitleBg_color RGB( 0, 23, 16)
|
||||
#define Def_TitleTxt_color Color_White
|
||||
#define Def_Cursor_Color RGB(20, 49, 31)
|
||||
#define Def_TitleBg_Color RGB( 0, 23, 16)
|
||||
#define Def_TitleTxt_Color Color_White
|
||||
#define Def_Text_Color Color_White
|
||||
#define Def_Selected_Color Select_Color
|
||||
#define Def_SplitLine_Color RGB( 0, 23, 16)
|
||||
#define Def_Highlight_Color Color_White
|
||||
#define Def_StatusBg_Color RGB( 0, 23, 16)
|
||||
#define Def_StatusTxt_Color Color_Yellow
|
||||
#define Def_PopupBg_color Color_Bg_Window
|
||||
#define Def_PopupBg_Color Color_Bg_Window
|
||||
#define Def_PopupTxt_Color Popup_Text_Color
|
||||
#define Def_AlertBg_Color Color_Bg_Red
|
||||
#define Def_AlertTxt_Color Color_Yellow
|
||||
|
@ -68,55 +69,15 @@
|
|||
#if BOTH(LED_CONTROL_MENU, HAS_COLOR_LEDS)
|
||||
#define Def_Leds_Color LEDColorWhite()
|
||||
#endif
|
||||
#if ENABLED(CASELIGHT_USES_BRIGHTNESS)
|
||||
#define Def_CaseLight_Brightness 255
|
||||
#endif
|
||||
#ifdef Z_AFTER_HOMING
|
||||
#define DEF_Z_AFTER_HOMING Z_AFTER_HOMING
|
||||
#else
|
||||
#define DEF_Z_AFTER_HOMING 0
|
||||
#endif
|
||||
#define DEF_HOTENDPIDT TERN(PREHEAT_1_TEMP_BED, PREHEAT_1_TEMP_HOTEND, 195)
|
||||
#define DEF_BEDPIDT TERN(PREHEAT_1_TEMP_BED, PREHEAT_1_TEMP_HOTEND, 60)
|
||||
#define DEF_PIDCYCLES 5
|
||||
|
||||
typedef struct {
|
||||
// Color settings
|
||||
uint16_t Background_Color = Def_Background_Color;
|
||||
uint16_t Cursor_color = Def_Cursor_color;
|
||||
uint16_t TitleBg_color = Def_TitleBg_color;
|
||||
uint16_t TitleTxt_color = Def_TitleTxt_color;
|
||||
uint16_t Text_Color = Def_Text_Color;
|
||||
uint16_t Selected_Color = Def_Selected_Color;
|
||||
uint16_t SplitLine_Color = Def_SplitLine_Color;
|
||||
uint16_t Highlight_Color = Def_Highlight_Color;
|
||||
uint16_t StatusBg_Color = Def_StatusBg_Color;
|
||||
uint16_t StatusTxt_Color = Def_StatusTxt_Color;
|
||||
uint16_t PopupBg_color = Def_PopupBg_color;
|
||||
uint16_t PopupTxt_Color = Def_PopupTxt_Color;
|
||||
uint16_t AlertBg_Color = Def_AlertBg_Color;
|
||||
uint16_t AlertTxt_Color = Def_AlertTxt_Color;
|
||||
uint16_t PercentTxt_Color = Def_PercentTxt_Color;
|
||||
uint16_t Barfill_Color = Def_Barfill_Color;
|
||||
uint16_t Indicator_Color = Def_Indicator_Color;
|
||||
uint16_t Coordinate_Color = Def_Coordinate_Color;
|
||||
// Temperatures
|
||||
#if HAS_HOTEND && defined(PREHEAT_1_TEMP_HOTEND)
|
||||
int16_t HotendPidT = PREHEAT_1_TEMP_HOTEND;
|
||||
#endif
|
||||
#if HAS_HEATED_BED && defined(PREHEAT_1_TEMP_BED)
|
||||
int16_t BedPidT = PREHEAT_1_TEMP_BED;
|
||||
#endif
|
||||
#if HAS_HOTEND || HAS_HEATED_BED
|
||||
int16_t PidCycles = 10;
|
||||
#endif
|
||||
#if ENABLED(PREVENT_COLD_EXTRUSION)
|
||||
int16_t ExtMinT = EXTRUDE_MINTEMP;
|
||||
#endif
|
||||
#if BOTH(HAS_HEATED_BED, PREHEAT_BEFORE_LEVELING)
|
||||
int16_t BedLevT = LEVELING_BED_TEMP;
|
||||
#endif
|
||||
#if ENABLED(BAUD_RATE_GCODE)
|
||||
bool Baud115K = false;
|
||||
#endif
|
||||
bool FullManualTramming = false;
|
||||
#if ENABLED(MESH_BED_LEVELING)
|
||||
float ManualZOffset = 0;
|
||||
#endif
|
||||
// Led
|
||||
#if BOTH(LED_CONTROL_MENU, HAS_COLOR_LEDS)
|
||||
LEDColor Led_Color = Def_Leds_Color;
|
||||
#endif
|
||||
} HMI_data_t;
|
||||
|
||||
static constexpr size_t eeprom_data_size = sizeof(HMI_data_t);
|
||||
extern HMI_data_t HMI_data;
|
||||
|
|
|
@ -46,8 +46,8 @@ uint16_t HighlightYPos = 280;
|
|||
void Draw_Select_Highlight(const bool sel, const uint16_t ypos) {
|
||||
HighlightYPos = ypos;
|
||||
HMI_flag.select_flag = sel;
|
||||
const uint16_t c1 = sel ? HMI_data.Highlight_Color : HMI_data.PopupBg_color,
|
||||
c2 = sel ? HMI_data.PopupBg_color : HMI_data.Highlight_Color;
|
||||
const uint16_t c1 = sel ? HMI_data.Highlight_Color : HMI_data.PopupBg_Color,
|
||||
c2 = sel ? HMI_data.PopupBg_Color : HMI_data.Highlight_Color;
|
||||
DWIN_Draw_Rectangle(0, c1, 25, ypos - 1, 126, ypos + 38);
|
||||
DWIN_Draw_Rectangle(0, c1, 24, ypos - 2, 127, ypos + 39);
|
||||
DWIN_Draw_Rectangle(0, c2, 145, ypos - 1, 246, ypos + 38);
|
||||
|
|
|
@ -44,7 +44,7 @@ void Goto_Popup(const popupDrawFunc_t fnDraw, const popupClickFunc_t fnClick=nul
|
|||
void HMI_Popup();
|
||||
|
||||
inline void Draw_Popup_Bkgd() {
|
||||
DWIN_Draw_Rectangle(1, HMI_data.PopupBg_color, 14, 60, 258, 330);
|
||||
DWIN_Draw_Rectangle(1, HMI_data.PopupBg_Color, 14, 60, 258, 330);
|
||||
DWIN_Draw_Rectangle(0, HMI_data.Highlight_Color, 14, 60, 258, 330);
|
||||
}
|
||||
|
||||
|
|
|
@ -23,21 +23,17 @@
|
|||
/**
|
||||
* DWIN Enhanced implementation for PRO UI
|
||||
* Author: Miguel A. Risco-Castillo (MRISCOC)
|
||||
* Version: 3.18.1
|
||||
* Date: 2022/07/05
|
||||
* Version: 3.20.1
|
||||
* Date: 2022/10/25
|
||||
*/
|
||||
|
||||
#include "../../../inc/MarlinConfigPre.h"
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(DWIN_LCD_PROUI)
|
||||
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
#include "dwin_defines.h"
|
||||
#include "dwin_lcd.h"
|
||||
#include "dwinui.h"
|
||||
#include "dwin_defines.h"
|
||||
|
||||
//#define DEBUG_OUT 1
|
||||
#include "../../../core/debug_out.h"
|
||||
|
||||
xy_int_t DWINUI::cursor = { 0 };
|
||||
uint16_t DWINUI::pencolor = Color_White;
|
||||
|
@ -50,13 +46,6 @@ FSTR_P const DWINUI::Author = F(STRING_CONFIG_H_AUTHOR);
|
|||
void (*DWINUI::onTitleDraw)(TitleClass* title) = nullptr;
|
||||
|
||||
void DWINUI::init() {
|
||||
delay(750); // Delay for wait to wakeup screen
|
||||
const bool hs = DWIN_Handshake(); UNUSED(hs);
|
||||
#if ENABLED(DEBUG_DWIN)
|
||||
SERIAL_ECHOPGM("DWIN_Handshake ");
|
||||
SERIAL_ECHOLNF(hs ? F("ok.") : F("error."));
|
||||
#endif
|
||||
DWIN_Frame_SetDir(1);
|
||||
cursor.reset();
|
||||
pencolor = Color_White;
|
||||
textcolor = Def_Text_Color;
|
||||
|
@ -210,6 +199,19 @@ void DWINUI::Draw_Float(uint8_t bShow, bool signedMode, fontid_t fid, uint16_t c
|
|||
DWIN_Draw_String(bShow, fid, color, bColor, x, y, dtostrf(value, iNum + (signedMode ? 2:1) + fNum, fNum, nstr));
|
||||
}
|
||||
|
||||
// ------------------------- Icons -------------------------------//
|
||||
|
||||
// Draw an Icon and select library automatically
|
||||
// BG: The icon background display: false=Background filtering is not displayed, true=Background display
|
||||
// libID: Icon library ID
|
||||
// picID: Icon ID
|
||||
// x/y: Upper-left point
|
||||
void DWINUI::ICON_Show(bool BG, uint8_t icon, uint16_t x, uint16_t y) {
|
||||
const uint8_t libID = ICON TERN_(HAS_CUSTOMICONS, + (icon / 100));
|
||||
const uint8_t picID = icon TERN_(HAS_CUSTOMICONS, % 100);
|
||||
DWIN_ICON_Show(BG, false, !BG, libID, picID, x, y);
|
||||
}
|
||||
|
||||
// ------------------------- Buttons ------------------------------//
|
||||
|
||||
void DWINUI::Draw_Button(uint16_t color, uint16_t bcolor, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, const char * const caption) {
|
||||
|
@ -320,8 +322,8 @@ uint16_t DWINUI::RainbowInt(int16_t val, int16_t minv, int16_t maxv) {
|
|||
// x/y: Upper-left point
|
||||
// mode : 0 : unchecked, 1 : checked
|
||||
void DWINUI::Draw_Checkbox(uint16_t color, uint16_t bcolor, uint16_t x, uint16_t y, bool checked=false) {
|
||||
DWIN_Draw_String(true, font8x16, color, bcolor, x + 4, y, checked ? F("x") : F(" "));
|
||||
DWIN_Draw_Rectangle(0, color, x + 2, y + 2, x + 17, y + 17);
|
||||
DWIN_Draw_Rectangle(1, checked ? color : bcolor, x + 6, y + 6, x + 13, y + 13);
|
||||
}
|
||||
|
||||
// Clear Menu by filling the menu area with background color
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* DWIN Enhanced implementation for PRO UI
|
||||
|
@ -28,10 +27,14 @@
|
|||
* Date: 2022/07/05
|
||||
*/
|
||||
|
||||
#include "dwin_lcd.h"
|
||||
#pragma once
|
||||
|
||||
#include "../../../inc/MarlinConfigPre.h"
|
||||
|
||||
#include "../common/dwin_set.h"
|
||||
#include "../common/dwin_font.h"
|
||||
#include "../common/dwin_color.h"
|
||||
#include "dwin_lcd.h"
|
||||
|
||||
// Extra Icons
|
||||
#define ICON_AdvSet ICON_Language
|
||||
|
@ -74,6 +77,10 @@
|
|||
#define ICON_MaxPosX ICON_MoveX
|
||||
#define ICON_MaxPosY ICON_MoveY
|
||||
#define ICON_MaxPosZ ICON_MoveZ
|
||||
#define ICON_MeshEdit ICON_Homing
|
||||
#define ICON_MeshEditX ICON_MoveX
|
||||
#define ICON_MeshEditY ICON_MoveY
|
||||
#define ICON_MeshEditZ ICON_MoveZ
|
||||
#define ICON_MeshNext ICON_Axis
|
||||
#define ICON_MeshPoints ICON_SetEndTemp
|
||||
#define ICON_MeshSave ICON_WriteEEPROM
|
||||
|
@ -85,11 +92,22 @@
|
|||
#define ICON_ParkPosY ICON_StepY
|
||||
#define ICON_ParkPosZ ICON_StepZ
|
||||
#define ICON_PhySet ICON_PrintSize
|
||||
#define ICON_PIDbed ICON_SetBedTemp
|
||||
#define ICON_PIDcycles ICON_ResumeEEPROM
|
||||
#define ICON_PIDNozzle ICON_SetEndTemp
|
||||
#define ICON_PIDBed ICON_SetBedTemp
|
||||
#define ICON_PIDCycles ICON_ResumeEEPROM
|
||||
#define ICON_PIDValue ICON_Contact
|
||||
#define ICON_PrintStats ICON_PrintTime
|
||||
#define ICON_PrintStatsReset ICON_RemainTime
|
||||
#define ICON_Preheat1 ICON_PLAPreheat
|
||||
#define ICON_Preheat2 ICON_ABSPreheat
|
||||
#define ICON_Preheat3 ICON_CustomPreheat
|
||||
#define ICON_Preheat4 ICON_CustomPreheat
|
||||
#define ICON_Preheat5 ICON_CustomPreheat
|
||||
#define ICON_Preheat6 ICON_CustomPreheat
|
||||
#define ICON_Preheat7 ICON_CustomPreheat
|
||||
#define ICON_Preheat8 ICON_CustomPreheat
|
||||
#define ICON_Preheat9 ICON_CustomPreheat
|
||||
#define ICON_Preheat10 ICON_CustomPreheat
|
||||
#define ICON_ProbeDeploy ICON_SetEndTemp
|
||||
#define ICON_ProbeMargin ICON_PrintSize
|
||||
#define ICON_ProbeOffsetX ICON_StepX
|
||||
|
@ -105,9 +123,28 @@
|
|||
#define ICON_Scolor ICON_MaxSpeed
|
||||
#define ICON_SetBaudRate ICON_Setspeed
|
||||
#define ICON_SetCustomPreheat ICON_SetEndTemp
|
||||
#define ICON_SetPreheat1 ICON_SetPLAPreheat
|
||||
#define ICON_SetPreheat2 ICON_SetABSPreheat
|
||||
#define ICON_SetPreheat3 ICON_SetCustomPreheat
|
||||
#define ICON_SetPreheat4 ICON_SetCustomPreheat
|
||||
#define ICON_SetPreheat5 ICON_SetCustomPreheat
|
||||
#define ICON_SetPreheat6 ICON_SetCustomPreheat
|
||||
#define ICON_SetPreheat7 ICON_SetCustomPreheat
|
||||
#define ICON_SetPreheat8 ICON_SetCustomPreheat
|
||||
#define ICON_SetPreheat9 ICON_SetCustomPreheat
|
||||
#define ICON_SetPreheat10 ICON_SetCustomPreheat
|
||||
#define ICON_Sound ICON_Cool
|
||||
#define ICON_TBSetup ICON_Contact
|
||||
#define ICON_UBLActive ICON_HotendTemp
|
||||
#define ICON_UBLActive ICON_HotendTemp
|
||||
#define ICON_UBLSlot ICON_ResumeEEPROM
|
||||
#define ICON_UBLSaveMesh ICON_WriteEEPROM
|
||||
#define ICON_UBLLoadMesh ICON_ReadEEPROM
|
||||
#define ICON_UBLTiltGrid ICON_PrintSize
|
||||
#define ICON_UBLSmartFill ICON_StockConfiguration
|
||||
#define ICON_ZAfterHome ICON_SetEndTemp
|
||||
|
||||
|
||||
|
||||
#define ICON_CaseLight ICON_Motion
|
||||
#define ICON_LedControl ICON_Motion
|
||||
|
@ -262,18 +299,25 @@ namespace DWINUI {
|
|||
return t;
|
||||
}
|
||||
|
||||
// Draw an Icon and select library automatically
|
||||
// BG: The icon background display: false=Background filtering is not displayed, true=Background display
|
||||
// libID: Icon library ID
|
||||
// picID: Icon ID
|
||||
// x/y: Upper-left point
|
||||
void ICON_Show(bool BG, uint8_t icon, uint16_t x, uint16_t y);
|
||||
|
||||
// Draw an Icon with transparent background from the library ICON
|
||||
// icon: Icon ID
|
||||
// x/y: Upper-left point
|
||||
inline void Draw_Icon(uint8_t icon, uint16_t x, uint16_t y) {
|
||||
DWIN_ICON_Show(ICON, icon, x, y);
|
||||
ICON_Show(false, icon, x, y);
|
||||
}
|
||||
|
||||
// Draw an Icon from the library ICON with its background
|
||||
// icon: Icon ID
|
||||
// x/y: Upper-left point
|
||||
inline void Draw_IconWB(uint8_t icon, uint16_t x, uint16_t y) {
|
||||
DWIN_ICON_Show(true, false, false, ICON, icon, x, y);
|
||||
ICON_Show(true, icon, x, y);
|
||||
}
|
||||
|
||||
// Draw a numeric integer value
|
||||
|
|
|
@ -23,17 +23,13 @@
|
|||
/**
|
||||
* DWIN Endstops diagnostic page for PRO UI
|
||||
* Author: Miguel A. Risco-Castillo (MRISCOC)
|
||||
* Version: 1.2.2
|
||||
* Date: 2022/02/24
|
||||
* Version: 1.3.3
|
||||
* Date: 2022/10/07
|
||||
*/
|
||||
|
||||
#include "../../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ENABLED(DWIN_LCD_PROUI)
|
||||
|
||||
#include "dwin_defines.h"
|
||||
|
||||
#if HAS_ESDIAG
|
||||
#if BOTH(DWIN_LCD_PROUI, HAS_ESDIAG)
|
||||
|
||||
#include "endstop_diag.h"
|
||||
|
||||
|
@ -64,7 +60,7 @@ void draw_es_label(FSTR_P const flabel=nullptr) {
|
|||
void draw_es_state(const bool is_hit) {
|
||||
const uint8_t LM = 130;
|
||||
DWINUI::cursor.x = LM;
|
||||
DWIN_Draw_Rectangle(1, HMI_data.PopupBg_color, LM, DWINUI::cursor.y, LM + 100, DWINUI::cursor.y + 20);
|
||||
DWIN_Draw_Rectangle(1, HMI_data.PopupBg_Color, LM, DWINUI::cursor.y, LM + 100, DWINUI::cursor.y + 20);
|
||||
is_hit ? DWINUI::Draw_String(RGB(31,31,16), F(STR_ENDSTOP_HIT)) : DWINUI::Draw_String(RGB(16,63,16), F(STR_ENDSTOP_OPEN));
|
||||
DWINUI::MoveBy(0, 25);
|
||||
}
|
||||
|
@ -109,5 +105,4 @@ void ESDiagClass::Update() {
|
|||
DWIN_UpdateLCD();
|
||||
}
|
||||
|
||||
#endif // HAS_ESDIAG
|
||||
#endif // DWIN_LCD_PROUI
|
||||
#endif // DWIN_LCD_PROUI && HAS_ESDIAG
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
/**
|
||||
* DWIN End Stops diagnostic page for PRO UI
|
||||
* Author: Miguel A. Risco-Castillo (MRISCOC)
|
||||
* Version: 1.2.3
|
||||
* Date: 2022/02/24
|
||||
* Version: 1.3.2
|
||||
* Date: 2022/10/07
|
||||
*/
|
||||
|
||||
class ESDiagClass {
|
||||
|
|
|
@ -23,8 +23,8 @@
|
|||
/**
|
||||
* DWIN g-code thumbnail preview
|
||||
* Author: Miguel A. Risco-Castillo
|
||||
* version: 2.1
|
||||
* Date: 2021/06/19
|
||||
* version: 3.1.2
|
||||
* Date: 2022/09/03
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
|
@ -43,11 +43,8 @@
|
|||
*/
|
||||
|
||||
#include "../../../inc/MarlinConfigPre.h"
|
||||
#if ENABLED(DWIN_LCD_PROUI)
|
||||
|
||||
#include "dwin_defines.h"
|
||||
|
||||
#if HAS_GCODE_PREVIEW
|
||||
#if BOTH(DWIN_LCD_PROUI, HAS_GCODE_PREVIEW)
|
||||
|
||||
#include "../../../core/types.h"
|
||||
#include "../../marlinui.h"
|
||||
|
@ -246,6 +243,10 @@ void Preview_DrawFromSD() {
|
|||
}
|
||||
}
|
||||
|
||||
void Preview_Invalidate() {
|
||||
fileprop.thumbstart = 0;
|
||||
}
|
||||
|
||||
bool Preview_Valid() {
|
||||
return !!fileprop.thumbstart;
|
||||
}
|
||||
|
@ -254,5 +255,4 @@ void Preview_Reset() {
|
|||
fileprop.thumbsize = 0;
|
||||
}
|
||||
|
||||
#endif // HAS_GCODE_PREVIEW
|
||||
#endif // DWIN_LCD_PROUI
|
||||
#endif // HAS_GCODE_PREVIEW && DWIN_LCD_PROUI
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/**
|
||||
* DWIN g-code thumbnail preview
|
||||
* Author: Miguel A. Risco-Castillo
|
||||
* version: 2.1
|
||||
* Date: 2021/06/19
|
||||
* version: 3.1.2
|
||||
* Date: 2022/09/03
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
|
@ -23,5 +23,6 @@
|
|||
#pragma once
|
||||
|
||||
void Preview_DrawFromSD();
|
||||
void Preview_Invalidate();
|
||||
bool Preview_Valid();
|
||||
void Preview_Reset();
|
||||
|
|
|
@ -23,18 +23,15 @@
|
|||
/**
|
||||
* Lock screen implementation for PRO UI
|
||||
* Author: Miguel A. Risco-Castillo (MRISCOC)
|
||||
* Version: 2.2.0
|
||||
* Date: 2022/04/11
|
||||
* Version: 2.3.2
|
||||
* Date: 2022/11/20
|
||||
*/
|
||||
|
||||
#include "../../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ENABLED(DWIN_LCD_PROUI)
|
||||
#if BOTH(DWIN_LCD_PROUI, HAS_LOCKSCREEN)
|
||||
|
||||
#include "dwin_defines.h"
|
||||
|
||||
#if HAS_LOCKSCREEN
|
||||
|
||||
#include "dwinui.h"
|
||||
#include "dwin.h"
|
||||
#include "lockscreen.h"
|
||||
|
@ -75,6 +72,4 @@ void LockScreenClass::onEncoder(EncoderState encoder_diffState) {
|
|||
DWIN_UpdateLCD();
|
||||
}
|
||||
|
||||
#endif // HAS_LOCKSCREEN
|
||||
|
||||
#endif // DWIN_LCD_PROUI
|
||||
#endif // DWIN_LCD_PROUI && HAS_LOCKSCREEN
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
/**
|
||||
* Lock screen implementation for PRO UI
|
||||
* Author: Miguel A. Risco-Castillo (MRISCOC)
|
||||
* Version: 2.2.0
|
||||
* Date: 2022/04/11
|
||||
* Version: 2.3.2
|
||||
* Date: 2022/11/20
|
||||
*/
|
||||
|
||||
#include "../common/encoder.h"
|
||||
|
|
|
@ -23,8 +23,8 @@
|
|||
/**
|
||||
* Menu functions for ProUI
|
||||
* Author: Miguel A. Risco-Castillo
|
||||
* Version: 1.5.1
|
||||
* Date: 2022/05/23
|
||||
* Version: 1.9.1
|
||||
* Date: 2022/12/02
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
|
@ -53,22 +53,23 @@
|
|||
|
||||
int8_t MenuItemTotal = 0;
|
||||
int8_t MenuItemCount = 0;
|
||||
MenuItemClass** MenuItems = nullptr;
|
||||
CustomMenuItemClass** MenuItems = nullptr;
|
||||
MenuClass *CurrentMenu = nullptr;
|
||||
MenuClass *PreviousMenu = nullptr;
|
||||
void (*onMenuDraw)(MenuClass* menu) = nullptr;
|
||||
void (*onCursorErase)(const int8_t line) = nullptr;
|
||||
void (*onCursorDraw)(const int8_t line) = nullptr;
|
||||
MenuData_t MenuData;
|
||||
|
||||
// Menuitem Drawing functions =================================================
|
||||
|
||||
void Draw_Title(TitleClass* title) {
|
||||
DWIN_Draw_Rectangle(1, HMI_data.TitleBg_color, 0, 0, DWIN_WIDTH - 1, TITLE_HEIGHT - 1);
|
||||
DWIN_Draw_Rectangle(1, HMI_data.TitleBg_Color, 0, 0, DWIN_WIDTH - 1, TITLE_HEIGHT - 1);
|
||||
if (title->frameid)
|
||||
DWIN_Frame_AreaCopy(title->frameid, title->frame.left, title->frame.top, title->frame.right, title->frame.bottom, 14, (TITLE_HEIGHT - (title->frame.bottom - title->frame.top)) / 2 - 1);
|
||||
else
|
||||
DWIN_Draw_String(false, DWIN_FONT_HEAD, HMI_data.TitleTxt_color, HMI_data.TitleBg_color, 14, (TITLE_HEIGHT - DWINUI::fontHeight(DWIN_FONT_HEAD)) / 2 - 1, title->caption);
|
||||
#if ENABLED(TITLE_CENTERED)
|
||||
DWINUI::Draw_CenteredString(false, DWIN_FONT_HEAD, HMI_data.TitleTxt_Color, HMI_data.TitleBg_Color, (TITLE_HEIGHT - DWINUI::fontHeight(DWIN_FONT_HEAD)) / 2 - 1, title->caption);
|
||||
#else
|
||||
DWIN_Draw_String(false, DWIN_FONT_HEAD, HMI_data.TitleTxt_Color, HMI_data.TitleBg_Color, 14, (TITLE_HEIGHT - DWINUI::fontHeight(DWIN_FONT_HEAD)) / 2 - 1, title->caption);
|
||||
#endif
|
||||
}
|
||||
|
||||
void Draw_Menu(MenuClass* menu) {
|
||||
|
@ -78,7 +79,7 @@ void Draw_Menu(MenuClass* menu) {
|
|||
|
||||
void Draw_Menu_Cursor(const int8_t line) {
|
||||
const uint16_t ypos = MYPOS(line);
|
||||
DWINUI::Draw_Box(1, HMI_data.Cursor_color, {0, ypos, 15, MLINE - 1});
|
||||
DWINUI::Draw_Box(1, HMI_data.Cursor_Color, {0, ypos, 15, MLINE - 1});
|
||||
}
|
||||
|
||||
void Erase_Menu_Cursor(const int8_t line) {
|
||||
|
@ -86,17 +87,39 @@ void Erase_Menu_Cursor(const int8_t line) {
|
|||
DWINUI::Draw_Box(1, HMI_data.Background_Color, {0, ypos, 15, MLINE - 1});
|
||||
}
|
||||
|
||||
void Draw_Menu_Line(const uint8_t line, const uint8_t icon /*=0*/, const char * const label /*=nullptr*/, bool more /*=false*/) {
|
||||
void Erase_Menu_Text(const int8_t line) {
|
||||
if (line < 0 || line >= TROWS) return;
|
||||
const uint16_t ypos = MYPOS(line) + 1;
|
||||
DWINUI::Draw_Box(1, HMI_data.Background_Color, {LBLX, ypos, DWIN_WIDTH - LBLX, MLINE - 2});
|
||||
}
|
||||
|
||||
void Draw_Menu_Line(const uint8_t line, const uint8_t icon /*=0*/, const char * const label /*=nullptr*/, bool more /*=false*/, bool selected /*=false*/) {
|
||||
if (icon) DWINUI::Draw_Icon(icon, ICOX, MBASE(line) - 3);
|
||||
if (label) DWINUI::Draw_String(LBLX, MBASE(line) - 1, (char*)label);
|
||||
if (more) DWINUI::Draw_Icon(ICON_More, VALX + 16, MBASE(line) - 3);
|
||||
if (selected) Draw_Menu_Cursor(line);
|
||||
DWIN_Draw_HLine(HMI_data.SplitLine_Color, 16, MYPOS(line + 1), 240);
|
||||
}
|
||||
|
||||
void Draw_Menu_Line(const uint8_t line, const uint8_t icon /*=0*/, FSTR_P label /*=nullptr*/, bool more /*=false*/, bool selected /*=false*/) {
|
||||
Draw_Menu_Line(line, icon, FTOP(label), more, selected);
|
||||
}
|
||||
|
||||
void Draw_Chkb_Line(const uint8_t line, const bool checked) {
|
||||
DWINUI::Draw_Checkbox(HMI_data.Text_Color, HMI_data.Background_Color, VALX + 3 * DWINUI::fontWidth(), MBASE(line) - 1, checked);
|
||||
}
|
||||
|
||||
void Show_Chkb_Line(const bool checked) {
|
||||
const uint8_t line = CurrentMenu->line();
|
||||
DWINUI::Draw_Checkbox(HMI_data.Text_Color, HMI_data.Background_Color, VALX + 3 * DWINUI::fontWidth(), MBASE(line) - 1, checked);
|
||||
DWIN_UpdateLCD();
|
||||
}
|
||||
|
||||
void Toogle_Chkb_Line(bool &checked) {
|
||||
checked = !checked;
|
||||
Show_Chkb_Line(checked);
|
||||
}
|
||||
|
||||
void Draw_Menu_IntValue(uint16_t bcolor, const uint8_t line, uint8_t iNum, const int32_t value /*=0*/) {
|
||||
DWINUI::Draw_Signed_Int(HMI_data.Text_Color, bcolor, iNum , VALX, MBASE(line) - 1, value);
|
||||
}
|
||||
|
@ -140,22 +163,11 @@ void onDrawFloatMenu(MenuItemClass* menuitem, int8_t line, uint8_t dp, const flo
|
|||
DWINUI::Draw_Signed_Float(HMI_data.Text_Color, HMI_data.Background_Color, 3, dp, VALX - dp * DWINUI::fontWidth(DWIN_FONT_MENU), MBASE(line), value);
|
||||
}
|
||||
|
||||
void onDrawPFloatMenu(MenuItemClass* menuitem, int8_t line) {
|
||||
void onDrawPFloatMenu(MenuItemClass* menuitem, int8_t line, uint8_t dp) {
|
||||
const float value = *(float*)static_cast<MenuItemPtrClass*>(menuitem)->value;
|
||||
const int8_t dp = UNITFDIGITS;
|
||||
onDrawFloatMenu(menuitem, line, dp, value);
|
||||
}
|
||||
|
||||
void onDrawPFloat2Menu(MenuItemClass* menuitem, int8_t line) {
|
||||
const float value = *(float*)static_cast<MenuItemPtrClass*>(menuitem)->value;
|
||||
onDrawFloatMenu(menuitem, line, 2, value);
|
||||
}
|
||||
|
||||
void onDrawPFloat3Menu(MenuItemClass* menuitem, int8_t line) {
|
||||
const float value = *(float*)static_cast<MenuItemPtrClass*>(menuitem)->value;
|
||||
onDrawFloatMenu(menuitem, line, 3, value);
|
||||
}
|
||||
|
||||
void onDrawChkbMenu(MenuItemClass* menuitem, int8_t line, bool checked) {
|
||||
onDrawMenuItem(menuitem, line);
|
||||
Draw_Chkb_Line(line, checked);
|
||||
|
@ -166,13 +178,15 @@ void onDrawChkbMenu(MenuItemClass* menuitem, int8_t line) {
|
|||
onDrawChkbMenu(menuitem, line, val);
|
||||
}
|
||||
|
||||
void DrawItemEdit() {
|
||||
void DrawItemEdit(const bool selected) {
|
||||
const uint16_t bcolor = selected ? HMI_data.Selected_Color : HMI_data.Background_Color;
|
||||
const uint8_t iNum = 4 - ((MenuData.dp > 0) ? (MenuData.dp - 1) : 0);
|
||||
switch (checkkey) {
|
||||
case SetIntNoDraw: if (MenuData.LiveUpdate) MenuData.LiveUpdate(); break;
|
||||
case SetInt:
|
||||
case SetPInt: DWINUI::Draw_Signed_Int(HMI_data.Text_Color, HMI_data.Selected_Color, 4 , VALX, MBASE(CurrentMenu->line()) - 1, MenuData.Value); break;
|
||||
case SetPInt: DWINUI::Draw_Signed_Int(HMI_data.Text_Color, bcolor, iNum , VALX, MBASE(CurrentMenu->line()) - 1, MenuData.Value); break;
|
||||
case SetFloat:
|
||||
case SetPFloat: DWINUI::Draw_Signed_Float(HMI_data.Text_Color, HMI_data.Selected_Color, 3, MenuData.dp, VALX - MenuData.dp * DWINUI::fontWidth(DWIN_FONT_MENU), MBASE(CurrentMenu->line()), MenuData.Value / POW(10, MenuData.dp)); break;
|
||||
case SetPFloat: DWINUI::Draw_Signed_Float(HMI_data.Text_Color, bcolor, iNum, MenuData.dp, VALX - 2 * DWINUI::fontWidth(), MBASE(CurrentMenu->line()), MenuData.Value / POW(10, MenuData.dp)); break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
@ -209,7 +223,7 @@ void SetOnClick(uint8_t process, const int32_t lo, const int32_t hi, uint8_t dp,
|
|||
// Apply: update function when the encoder is pressed
|
||||
void SetValueOnClick(uint8_t process, const int32_t lo, const int32_t hi, const int32_t val, void (*Apply)() /*= nullptr*/, void (*LiveUpdate)() /*= nullptr*/) {
|
||||
SetOnClick(process, lo, hi, 0, val, Apply, LiveUpdate);
|
||||
Draw_Menu_IntValue(HMI_data.Selected_Color, CurrentMenu->line(), 4, MenuData.Value);
|
||||
DrawItemEdit(true);
|
||||
}
|
||||
|
||||
// Generic onclick event for float values
|
||||
|
@ -222,7 +236,7 @@ void SetValueOnClick(uint8_t process, const int32_t lo, const int32_t hi, const
|
|||
void SetValueOnClick(uint8_t process, const float lo, const float hi, uint8_t dp, const float val, void (*Apply)() /*= nullptr*/, void (*LiveUpdate)() /*= nullptr*/) {
|
||||
const int32_t value = round(val * POW(10, dp));
|
||||
SetOnClick(process, lo * POW(10, dp), hi * POW(10, dp), dp, value, Apply, LiveUpdate);
|
||||
DWINUI::Draw_Signed_Float(HMI_data.Text_Color, HMI_data.Selected_Color, 3, dp, VALX - dp * DWINUI::fontWidth(DWIN_FONT_MENU), MBASE(CurrentMenu->line()), val);
|
||||
DrawItemEdit(true);
|
||||
}
|
||||
|
||||
// Generic onclick event for integer values
|
||||
|
@ -271,8 +285,8 @@ void SetPFloatOnClick(const float lo, const float hi, uint8_t dp, void (*Apply)(
|
|||
// Generic menu control using the encoder
|
||||
void HMI_Menu() {
|
||||
EncoderState encoder_diffState = get_encoder_state();
|
||||
if (encoder_diffState == ENCODER_DIFF_NO) return;
|
||||
if (CurrentMenu) {
|
||||
if (encoder_diffState == ENCODER_DIFF_NO) return;
|
||||
if (encoder_diffState == ENCODER_DIFF_ENTER)
|
||||
CurrentMenu->onClick();
|
||||
else
|
||||
|
@ -280,65 +294,46 @@ void HMI_Menu() {
|
|||
}
|
||||
}
|
||||
|
||||
// Get an integer value using the encoder without draw anything
|
||||
// lo: low limit
|
||||
// hi: high limit
|
||||
// Get a value using the encoder
|
||||
// draw : draw the value
|
||||
// Return value:
|
||||
// 0 : no change
|
||||
// 1 : live change
|
||||
// 2 : apply change
|
||||
int8_t HMI_GetIntNoDraw(const int32_t lo, const int32_t hi) {
|
||||
int8_t HMI_Get(bool draw) {
|
||||
const int32_t lo = MenuData.MinValue;
|
||||
const int32_t hi = MenuData.MaxValue;
|
||||
const int32_t cval = MenuData.Value;
|
||||
EncoderState encoder_diffState = Encoder_ReceiveAnalyze();
|
||||
EncoderState encoder_diffState = get_encoder_state();
|
||||
if (encoder_diffState != ENCODER_DIFF_NO) {
|
||||
if (Apply_Encoder(encoder_diffState, MenuData.Value)) {
|
||||
EncoderRate.enabled = false;
|
||||
if (draw) DrawItemEdit(false);
|
||||
checkkey = Menu;
|
||||
return 2;
|
||||
}
|
||||
LIMIT(MenuData.Value, lo, hi);
|
||||
}
|
||||
return int8_t(cval != MenuData.Value);
|
||||
const bool change = cval != MenuData.Value;
|
||||
if (change) DrawItemEdit(true);
|
||||
return int8_t(change);
|
||||
}
|
||||
|
||||
// Get an integer value using the encoder
|
||||
// lo: low limit
|
||||
// hi: high limit
|
||||
// Return value:
|
||||
// 0 : no change
|
||||
// 1 : live change
|
||||
// 2 : apply change
|
||||
int8_t HMI_GetInt(const int32_t lo, const int32_t hi) {
|
||||
EncoderState encoder_diffState = Encoder_ReceiveAnalyze();
|
||||
if (encoder_diffState != ENCODER_DIFF_NO) {
|
||||
if (Apply_Encoder(encoder_diffState, MenuData.Value)) {
|
||||
EncoderRate.enabled = false;
|
||||
DWINUI::Draw_Signed_Int(HMI_data.Text_Color, HMI_data.Background_Color, 4 , VALX, MBASE(CurrentMenu->line()) - 1, MenuData.Value);
|
||||
checkkey = Menu;
|
||||
return 2;
|
||||
}
|
||||
LIMIT(MenuData.Value, lo, hi);
|
||||
DrawItemEdit();
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Set an integer using the encoder
|
||||
void HMI_SetInt() {
|
||||
int8_t val = HMI_GetInt(MenuData.MinValue, MenuData.MaxValue);
|
||||
// Set and draw a value using the encoder
|
||||
void HMI_SetDraw() {
|
||||
int8_t val = HMI_Get(true);
|
||||
switch (val) {
|
||||
case 0: return; break;
|
||||
case 0: return;
|
||||
case 1: if (MenuData.LiveUpdate) MenuData.LiveUpdate(); break;
|
||||
case 2: if (MenuData.Apply) MenuData.Apply(); break;
|
||||
}
|
||||
}
|
||||
|
||||
// Set an integer without drawing
|
||||
void HMI_SetIntNoDraw() {
|
||||
int8_t val = HMI_GetIntNoDraw(MenuData.MinValue, MenuData.MaxValue);
|
||||
// Set an value without drawing
|
||||
void HMI_SetNoDraw() {
|
||||
int8_t val = HMI_Get(false);
|
||||
switch (val) {
|
||||
case 0: return; break;
|
||||
case 0: return;
|
||||
case 1: if (MenuData.LiveUpdate) MenuData.LiveUpdate(); break;
|
||||
case 2: if (MenuData.Apply) MenuData.Apply(); break;
|
||||
}
|
||||
|
@ -346,7 +341,7 @@ void HMI_SetIntNoDraw() {
|
|||
|
||||
// Set an integer pointer variable using the encoder
|
||||
void HMI_SetPInt() {
|
||||
int8_t val = HMI_GetInt(MenuData.MinValue, MenuData.MaxValue);
|
||||
int8_t val = HMI_Get(true);
|
||||
switch (val) {
|
||||
case 0: return;
|
||||
case 1: if (MenuData.LiveUpdate) MenuData.LiveUpdate(); break;
|
||||
|
@ -354,43 +349,9 @@ void HMI_SetPInt() {
|
|||
}
|
||||
}
|
||||
|
||||
// Get a scaled float value using the encoder
|
||||
// dp: decimal places
|
||||
// lo: scaled low limit
|
||||
// hi: scaled high limit
|
||||
// Return value:
|
||||
// 0 : no change
|
||||
// 1 : live change
|
||||
// 2 : apply change
|
||||
int8_t HMI_GetFloat(uint8_t dp, int32_t lo, int32_t hi) {
|
||||
EncoderState encoder_diffState = Encoder_ReceiveAnalyze();
|
||||
if (encoder_diffState != ENCODER_DIFF_NO) {
|
||||
if (Apply_Encoder(encoder_diffState, MenuData.Value)) {
|
||||
EncoderRate.enabled = false;
|
||||
DWINUI::Draw_Signed_Float(HMI_data.Text_Color, HMI_data.Background_Color, 3, dp, VALX - dp * DWINUI::fontWidth(DWIN_FONT_MENU), MBASE(CurrentMenu->line()), MenuData.Value / POW(10, dp));
|
||||
checkkey = Menu;
|
||||
return 2;
|
||||
}
|
||||
LIMIT(MenuData.Value, lo, hi);
|
||||
DrawItemEdit();
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Set a scaled float using the encoder
|
||||
void HMI_SetFloat() {
|
||||
const int8_t val = HMI_GetFloat(MenuData.dp, MenuData.MinValue, MenuData.MaxValue);
|
||||
switch (val) {
|
||||
case 0: return;
|
||||
case 1: if (MenuData.LiveUpdate) MenuData.LiveUpdate(); break;
|
||||
case 2: if (MenuData.Apply) MenuData.Apply(); break;
|
||||
}
|
||||
}
|
||||
|
||||
// Set a scaled float pointer variable using the encoder
|
||||
void HMI_SetPFloat() {
|
||||
const int8_t val = HMI_GetFloat(MenuData.dp, MenuData.MinValue, MenuData.MaxValue);
|
||||
const int8_t val = HMI_Get(true);
|
||||
switch (val) {
|
||||
case 0: return;
|
||||
case 1: if (MenuData.LiveUpdate) MenuData.LiveUpdate(); break;
|
||||
|
@ -398,7 +359,7 @@ void HMI_SetPFloat() {
|
|||
}
|
||||
}
|
||||
|
||||
// Menu Classes ===============================================================
|
||||
// Menu Class ===============================================================
|
||||
|
||||
MenuClass::MenuClass() {
|
||||
selected = 0;
|
||||
|
@ -407,10 +368,10 @@ MenuClass::MenuClass() {
|
|||
|
||||
void MenuClass::draw() {
|
||||
MenuTitle.draw();
|
||||
if (onMenuDraw != nullptr) onMenuDraw(this);
|
||||
Draw_Menu(this);
|
||||
for (int8_t i = 0; i < MenuItemCount; i++)
|
||||
MenuItems[i]->draw(i - topline);
|
||||
if (onCursorDraw != nullptr) onCursorDraw(line());
|
||||
Draw_Menu_Cursor(line());
|
||||
DWIN_UpdateLCD();
|
||||
}
|
||||
|
||||
|
@ -419,7 +380,7 @@ void MenuClass::onScroll(bool dir) {
|
|||
if (dir) sel++; else sel--;
|
||||
LIMIT(sel, 0, MenuItemCount - 1);
|
||||
if (sel != selected) {
|
||||
if (onCursorErase != nullptr) onCursorErase(line());
|
||||
Erase_Menu_Cursor(line());
|
||||
DWIN_UpdateLCD();
|
||||
if ((sel - topline) == TROWS) {
|
||||
DWIN_Frame_AreaMove(1, DWIN_SCROLL_UP, MLINE, DWINUI::backcolor, 0, TITLE_HEIGHT + 1, DWIN_WIDTH, STATUS_Y - 1);
|
||||
|
@ -432,63 +393,70 @@ void MenuClass::onScroll(bool dir) {
|
|||
MenuItems[sel]->draw(0);
|
||||
}
|
||||
selected = sel;
|
||||
if (onCursorDraw != nullptr) onCursorDraw(line());
|
||||
Draw_Menu_Cursor(line());
|
||||
DWIN_UpdateLCD();
|
||||
}
|
||||
}
|
||||
|
||||
void MenuClass::onClick() {
|
||||
if (MenuItems[selected]->onClick != nullptr) (*MenuItems[selected]->onClick)();
|
||||
if (MenuItems[selected]->onClick != nullptr) (*MenuItems[selected]->onClick)();
|
||||
}
|
||||
|
||||
MenuItemClass *MenuClass::SelectedItem() {
|
||||
CustomMenuItemClass *MenuClass::SelectedItem() {
|
||||
return MenuItems[selected];
|
||||
}
|
||||
|
||||
MenuItemClass** MenuClass::Items() {
|
||||
CustomMenuItemClass** MenuClass::Items() {
|
||||
return MenuItems;
|
||||
}
|
||||
|
||||
int8_t MenuClass::count() {
|
||||
return MenuItemCount;
|
||||
int8_t MenuClass::count() {
|
||||
return MenuItemCount;
|
||||
};
|
||||
|
||||
/* MenuItem Class ===========================================================*/
|
||||
|
||||
MenuItemClass::MenuItemClass(uint8_t cicon, const char * const text, void (*ondraw)(MenuItemClass* menuitem, int8_t line), void (*onclick)()) {
|
||||
icon = cicon;
|
||||
onClick = onclick;
|
||||
onDraw = ondraw;
|
||||
const uint8_t len = _MIN(sizeof(caption) - 1, strlen(text));
|
||||
memcpy(&caption[0], text, len);
|
||||
caption[len] = '\0';
|
||||
void CustomMenuItemClass::draw(int8_t line) {
|
||||
if (line < 0 || line >= TROWS) return;
|
||||
if (onDraw != nullptr) (*onDraw)(static_cast<MenuItemClass*>(this), line);
|
||||
};
|
||||
|
||||
void CustomMenuItemClass::redraw(bool erase /*=false*/) {
|
||||
const int8_t line = CurrentMenu->line(this->pos);
|
||||
if (erase) Erase_Menu_Text(line);
|
||||
draw(line);
|
||||
}
|
||||
|
||||
MenuItemClass::MenuItemClass(uint8_t cicon, uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, void (*ondraw)(MenuItemClass* menuitem, int8_t line), void (*onclick)()) {
|
||||
icon = cicon;
|
||||
CustomMenuItemClass::CustomMenuItemClass(OnDrawItem ondraw, OnClickItem onclick) {
|
||||
onClick = onclick;
|
||||
onDraw = ondraw;
|
||||
onDraw = ondraw;
|
||||
}
|
||||
|
||||
MenuItemClass::MenuItemClass(uint8_t cicon, const char * const text, OnDrawItem ondraw, OnClickItem onclick) : CustomMenuItemClass(ondraw, onclick) {
|
||||
icon = cicon;
|
||||
SetCaption(text);
|
||||
}
|
||||
|
||||
MenuItemClass::MenuItemClass(uint8_t cicon, uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, OnDrawItem ondraw, OnClickItem onclick) : CustomMenuItemClass(ondraw, onclick) {
|
||||
icon = cicon;
|
||||
caption[0] = '\0';
|
||||
frameid = id;
|
||||
frame = { x1, y1, x2, y2 };
|
||||
}
|
||||
|
||||
void MenuItemClass::SetCaption(const char * const text) {
|
||||
const uint8_t len = _MIN(sizeof(caption) - 1, strlen(text));
|
||||
memcpy(&caption[0], text, len);
|
||||
caption[len] = '\0';
|
||||
}
|
||||
|
||||
void MenuItemClass::SetFrame(uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2) {
|
||||
caption[0] = '\0';
|
||||
frameid = id;
|
||||
frame = { x1, y1, x2, y2 };
|
||||
}
|
||||
|
||||
void MenuItemClass::draw(int8_t line) {
|
||||
if (!WITHIN(line, 0, TROWS - 1)) return;
|
||||
if (onDraw != nullptr) (*onDraw)(this, line);
|
||||
};
|
||||
|
||||
void MenuItemClass::redraw() {
|
||||
draw(CurrentMenu->line(this->pos));
|
||||
}
|
||||
|
||||
MenuItemPtrClass::MenuItemPtrClass(uint8_t cicon, const char * const text, void (*ondraw)(MenuItemClass* menuitem, int8_t line), void (*onclick)(), void* val) : MenuItemClass(cicon, text, ondraw, onclick) {
|
||||
MenuItemPtrClass::MenuItemPtrClass(uint8_t cicon, const char * const text, OnDrawItem ondraw, OnClickItem onclick, void* val) : MenuItemClass(cicon, text, ondraw, onclick) {
|
||||
value = val;
|
||||
};
|
||||
|
||||
|
@ -505,38 +473,56 @@ void MenuItemsClear() {
|
|||
|
||||
void MenuItemsPrepare(int8_t totalitems) {
|
||||
MenuItemsClear();
|
||||
MenuItemTotal = totalitems;
|
||||
MenuItems = new MenuItemClass*[totalitems];
|
||||
MenuItemTotal = _MIN(totalitems, MENU_MAX_ITEMS);
|
||||
MenuItems = new CustomMenuItemClass*[totalitems];
|
||||
}
|
||||
|
||||
MenuItemClass* MenuItemsAdd(MenuItemClass* menuitem) {
|
||||
bool IsMenu(MenuClass* _menu) {
|
||||
return ((checkkey == Menu) && !!CurrentMenu && (CurrentMenu == _menu));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T* MenuItemAdd(T* menuitem) {
|
||||
MenuItems[MenuItemCount] = menuitem;
|
||||
menuitem->pos = MenuItemCount++;
|
||||
return menuitem;
|
||||
}
|
||||
|
||||
MenuItemClass* MenuItemsAdd(uint8_t cicon, const char * const text/*=nullptr*/, void (*ondraw)(MenuItemClass* menuitem, int8_t line)/*=nullptr*/, void (*onclick)()/*=nullptr*/) {
|
||||
CustomMenuItemClass* MenuItemAdd(OnDrawItem ondraw/*=nullptr*/, OnClickItem onclick/*=nullptr*/) {
|
||||
if (MenuItemCount < MenuItemTotal) {
|
||||
CustomMenuItemClass* menuitem = new CustomMenuItemClass(ondraw, onclick);
|
||||
return MenuItemAdd(menuitem);
|
||||
}
|
||||
else return nullptr;
|
||||
}
|
||||
|
||||
MenuItemClass* MenuItemAdd(uint8_t cicon, const char * const text/*=nullptr*/, OnDrawItem ondraw/*=nullptr*/, OnClickItem onclick/*=nullptr*/) {
|
||||
if (MenuItemCount < MenuItemTotal) {
|
||||
MenuItemClass* menuitem = new MenuItemClass(cicon, text, ondraw, onclick);
|
||||
return MenuItemsAdd(menuitem);
|
||||
return MenuItemAdd(menuitem);
|
||||
}
|
||||
else return nullptr;
|
||||
}
|
||||
|
||||
MenuItemClass* MenuItemsAdd(uint8_t cicon, uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, void (*ondraw)(MenuItemClass* menuitem, int8_t line)/*=nullptr*/, void (*onclick)()/*=nullptr*/) {
|
||||
MenuItemClass* MenuItemAdd(uint8_t cicon, uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, OnDrawItem ondraw/*=nullptr*/, OnClickItem onclick/*=nullptr*/) {
|
||||
if (MenuItemCount < MenuItemTotal) {
|
||||
MenuItemClass* menuitem = new MenuItemClass(cicon, id, x1, y1, x2, y2, ondraw, onclick);
|
||||
return MenuItemsAdd(menuitem);
|
||||
return MenuItemAdd(menuitem);
|
||||
}
|
||||
else return nullptr;
|
||||
}
|
||||
|
||||
MenuItemClass* EditItemAdd(uint8_t cicon, const char * const text, OnDrawItem ondraw, OnClickItem onclick, void* val) {
|
||||
if (MenuItemCount < MenuItemTotal) {
|
||||
MenuItemClass* menuitem = new MenuItemPtrClass(cicon, text, ondraw, onclick, val);
|
||||
return MenuItemAdd(menuitem);
|
||||
}
|
||||
else return nullptr;
|
||||
}
|
||||
|
||||
MenuItemClass* MenuItemsAdd(uint8_t cicon, const char * const text, void (*ondraw)(MenuItemClass* menuitem, int8_t line), void (*onclick)(), void* val) {
|
||||
if (MenuItemCount < MenuItemTotal) {
|
||||
MenuItemClass* menuitem = new MenuItemPtrClass(cicon, text, ondraw, onclick, val);
|
||||
return MenuItemsAdd(menuitem);
|
||||
}
|
||||
else return nullptr;
|
||||
void InitMenu() {
|
||||
PreviousMenu = nullptr;
|
||||
InvalidateMenu();
|
||||
}
|
||||
|
||||
bool SetMenu(MenuClass* &menu, FSTR_P title, int8_t totalitems) {
|
||||
|
@ -549,6 +535,27 @@ bool SetMenu(MenuClass* &menu, FSTR_P title, int8_t totalitems) {
|
|||
return NotCurrent;
|
||||
}
|
||||
|
||||
bool SetMenu(MenuClass* &menu, frame_rect_t cn, FSTR_P title, int8_t totalitems) {
|
||||
if (!menu) menu = new MenuClass();
|
||||
const bool NotCurrent = (CurrentMenu != menu);
|
||||
if (NotCurrent) {
|
||||
if (cn.w != 0)
|
||||
menu->MenuTitle.SetFrame(cn.x, cn.y, cn.w, cn.h);
|
||||
else
|
||||
menu->MenuTitle.SetCaption(title);
|
||||
MenuItemsPrepare(totalitems);
|
||||
}
|
||||
return NotCurrent;
|
||||
}
|
||||
|
||||
void InvalidateMenu() {
|
||||
if (CurrentMenu) {
|
||||
CurrentMenu->topline = 0;
|
||||
CurrentMenu->selected = 0;
|
||||
CurrentMenu = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateMenu(MenuClass* &menu) {
|
||||
if (!menu) return;
|
||||
if (CurrentMenu != menu) {
|
||||
|
@ -558,9 +565,9 @@ void UpdateMenu(MenuClass* &menu) {
|
|||
menu->draw();
|
||||
}
|
||||
|
||||
void ReDrawMenu(const bool force/*=false*/) {
|
||||
if (CurrentMenu && (force || checkkey == Menu)) CurrentMenu->draw();
|
||||
if (force) DrawItemEdit();
|
||||
void ReDrawMenu(bool force /*= false*/) {
|
||||
if (CurrentMenu && (force || checkkey==Menu)) CurrentMenu->draw();
|
||||
if (force) DrawItemEdit(true);
|
||||
}
|
||||
|
||||
#endif // DWIN_LCD_PROUI
|
||||
|
|
|
@ -23,8 +23,8 @@
|
|||
/**
|
||||
* Menu functions for ProUI
|
||||
* Author: Miguel A. Risco-Castillo
|
||||
* Version: 1.5.1
|
||||
* Date: 2022/05/23
|
||||
* Version: 1.9.1
|
||||
* Date: 2022/12/02
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as
|
||||
|
@ -44,6 +44,9 @@
|
|||
|
||||
#include "dwinui.h"
|
||||
|
||||
#define MENU_CHAR_LIMIT 24
|
||||
#define MENU_MAX_ITEMS TERN(SDSORT_LIMIT, SDSORT_LIMIT, 64)
|
||||
|
||||
typedef struct {
|
||||
int32_t MaxValue = 0; // Auxiliar max integer/scaled float value
|
||||
int32_t MinValue = 0; // Auxiliar min integer/scaled float value
|
||||
|
@ -56,46 +59,60 @@ typedef struct {
|
|||
} MenuData_t;
|
||||
|
||||
extern MenuData_t MenuData;
|
||||
extern void (*onCursorErase)(const int8_t line);
|
||||
extern void (*onCursorDraw)(const int8_t line);
|
||||
|
||||
// Auxiliary Macros ===========================================================
|
||||
|
||||
// Create and add a MenuItem object to the menu array
|
||||
#define BACK_ITEM(H) MenuItemsAdd(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawMenuItem, H)
|
||||
#define MENU_ITEM(V...) MenuItemsAdd(V)
|
||||
#define EDIT_ITEM(V...) MenuItemsAdd(V)
|
||||
#define MENU_ITEM_F(I,L,V...) MenuItemsAdd(I, GET_TEXT_F(L), V)
|
||||
#define EDIT_ITEM_F(I,L,V...) MenuItemsAdd(I, GET_TEXT_F(L), V)
|
||||
#define SET_MENU(I,L,V) SetMenu(I, GET_TEXT_F(L), V)
|
||||
#define SET_MENU_F(I,L,V) SetMenu(I, F(L), V)
|
||||
#define SET_MENU_R(I,R,L,V) SetMenu(I, R, GET_TEXT_F(L), V)
|
||||
|
||||
#define BACK_ITEM(H) MenuItemAdd(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawMenuItem, H)
|
||||
#define MENU_ITEM(I,L,V...) MenuItemAdd(I, GET_TEXT_F(L), V)
|
||||
#define EDIT_ITEM(I,L,V...) EditItemAdd(I, GET_TEXT_F(L), V)
|
||||
#define MENU_ITEM_F(I,L,V...) MenuItemAdd(I, F(L), V)
|
||||
#define EDIT_ITEM_F(I,L,V...) EditItemAdd(I, F(L), V)
|
||||
|
||||
// Menu Classes ===============================================================
|
||||
|
||||
class MenuItemClass {
|
||||
protected:
|
||||
class CustomMenuItemClass;
|
||||
class MenuItemClass;
|
||||
|
||||
typedef void (*OnDrawCustomItem)(CustomMenuItemClass* menuitem, int8_t line);
|
||||
typedef void (*OnDrawItem)(MenuItemClass* menuitem, int8_t line);
|
||||
typedef void (*OnClickItem)();
|
||||
|
||||
class CustomMenuItemClass {
|
||||
public:
|
||||
int8_t pos = 0;
|
||||
OnDrawItem onDraw = nullptr;
|
||||
void (*onClick)() = nullptr;
|
||||
CustomMenuItemClass() {};
|
||||
CustomMenuItemClass(OnDrawItem ondraw=nullptr, OnClickItem onclick=nullptr);
|
||||
virtual ~CustomMenuItemClass(){};
|
||||
virtual void draw(int8_t line);
|
||||
void redraw(bool erase=false);
|
||||
};
|
||||
|
||||
class MenuItemClass: public CustomMenuItemClass {
|
||||
public:
|
||||
uint8_t icon = 0;
|
||||
char caption[32] = "";
|
||||
char caption[MENU_CHAR_LIMIT] = "";
|
||||
uint8_t frameid = 0;
|
||||
rect_t frame = {0};
|
||||
void (*onDraw)(MenuItemClass* menuitem, int8_t line) = nullptr;
|
||||
void (*onClick)() = nullptr;
|
||||
MenuItemClass() {};
|
||||
MenuItemClass(uint8_t cicon, const char * const text=nullptr, void (*ondraw)(MenuItemClass* menuitem, int8_t line)=nullptr, void (*onclick)()=nullptr);
|
||||
// MenuItemClass(uint8_t cicon, FSTR_P text = nullptr, void (*ondraw)(MenuItemClass* menuitem, int8_t line)=nullptr, void (*onclick)()=nullptr) : MenuItemClass(cicon, FTOP(text), ondraw, onclick){}
|
||||
MenuItemClass(uint8_t cicon, uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, void (*ondraw)(MenuItemClass* menuitem, int8_t line)=nullptr, void (*onclick)()=nullptr);
|
||||
using CustomMenuItemClass::CustomMenuItemClass;
|
||||
MenuItemClass(uint8_t cicon, const char * const text=nullptr, OnDrawItem ondraw=nullptr, OnClickItem onclick=nullptr);
|
||||
MenuItemClass(uint8_t cicon, uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, OnDrawItem ondraw=nullptr, OnClickItem onclick=nullptr);
|
||||
void SetFrame(uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2);
|
||||
virtual ~MenuItemClass(){};
|
||||
virtual void draw(int8_t line);
|
||||
void redraw();
|
||||
void SetCaption(const char * const text = nullptr);
|
||||
};
|
||||
|
||||
class MenuItemPtrClass: public MenuItemClass {
|
||||
public:
|
||||
void *value = nullptr;
|
||||
using MenuItemClass::MenuItemClass;
|
||||
MenuItemPtrClass(uint8_t cicon, const char * const text, void (*ondraw)(MenuItemClass* menuitem, int8_t line), void (*onclick)(), void* val);
|
||||
MenuItemPtrClass(uint8_t cicon, FSTR_P text, void (*ondraw)(MenuItemClass* menuitem, int8_t line), void (*onclick)(), void* val) : MenuItemPtrClass(cicon, FTOP(text), ondraw, onclick, val){}
|
||||
MenuItemPtrClass(uint8_t cicon, const char * const text, OnDrawItem ondraw, OnClickItem onclick, void* val);
|
||||
MenuItemPtrClass(uint8_t cicon, FSTR_P text, OnDrawItem ondraw, OnClickItem onclick, void* val) : MenuItemPtrClass(cicon, FTOP(text), ondraw, onclick, val){}
|
||||
};
|
||||
|
||||
class MenuClass {
|
||||
|
@ -111,12 +128,11 @@ public:
|
|||
virtual void draw();
|
||||
virtual void onScroll(bool dir);
|
||||
void onClick();
|
||||
MenuItemClass* SelectedItem();
|
||||
static MenuItemClass** Items();
|
||||
CustomMenuItemClass* SelectedItem();
|
||||
static CustomMenuItemClass** Items();
|
||||
};
|
||||
extern MenuClass *CurrentMenu;
|
||||
extern MenuClass *PreviousMenu;
|
||||
extern void (*onMenuDraw)(MenuClass* menu);
|
||||
|
||||
// Menuitem Drawing functions =================================================
|
||||
|
||||
|
@ -124,8 +140,12 @@ void Draw_Title(TitleClass* title);
|
|||
void Draw_Menu(MenuClass* menu);
|
||||
void Draw_Menu_Cursor(const int8_t line);
|
||||
void Erase_Menu_Cursor(const int8_t line);
|
||||
void Draw_Menu_Line(const uint8_t line, const uint8_t icon=0, const char * const label=nullptr, bool more=false);
|
||||
void Erase_Menu_Text(const int8_t line);
|
||||
void Draw_Menu_Line(const uint8_t line, const uint8_t icon=0, const char * const label=nullptr, bool more=false, bool selected=false);
|
||||
void Draw_Menu_Line(const uint8_t line, const uint8_t icon=0, FSTR_P label=nullptr, bool more=false, bool selected=false);
|
||||
void Draw_Chkb_Line(const uint8_t line, const bool checked);
|
||||
void Show_Chkb_Line(const bool checked);
|
||||
void Toogle_Chkb_Line(bool &checked);
|
||||
void Draw_Menu_IntValue(uint16_t bcolor, const uint8_t line, uint8_t iNum, const int32_t value=0);
|
||||
void onDrawMenuItem(MenuItemClass* menuitem, int8_t line);
|
||||
void onDrawSubMenu(MenuItemClass* menuitem, int8_t line);
|
||||
|
@ -134,9 +154,11 @@ void onDrawPIntMenu(MenuItemClass* menuitem, int8_t line);
|
|||
void onDrawPInt8Menu(MenuItemClass* menuitem, int8_t line);
|
||||
void onDrawPInt32Menu(MenuItemClass* menuitem, int8_t line);
|
||||
void onDrawFloatMenu(MenuItemClass* menuitem, int8_t line, uint8_t dp, const float value);
|
||||
void onDrawPFloatMenu(MenuItemClass* menuitem, int8_t line);
|
||||
void onDrawPFloat2Menu(MenuItemClass* menuitem, int8_t line);
|
||||
void onDrawPFloat3Menu(MenuItemClass* menuitem, int8_t line);
|
||||
void onDrawPFloatMenu(MenuItemClass* menuitem, int8_t line, uint8_t dp);
|
||||
inline void onDrawPFloatMenu(MenuItemClass* menuitem, int8_t line) { onDrawPFloatMenu(menuitem, line, UNITFDIGITS); };
|
||||
inline void onDrawPFloat2Menu(MenuItemClass* menuitem, int8_t line) { onDrawPFloatMenu(menuitem, line, 2); };
|
||||
inline void onDrawPFloat3Menu(MenuItemClass* menuitem, int8_t line) { onDrawPFloatMenu(menuitem, line, 3); };
|
||||
inline void onDrawPFloat4Menu(MenuItemClass* menuitem, int8_t line) { onDrawPFloatMenu(menuitem, line, 4); };
|
||||
void onDrawChkbMenu(MenuItemClass* menuitem, int8_t line, bool checked);
|
||||
void onDrawChkbMenu(MenuItemClass* menuitem, int8_t line);
|
||||
|
||||
|
@ -153,22 +175,28 @@ void SetPFloatOnClick(const float lo, const float hi, uint8_t dp, void (*Apply)(
|
|||
// HMI user control functions =================================================
|
||||
|
||||
void HMI_Menu();
|
||||
void HMI_SetInt();
|
||||
void HMI_SetDraw();
|
||||
void HMI_SetNoDraw();
|
||||
void HMI_SetPInt();
|
||||
void HMI_SetIntNoDraw();
|
||||
void HMI_SetFloat();
|
||||
void HMI_SetPFloat();
|
||||
|
||||
// Menu auxiliary functions ===================================================
|
||||
|
||||
// Initialize menu
|
||||
void InitMenu();
|
||||
|
||||
// Create a new menu
|
||||
bool SetMenu(MenuClass* &menu, FSTR_P title, int8_t totalitems);
|
||||
bool SetMenu(MenuClass* &menu, frame_rect_t cn, FSTR_P title, int8_t totalitems);
|
||||
|
||||
// Invalidate CurrentMenu to prepare for full menu drawing
|
||||
void InvalidateMenu();
|
||||
|
||||
//Update the Menu and Draw if it is valid
|
||||
void UpdateMenu(MenuClass* &menu);
|
||||
|
||||
//Redraw the current Menu if it is valid
|
||||
void ReDrawMenu(const bool force=false);
|
||||
void ReDrawMenu(bool force = false);
|
||||
|
||||
// Clear MenuItems array and free MenuItems elements
|
||||
void MenuItemsClear();
|
||||
|
@ -176,13 +204,17 @@ void MenuItemsClear();
|
|||
// Prepare MenuItems array
|
||||
void MenuItemsPrepare(int8_t totalitems);
|
||||
|
||||
// Is the current menu = menu?
|
||||
bool IsMenu(MenuClass* menu);
|
||||
|
||||
// Add elements to the MenuItems array
|
||||
MenuItemClass* MenuItemsAdd(uint8_t cicon, const char * const text=nullptr, void (*ondraw)(MenuItemClass* menuitem, int8_t line)=nullptr, void (*onclick)()=nullptr);
|
||||
inline MenuItemClass* MenuItemsAdd(uint8_t cicon, FSTR_P text = nullptr, void (*ondraw)(MenuItemClass* menuitem, int8_t line)=nullptr, void (*onclick)()=nullptr) {
|
||||
return MenuItemsAdd(cicon, FTOP(text), ondraw, onclick);
|
||||
CustomMenuItemClass* MenuItemAdd(OnDrawItem ondraw=nullptr, OnClickItem onclick=nullptr);
|
||||
MenuItemClass* MenuItemAdd(uint8_t cicon, const char * const text=nullptr, OnDrawItem ondraw=nullptr, OnClickItem onclick=nullptr);
|
||||
inline MenuItemClass* MenuItemAdd(uint8_t cicon, FSTR_P text = nullptr, OnDrawItem ondraw=nullptr, OnClickItem onclick=nullptr) {
|
||||
return MenuItemAdd(cicon, FTOP(text), ondraw, onclick);
|
||||
}
|
||||
MenuItemClass* MenuItemsAdd(uint8_t cicon, uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, void (*ondraw)(MenuItemClass* menuitem, int8_t line)=nullptr, void (*onclick)()=nullptr);
|
||||
MenuItemClass* MenuItemsAdd(uint8_t cicon, const char * const text, void (*ondraw)(MenuItemClass* menuitem, int8_t line), void (*onclick)(), void* val);
|
||||
inline MenuItemClass* MenuItemsAdd(uint8_t cicon, FSTR_P text, void (*ondraw)(MenuItemClass* menuitem, int8_t line), void (*onclick)(), void* val) {
|
||||
return MenuItemsAdd(cicon, FTOP(text), ondraw, onclick, val);
|
||||
MenuItemClass* MenuItemAdd(uint8_t cicon, uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, OnDrawItem ondraw=nullptr, OnClickItem onclick=nullptr);
|
||||
MenuItemClass* EditItemAdd(uint8_t cicon, const char * const text, OnDrawItem ondraw, OnClickItem onclick, void* val);
|
||||
inline MenuItemClass* EditItemAdd(uint8_t cicon, FSTR_P text, OnDrawItem ondraw, OnClickItem onclick, void* val) {
|
||||
return EditItemAdd(cicon, FTOP(text), ondraw, onclick, val);
|
||||
}
|
||||
|
|
|
@ -113,8 +113,8 @@ void MeshViewerClass::Draw(bool withsave /*= false*/) {
|
|||
Title.ShowCaption(GET_TEXT_F(MSG_MESH_VIEWER));
|
||||
#if USE_UBL_VIEWER
|
||||
DWINUI::ClearMainArea();
|
||||
BedLevelTools.viewer_print_value = true;
|
||||
BedLevelTools.Draw_Bed_Mesh(-1, 1, 8, 10 + TITLE_HEIGHT);
|
||||
bedLevelTools.viewer_print_value = true;
|
||||
bedLevelTools.Draw_Bed_Mesh(-1, 1, 8, 10 + TITLE_HEIGHT);
|
||||
#else
|
||||
DrawMesh(bedlevel.z_values, GRID_MAX_POINTS_X, GRID_MAX_POINTS_Y);
|
||||
#endif
|
||||
|
@ -127,7 +127,7 @@ void MeshViewerClass::Draw(bool withsave /*= false*/) {
|
|||
DWINUI::Draw_Button(BTN_Continue, 86, 305);
|
||||
|
||||
#if USE_UBL_VIEWER
|
||||
BedLevelTools.Set_Mesh_Viewer_Status();
|
||||
bedLevelTools.Set_Mesh_Viewer_Status();
|
||||
#else
|
||||
char str_1[6], str_2[6] = "";
|
||||
ui.status_printf(0, F("Mesh minZ: %s, maxZ: %s"),
|
||||
|
|
|
@ -23,8 +23,8 @@
|
|||
/**
|
||||
* DWIN Single var plot
|
||||
* Author: Miguel A. Risco-Castillo
|
||||
* Version: 2.0
|
||||
* Date: 2022/01/31
|
||||
* Version: 2.1.2
|
||||
* Date: 2022/11/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
|
||||
|
@ -44,14 +44,9 @@
|
|||
|
||||
#include "../../../inc/MarlinConfigPre.h"
|
||||
|
||||
#ifdef DWIN_LCD_PROUI
|
||||
|
||||
#include "dwin_defines.h"
|
||||
|
||||
#if HAS_PIDPLOT
|
||||
#if BOTH(DWIN_LCD_PROUI, HAS_PIDPLOT)
|
||||
|
||||
#include "plot.h"
|
||||
|
||||
#include "../../../core/types.h"
|
||||
#include "../../marlinui.h"
|
||||
#include "dwin_lcd.h"
|
||||
|
@ -74,7 +69,7 @@ void PlotClass::Draw(const frame_rect_t frame, const float max, const float ref)
|
|||
y2 = frame.y + frame.h - 1;
|
||||
r = round((y2) - ref * scale);
|
||||
DWINUI::Draw_Box(1, Plot_Bg_Color, frame);
|
||||
for (uint8_t i = 1; i < 4; i++) if (i * 50 < frame.w) DWIN_Draw_VLine(Line_Color, i * 50 + frame.x, frame.y, frame.h);
|
||||
for (uint8_t i = 1; i < 4; i++) if (i * 50 < frame.w) DWIN_Draw_VLine(Line_Color, i * 50 + frame.x, frame.y, frame.h);
|
||||
DWINUI::Draw_Box(0, Color_White, DWINUI::ExtendFrame(frame, 1));
|
||||
DWIN_Draw_HLine(Color_Red, frame.x, r, frame.w);
|
||||
}
|
||||
|
@ -94,6 +89,4 @@ void PlotClass::Update(const float value) {
|
|||
grphpoints++;
|
||||
}
|
||||
|
||||
#endif // HAS_PIDPLOT
|
||||
|
||||
#endif // DWIN_LCD_PROUI
|
||||
#endif // DWIN_LCD_PROUI && HAS_PIDPLOT
|
||||
|
|
|
@ -23,8 +23,8 @@
|
|||
/**
|
||||
* DWIN Single var plot
|
||||
* Author: Miguel A. Risco-Castillo
|
||||
* Version: 1.0
|
||||
* Date: 2022/01/30
|
||||
* Version: 2.1.2
|
||||
* Date: 2022/11/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
|
||||
|
|
|
@ -23,8 +23,8 @@
|
|||
/**
|
||||
* Print Stats page for PRO UI
|
||||
* Author: Miguel A. Risco-Castillo (MRISCOC)
|
||||
* Version: 1.3.0
|
||||
* Date: 2022/02/24
|
||||
* Version: 1.4.2
|
||||
* Date: 2022/12/03
|
||||
*/
|
||||
|
||||
#include "../../../inc/MarlinConfigPre.h"
|
||||
|
@ -79,4 +79,12 @@ void Goto_PrintStats() {
|
|||
HMI_SaveProcessID(WaitResponse);
|
||||
}
|
||||
|
||||
// Print Stats Reset popup
|
||||
void Popup_ResetStats() { DWIN_Popup_ConfirmCancel(ICON_Info_0, GET_TEXT_F(MSG_RESET_STATS)); }
|
||||
void OnClick_ResetStats() {
|
||||
if (HMI_flag.select_flag) PrintStatsClass::Reset();
|
||||
HMI_ReturnScreen();
|
||||
}
|
||||
void PrintStatsReset() { Goto_Popup(Popup_ResetStats, OnClick_ResetStats); }
|
||||
|
||||
#endif // DWIN_LCD_PROUI && PRINTCOUNTER
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
/**
|
||||
* Print Stats page for PRO UI
|
||||
* Author: Miguel A. Risco-Castillo (MRISCOC)
|
||||
* Version: 1.3.0
|
||||
* Date: 2022/02/24
|
||||
* Version: 1.4.2
|
||||
* Date: 2022/12/03
|
||||
*/
|
||||
|
||||
class PrintStatsClass {
|
||||
|
@ -37,3 +37,4 @@ public:
|
|||
extern PrintStatsClass PrintStats;
|
||||
|
||||
void Goto_PrintStats();
|
||||
void PrintStatsReset();
|
||||
|
|
|
@ -52,7 +52,6 @@ void AdvancedSettingsMenu::onRedraw(draw_mode_t what) {
|
|||
.enabled(ENABLED(HAS_MULTI_HOTEND))
|
||||
.tag(6) .button(BTN_POS(1,5), BTN_SIZE(1,1), GET_TEXT_F(MSG_OFFSETS_MENU))
|
||||
|
||||
|
||||
.tag(7) .button(BTN_POS(2,1), BTN_SIZE(1,1), GET_TEXT_F(MSG_STEPS_PER_MM))
|
||||
.tag(8) .button(BTN_POS(2,2), BTN_SIZE(1,1), GET_TEXT_F(MSG_MAX_SPEED))
|
||||
.tag(9) .button(BTN_POS(2,3), BTN_SIZE(1,1), GET_TEXT_F(MSG_ACCELERATION))
|
||||
|
|
|
@ -82,6 +82,7 @@ namespace Language_en {
|
|||
LSTR MSG_AUTO_HOME_X = _UxGT("Home X");
|
||||
LSTR MSG_AUTO_HOME_Y = _UxGT("Home Y");
|
||||
LSTR MSG_AUTO_HOME_Z = _UxGT("Home Z");
|
||||
LSTR MSG_Z_AFTER_HOME = _UxGT("Z After Homing");
|
||||
LSTR MSG_FILAMENT_SET = _UxGT("Filament Settings");
|
||||
LSTR MSG_FILAMENT_MAN = _UxGT("Filament Management");
|
||||
LSTR MSG_MANUAL_LEVELING = _UxGT("Manual Leveling");
|
||||
|
@ -133,6 +134,7 @@ namespace Language_en {
|
|||
LSTR MSG_PREHEAT_M_BEDONLY = _UxGT("Preheat $ Bed");
|
||||
LSTR MSG_PREHEAT_M_SETTINGS = _UxGT("Preheat $ Conf");
|
||||
#endif
|
||||
LSTR MSG_PREHEAT_HOTEND = _UxGT("Preheat Hotend");
|
||||
LSTR MSG_PREHEAT_CUSTOM = _UxGT("Preheat Custom");
|
||||
LSTR MSG_COOLDOWN = _UxGT("Cooldown");
|
||||
|
||||
|
@ -266,6 +268,7 @@ namespace Language_en {
|
|||
LSTR MSG_UBL_INVALID_SLOT = _UxGT("First Select a Mesh Slot");
|
||||
LSTR MSG_MESH_LOADED = _UxGT("Mesh %i Loaded");
|
||||
LSTR MSG_MESH_SAVED = _UxGT("Mesh %i Saved");
|
||||
LSTR MSG_MESH_ACTIVE = _UxGT("Mesh %i active");
|
||||
LSTR MSG_UBL_NO_STORAGE = _UxGT("No Storage");
|
||||
LSTR MSG_UBL_SAVE_ERROR = _UxGT("Err: UBL Save");
|
||||
LSTR MSG_UBL_RESTORE_ERROR = _UxGT("Err: UBL Restore");
|
||||
|
@ -323,6 +326,7 @@ namespace Language_en {
|
|||
LSTR MSG_MOVE_01IN = _UxGT("Move 0.1in");
|
||||
LSTR MSG_MOVE_05IN = _UxGT("Move 0.5in");
|
||||
LSTR MSG_MOVE_1IN = _UxGT("Move 1.0in");
|
||||
LSTR MSG_LIVE_MOVE = _UxGT("Live Move");
|
||||
LSTR MSG_SPEED = _UxGT("Speed");
|
||||
LSTR MSG_BED_Z = _UxGT("Bed Z");
|
||||
LSTR MSG_NOZZLE = _UxGT("Nozzle");
|
||||
|
@ -538,6 +542,7 @@ namespace Language_en {
|
|||
LSTR MSG_SINGLENOZZLE_WIPE_RETRACT = _UxGT("Wipe Retract");
|
||||
LSTR MSG_SINGLENOZZLE_RETRACT_SPEED = _UxGT("Retract Speed");
|
||||
LSTR MSG_FILAMENT_PARK_ENABLED = _UxGT("Park Head");
|
||||
LSTR MSG_PARK_FAILED = _UxGT("Head cannot be parked");
|
||||
LSTR MSG_SINGLENOZZLE_UNRETRACT_SPEED = _UxGT("Recover Speed");
|
||||
LSTR MSG_SINGLENOZZLE_FAN_SPEED = _UxGT("Fan Speed");
|
||||
LSTR MSG_SINGLENOZZLE_FAN_TIME = _UxGT("Fan Time");
|
||||
|
@ -643,6 +648,7 @@ namespace Language_en {
|
|||
LSTR MSG_MESH_LEVELING = _UxGT("Mesh Leveling");
|
||||
LSTR MSG_MESH_DONE = _UxGT("Mesh probing done");
|
||||
LSTR MSG_INFO_STATS_MENU = _UxGT("Printer Stats");
|
||||
LSTR MSG_RESET_STATS = _UxGT("Reset Print Stats?");
|
||||
LSTR MSG_INFO_BOARD_MENU = _UxGT("Board Info");
|
||||
LSTR MSG_INFO_THERMISTOR_MENU = _UxGT("Thermistors");
|
||||
LSTR MSG_INFO_EXTRUDERS = _UxGT("Extruders");
|
||||
|
|
|
@ -1650,6 +1650,7 @@ void MarlinUI::init() {
|
|||
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_open(PROMPT_INFO, F("UI Aborted"), FPSTR(DISMISS_STR)));
|
||||
LCD_MESSAGE(MSG_PRINT_ABORTED);
|
||||
TERN_(HAS_MARLINUI_MENU, return_to_status());
|
||||
TERN_(DWIN_LCD_PROUI, HMI_flag.abort_flag = true);
|
||||
}
|
||||
|
||||
#if BOTH(HAS_MARLINUI_MENU, PSU_CONTROL)
|
||||
|
|
|
@ -29,6 +29,10 @@
|
|||
|
||||
#include "motion.h"
|
||||
|
||||
#if ENABLED(DWIN_LCD_PROUI)
|
||||
#include "../lcd/e3v2/proui/dwin.h"
|
||||
#endif
|
||||
|
||||
#if HAS_BED_PROBE
|
||||
enum ProbePtRaise : uint8_t {
|
||||
PROBE_PT_NONE, // No raise or stow after run_z_probe
|
||||
|
@ -45,12 +49,14 @@
|
|||
#define PROBE_TRIGGERED() (READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING)
|
||||
#endif
|
||||
|
||||
#ifdef Z_AFTER_HOMING
|
||||
#define Z_POST_CLEARANCE Z_AFTER_HOMING
|
||||
#if ALL(DWIN_LCD_PROUI, INDIVIDUAL_AXIS_HOMING_SUBMENU, MESH_BED_LEVELING)
|
||||
#define Z_POST_CLEARANCE HMI_data.z_after_homing;
|
||||
#elif defined(Z_AFTER_HOMING)
|
||||
#define Z_POST_CLEARANCE Z_AFTER_HOMING
|
||||
#elif defined(Z_HOMING_HEIGHT)
|
||||
#define Z_POST_CLEARANCE Z_HOMING_HEIGHT
|
||||
#define Z_POST_CLEARANCE Z_HOMING_HEIGHT
|
||||
#else
|
||||
#define Z_POST_CLEARANCE 10
|
||||
#define Z_POST_CLEARANCE 10
|
||||
#endif
|
||||
|
||||
#if ENABLED(PREHEAT_BEFORE_LEVELING)
|
||||
|
@ -155,7 +161,9 @@ public:
|
|||
#endif
|
||||
|
||||
static void move_z_after_homing() {
|
||||
#ifdef Z_AFTER_HOMING
|
||||
#if ALL(DWIN_LCD_PROUI, INDIVIDUAL_AXIS_HOMING_SUBMENU, MESH_BED_LEVELING)
|
||||
do_z_clearance(HMI_data.z_after_homing, true);
|
||||
#elif defined(Z_AFTER_HOMING)
|
||||
do_z_clearance(Z_AFTER_HOMING, true);
|
||||
#elif BOTH(Z_AFTER_PROBING, HAS_BED_PROBE)
|
||||
move_z_after_probing();
|
||||
|
|
|
@ -2527,7 +2527,7 @@ void MarlinSettings::postprocess() {
|
|||
#endif
|
||||
|
||||
//
|
||||
// Creality DWIN User Data
|
||||
// DWIN User Data
|
||||
//
|
||||
#if ENABLED(DWIN_LCD_PROUI)
|
||||
{
|
||||
|
@ -2852,7 +2852,7 @@ void MarlinSettings::postprocess() {
|
|||
#endif
|
||||
|
||||
#if ENABLED(DWIN_LCD_PROUI)
|
||||
status = !BedLevelTools.meshvalidate();
|
||||
status = !bedLevelTools.meshvalidate();
|
||||
if (status) {
|
||||
bedlevel.invalidate();
|
||||
LCD_MESSAGE(MSG_UBL_MESH_INVALID);
|
||||
|
|
|
@ -657,7 +657,7 @@ volatile bool Temperature::raw_temps_ready = false;
|
|||
TERN_(HAS_FAN_LOGIC, fan_update_ms = next_temp_ms + fan_update_interval_ms);
|
||||
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_STARTED));
|
||||
TERN_(DWIN_LCD_PROUI, DWIN_PidTuning(isbed ? PID_BED_START : PID_EXTR_START));
|
||||
TERN_(DWIN_LCD_PROUI, DWIN_PidTuning(isbed ? PIDTEMPBED_START : PIDTEMP_START));
|
||||
|
||||
if (target > GHV(CHAMBER_MAX_TARGET, BED_MAX_TARGET, temp_range[heater_id].maxtemp - (HOTEND_OVERSHOOT))) {
|
||||
SERIAL_ECHOPGM(STR_PID_AUTOTUNE);
|
||||
|
|
|
@ -581,7 +581,7 @@ void CardReader::startOrResumeFilePrinting() {
|
|||
//
|
||||
void CardReader::endFilePrintNow(TERN_(SD_RESORT, const bool re_sort/*=false*/)) {
|
||||
TERN_(ADVANCED_PAUSE_FEATURE, did_pause_print = 0);
|
||||
TERN_(HAS_DWIN_E3V2_BASIC, HMI_flag.print_finish = flag.sdprinting);
|
||||
TERN_(DWIN_CREALITY_LCD, HMI_flag.print_finish = flag.sdprinting);
|
||||
flag.abort_sd_printing = false;
|
||||
if (isFileOpen()) file.close();
|
||||
TERN_(SD_RESORT, if (re_sort) presort());
|
||||
|
|
Loading…
Reference in a new issue