🚸 Update Ender3 V2/S1 Pro UI (#23878)
This commit is contained in:
parent
b045c91f26
commit
eabeac29fd
@ -822,7 +822,7 @@ void idle(bool no_stepper_sleep/*=false*/) {
|
|||||||
TERN_(USE_BEEPER, buzzer.tick());
|
TERN_(USE_BEEPER, buzzer.tick());
|
||||||
|
|
||||||
// Handle UI input / draw events
|
// Handle UI input / draw events
|
||||||
TERN(HAS_DWIN_E3V2_BASIC, DWIN_Update(), ui.update());
|
TERN(DWIN_CREALITY_LCD, DWIN_Update(), ui.update());
|
||||||
|
|
||||||
// Run i2c Position Encoders
|
// Run i2c Position Encoders
|
||||||
#if ENABLED(I2C_POSITION_ENCODERS)
|
#if ENABLED(I2C_POSITION_ENCODERS)
|
||||||
@ -1571,11 +1571,7 @@ void setup() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAS_DWIN_E3V2_BASIC
|
#if HAS_DWIN_E3V2_BASIC
|
||||||
SETUP_LOG("E3V2 Init");
|
SETUP_RUN(DWIN_InitScreen());
|
||||||
Encoder_Configuration();
|
|
||||||
HMI_Init();
|
|
||||||
HMI_SetLanguageCache();
|
|
||||||
HMI_StartFrame(true);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAS_SERVICE_INTERVALS && !HAS_DWIN_E3V2_BASIC
|
#if HAS_SERVICE_INTERVALS && !HAS_DWIN_E3V2_BASIC
|
||||||
|
@ -407,6 +407,7 @@ bool pause_print(const_float_t retract, const xyz_pos_t &park_point, const bool
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_open(PROMPT_INFO, F("Pause"), FPSTR(DISMISS_STR)));
|
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
|
// Indicate that the printer is paused
|
||||||
++did_pause_print;
|
++did_pause_print;
|
||||||
@ -709,7 +710,7 @@ void resume_print(const_float_t slow_load_length/*=0*/, const_float_t fast_load_
|
|||||||
|
|
||||||
TERN_(HAS_FILAMENT_SENSOR, runout.reset());
|
TERN_(HAS_FILAMENT_SENSOR, runout.reset());
|
||||||
|
|
||||||
TERN_(HAS_STATUS_MESSAGE, ui.reset_status());
|
TERN(DWIN_LCD_PROUI, DWIN_Print_Resume(), ui.reset_status());
|
||||||
TERN_(HAS_MARLINUI_MENU, ui.return_to_status());
|
TERN_(HAS_MARLINUI_MENU, ui.return_to_status());
|
||||||
TERN_(DWIN_LCD_PROUI, HMI_ReturnScreen());
|
TERN_(DWIN_LCD_PROUI, HMI_ReturnScreen());
|
||||||
}
|
}
|
||||||
|
@ -105,6 +105,7 @@ void GcodeSuite::G29() {
|
|||||||
if (!ui.wait_for_move) {
|
if (!ui.wait_for_move) {
|
||||||
queue.inject(parser.seen_test('N') ? F("G28" TERN(CAN_SET_LEVELING_AFTER_G28, "L0", "") "\nG29S2") : F("G29S2"));
|
queue.inject(parser.seen_test('N') ? F("G28" TERN(CAN_SET_LEVELING_AFTER_G28, "L0", "") "\nG29S2") : F("G29S2"));
|
||||||
TERN_(EXTENSIBLE_UI, ExtUI::onMeshLevelingStart());
|
TERN_(EXTENSIBLE_UI, ExtUI::onMeshLevelingStart());
|
||||||
|
TERN_(DWIN_LCD_PROUI, DWIN_MeshLevelingStart());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
state = MeshNext;
|
state = MeshNext;
|
||||||
@ -127,6 +128,7 @@ void GcodeSuite::G29() {
|
|||||||
// Save Z for the previous mesh position
|
// Save Z for the previous mesh position
|
||||||
mbl.set_zigzag_z(mbl_probe_index - 1, current_position.z);
|
mbl.set_zigzag_z(mbl_probe_index - 1, current_position.z);
|
||||||
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(ix, iy, current_position.z));
|
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(ix, iy, current_position.z));
|
||||||
|
TERN_(DWIN_LCD_PROUI, DWIN_MeshUpdate(_MIN(mbl_probe_index, GRID_MAX_POINTS), int(GRID_MAX_POINTS), current_position.z));
|
||||||
SET_SOFT_ENDSTOP_LOOSE(false);
|
SET_SOFT_ENDSTOP_LOOSE(false);
|
||||||
}
|
}
|
||||||
// If there's another point to sample, move there with optional lift.
|
// If there's another point to sample, move there with optional lift.
|
||||||
|
@ -27,6 +27,10 @@
|
|||||||
#include "../gcode.h"
|
#include "../gcode.h"
|
||||||
#include "../../module/temperature.h"
|
#include "../../module/temperature.h"
|
||||||
|
|
||||||
|
#if ENABLED(DWIN_LCD_PROUI)
|
||||||
|
#include "../../lcd/e3v2/proui/dwin_defines.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* M302: Allow cold extrudes, or set the minimum extrude temperature
|
* M302: Allow cold extrudes, or set the minimum extrude temperature
|
||||||
*
|
*
|
||||||
@ -47,6 +51,7 @@ void GcodeSuite::M302() {
|
|||||||
if (seen_S) {
|
if (seen_S) {
|
||||||
thermalManager.extrude_min_temp = parser.value_celsius();
|
thermalManager.extrude_min_temp = parser.value_celsius();
|
||||||
thermalManager.allow_cold_extrude = (thermalManager.extrude_min_temp == 0);
|
thermalManager.allow_cold_extrude = (thermalManager.extrude_min_temp == 0);
|
||||||
|
TERN_(DWIN_LCD_PROUI, HMI_data.ExtMinT = thermalManager.extrude_min_temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parser.seen('P'))
|
if (parser.seen('P'))
|
||||||
|
@ -27,15 +27,27 @@
|
|||||||
#include "../gcode.h"
|
#include "../gcode.h"
|
||||||
#include "../../sd/cardreader.h"
|
#include "../../sd/cardreader.h"
|
||||||
|
|
||||||
|
#if ENABLED(DWIN_LCD_PROUI)
|
||||||
|
#include "../../lcd/e3v2/proui/dwin.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* M524: Abort the current SD print job (started with M24)
|
* M524: Abort the current SD print job (started with M24)
|
||||||
*/
|
*/
|
||||||
void GcodeSuite::M524() {
|
void GcodeSuite::M524() {
|
||||||
|
|
||||||
if (IS_SD_PRINTING())
|
#if ENABLED(DWIN_LCD_PROUI)
|
||||||
card.abortFilePrintSoon();
|
|
||||||
else if (card.isMounted())
|
HMI_flag.abort_flag = true; // The LCD will handle it
|
||||||
card.closefile();
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
if (IS_SD_PRINTING())
|
||||||
|
card.abortFilePrintSoon();
|
||||||
|
else if (card.isMounted())
|
||||||
|
card.closefile();
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,8 +39,8 @@
|
|||||||
void GcodeSuite::M75() {
|
void GcodeSuite::M75() {
|
||||||
startOrResumeJob();
|
startOrResumeJob();
|
||||||
#if ENABLED(DWIN_LCD_PROUI)
|
#if ENABLED(DWIN_LCD_PROUI)
|
||||||
DWIN_Print_Header(parser.string_arg && parser.string_arg[0] ? parser.string_arg : GET_TEXT(MSG_HOST_START_PRINT));
|
|
||||||
DWIN_Print_Started(false);
|
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
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,6 +50,7 @@ void GcodeSuite::M75() {
|
|||||||
void GcodeSuite::M76() {
|
void GcodeSuite::M76() {
|
||||||
print_job_timer.pause();
|
print_job_timer.pause();
|
||||||
TERN_(HOST_PAUSE_M76, hostui.pause());
|
TERN_(HOST_PAUSE_M76, hostui.pause());
|
||||||
|
TERN_(DWIN_LCD_PROUI, DWIN_Print_Pause());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -479,6 +479,9 @@
|
|||||||
#if EITHER(HAS_DWIN_E3V2_BASIC, DWIN_CREALITY_LCD_JYERSUI)
|
#if EITHER(HAS_DWIN_E3V2_BASIC, DWIN_CREALITY_LCD_JYERSUI)
|
||||||
#define HAS_DWIN_E3V2 1
|
#define HAS_DWIN_E3V2 1
|
||||||
#endif
|
#endif
|
||||||
|
#if ENABLED(DWIN_LCD_PROUI)
|
||||||
|
#define DO_LIST_BIN_FILES 1
|
||||||
|
#endif
|
||||||
|
|
||||||
// E3V2 extras
|
// E3V2 extras
|
||||||
#if HAS_DWIN_E3V2 || IS_DWIN_MARLINUI
|
#if HAS_DWIN_E3V2 || IS_DWIN_MARLINUI
|
||||||
@ -513,7 +516,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ANY(HAS_WIRED_LCD, EXTENSIBLE_UI, DWIN_CREALITY_LCD_JYERSUI)
|
#if ANY(HAS_WIRED_LCD, EXTENSIBLE_UI, DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI)
|
||||||
#define HAS_DISPLAY 1
|
#define HAS_DISPLAY 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -45,12 +45,32 @@ typedef enum {
|
|||||||
ENCODER_DIFF_ENTER = 3 // click
|
ENCODER_DIFF_ENTER = 3 // click
|
||||||
} EncoderState;
|
} EncoderState;
|
||||||
|
|
||||||
|
#define ENCODER_WAIT_MS 20
|
||||||
|
|
||||||
// Encoder initialization
|
// Encoder initialization
|
||||||
void Encoder_Configuration();
|
void Encoder_Configuration();
|
||||||
|
|
||||||
// Analyze encoder value and return state
|
// Analyze encoder value and return state
|
||||||
EncoderState Encoder_ReceiveAnalyze();
|
EncoderState Encoder_ReceiveAnalyze();
|
||||||
|
|
||||||
|
inline EncoderState get_encoder_state() {
|
||||||
|
static millis_t Encoder_ms = 0;
|
||||||
|
const millis_t ms = millis();
|
||||||
|
if (PENDING(ms, Encoder_ms)) return ENCODER_DIFF_NO;
|
||||||
|
const EncoderState state = Encoder_ReceiveAnalyze();
|
||||||
|
if (state != ENCODER_DIFF_NO) Encoder_ms = ms + ENCODER_WAIT_MS;
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
inline bool Apply_Encoder(const EncoderState &encoder_diffState, T &valref) {
|
||||||
|
if (encoder_diffState == ENCODER_DIFF_CW)
|
||||||
|
valref += EncoderRate.encoderMoveValue;
|
||||||
|
else if (encoder_diffState == ENCODER_DIFF_CCW)
|
||||||
|
valref -= EncoderRate.encoderMoveValue;
|
||||||
|
return encoder_diffState == ENCODER_DIFF_ENTER;
|
||||||
|
}
|
||||||
|
|
||||||
/*********************** Encoder LED ***********************/
|
/*********************** Encoder LED ***********************/
|
||||||
|
|
||||||
#if PIN_EXISTS(LCD_LED)
|
#if PIN_EXISTS(LCD_LED)
|
||||||
|
@ -471,15 +471,6 @@ void Draw_Back_First(const bool is_sel=true) {
|
|||||||
if (is_sel) Draw_Menu_Cursor(0);
|
if (is_sel) Draw_Menu_Cursor(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
inline bool Apply_Encoder(const EncoderState &encoder_diffState, T &valref) {
|
|
||||||
if (encoder_diffState == ENCODER_DIFF_CW)
|
|
||||||
valref += EncoderRate.encoderMoveValue;
|
|
||||||
else if (encoder_diffState == ENCODER_DIFF_CCW)
|
|
||||||
valref -= EncoderRate.encoderMoveValue;
|
|
||||||
return encoder_diffState == ENCODER_DIFF_ENTER;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Draw Menus
|
// Draw Menus
|
||||||
//
|
//
|
||||||
@ -1296,15 +1287,6 @@ void Goto_MainMenu() {
|
|||||||
TERN(HAS_ONESTEP_LEVELING, ICON_Leveling, ICON_StartInfo)();
|
TERN(HAS_ONESTEP_LEVELING, ICON_Leveling, ICON_StartInfo)();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline EncoderState get_encoder_state() {
|
|
||||||
static millis_t Encoder_ms = 0;
|
|
||||||
const millis_t ms = millis();
|
|
||||||
if (PENDING(ms, Encoder_ms)) return ENCODER_DIFF_NO;
|
|
||||||
const EncoderState state = Encoder_ReceiveAnalyze();
|
|
||||||
if (state != ENCODER_DIFF_NO) Encoder_ms = ms + ENCODER_WAIT_MS;
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
|
|
||||||
void HMI_Plan_Move(const feedRate_t fr_mm_s) {
|
void HMI_Plan_Move(const feedRate_t fr_mm_s) {
|
||||||
if (!planner.is_full()) {
|
if (!planner.is_full()) {
|
||||||
planner.synchronize();
|
planner.synchronize();
|
||||||
@ -4086,6 +4068,13 @@ void HMI_Init() {
|
|||||||
HMI_SetLanguage();
|
HMI_SetLanguage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DWIN_InitScreen() {
|
||||||
|
Encoder_Configuration();
|
||||||
|
HMI_Init();
|
||||||
|
HMI_SetLanguageCache();
|
||||||
|
HMI_StartFrame(true);
|
||||||
|
}
|
||||||
|
|
||||||
void DWIN_Update() {
|
void DWIN_Update() {
|
||||||
EachMomentUpdate(); // Status update
|
EachMomentUpdate(); // Status update
|
||||||
HMI_SDCardUpdate(); // SD card update
|
HMI_SDCardUpdate(); // SD card update
|
||||||
|
@ -236,6 +236,7 @@ void HMI_MaxJerk(); // Maximum jerk speed submenu
|
|||||||
void HMI_Step(); // Transmission ratio
|
void HMI_Step(); // Transmission ratio
|
||||||
|
|
||||||
void HMI_Init();
|
void HMI_Init();
|
||||||
|
void DWIN_InitScreen();
|
||||||
void DWIN_Update();
|
void DWIN_Update();
|
||||||
void EachMomentUpdate();
|
void EachMomentUpdate();
|
||||||
void DWIN_HandleScreen();
|
void DWIN_HandleScreen();
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -22,32 +22,18 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enhanced DWIN implementation
|
* DWIN Enhanced implementation for PRO UI
|
||||||
* Author: Miguel A. Risco-Castillo (MRISCOC)
|
* Author: Miguel A. Risco-Castillo (MRISCOC)
|
||||||
* Version: 3.9.2
|
* Version: 3.15.2
|
||||||
* date: 2021/11/21
|
* Date: 2022/03/01
|
||||||
*
|
|
||||||
* Based on the original code provided by Creality under GPL
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../../../inc/MarlinConfigPre.h"
|
#include "dwin_defines.h"
|
||||||
#include "dwinui.h"
|
#include "dwinui.h"
|
||||||
#include "../common/encoder.h"
|
#include "../common/encoder.h"
|
||||||
#include "../../../libs/BL24CXX.h"
|
#include "../../../libs/BL24CXX.h"
|
||||||
|
|
||||||
#if ANY(AUTO_BED_LEVELING_BILINEAR, AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_3POINT) && DISABLED(PROBE_MANUALLY)
|
#include "../../../inc/MarlinConfig.h"
|
||||||
#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
|
|
||||||
|
|
||||||
#include "dwin_defines.h"
|
|
||||||
|
|
||||||
enum processID : uint8_t {
|
enum processID : uint8_t {
|
||||||
// Process ID
|
// Process ID
|
||||||
@ -60,23 +46,16 @@ enum processID : uint8_t {
|
|||||||
SetPFloat,
|
SetPFloat,
|
||||||
SelectFile,
|
SelectFile,
|
||||||
PrintProcess,
|
PrintProcess,
|
||||||
PrintDone,
|
Popup,
|
||||||
PwrlossRec,
|
|
||||||
Reboot,
|
|
||||||
Info,
|
|
||||||
ConfirmToPrint,
|
|
||||||
|
|
||||||
// Popup Windows
|
|
||||||
Homing,
|
|
||||||
Leveling,
|
Leveling,
|
||||||
PidProcess,
|
|
||||||
ESDiagProcess,
|
|
||||||
PrintStatsProcess,
|
|
||||||
PauseOrStop,
|
|
||||||
FilamentPurge,
|
|
||||||
WaitResponse,
|
|
||||||
Locked,
|
Locked,
|
||||||
NothingToDo,
|
Reboot,
|
||||||
|
PrintDone,
|
||||||
|
ESDiagProcess,
|
||||||
|
WaitResponse,
|
||||||
|
Homing,
|
||||||
|
PidProcess,
|
||||||
|
NothingToDo
|
||||||
};
|
};
|
||||||
|
|
||||||
enum pidresult_t : uint8_t {
|
enum pidresult_t : uint8_t {
|
||||||
@ -93,24 +72,18 @@ enum pidresult_t : uint8_t {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int8_t Color[3]; // Color components
|
int8_t Color[3]; // Color components
|
||||||
uint16_t pidgrphpoints = 0;
|
|
||||||
pidresult_t pidresult = PID_DONE;
|
pidresult_t pidresult = PID_DONE;
|
||||||
int8_t Preheat = 0; // Material Select 0: PLA, 1: ABS, 2: Custom
|
int8_t Preheat = 0; // Material Select 0: PLA, 1: ABS, 2: Custom
|
||||||
AxisEnum axis = X_AXIS; // Axis Select
|
AxisEnum axis = X_AXIS; // Axis Select
|
||||||
int32_t MaxValue = 0; // Auxiliar max integer/scaled float value
|
|
||||||
int32_t MinValue = 0; // Auxiliar min integer/scaled float value
|
|
||||||
int8_t dp = 0; // Auxiliar decimal places
|
|
||||||
int32_t Value = 0; // Auxiliar integer / scaled float value
|
|
||||||
int16_t *P_Int = nullptr; // Auxiliar pointer to 16 bit integer variable
|
|
||||||
float *P_Float = nullptr; // Auxiliar pointer to float variable
|
|
||||||
void (*Apply)() = nullptr; // Auxiliar apply function
|
|
||||||
void (*LiveUpdate)() = nullptr; // Auxiliar live update function
|
|
||||||
} HMI_value_t;
|
} HMI_value_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t language;
|
uint8_t language;
|
||||||
|
bool remain_flag:1; // remain was override by M73
|
||||||
bool pause_flag:1; // printing is paused
|
bool pause_flag:1; // printing is paused
|
||||||
bool pause_action:1; // flag a pause action
|
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 print_finish:1; // print was finished
|
||||||
bool select_flag:1; // Popup button selected
|
bool select_flag:1; // Popup button selected
|
||||||
bool home_flag:1; // homing in course
|
bool home_flag:1; // homing in course
|
||||||
@ -126,9 +99,6 @@ extern millis_t dwin_heat_time;
|
|||||||
#if HAS_HOTEND || HAS_HEATED_BED
|
#if HAS_HOTEND || HAS_HEATED_BED
|
||||||
void DWIN_Popup_Temperature(const bool toohigh);
|
void DWIN_Popup_Temperature(const bool toohigh);
|
||||||
#endif
|
#endif
|
||||||
#if HAS_HOTEND
|
|
||||||
void Popup_Window_ETempTooLow();
|
|
||||||
#endif
|
|
||||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||||
void Popup_PowerLossRecovery();
|
void Popup_PowerLossRecovery();
|
||||||
#endif
|
#endif
|
||||||
@ -143,50 +113,64 @@ void Goto_Main_Menu();
|
|||||||
void Goto_Info_Menu();
|
void Goto_Info_Menu();
|
||||||
void Goto_PowerLossRecovery();
|
void Goto_PowerLossRecovery();
|
||||||
void Goto_ConfirmToPrint();
|
void Goto_ConfirmToPrint();
|
||||||
void Draw_Status_Area(const bool with_update); // Status Area
|
void DWIN_Draw_Dashboard(const bool with_update); // Status Area
|
||||||
void Draw_Main_Area(); // Redraw main area;
|
void Draw_Main_Area(); // Redraw main area;
|
||||||
void DWIN_Redraw_screen(); // Redraw all screen elements
|
void DWIN_Redraw_screen(); // Redraw all screen elements
|
||||||
void HMI_StartFrame(const bool with_update); // Prepare the menu view
|
|
||||||
void HMI_MainMenu(); // Main process screen
|
void HMI_MainMenu(); // Main process screen
|
||||||
void HMI_SelectFile(); // File page
|
void HMI_SelectFile(); // File page
|
||||||
void HMI_Printing(); // Print page
|
void HMI_Printing(); // Print page
|
||||||
void HMI_ReturnScreen(); // Return to previous screen before popups
|
void HMI_ReturnScreen(); // Return to previous screen before popups
|
||||||
void ApplyExtMinT();
|
void ApplyExtMinT();
|
||||||
void HMI_SetLanguageCache(); // Set the languaje image cache
|
void HMI_SetLanguageCache(); // Set the languaje image cache
|
||||||
|
void RebootPrinter();
|
||||||
|
#if ENABLED(BAUD_RATE_GCODE)
|
||||||
|
void HMI_SetBaudRate();
|
||||||
|
void SetBaud115K();
|
||||||
|
void SetBaud250K();
|
||||||
|
#endif
|
||||||
|
#if ENABLED(EEPROM_SETTINGS)
|
||||||
|
void WriteEeprom();
|
||||||
|
void ReadEeprom();
|
||||||
|
void ResetEeprom();
|
||||||
|
#endif
|
||||||
|
|
||||||
void HMI_Init();
|
void HMI_WaitForUser();
|
||||||
void HMI_Popup();
|
|
||||||
void HMI_SaveProcessID(const uint8_t id);
|
void HMI_SaveProcessID(const uint8_t id);
|
||||||
void HMI_AudioFeedback(const bool success=true);
|
void HMI_AudioFeedback(const bool success=true);
|
||||||
void EachMomentUpdate();
|
void EachMomentUpdate();
|
||||||
void update_variable();
|
void update_variable();
|
||||||
|
void DWIN_InitScreen();
|
||||||
void DWIN_HandleScreen();
|
void DWIN_HandleScreen();
|
||||||
void DWIN_Update();
|
|
||||||
void DWIN_CheckStatusMessage();
|
void DWIN_CheckStatusMessage();
|
||||||
void DWIN_StartHoming();
|
void DWIN_StartHoming();
|
||||||
void DWIN_CompletedHoming();
|
void DWIN_CompletedHoming();
|
||||||
#if HAS_MESH
|
#if HAS_MESH
|
||||||
void DWIN_MeshUpdate(const int8_t xpos, const int8_t ypos, const float zval);
|
void DWIN_MeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval);
|
||||||
#endif
|
#endif
|
||||||
void DWIN_MeshLevelingStart();
|
void DWIN_MeshLevelingStart();
|
||||||
void DWIN_CompletedLeveling();
|
void DWIN_CompletedLeveling();
|
||||||
void DWIN_PidTuning(pidresult_t result);
|
void DWIN_PidTuning(pidresult_t result);
|
||||||
void DWIN_Print_Started(const bool sd = false);
|
void DWIN_Print_Started(const bool sd=false);
|
||||||
|
void DWIN_Print_Pause();
|
||||||
|
void DWIN_Print_Resume();
|
||||||
void DWIN_Print_Finished();
|
void DWIN_Print_Finished();
|
||||||
|
void DWIN_Print_Aborted();
|
||||||
#if HAS_FILAMENT_SENSOR
|
#if HAS_FILAMENT_SENSOR
|
||||||
void DWIN_FilamentRunout(const uint8_t extruder);
|
void DWIN_FilamentRunout(const uint8_t extruder);
|
||||||
#endif
|
#endif
|
||||||
void DWIN_Progress_Update();
|
void DWIN_Progress_Update();
|
||||||
void DWIN_Print_Header(const char *text);
|
void DWIN_Print_Header(const char *text);
|
||||||
void DWIN_SetColorDefaults();
|
void DWIN_SetColorDefaults();
|
||||||
|
void DWIN_ApplyColor();
|
||||||
void DWIN_StoreSettings(char *buff);
|
void DWIN_StoreSettings(char *buff);
|
||||||
void DWIN_LoadSettings(const char *buff);
|
void DWIN_LoadSettings(const char *buff);
|
||||||
void DWIN_SetDataDefaults();
|
void DWIN_SetDataDefaults();
|
||||||
void DWIN_RebootScreen();
|
void DWIN_RebootScreen();
|
||||||
|
|
||||||
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
||||||
|
void DWIN_Popup_Pause(FSTR_P const fmsg, uint8_t button=0);
|
||||||
void Draw_Popup_FilamentPurge();
|
void Draw_Popup_FilamentPurge();
|
||||||
void DWIN_Popup_FilamentPurge();
|
void Goto_FilamentPurge();
|
||||||
void HMI_FilamentPurge();
|
void HMI_FilamentPurge();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -207,14 +191,6 @@ void HMI_LockScreen();
|
|||||||
void Draw_PrintStats();
|
void Draw_PrintStats();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// HMI user control functions
|
|
||||||
void HMI_Menu();
|
|
||||||
void HMI_SetInt();
|
|
||||||
void HMI_SetPInt();
|
|
||||||
void HMI_SetIntNoDraw();
|
|
||||||
void HMI_SetFloat();
|
|
||||||
void HMI_SetPFloat();
|
|
||||||
|
|
||||||
// Menu drawing functions
|
// Menu drawing functions
|
||||||
void Draw_Control_Menu();
|
void Draw_Control_Menu();
|
||||||
void Draw_AdvancedSettings_Menu();
|
void Draw_AdvancedSettings_Menu();
|
||||||
|
@ -22,18 +22,37 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DWIN general defines and data structs
|
* DWIN general defines and data structs for PRO UI
|
||||||
* Author: Miguel A. Risco-Castillo (MRISCOC)
|
* Author: Miguel A. Risco-Castillo (MRISCOC)
|
||||||
* Version: 3.9.2
|
* Version: 3.11.2
|
||||||
* Date: 2021/11/21
|
* Date: 2022/02/28
|
||||||
*
|
|
||||||
* Based on the original code provided by Creality under GPL
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//#define NEED_HEX_PRINT 1
|
|
||||||
//#define DEBUG_DWIN 1
|
//#define DEBUG_DWIN 1
|
||||||
|
//#define NEED_HEX_PRINT 1
|
||||||
|
|
||||||
|
#include "../../../inc/MarlinConfigPre.h"
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
#if DISABLED(INDIVIDUAL_AXIS_HOMING_SUBMENU)
|
||||||
|
#error "INDIVIDUAL_AXIS_HOMING_SUBMENU is required with ProUI."
|
||||||
|
#endif
|
||||||
|
#if DISABLED(LCD_SET_PROGRESS_MANUALLY)
|
||||||
|
#error "LCD_SET_PROGRESS_MANUALLY is required with ProUI."
|
||||||
|
#endif
|
||||||
|
#if DISABLED(STATUS_MESSAGE_SCROLLING)
|
||||||
|
#error "STATUS_MESSAGE_SCROLLING is required with ProUI."
|
||||||
|
#endif
|
||||||
|
#if DISABLED(BAUD_RATE_GCODE)
|
||||||
|
#error "BAUD_RATE_GCODE is required with ProUI."
|
||||||
|
#endif
|
||||||
|
#if DISABLED(SOUND_MENU_ITEM)
|
||||||
|
#error "SOUND_MENU_ITEM is required with ProUI."
|
||||||
|
#endif
|
||||||
|
#if DISABLED(PRINTCOUNTER)
|
||||||
|
#error "PRINTCOUNTER is required with ProUI."
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "../../../core/types.h"
|
|
||||||
#include "../common/dwin_color.h"
|
#include "../common/dwin_color.h"
|
||||||
#if ENABLED(LED_CONTROL_MENU)
|
#if ENABLED(LED_CONTROL_MENU)
|
||||||
#include "../../../feature/leds/leds.h"
|
#include "../../../feature/leds/leds.h"
|
||||||
@ -57,8 +76,8 @@
|
|||||||
#define Def_Barfill_Color BarFill_Color
|
#define Def_Barfill_Color BarFill_Color
|
||||||
#define Def_Indicator_Color Color_White
|
#define Def_Indicator_Color Color_White
|
||||||
#define Def_Coordinate_Color Color_White
|
#define Def_Coordinate_Color Color_White
|
||||||
|
#define Def_Button_Color RGB( 0, 23, 16)
|
||||||
|
|
||||||
//#define HAS_GCODE_PREVIEW 1
|
|
||||||
#define HAS_ESDIAG 1
|
#define HAS_ESDIAG 1
|
||||||
|
|
||||||
#if ENABLED(LED_CONTROL_MENU, HAS_COLOR_LEDS)
|
#if ENABLED(LED_CONTROL_MENU, HAS_COLOR_LEDS)
|
||||||
@ -101,6 +120,9 @@ typedef struct {
|
|||||||
#if ENABLED(PREVENT_COLD_EXTRUSION)
|
#if ENABLED(PREVENT_COLD_EXTRUSION)
|
||||||
int16_t ExtMinT = EXTRUDE_MINTEMP;
|
int16_t ExtMinT = EXTRUDE_MINTEMP;
|
||||||
#endif
|
#endif
|
||||||
|
int16_t BedLevT = PREHEAT_1_TEMP_BED;
|
||||||
|
TERN_(BAUD_RATE_GCODE, bool Baud115K = false);
|
||||||
|
bool FullManualTramming = false;
|
||||||
// Led
|
// Led
|
||||||
#if BOTH(LED_CONTROL_MENU, HAS_COLOR_LEDS)
|
#if BOTH(LED_CONTROL_MENU, HAS_COLOR_LEDS)
|
||||||
LEDColor Led_Color = Def_Leds_Color;
|
LEDColor Led_Color = Def_Leds_Color;
|
||||||
@ -113,3 +135,8 @@ typedef struct {
|
|||||||
|
|
||||||
static constexpr size_t eeprom_data_size = 64;
|
static constexpr size_t eeprom_data_size = 64;
|
||||||
extern HMI_data_t HMI_data;
|
extern HMI_data_t HMI_data;
|
||||||
|
|
||||||
|
#if PREHEAT_1_TEMP_BED
|
||||||
|
#undef LEVELING_BED_TEMP
|
||||||
|
#define LEVELING_BED_TEMP HMI_data.BedLevT
|
||||||
|
#endif
|
||||||
|
@ -21,12 +21,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DWIN UI Enhanced implementation
|
* DWIN Enhanced implementation for PRO UI
|
||||||
* Author: Miguel A. Risco-Castillo (MRISCOC)
|
* Author: Miguel A. Risco-Castillo (MRISCOC)
|
||||||
* Version: 3.8.1
|
* Version: 3.9.1
|
||||||
* Date: 2021/11/09
|
* Date: 2022/02/08
|
||||||
*
|
|
||||||
* Based on the original code provided by Creality under GPL
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../../../inc/MarlinConfigPre.h"
|
#include "../../../inc/MarlinConfigPre.h"
|
||||||
@ -37,6 +35,54 @@
|
|||||||
|
|
||||||
#include "dwin_lcd.h"
|
#include "dwin_lcd.h"
|
||||||
|
|
||||||
|
/*---------------------------------------- Numeric related functions ----------------------------------------*/
|
||||||
|
|
||||||
|
// Draw a numeric value
|
||||||
|
// bShow: true=display background color; false=don't display background color
|
||||||
|
// zeroFill: true=zero fill; false=no zero fill
|
||||||
|
// signedMode: 1=signed; 0=unsigned
|
||||||
|
// zeroMode: 1=leading 0 displayed as 0; 0=leading 0 displayed as a space
|
||||||
|
// size: Font size
|
||||||
|
// color: Character color
|
||||||
|
// bColor: Background color
|
||||||
|
// iNum: Number of digits
|
||||||
|
// fNum: Number of decimal digits
|
||||||
|
// x/y: Upper-left coordinate
|
||||||
|
// value: Integer value
|
||||||
|
void DWIN_Draw_Value(uint8_t bShow, bool signedMode, bool zeroFill, uint8_t zeroMode, uint8_t size, uint16_t color,
|
||||||
|
uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, int32_t value) {
|
||||||
|
size_t i = 0;
|
||||||
|
DWIN_Byte(i, 0x14);
|
||||||
|
// Bit 7: bshow
|
||||||
|
// Bit 6: 1 = signed; 0 = unsigned number;
|
||||||
|
// Bit 5: zeroFill
|
||||||
|
// Bit 4: zeroMode
|
||||||
|
// Bit 3-0: size
|
||||||
|
DWIN_Byte(i, (bShow * 0x80) | (signedMode * 0x40) | (zeroFill * 0x20) | (zeroMode * 0x10) | size);
|
||||||
|
DWIN_Word(i, color);
|
||||||
|
DWIN_Word(i, bColor);
|
||||||
|
DWIN_Byte(i, signedMode && (value >= 0) ? iNum + 1 : iNum);
|
||||||
|
DWIN_Byte(i, fNum);
|
||||||
|
DWIN_Word(i, x);
|
||||||
|
DWIN_Word(i, y);
|
||||||
|
// Write a big-endian 64 bit integer
|
||||||
|
const size_t p = i + 1;
|
||||||
|
for (size_t count = 8; count--;) { // 7..0
|
||||||
|
++i;
|
||||||
|
DWIN_SendBuf[p + count] = value;
|
||||||
|
value >>= 8;
|
||||||
|
}
|
||||||
|
DWIN_Send(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw a numeric value
|
||||||
|
// value: positive unscaled float value
|
||||||
|
void DWIN_Draw_Value(uint8_t bShow, bool signedMode, bool zeroFill, uint8_t zeroMode, uint8_t size, uint16_t color,
|
||||||
|
uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
|
||||||
|
const int32_t val = round(value * POW(10, fNum));
|
||||||
|
DWIN_Draw_Value(bShow, signedMode, zeroFill, zeroMode, size, color, bColor, iNum, fNum, x, y, val);
|
||||||
|
}
|
||||||
|
|
||||||
/*---------------------------------------- Picture related functions ----------------------------------------*/
|
/*---------------------------------------- Picture related functions ----------------------------------------*/
|
||||||
|
|
||||||
// Display QR code
|
// Display QR code
|
||||||
|
@ -22,16 +22,32 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DWIN UI Enhanced implementation
|
* DWIN Enhanced implementation for PRO UI
|
||||||
* Author: Miguel A. Risco-Castillo (MRISCOC)
|
* Author: Miguel A. Risco-Castillo (MRISCOC)
|
||||||
* Version: 3.8.1
|
* Version: 3.9.1
|
||||||
* Date: 2021/11/09
|
* Date: 2022/02/08
|
||||||
*
|
|
||||||
* Based on the original code provided by Creality under GPL
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../common/dwin_api.h"
|
#include "../common/dwin_api.h"
|
||||||
|
|
||||||
|
// Draw a numeric value
|
||||||
|
// bShow: true=display background color; false=don't display background color
|
||||||
|
// zeroFill: true=zero fill; false=no zero fill
|
||||||
|
// signedMode: 1=signed; 0=unsigned
|
||||||
|
// zeroMode: 1=leading 0 displayed as 0; 0=leading 0 displayed as a space
|
||||||
|
// size: Font size
|
||||||
|
// color: Character color
|
||||||
|
// bColor: Background color
|
||||||
|
// iNum: Number of digits
|
||||||
|
// fNum: Number of decimal digits
|
||||||
|
// x/y: Upper-left coordinate
|
||||||
|
// value: Integer value
|
||||||
|
void DWIN_Draw_Value(uint8_t bShow, bool signedMode, bool zeroFill, uint8_t zeroMode, uint8_t size, uint16_t color,
|
||||||
|
uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, int32_t value);
|
||||||
|
// value: positive unscaled float value
|
||||||
|
void DWIN_Draw_Value(uint8_t bShow, bool signedMode, bool zeroFill, uint8_t zeroMode, uint8_t size, uint16_t color,
|
||||||
|
uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value);
|
||||||
|
|
||||||
// Display QR code
|
// Display QR code
|
||||||
// The size of the QR code is (46*QR_Pixel)*(46*QR_Pixel) dot matrix
|
// The size of the QR code is (46*QR_Pixel)*(46*QR_Pixel) dot matrix
|
||||||
// QR_Pixel: The pixel size occupied by each point of the QR code: 0x01-0x0F (1-16)
|
// QR_Pixel: The pixel size occupied by each point of the QR code: 0x01-0x0F (1-16)
|
||||||
|
@ -21,12 +21,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DWIN UI Enhanced implementation
|
* DWIN Enhanced implementation for PRO UI
|
||||||
* Author: Miguel A. Risco-Castillo (MRISCOC)
|
* Author: Miguel A. Risco-Castillo (MRISCOC)
|
||||||
* Version: 3.10.1
|
* Version: 3.11.1
|
||||||
* Date: 2022/01/21
|
* Date: 2022/02/28
|
||||||
*
|
|
||||||
* Based on the original code provided by Creality under GPL
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../../../inc/MarlinConfigPre.h"
|
#include "../../../inc/MarlinConfigPre.h"
|
||||||
@ -34,30 +32,64 @@
|
|||||||
#if ENABLED(DWIN_LCD_PROUI)
|
#if ENABLED(DWIN_LCD_PROUI)
|
||||||
|
|
||||||
#include "dwin.h"
|
#include "dwin.h"
|
||||||
|
#include "dwinui.h"
|
||||||
#include "dwin_popup.h"
|
#include "dwin_popup.h"
|
||||||
|
|
||||||
void Draw_Select_Highlight(const bool sel) {
|
#include "../../../MarlinCore.h" // for wait_for_user
|
||||||
|
|
||||||
|
popupDrawFunc_t popupDraw = nullptr;
|
||||||
|
popupClickFunc_t popupClick = nullptr;
|
||||||
|
popupChangeFunc_t popupChange = nullptr;
|
||||||
|
|
||||||
|
uint16_t HighlightYPos = 280;
|
||||||
|
|
||||||
|
void Draw_Select_Highlight(const bool sel, const uint16_t ypos) {
|
||||||
|
HighlightYPos = ypos;
|
||||||
HMI_flag.select_flag = sel;
|
HMI_flag.select_flag = sel;
|
||||||
const uint16_t c1 = sel ? HMI_data.Highlight_Color : HMI_data.PopupBg_color,
|
const uint16_t c1 = sel ? HMI_data.Highlight_Color : HMI_data.PopupBg_color,
|
||||||
c2 = sel ? HMI_data.PopupBg_color : HMI_data.Highlight_Color;
|
c2 = sel ? HMI_data.PopupBg_color : HMI_data.Highlight_Color;
|
||||||
DWIN_Draw_Rectangle(0, c1, 25, 279, 126, 318);
|
DWIN_Draw_Rectangle(0, c1, 25, ypos - 1, 126, ypos + 38);
|
||||||
DWIN_Draw_Rectangle(0, c1, 24, 278, 127, 319);
|
DWIN_Draw_Rectangle(0, c1, 24, ypos - 2, 127, ypos + 39);
|
||||||
DWIN_Draw_Rectangle(0, c2, 145, 279, 246, 318);
|
DWIN_Draw_Rectangle(0, c2, 145, ypos - 1, 246, ypos + 38);
|
||||||
DWIN_Draw_Rectangle(0, c2, 144, 278, 247, 319);
|
DWIN_Draw_Rectangle(0, c2, 144, ypos - 2, 247, ypos + 39);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DWIN_Popup_Continue(const uint8_t icon, FSTR_P const fmsg1, FSTR_P const fmsg2) {
|
void DWIN_Popup_Continue(const uint8_t icon, FSTR_P const fmsg1, FSTR_P const fmsg2) {
|
||||||
HMI_SaveProcessID(WaitResponse);
|
HMI_SaveProcessID(WaitResponse);
|
||||||
DWIN_Draw_Popup(icon, fmsg1, fmsg2, ICON_Continue_E); // Button Continue
|
DWIN_Draw_Popup(icon, fmsg1, fmsg2, BTN_Continue); // Button Continue
|
||||||
DWIN_UpdateLCD();
|
DWIN_UpdateLCD();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DWIN_Popup_ConfirmCancel(const uint8_t icon, FSTR_P const fmsg2) {
|
void DWIN_Popup_ConfirmCancel(const uint8_t icon, FSTR_P const fmsg2) {
|
||||||
DWIN_Draw_Popup(ICON_BLTouch, F("Please confirm"), fmsg2);
|
DWIN_Draw_Popup(ICON_BLTouch, F("Please confirm"), fmsg2);
|
||||||
DWINUI::Draw_IconWB(ICON_Confirm_E, 26, 280);
|
DWINUI::Draw_Button(BTN_Confirm, 26, 280);
|
||||||
DWINUI::Draw_IconWB(ICON_Cancel_E, 146, 280);
|
DWINUI::Draw_Button(BTN_Cancel, 146, 280);
|
||||||
Draw_Select_Highlight(true);
|
Draw_Select_Highlight(HMI_flag.select_flag);
|
||||||
DWIN_UpdateLCD();
|
DWIN_UpdateLCD();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Goto_Popup(const popupDrawFunc_t fnDraw, const popupClickFunc_t fnClick/*=nullptr*/, const popupChangeFunc_t fnChange/*=nullptr*/) {
|
||||||
|
popupDraw = fnDraw;
|
||||||
|
popupClick = fnClick;
|
||||||
|
popupChange = fnChange;
|
||||||
|
HMI_SaveProcessID(Popup);
|
||||||
|
HMI_flag.select_flag = false;
|
||||||
|
popupDraw();
|
||||||
|
}
|
||||||
|
|
||||||
|
void HMI_Popup() {
|
||||||
|
if (!wait_for_user) {
|
||||||
|
if (popupClick) popupClick();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
EncoderState encoder_diffState = get_encoder_state();
|
||||||
|
if (encoder_diffState == ENCODER_DIFF_CW || encoder_diffState == ENCODER_DIFF_CCW) {
|
||||||
|
const bool change = encoder_diffState != ENCODER_DIFF_CW;
|
||||||
|
if (popupChange) popupChange(change); else Draw_Select_Highlight(change, HighlightYPos);
|
||||||
|
DWIN_UpdateLCD();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif // DWIN_LCD_PROUI
|
#endif // DWIN_LCD_PROUI
|
||||||
|
@ -22,20 +22,26 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DWIN UI Enhanced implementation
|
* DWIN Enhanced implementation for PRO UI
|
||||||
* Author: Miguel A. Risco-Castillo (MRISCOC)
|
* Author: Miguel A. Risco-Castillo (MRISCOC)
|
||||||
* Version: 3.10.1
|
* Version: 3.11.1
|
||||||
* Date: 2022/01/21
|
* Date: 2022/02/28
|
||||||
*
|
|
||||||
* Based on the original code provided by Creality under GPL
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "dwinui.h"
|
#include "dwinui.h"
|
||||||
#include "dwin.h"
|
#include "dwin.h"
|
||||||
|
|
||||||
// Popup windows
|
typedef void (*popupDrawFunc_t)();
|
||||||
|
typedef void (*popupClickFunc_t)();
|
||||||
|
typedef void (*popupChangeFunc_t)(const bool state);
|
||||||
|
extern popupDrawFunc_t popupDraw;
|
||||||
|
|
||||||
void Draw_Select_Highlight(const bool sel);
|
void Draw_Select_Highlight(const bool sel, const uint16_t ypos);
|
||||||
|
inline void Draw_Select_Highlight(const bool sel) { Draw_Select_Highlight(sel, 280); };
|
||||||
|
void DWIN_Popup_Continue(const uint8_t icon, FSTR_P const fmsg1, FSTR_P const fmsg2);
|
||||||
|
void DWIN_Popup_ConfirmCancel(const uint8_t icon, FSTR_P const fmsg2);
|
||||||
|
void Goto_Popup(const popupDrawFunc_t fnDraw, const popupClickFunc_t fnClick=nullptr, const popupChangeFunc_t fnChange=nullptr);
|
||||||
|
void HMI_Popup();
|
||||||
|
|
||||||
inline void Draw_Popup_Bkgd() {
|
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);
|
||||||
@ -49,7 +55,7 @@ void DWIN_Draw_Popup(const uint8_t icon, T amsg1=nullptr, U amsg2=nullptr, uint8
|
|||||||
if (icon) DWINUI::Draw_Icon(icon, 101, 105);
|
if (icon) DWINUI::Draw_Icon(icon, 101, 105);
|
||||||
if (amsg1) DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 210, amsg1);
|
if (amsg1) DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 210, amsg1);
|
||||||
if (amsg2) DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 240, amsg2);
|
if (amsg2) DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 240, amsg2);
|
||||||
if (button) DWINUI::Draw_IconWB(button, 86, 280);
|
if (button) DWINUI::Draw_Button(button, 86, 280);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T, typename U>
|
template<typename T, typename U>
|
||||||
@ -61,10 +67,7 @@ void DWIN_Show_Popup(const uint8_t icon, T amsg1=nullptr, U amsg2=nullptr, uint8
|
|||||||
template<typename T, typename U>
|
template<typename T, typename U>
|
||||||
void DWIN_Popup_Confirm(const uint8_t icon, T amsg1, U amsg2) {
|
void DWIN_Popup_Confirm(const uint8_t icon, T amsg1, U amsg2) {
|
||||||
HMI_SaveProcessID(WaitResponse);
|
HMI_SaveProcessID(WaitResponse);
|
||||||
DWIN_Draw_Popup(icon, amsg1, amsg2, ICON_Confirm_E); // Button Confirm
|
DWIN_Draw_Popup(icon, amsg1, amsg2, BTN_Confirm); // Button Confirm
|
||||||
DWIN_UpdateLCD();
|
DWIN_UpdateLCD();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DWIN_Popup_Continue(const uint8_t icon, FSTR_P const fmsg1, FSTR_P const fmsg2);
|
|
||||||
|
|
||||||
void DWIN_Popup_ConfirmCancel(const uint8_t icon, FSTR_P const fmsg2);
|
|
||||||
|
@ -21,12 +21,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DWIN UI Enhanced implementation
|
* DWIN Enhanced implementation for PRO UI
|
||||||
* Author: Miguel A. Risco-Castillo (MRISCOC)
|
* Author: Miguel A. Risco-Castillo (MRISCOC)
|
||||||
* Version: 3.8.2
|
* Version: 3.15.1
|
||||||
* Date: 2021/11/09
|
* Date: 2022/02/25
|
||||||
*
|
|
||||||
* Based on the original code provided by Creality under GPL
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../../../inc/MarlinConfigPre.h"
|
#include "../../../inc/MarlinConfigPre.h"
|
||||||
@ -51,7 +49,9 @@ xy_int_t DWINUI::cursor = { 0 };
|
|||||||
uint16_t DWINUI::pencolor = Color_White;
|
uint16_t DWINUI::pencolor = Color_White;
|
||||||
uint16_t DWINUI::textcolor = Def_Text_Color;
|
uint16_t DWINUI::textcolor = Def_Text_Color;
|
||||||
uint16_t DWINUI::backcolor = Def_Background_Color;
|
uint16_t DWINUI::backcolor = Def_Background_Color;
|
||||||
|
uint16_t DWINUI::buttoncolor = Def_Button_Color;
|
||||||
uint8_t DWINUI::font = font8x16;
|
uint8_t DWINUI::font = font8x16;
|
||||||
|
FSTR_P const DWINUI::Author = F(STRING_CONFIG_H_AUTHOR);
|
||||||
|
|
||||||
void (*DWINUI::onCursorErase)(const int8_t line)=nullptr;
|
void (*DWINUI::onCursorErase)(const int8_t line)=nullptr;
|
||||||
void (*DWINUI::onCursorDraw)(const int8_t line)=nullptr;
|
void (*DWINUI::onCursorDraw)(const int8_t line)=nullptr;
|
||||||
@ -59,18 +59,16 @@ void (*DWINUI::onTitleDraw)(TitleClass* title)=nullptr;
|
|||||||
void (*DWINUI::onMenuDraw)(MenuClass* menu)=nullptr;
|
void (*DWINUI::onMenuDraw)(MenuClass* menu)=nullptr;
|
||||||
|
|
||||||
void DWINUI::init() {
|
void DWINUI::init() {
|
||||||
DEBUG_ECHOPGM("\r\nDWIN handshake ");
|
TERN_(DEBUG_DWIN, SERIAL_ECHOPGM("\r\nDWIN handshake "));
|
||||||
delay(750); // Delay here or init later in the boot process
|
delay(750); // Delay for wait to wakeup screen
|
||||||
const bool success = DWIN_Handshake();
|
const bool hs = DWIN_Handshake();
|
||||||
if (success) DEBUG_ECHOLNPGM("ok."); else DEBUG_ECHOLNPGM("error.");
|
TERN(DEBUG_DWIN, SERIAL_ECHOLNF(hs ? F("ok.") : F("error.")), UNUSED(hs));
|
||||||
DWIN_Frame_SetDir(1);
|
DWIN_Frame_SetDir(1);
|
||||||
TERN(SHOW_BOOTSCREEN,,DWIN_Frame_Clear(Color_Bg_Black));
|
cursor.reset();
|
||||||
DWIN_UpdateLCD();
|
|
||||||
cursor.x = 0;
|
|
||||||
cursor.y = 0;
|
|
||||||
pencolor = Color_White;
|
pencolor = Color_White;
|
||||||
textcolor = Def_Text_Color;
|
textcolor = Def_Text_Color;
|
||||||
backcolor = Def_Background_Color;
|
backcolor = Def_Background_Color;
|
||||||
|
buttoncolor = Def_Button_Color;
|
||||||
font = font8x16;
|
font = font8x16;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,9 +122,10 @@ uint16_t DWINUI::RowToY(uint8_t row) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set text/number color
|
// Set text/number color
|
||||||
void DWINUI::SetColors(uint16_t fgcolor, uint16_t bgcolor) {
|
void DWINUI::SetColors(uint16_t fgcolor, uint16_t bgcolor, uint16_t alcolor) {
|
||||||
textcolor = fgcolor;
|
textcolor = fgcolor;
|
||||||
backcolor = bgcolor;
|
backcolor = bgcolor;
|
||||||
|
buttoncolor = alcolor;
|
||||||
}
|
}
|
||||||
void DWINUI::SetTextColor(uint16_t fgcolor) {
|
void DWINUI::SetTextColor(uint16_t fgcolor) {
|
||||||
textcolor = fgcolor;
|
textcolor = fgcolor;
|
||||||
@ -159,16 +158,22 @@ void DWINUI::MoveBy(xy_int_t point) {
|
|||||||
cursor += point;
|
cursor += point;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw a Centered string using DWIN_WIDTH
|
// Draw a Centered string using arbitrary x1 and x2 margins
|
||||||
void DWINUI::Draw_CenteredString(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t y, const char * const string) {
|
void DWINUI::Draw_CenteredString(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t x1, uint16_t x2, uint16_t y, const char * const string) {
|
||||||
const int8_t x = _MAX(0U, DWIN_WIDTH - strlen_P(string) * fontWidth(size)) / 2 - 1;
|
const uint16_t x = _MAX(0U, x2 + x1 - strlen_P(string) * fontWidth(size)) / 2 - 1;
|
||||||
DWIN_Draw_String(bShow, size, color, bColor, x, y, string);
|
DWIN_Draw_String(bShow, size, color, bColor, x, y, string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// // Draw a Centered string using DWIN_WIDTH
|
||||||
|
// void DWINUI::Draw_CenteredString(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t y, const char * const string) {
|
||||||
|
// const int8_t x = _MAX(0U, DWIN_WIDTH - strlen_P(string) * fontWidth(size)) / 2 - 1;
|
||||||
|
// DWIN_Draw_String(bShow, size, color, bColor, x, y, string);
|
||||||
|
// }
|
||||||
|
|
||||||
// Draw a char at cursor position
|
// Draw a char at cursor position
|
||||||
void DWINUI::Draw_Char(const char c) {
|
void DWINUI::Draw_Char(uint16_t color, const char c) {
|
||||||
const char string[2] = { c, 0};
|
const char string[2] = { c, 0};
|
||||||
DWIN_Draw_String(false, font, textcolor, backcolor, cursor.x, cursor.y, string, 1);
|
DWIN_Draw_String(false, font, color, backcolor, cursor.x, cursor.y, string, 1);
|
||||||
MoveBy(fontWidth(font), 0);
|
MoveBy(fontWidth(font), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,21 +190,26 @@ void DWINUI::Draw_String(uint16_t color, const char * const string, uint16_t rli
|
|||||||
MoveBy(strlen(string) * fontWidth(font), 0);
|
MoveBy(strlen(string) * fontWidth(font), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw a signed floating point number
|
// ------------------------- Buttons ------------------------------//
|
||||||
// bShow: true=display background color; false=don't display background color
|
|
||||||
// zeroFill: true=zero fill; false=no zero fill
|
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) {
|
||||||
// zeroMode: 1=leading 0 displayed as 0; 0=leading 0 displayed as a space
|
DWIN_Draw_Rectangle(1, bcolor, x1, y1, x2, y2);
|
||||||
// size: Font size
|
Draw_CenteredString(0, font, color, bcolor, x1, x2, (y2 + y1 - fontHeight())/2, caption);
|
||||||
// bColor: Background color
|
|
||||||
// iNum: Number of whole digits
|
|
||||||
// fNum: Number of decimal digits
|
|
||||||
// x/y: Upper-left point
|
|
||||||
// value: Float value
|
|
||||||
void DWINUI::Draw_Signed_Float(uint8_t bShow, bool zeroFill, uint8_t zeroMode, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
|
|
||||||
DWIN_Draw_FloatValue(bShow, zeroFill, zeroMode, size, color, bColor, iNum, fNum, x, y, value < 0 ? -value : value);
|
|
||||||
DWIN_Draw_String(bShow, size, color, bColor, x - 6, y, value < 0 ? F("-") : F(" "));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DWINUI::Draw_Button(uint8_t id, uint16_t x, uint16_t y) {
|
||||||
|
switch (id) {
|
||||||
|
case BTN_Cancel : Draw_Button(GET_TEXT_F(MSG_BUTTON_CANCEL), x, y); break;
|
||||||
|
case BTN_Confirm : Draw_Button(GET_TEXT_F(MSG_BUTTON_CONFIRM), x, y); break;
|
||||||
|
case BTN_Continue: Draw_Button(GET_TEXT_F(MSG_BUTTON_CONTINUE), x, y); break;
|
||||||
|
case BTN_Print : Draw_Button(GET_TEXT_F(MSG_BUTTON_PRINT), x, y); break;
|
||||||
|
case BTN_Save : Draw_Button(GET_TEXT_F(MSG_BUTTON_SAVE), x, y); break;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------------------------- Extra -------------------------------//
|
||||||
|
|
||||||
// Draw a circle
|
// Draw a circle
|
||||||
// color: circle color
|
// color: circle color
|
||||||
// x: the abscissa of the center of the circle
|
// x: the abscissa of the center of the circle
|
||||||
@ -247,13 +257,12 @@ void DWINUI::Draw_FillCircle(uint16_t bcolor, uint16_t x,uint16_t y,uint8_t r) {
|
|||||||
// color1 : Start color
|
// color1 : Start color
|
||||||
// color2 : End color
|
// color2 : End color
|
||||||
uint16_t DWINUI::ColorInt(int16_t val, int16_t minv, int16_t maxv, uint16_t color1, uint16_t color2) {
|
uint16_t DWINUI::ColorInt(int16_t val, int16_t minv, int16_t maxv, uint16_t color1, uint16_t color2) {
|
||||||
uint8_t B,G,R;
|
uint8_t B, G, R;
|
||||||
float n;
|
const float n = (float)(val - minv) / (maxv - minv);
|
||||||
n = (float)(val-minv)/(maxv-minv);
|
R = (1 - n) * GetRColor(color1) + n * GetRColor(color2);
|
||||||
R = (1-n)*GetRColor(color1) + n*GetRColor(color2);
|
G = (1 - n) * GetGColor(color1) + n * GetGColor(color2);
|
||||||
G = (1-n)*GetGColor(color1) + n*GetGColor(color2);
|
B = (1 - n) * GetBColor(color1) + n * GetBColor(color2);
|
||||||
B = (1-n)*GetBColor(color1) + n*GetBColor(color2);
|
return RGB(R, G, B);
|
||||||
return RGB(R,G,B);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Color Interpolator through Red->Yellow->Green->Blue
|
// Color Interpolator through Red->Yellow->Green->Blue
|
||||||
@ -261,33 +270,27 @@ uint16_t DWINUI::ColorInt(int16_t val, int16_t minv, int16_t maxv, uint16_t colo
|
|||||||
// minv : Minimum value
|
// minv : Minimum value
|
||||||
// maxv : Maximum value
|
// maxv : Maximum value
|
||||||
uint16_t DWINUI::RainbowInt(int16_t val, int16_t minv, int16_t maxv) {
|
uint16_t DWINUI::RainbowInt(int16_t val, int16_t minv, int16_t maxv) {
|
||||||
uint8_t B,G,R;
|
uint8_t B, G, R;
|
||||||
const uint8_t maxB = 28;
|
const uint8_t maxB = 28, maxR = 28, maxG = 38;
|
||||||
const uint8_t maxR = 28;
|
|
||||||
const uint8_t maxG = 38;
|
|
||||||
const int16_t limv = _MAX(abs(minv), abs(maxv));
|
const int16_t limv = _MAX(abs(minv), abs(maxv));
|
||||||
float n;
|
float n = minv >= 0 ? (float)(val - minv) / (maxv - minv) : (float)val / limv;
|
||||||
if (minv>=0) {
|
LIMIT(n, -1, 1);
|
||||||
n = (float)(val-minv)/(maxv-minv);
|
|
||||||
} else {
|
|
||||||
n = (float)val/limv;
|
|
||||||
}
|
|
||||||
n = _MIN(1, n);
|
|
||||||
n = _MAX(-1, n);
|
|
||||||
if (n < 0) {
|
if (n < 0) {
|
||||||
R = 0;
|
R = 0;
|
||||||
G = (1+n)*maxG;
|
G = (1 + n) * maxG;
|
||||||
B = (-n)*maxB;
|
B = (-n) * maxB;
|
||||||
} else if (n < 0.5) {
|
}
|
||||||
R = maxR*n*2;
|
else if (n < 0.5) {
|
||||||
|
R = maxR * n * 2;
|
||||||
G = maxG;
|
G = maxG;
|
||||||
B = 0;
|
B = 0;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
R = maxR;
|
R = maxR;
|
||||||
G = maxG*(1-n);
|
G = maxG * (1 - n);
|
||||||
B = 0;
|
B = 0;
|
||||||
}
|
}
|
||||||
return RGB(R,G,B);
|
return RGB(R, G, B);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw a checkbox
|
// Draw a checkbox
|
||||||
|
@ -22,12 +22,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DWIN UI Enhanced implementation
|
* DWIN Enhanced implementation for PRO UI
|
||||||
* Author: Miguel A. Risco-Castillo (MRISCOC)
|
* Author: Miguel A. Risco-Castillo (MRISCOC)
|
||||||
* Version: 3.11.1
|
* Version: 3.15.1
|
||||||
* Date: 2022/01/19
|
* Date: 2022/02/25
|
||||||
*
|
|
||||||
* Based on the original code provided by Creality under GPL
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "dwin_lcd.h"
|
#include "dwin_lcd.h"
|
||||||
@ -107,6 +105,13 @@
|
|||||||
#define ICON_CaseLight ICON_Motion
|
#define ICON_CaseLight ICON_Motion
|
||||||
#define ICON_LedControl ICON_Motion
|
#define ICON_LedControl ICON_Motion
|
||||||
|
|
||||||
|
// Buttons
|
||||||
|
#define BTN_Continue 85
|
||||||
|
#define BTN_Cancel 87
|
||||||
|
#define BTN_Confirm 89
|
||||||
|
#define BTN_Print 90
|
||||||
|
#define BTN_Save 91
|
||||||
|
|
||||||
// Extended and default UI Colors
|
// Extended and default UI Colors
|
||||||
#define Color_Black 0
|
#define Color_Black 0
|
||||||
#define Color_Green RGB(0,63,0)
|
#define Color_Green RGB(0,63,0)
|
||||||
@ -119,7 +124,11 @@
|
|||||||
#define DWIN_FONT_HEAD font10x20
|
#define DWIN_FONT_HEAD font10x20
|
||||||
#define DWIN_FONT_ALERT font10x20
|
#define DWIN_FONT_ALERT font10x20
|
||||||
#define STATUS_Y 354
|
#define STATUS_Y 354
|
||||||
#define LCD_WIDTH (DWIN_WIDTH / 8)
|
#define LCD_WIDTH (DWIN_WIDTH / 8) // only if the default font is font8x16
|
||||||
|
|
||||||
|
// Minimum unit (0.1) : multiple (10)
|
||||||
|
#define UNITFDIGITS 1
|
||||||
|
#define MINUNITMULT POW(10, UNITFDIGITS)
|
||||||
|
|
||||||
constexpr uint16_t TITLE_HEIGHT = 30, // Title bar height
|
constexpr uint16_t TITLE_HEIGHT = 30, // Title bar height
|
||||||
MLINE = 53, // Menu line height
|
MLINE = 53, // Menu line height
|
||||||
@ -212,7 +221,9 @@ namespace DWINUI {
|
|||||||
extern uint16_t pencolor;
|
extern uint16_t pencolor;
|
||||||
extern uint16_t textcolor;
|
extern uint16_t textcolor;
|
||||||
extern uint16_t backcolor;
|
extern uint16_t backcolor;
|
||||||
|
extern uint16_t buttoncolor;
|
||||||
extern uint8_t font;
|
extern uint8_t font;
|
||||||
|
extern FSTR_P const Author;
|
||||||
|
|
||||||
extern void (*onCursorErase)(const int8_t line);
|
extern void (*onCursorErase)(const int8_t line);
|
||||||
extern void (*onCursorDraw)(const int8_t line);
|
extern void (*onCursorDraw)(const int8_t line);
|
||||||
@ -240,7 +251,7 @@ namespace DWINUI {
|
|||||||
uint16_t RowToY(uint8_t row);
|
uint16_t RowToY(uint8_t row);
|
||||||
|
|
||||||
// Set text/number color
|
// Set text/number color
|
||||||
void SetColors(uint16_t fgcolor, uint16_t bgcolor);
|
void SetColors(uint16_t fgcolor, uint16_t bgcolor, uint16_t alcolor);
|
||||||
void SetTextColor(uint16_t fgcolor);
|
void SetTextColor(uint16_t fgcolor);
|
||||||
void SetBackgroundColor(uint16_t bgcolor);
|
void SetBackgroundColor(uint16_t bgcolor);
|
||||||
|
|
||||||
@ -268,6 +279,17 @@ namespace DWINUI {
|
|||||||
DWIN_Draw_Line(pencolor, cursor.x, cursor.y, x, y);
|
DWIN_Draw_Line(pencolor, cursor.x, cursor.y, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Extend a frame box
|
||||||
|
// v: value to extend
|
||||||
|
inline frame_rect_t ExtendFrame(frame_rect_t frame, uint8_t v) {
|
||||||
|
frame_rect_t t;
|
||||||
|
t.x = frame.x - v;
|
||||||
|
t.y = frame.y - v;
|
||||||
|
t.w = frame.w + 2 * v;
|
||||||
|
t.h = frame.h + 2 * v;
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
|
||||||
// Draw an Icon with transparent background from the library ICON
|
// Draw an Icon with transparent background from the library ICON
|
||||||
// icon: Icon ID
|
// icon: Icon ID
|
||||||
// x/y: Upper-left point
|
// x/y: Upper-left point
|
||||||
@ -293,26 +315,56 @@ namespace DWINUI {
|
|||||||
// x/y: Upper-left coordinate
|
// x/y: Upper-left coordinate
|
||||||
// value: Integer value
|
// value: Integer value
|
||||||
inline void Draw_Int(uint8_t bShow, bool zeroFill, uint8_t zeroMode, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) {
|
inline void Draw_Int(uint8_t bShow, bool zeroFill, uint8_t zeroMode, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) {
|
||||||
DWIN_Draw_IntValue(bShow, zeroFill, zeroMode, size, color, bColor, iNum, x, y, value);
|
DWIN_Draw_Value(bShow, 0, zeroFill, zeroMode, size, color, bColor, iNum, 0, x, y, value);
|
||||||
}
|
}
|
||||||
inline void Draw_Int(uint8_t iNum, long value) {
|
inline void Draw_Int(uint8_t iNum, long value) {
|
||||||
DWIN_Draw_IntValue(false, true, 0, font, textcolor, backcolor, iNum, cursor.x, cursor.y, value);
|
DWIN_Draw_Value(false, 0, true, 0, font, textcolor, backcolor, iNum, 0, cursor.x, cursor.y, value);
|
||||||
MoveBy(iNum * fontWidth(font), 0);
|
MoveBy(iNum * fontWidth(font), 0);
|
||||||
}
|
}
|
||||||
inline void Draw_Int(uint8_t iNum, uint16_t x, uint16_t y, long value) {
|
inline void Draw_Int(uint8_t iNum, uint16_t x, uint16_t y, long value) {
|
||||||
DWIN_Draw_IntValue(false, true, 0, font, textcolor, backcolor, iNum, x, y, value);
|
DWIN_Draw_Value(false, 0, true, 0, font, textcolor, backcolor, iNum, 0, x, y, value);
|
||||||
}
|
}
|
||||||
inline void Draw_Int(uint16_t color, uint8_t iNum, uint16_t x, uint16_t y, long value) {
|
inline void Draw_Int(uint16_t color, uint8_t iNum, uint16_t x, uint16_t y, long value) {
|
||||||
DWIN_Draw_IntValue(false, true, 0, font, color, backcolor, iNum, x, y, value);
|
DWIN_Draw_Value(false, 0, true, 0, font, color, backcolor, iNum, 0, x, y, value);
|
||||||
}
|
}
|
||||||
inline void Draw_Int(uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) {
|
inline void Draw_Int(uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) {
|
||||||
DWIN_Draw_IntValue(true, true, 0, font, color, bColor, iNum, x, y, value);
|
DWIN_Draw_Value(true, 0, true, 0, font, color, bColor, iNum, 0, x, y, value);
|
||||||
}
|
}
|
||||||
inline void Draw_Int(uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) {
|
inline void Draw_Int(uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) {
|
||||||
DWIN_Draw_IntValue(true, true, 0, size, color, bColor, iNum, x, y, value);
|
DWIN_Draw_Value(true, 0, true, 0, size, color, bColor, iNum, 0, x, y, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw a floating point number
|
// Draw a signed integer
|
||||||
|
// bShow: true=display background color; false=don't display background color
|
||||||
|
// zeroFill: true=zero fill; false=no zero fill
|
||||||
|
// zeroMode: 1=leading 0 displayed as 0; 0=leading 0 displayed as a space
|
||||||
|
// size: Font size
|
||||||
|
// color: Character color
|
||||||
|
// bColor: Background color
|
||||||
|
// iNum: Number of digits
|
||||||
|
// x/y: Upper-left coordinate
|
||||||
|
// value: Integer value
|
||||||
|
inline void Draw_Signed_Int(uint8_t bShow, bool zeroFill, uint8_t zeroMode, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) {
|
||||||
|
DWIN_Draw_Value(bShow, 1, zeroFill, zeroMode, size, color, bColor, iNum, 0, x, y, value);
|
||||||
|
}
|
||||||
|
inline void Draw_Signed_Int(uint8_t iNum, long value) {
|
||||||
|
DWIN_Draw_Value(false, 1, true, 0, font, textcolor, backcolor, iNum, 0, cursor.x, cursor.y, value);
|
||||||
|
MoveBy(iNum * fontWidth(font), 0);
|
||||||
|
}
|
||||||
|
inline void Draw_Signed_Int(uint8_t iNum, uint16_t x, uint16_t y, long value) {
|
||||||
|
DWIN_Draw_Value(false, 1, true, 0, font, textcolor, backcolor, iNum, 0, x, y, value);
|
||||||
|
}
|
||||||
|
inline void Draw_Signed_Int(uint16_t color, uint8_t iNum, uint16_t x, uint16_t y, long value) {
|
||||||
|
DWIN_Draw_Value(false, 1, true, 0, font, color, backcolor, iNum, 0, x, y, value);
|
||||||
|
}
|
||||||
|
inline void Draw_Signed_Int(uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) {
|
||||||
|
DWIN_Draw_Value(true, 1, true, 0, font, color, bColor, iNum, 0, x, y, value);
|
||||||
|
}
|
||||||
|
inline void Draw_Signed_Int(uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, long value) {
|
||||||
|
DWIN_Draw_Value(true, 1, true, 0, size, color, bColor, iNum, 0, x, y, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw a positive floating point number
|
||||||
// bShow: true=display background color; false=don't display background color
|
// bShow: true=display background color; false=don't display background color
|
||||||
// zeroFill: true=zero fill; false=no zero fill
|
// zeroFill: true=zero fill; false=no zero fill
|
||||||
// zeroMode: 1=leading 0 displayed as 0; 0=leading 0 displayed as a space
|
// zeroMode: 1=leading 0 displayed as 0; 0=leading 0 displayed as a space
|
||||||
@ -324,23 +376,23 @@ namespace DWINUI {
|
|||||||
// x/y: Upper-left point
|
// x/y: Upper-left point
|
||||||
// value: Float value
|
// value: Float value
|
||||||
inline void Draw_Float(uint8_t bShow, bool zeroFill, uint8_t zeroMode, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
|
inline void Draw_Float(uint8_t bShow, bool zeroFill, uint8_t zeroMode, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
|
||||||
DWIN_Draw_FloatValue(bShow, zeroFill, zeroMode, size, color, bColor, iNum, fNum, x, y, value);
|
DWIN_Draw_Value(bShow, 0, zeroFill, zeroMode, size, color, bColor, iNum, fNum, x, y, value);
|
||||||
}
|
}
|
||||||
inline void Draw_Float(uint8_t iNum, uint8_t fNum, float value) {
|
inline void Draw_Float(uint8_t iNum, uint8_t fNum, float value) {
|
||||||
DWIN_Draw_FloatValue(false, true, 0, font, textcolor, backcolor, iNum, fNum, cursor.x, cursor.y, value);
|
DWIN_Draw_Value(false, 0, true, 0, font, textcolor, backcolor, iNum, fNum, cursor.x, cursor.y, value);
|
||||||
MoveBy((iNum + fNum + 1) * fontWidth(font), 0);
|
MoveBy((iNum + fNum + 1) * fontWidth(font), 0);
|
||||||
}
|
}
|
||||||
inline void Draw_Float(uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
|
inline void Draw_Float(uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
|
||||||
DWIN_Draw_FloatValue(false, true, 0, font, textcolor, backcolor, iNum, fNum, x, y, value);
|
DWIN_Draw_Value(false, 0, true, 0, font, textcolor, backcolor, iNum, fNum, x, y, value);
|
||||||
}
|
}
|
||||||
inline void Draw_Float(uint16_t color, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
|
inline void Draw_Float(uint16_t color, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
|
||||||
DWIN_Draw_FloatValue(false, true, 0, font, color, backcolor, iNum, fNum, x, y, value);
|
DWIN_Draw_Value(false, 0, true, 0, font, color, backcolor, iNum, fNum, x, y, value);
|
||||||
}
|
}
|
||||||
inline void Draw_Float(uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
|
inline void Draw_Float(uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
|
||||||
DWIN_Draw_FloatValue(true, true, 0, font, color, bColor, iNum, fNum, x, y, value);
|
DWIN_Draw_Value(true, 0, true, 0, font, color, bColor, iNum, fNum, x, y, value);
|
||||||
}
|
}
|
||||||
inline void Draw_Float(uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
|
inline void Draw_Float(uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
|
||||||
DWIN_Draw_FloatValue(true, true, 0, size, color, bColor, iNum, fNum, x, y, value);
|
DWIN_Draw_Value(true, 0, true, 0, size, color, bColor, iNum, fNum, x, y, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw a signed floating point number
|
// Draw a signed floating point number
|
||||||
@ -348,31 +400,35 @@ namespace DWINUI {
|
|||||||
// zeroFill: true=zero fill; false=no zero fill
|
// zeroFill: true=zero fill; false=no zero fill
|
||||||
// zeroMode: 1=leading 0 displayed as 0; 0=leading 0 displayed as a space
|
// zeroMode: 1=leading 0 displayed as 0; 0=leading 0 displayed as a space
|
||||||
// size: Font size
|
// size: Font size
|
||||||
|
// color: Character color
|
||||||
// bColor: Background color
|
// bColor: Background color
|
||||||
// iNum: Number of whole digits
|
// iNum: Number of whole digits
|
||||||
// fNum: Number of decimal digits
|
// fNum: Number of decimal digits
|
||||||
// x/y: Upper-left point
|
// x/y: Upper-left point
|
||||||
// value: Float value
|
// value: Float value
|
||||||
void Draw_Signed_Float(uint8_t bShow, bool zeroFill, uint8_t zeroMode, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value);
|
inline void Draw_Signed_Float(uint8_t bShow, bool zeroFill, uint8_t zeroMode, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
|
||||||
|
DWIN_Draw_Value(bShow, 1, zeroFill, zeroMode, size, color, bColor, iNum, fNum, x, y, value);
|
||||||
|
}
|
||||||
inline void Draw_Signed_Float(uint8_t iNum, uint8_t fNum, float value) {
|
inline void Draw_Signed_Float(uint8_t iNum, uint8_t fNum, float value) {
|
||||||
Draw_Signed_Float(false, true, 0, font, textcolor, backcolor, iNum, fNum, cursor.x, cursor.y, value);
|
DWIN_Draw_Value(false, 1, true, 0, font, textcolor, backcolor, iNum, fNum, cursor.x, cursor.y, value);
|
||||||
MoveBy((iNum + fNum + 1) * fontWidth(font), 0);
|
MoveBy((iNum + fNum + 1) * fontWidth(font), 0);
|
||||||
}
|
}
|
||||||
inline void Draw_Signed_Float(uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
|
inline void Draw_Signed_Float(uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
|
||||||
Draw_Signed_Float(false, true, 0, font, textcolor, backcolor, iNum, fNum, x, y, value);
|
DWIN_Draw_Value(false, 1, true, 0, font, textcolor, backcolor, iNum, fNum, x, y, value);
|
||||||
}
|
}
|
||||||
inline void Draw_Signed_Float(uint8_t size, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
|
inline void Draw_Signed_Float(uint8_t size, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
|
||||||
Draw_Signed_Float(false, true, 0, size, textcolor, backcolor, iNum, fNum, x, y, value);
|
DWIN_Draw_Value(false, 1, true, 0, size, textcolor, backcolor, iNum, fNum, x, y, value);
|
||||||
}
|
}
|
||||||
inline void Draw_Signed_Float(uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
|
inline void Draw_Signed_Float(uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
|
||||||
Draw_Signed_Float(true, true, 0, font, color, bColor, iNum, fNum, x, y, value);
|
DWIN_Draw_Value(true, 1, true, 0, font, color, bColor, iNum, fNum, x, y, value);
|
||||||
}
|
}
|
||||||
inline void Draw_Signed_Float(uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
|
inline void Draw_Signed_Float(uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
|
||||||
Draw_Signed_Float(true, true, 0, size, color, bColor, iNum, fNum, x, y, value);
|
DWIN_Draw_Value(true, 1, true, 0, size, color, bColor, iNum, fNum, x, y, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw a char at cursor position
|
// Draw a char at cursor position
|
||||||
void Draw_Char(const char c);
|
void Draw_Char(uint16_t color, const char c);
|
||||||
|
inline void Draw_Char(const char c) { Draw_Char(textcolor, c); }
|
||||||
|
|
||||||
// Draw a string at cursor position
|
// Draw a string at cursor position
|
||||||
// color: Character color
|
// color: Character color
|
||||||
@ -425,7 +481,10 @@ namespace DWINUI {
|
|||||||
// bColor: Background color
|
// bColor: Background color
|
||||||
// y: Upper coordinate of the string
|
// y: Upper coordinate of the string
|
||||||
// *string: The string
|
// *string: The string
|
||||||
void Draw_CenteredString(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t y, const char * const string);
|
void Draw_CenteredString(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t x1, uint16_t x2, uint16_t y, const char * const string);
|
||||||
|
inline void Draw_CenteredString(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t y, const char * const string) {
|
||||||
|
Draw_CenteredString(bShow, size, color, bColor, 0, DWIN_WIDTH, y, string);
|
||||||
|
}
|
||||||
inline void Draw_CenteredString(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t y, FSTR_P string) {
|
inline void Draw_CenteredString(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t y, FSTR_P string) {
|
||||||
Draw_CenteredString(bShow, size, color, bColor, y, FTOP(string));
|
Draw_CenteredString(bShow, size, color, bColor, y, FTOP(string));
|
||||||
}
|
}
|
||||||
@ -487,6 +546,17 @@ namespace DWINUI {
|
|||||||
// color2 : End color
|
// color2 : End color
|
||||||
uint16_t ColorInt(int16_t val, int16_t minv, int16_t maxv, uint16_t color1, uint16_t color2);
|
uint16_t ColorInt(int16_t val, int16_t minv, int16_t maxv, uint16_t color1, uint16_t color2);
|
||||||
|
|
||||||
|
// ------------------------- Buttons ------------------------------//
|
||||||
|
|
||||||
|
void Draw_Button(uint16_t color, uint16_t bcolor, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, const char * const caption);
|
||||||
|
inline void Draw_Button(uint16_t color, uint16_t bcolor, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, FSTR_P caption) {
|
||||||
|
Draw_Button(color, bcolor, x1, y1, x2, y2, FTOP(caption));
|
||||||
|
}
|
||||||
|
inline void Draw_Button(FSTR_P caption, uint16_t x, uint16_t y) {
|
||||||
|
Draw_Button(textcolor, buttoncolor, x, y, x + 99, y + 37, caption);
|
||||||
|
}
|
||||||
|
void Draw_Button(uint8_t id, uint16_t x, uint16_t y);
|
||||||
|
|
||||||
// -------------------------- Extra -------------------------------//
|
// -------------------------- Extra -------------------------------//
|
||||||
|
|
||||||
// Draw a circle filled with color
|
// Draw a circle filled with color
|
||||||
|
@ -21,15 +21,12 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DWIN End Stops diagnostic page
|
* DWIN End Stops diagnostic page for PRO UI
|
||||||
* Author: Miguel A. Risco-Castillo (MRISCOC)
|
* Author: Miguel A. Risco-Castillo (MRISCOC)
|
||||||
* Version: 1.0.2
|
* Version: 1.2.2
|
||||||
* Date: 2021/11/06
|
* Date: 2022/02/24
|
||||||
*
|
|
||||||
* Based on the original code provided by Creality under GPL
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../../../inc/MarlinConfigPre.h"
|
|
||||||
#include "dwin_defines.h"
|
#include "dwin_defines.h"
|
||||||
|
|
||||||
#if BOTH(DWIN_LCD_PROUI, HAS_ESDIAG)
|
#if BOTH(DWIN_LCD_PROUI, HAS_ESDIAG)
|
||||||
@ -72,7 +69,7 @@ void ESDiagClass::Draw() {
|
|||||||
Title.ShowCaption(F("End-stops Diagnostic"));
|
Title.ShowCaption(F("End-stops Diagnostic"));
|
||||||
DWINUI::ClearMenuArea();
|
DWINUI::ClearMenuArea();
|
||||||
Draw_Popup_Bkgd();
|
Draw_Popup_Bkgd();
|
||||||
DWINUI::Draw_Icon(ICON_Continue_E, 86, 250);
|
DWINUI::Draw_Button(BTN_Continue, 86, 250);
|
||||||
DWINUI::cursor.y = 80;
|
DWINUI::cursor.y = 80;
|
||||||
#define ES_LABEL(S) draw_es_label(F(STR_##S))
|
#define ES_LABEL(S) draw_es_label(F(STR_##S))
|
||||||
#if HAS_X_MIN
|
#if HAS_X_MIN
|
||||||
|
@ -22,12 +22,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DWIN End Stops diagnostic page
|
* DWIN End Stops diagnostic page for PRO UI
|
||||||
* Author: Miguel A. Risco-Castillo (MRISCOC)
|
* Author: Miguel A. Risco-Castillo (MRISCOC)
|
||||||
* Version: 1.0
|
* Version: 1.2.3
|
||||||
* Date: 2021/11/06
|
* Date: 2022/02/24
|
||||||
*
|
|
||||||
* Based on the original code provided by Creality under GPL
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ESDiagClass {
|
class ESDiagClass {
|
||||||
|
@ -21,12 +21,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lock screen implementation for DWIN UI Enhanced implementation
|
* Lock screen implementation for PRO UI
|
||||||
* Author: Miguel A. Risco-Castillo (MRISCOC)
|
* Author: Miguel A. Risco-Castillo (MRISCOC)
|
||||||
* Version: 2.1
|
* Version: 2.1
|
||||||
* Date: 2021/11/09
|
* Date: 2021/11/09
|
||||||
*
|
|
||||||
* Based on the original code provided by Creality under GPL
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../../../inc/MarlinConfigPre.h"
|
#include "../../../inc/MarlinConfigPre.h"
|
||||||
|
@ -22,12 +22,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lock screen implementation for DWIN UI Enhanced implementation
|
* Lock screen implementation for PRO UI
|
||||||
* Author: Miguel A. Risco-Castillo (MRISCOC)
|
* Author: Miguel A. Risco-Castillo (MRISCOC)
|
||||||
* Version: 2.1
|
* Version: 2.1
|
||||||
* Date: 2021/11/09
|
* Date: 2021/11/09
|
||||||
*
|
|
||||||
* Based on the original code provided by Creality under GPL
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../common/encoder.h"
|
#include "../common/encoder.h"
|
||||||
|
370
Marlin/src/lcd/e3v2/proui/menus.cpp
Normal file
370
Marlin/src/lcd/e3v2/proui/menus.cpp
Normal file
@ -0,0 +1,370 @@
|
|||||||
|
/**
|
||||||
|
* Marlin 3D Printer Firmware
|
||||||
|
* Copyright (c) 2022 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||||
|
*
|
||||||
|
* Based on Sprinter and grbl.
|
||||||
|
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||||
|
*
|
||||||
|
* 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/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Menu functions for ProUI
|
||||||
|
* Author: Miguel A. Risco-Castillo
|
||||||
|
* Version: 1.2.1
|
||||||
|
* Date: 2022/02/25
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "../../../inc/MarlinConfigPre.h"
|
||||||
|
|
||||||
|
#if ENABLED(DWIN_LCD_PROUI)
|
||||||
|
|
||||||
|
#include "../common/encoder.h"
|
||||||
|
#include "dwin_lcd.h"
|
||||||
|
#include "dwinui.h"
|
||||||
|
#include "dwin.h"
|
||||||
|
#include "menus.h"
|
||||||
|
|
||||||
|
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);
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Draw_Menu(MenuClass* menu) {
|
||||||
|
DWINUI::SetColors(HMI_data.Text_Color, HMI_data.Background_Color, HMI_data.StatusBg_Color);
|
||||||
|
DWIN_Draw_Rectangle(1, DWINUI::backcolor, 0, TITLE_HEIGHT, DWIN_WIDTH - 1, STATUS_Y - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Draw_Menu_Cursor(const int8_t line) {
|
||||||
|
DWIN_Draw_Rectangle(1, HMI_data.Cursor_color, 0, MBASE(line) - 18, 14, MBASE(line + 1) - 20);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Erase_Menu_Cursor(const int8_t line) {
|
||||||
|
DWIN_Draw_Rectangle(1, HMI_data.Background_Color, 0, MBASE(line) - 18, 14, MBASE(line + 1) - 20);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Draw_Menu_Line(const uint8_t line, const uint8_t icon /*=0*/, const char * const label /*=nullptr*/, bool more /*=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);
|
||||||
|
DWIN_Draw_HLine(HMI_data.SplitLine_Color, 16, MYPOS(line + 1), 240);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Draw_Chkb_Line(const uint8_t line, const bool checked) {
|
||||||
|
DWINUI::Draw_Checkbox(HMI_data.Text_Color, HMI_data.Background_Color, VALX + 16, MBASE(line) - 1, 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
void onDrawMenuItem(MenuItemClass* menuitem, int8_t line) {
|
||||||
|
if (menuitem->icon) DWINUI::Draw_Icon(menuitem->icon, ICOX, MBASE(line) - 3);
|
||||||
|
if (menuitem->frameid)
|
||||||
|
DWIN_Frame_AreaCopy(menuitem->frameid, menuitem->frame.left, menuitem->frame.top, menuitem->frame.right, menuitem->frame.bottom, LBLX, MBASE(line));
|
||||||
|
else if (menuitem->caption)
|
||||||
|
DWINUI::Draw_String(LBLX, MBASE(line) - 1, menuitem->caption);
|
||||||
|
DWIN_Draw_HLine(HMI_data.SplitLine_Color, 16, MYPOS(line + 1), 240);
|
||||||
|
}
|
||||||
|
|
||||||
|
void onDrawSubMenu(MenuItemClass* menuitem, int8_t line) {
|
||||||
|
onDrawMenuItem(menuitem, line);
|
||||||
|
DWINUI::Draw_Icon(ICON_More, VALX + 16, MBASE(line) - 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
void onDrawIntMenu(MenuItemClass* menuitem, int8_t line, int32_t value) {
|
||||||
|
onDrawMenuItem(menuitem, line);
|
||||||
|
Draw_Menu_IntValue(HMI_data.Background_Color, line, 4, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void onDrawPIntMenu(MenuItemClass* menuitem, int8_t line) {
|
||||||
|
const int16_t value = *(int16_t*)static_cast<MenuItemPtrClass*>(menuitem)->value;
|
||||||
|
onDrawIntMenu(menuitem, line, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void onDrawPInt8Menu(MenuItemClass* menuitem, int8_t line) {
|
||||||
|
const uint8_t value = *(uint8_t*)static_cast<MenuItemPtrClass*>(menuitem)->value;
|
||||||
|
onDrawIntMenu(menuitem, line, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void onDrawPInt32Menu(MenuItemClass* menuitem, int8_t line) {
|
||||||
|
const uint32_t value = *(uint32_t*)static_cast<MenuItemPtrClass*>(menuitem)->value;
|
||||||
|
onDrawIntMenu(menuitem, line, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void onDrawFloatMenu(MenuItemClass* menuitem, int8_t line, uint8_t dp, const float value) {
|
||||||
|
onDrawMenuItem(menuitem, line);
|
||||||
|
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) {
|
||||||
|
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 onDrawChkbMenu(MenuItemClass* menuitem, int8_t line, bool checked) {
|
||||||
|
onDrawMenuItem(menuitem, line);
|
||||||
|
Draw_Chkb_Line(line, checked);
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// On click functions
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Generic onclick event without draw
|
||||||
|
// process: process id HMI destiny
|
||||||
|
// lo: low limit
|
||||||
|
// hi: high limit
|
||||||
|
// dp: decimal places, 0 for integers
|
||||||
|
// val: value / scaled value
|
||||||
|
// LiveUpdate: live update function when the encoder changes
|
||||||
|
// Apply: update function when the encoder is pressed
|
||||||
|
void SetOnClick(uint8_t process, const int32_t lo, const int32_t hi, uint8_t dp, const int32_t val, void (*Apply)() /*= nullptr*/, void (*LiveUpdate)() /*= nullptr*/) {
|
||||||
|
checkkey = process;
|
||||||
|
MenuData.MinValue = lo;
|
||||||
|
MenuData.MaxValue = hi;
|
||||||
|
MenuData.dp = dp;
|
||||||
|
MenuData.Apply = Apply;
|
||||||
|
MenuData.LiveUpdate = LiveUpdate;
|
||||||
|
MenuData.Value = val;
|
||||||
|
EncoderRate.enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generic onclick event for integer values
|
||||||
|
// process: process id HMI destiny
|
||||||
|
// lo: scaled low limit
|
||||||
|
// hi: scaled high limit
|
||||||
|
// val: value
|
||||||
|
// LiveUpdate: live update function when the encoder changes
|
||||||
|
// 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generic onclick event for float values
|
||||||
|
// process: process id HMI destiny
|
||||||
|
// lo: scaled low limit
|
||||||
|
// hi: scaled high limit
|
||||||
|
// val: value
|
||||||
|
// LiveUpdate: live update function when the encoder changes
|
||||||
|
// Apply: update function when the encoder is pressed
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generic onclick event for integer values
|
||||||
|
// lo: scaled low limit
|
||||||
|
// hi: scaled high limit
|
||||||
|
// val: value
|
||||||
|
// LiveUpdate: live update function when the encoder changes
|
||||||
|
// Apply: update function when the encoder is pressed
|
||||||
|
void SetIntOnClick(const int32_t lo, const int32_t hi, const int32_t val, void (*Apply)() /*= nullptr*/, void (*LiveUpdate)() /*= nullptr*/) {
|
||||||
|
SetValueOnClick(SetInt, lo, hi, val, Apply, LiveUpdate);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generic onclick event for set pointer to 16 bit uinteger values
|
||||||
|
// lo: low limit
|
||||||
|
// hi: high limit
|
||||||
|
// LiveUpdate: live update function when the encoder changes
|
||||||
|
// Apply: update function when the encoder is pressed
|
||||||
|
void SetPIntOnClick(const int32_t lo, const int32_t hi, void (*Apply)() /*= nullptr*/, void (*LiveUpdate)() /*= nullptr*/) {
|
||||||
|
MenuData.P_Int = (int16_t*)static_cast<MenuItemPtrClass*>(CurrentMenu->SelectedItem())->value;
|
||||||
|
const int32_t value = *MenuData.P_Int;
|
||||||
|
SetValueOnClick(SetPInt, lo, hi, value, Apply, LiveUpdate);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generic onclick event for float values
|
||||||
|
// process: process id HMI destiny
|
||||||
|
// lo: low limit
|
||||||
|
// hi: high limit
|
||||||
|
// dp: decimal places
|
||||||
|
// val: value
|
||||||
|
void SetFloatOnClick(const float lo, const float hi, uint8_t dp, const float val, void (*Apply)() /*= nullptr*/, void (*LiveUpdate)() /*= nullptr*/) {
|
||||||
|
SetValueOnClick(SetFloat, lo, hi, dp, val, Apply, LiveUpdate);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generic onclick event for set pointer to float values
|
||||||
|
// lo: low limit
|
||||||
|
// hi: high limit
|
||||||
|
// LiveUpdate: live update function when the encoder changes
|
||||||
|
// Apply: update function when the encoder is pressed
|
||||||
|
void SetPFloatOnClick(const float lo, const float hi, uint8_t dp, void (*Apply)() /*= nullptr*/, void (*LiveUpdate)() /*= nullptr*/) {
|
||||||
|
MenuData.P_Float = (float*)static_cast<MenuItemPtrClass*>(CurrentMenu->SelectedItem())->value;
|
||||||
|
SetValueOnClick(SetPFloat, lo, hi, dp, *MenuData.P_Float, Apply, LiveUpdate);
|
||||||
|
}
|
||||||
|
|
||||||
|
// HMI Control functions ======================================================
|
||||||
|
|
||||||
|
// 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_ENTER)
|
||||||
|
CurrentMenu->onClick();
|
||||||
|
else
|
||||||
|
CurrentMenu->onScroll(encoder_diffState == ENCODER_DIFF_CW);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get an integer value using the encoder without draw anything
|
||||||
|
// lo: low limit
|
||||||
|
// hi: high limit
|
||||||
|
// Return value:
|
||||||
|
// 0 : no change
|
||||||
|
// 1 : live change
|
||||||
|
// 2 : apply change
|
||||||
|
int8_t HMI_GetIntNoDraw(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;
|
||||||
|
checkkey = Menu;
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
LIMIT(MenuData.Value, lo, hi);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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);
|
||||||
|
DWINUI::Draw_Signed_Int(HMI_data.Text_Color, HMI_data.Selected_Color, 4 , VALX, MBASE(CurrentMenu->line()) - 1, MenuData.Value);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set an integer using the encoder
|
||||||
|
void HMI_SetInt() {
|
||||||
|
int8_t val = HMI_GetInt(MenuData.MinValue, MenuData.MaxValue);
|
||||||
|
switch (val) {
|
||||||
|
case 0: return; break;
|
||||||
|
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);
|
||||||
|
switch (val) {
|
||||||
|
case 0: return; break;
|
||||||
|
case 1: if (MenuData.LiveUpdate) MenuData.LiveUpdate(); break;
|
||||||
|
case 2: if (MenuData.Apply) MenuData.Apply(); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set an integer pointer variable using the encoder
|
||||||
|
void HMI_SetPInt() {
|
||||||
|
int8_t val = HMI_GetInt(MenuData.MinValue, MenuData.MaxValue);
|
||||||
|
switch (val) {
|
||||||
|
case 0: return;
|
||||||
|
case 1: if (MenuData.LiveUpdate) MenuData.LiveUpdate(); break;
|
||||||
|
case 2: *MenuData.P_Int = MenuData.Value; if (MenuData.Apply) MenuData.Apply(); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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);
|
||||||
|
DWINUI::Draw_Signed_Float(HMI_data.Text_Color, HMI_data.Selected_Color, 3, dp, VALX - dp * DWINUI::fontWidth(DWIN_FONT_MENU), MBASE(CurrentMenu->line()), MenuData.Value / POW(10, dp));
|
||||||
|
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);
|
||||||
|
switch (val) {
|
||||||
|
case 0: return;
|
||||||
|
case 1: if (MenuData.LiveUpdate) MenuData.LiveUpdate(); break;
|
||||||
|
case 2: *MenuData.P_Float = MenuData.Value / POW(10, MenuData.dp); if (MenuData.Apply) MenuData.Apply(); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // DWIN_LCD_PROUI
|
94
Marlin/src/lcd/e3v2/proui/menus.h
Normal file
94
Marlin/src/lcd/e3v2/proui/menus.h
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
/**
|
||||||
|
* Marlin 3D Printer Firmware
|
||||||
|
* Copyright (c) 2022 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||||
|
*
|
||||||
|
* Based on Sprinter and grbl.
|
||||||
|
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||||
|
*
|
||||||
|
* 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/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Menu functions for ProUI
|
||||||
|
* Author: Miguel A. Risco-Castillo
|
||||||
|
* Version: 1.2.1
|
||||||
|
* Date: 2022/02/25
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser 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 Lesser General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "dwinui.h"
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int32_t MaxValue = 0; // Auxiliar max integer/scaled float value
|
||||||
|
int32_t MinValue = 0; // Auxiliar min integer/scaled float value
|
||||||
|
int8_t dp = 0; // Auxiliar decimal places
|
||||||
|
int32_t Value = 0; // Auxiliar integer / scaled float value
|
||||||
|
int16_t *P_Int = nullptr; // Auxiliar pointer to 16 bit integer variable
|
||||||
|
float *P_Float = nullptr; // Auxiliar pointer to float variable
|
||||||
|
void (*Apply)() = nullptr; // Auxiliar apply function
|
||||||
|
void (*LiveUpdate)() = nullptr; // Auxiliar live update function
|
||||||
|
} MenuData_t;
|
||||||
|
|
||||||
|
extern MenuData_t MenuData;
|
||||||
|
|
||||||
|
// Menuitem Drawing functions =================================================
|
||||||
|
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 Draw_Chkb_Line(const uint8_t line, const 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);
|
||||||
|
void onDrawIntMenu(MenuItemClass* menuitem, int8_t line, int32_t value);
|
||||||
|
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 onDrawChkbMenu(MenuItemClass* menuitem, int8_t line, bool checked);
|
||||||
|
|
||||||
|
// On click functions =========================================================
|
||||||
|
void SetOnClick(uint8_t process, const int32_t lo, const int32_t hi, uint8_t dp, const int32_t val, void (*Apply)() = nullptr, void (*LiveUpdate)() = nullptr);
|
||||||
|
void SetValueOnClick(uint8_t process, const int32_t lo, const int32_t hi, const int32_t val, void (*Apply)() = nullptr, void (*LiveUpdate)() = nullptr);
|
||||||
|
void SetValueOnClick(uint8_t process, const float lo, const float hi, uint8_t dp, const float val, void (*Apply)() = nullptr, void (*LiveUpdate)() = nullptr);
|
||||||
|
void SetIntOnClick(const int32_t lo, const int32_t hi, const int32_t val, void (*Apply)() = nullptr, void (*LiveUpdate)() = nullptr);
|
||||||
|
void SetPIntOnClick(const int32_t lo, const int32_t hi, void (*Apply)() = nullptr, void (*LiveUpdate)() = nullptr);
|
||||||
|
void SetFloatOnClick(const float lo, const float hi, uint8_t dp, const float val, void (*Apply)() = nullptr, void (*LiveUpdate)() = nullptr);
|
||||||
|
void SetPFloatOnClick(const float lo, const float hi, uint8_t dp, void (*Apply)() = nullptr, void (*LiveUpdate)() = nullptr);
|
||||||
|
|
||||||
|
// HMI user control functions =================================================
|
||||||
|
void HMI_Menu();
|
||||||
|
void HMI_SetInt();
|
||||||
|
void HMI_SetPInt();
|
||||||
|
void HMI_SetIntNoDraw();
|
||||||
|
void HMI_SetFloat();
|
||||||
|
void HMI_SetPFloat();
|
@ -21,12 +21,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DWIN Mesh Viewer
|
* Mesh Viewer for PRO UI
|
||||||
* Author: Miguel A. Risco-Castillo (MRISCOC)
|
* Author: Miguel A. Risco-Castillo (MRISCOC)
|
||||||
* Version: 3.9.1
|
* version: 3.12.1
|
||||||
* Date: 2021/11/09
|
* Date: 2022/02/24
|
||||||
*
|
|
||||||
* Based on the original code provided by Creality under GPL
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../../../inc/MarlinConfigPre.h"
|
#include "../../../inc/MarlinConfigPre.h"
|
||||||
@ -40,49 +38,53 @@
|
|||||||
#include "dwin_lcd.h"
|
#include "dwin_lcd.h"
|
||||||
#include "dwinui.h"
|
#include "dwinui.h"
|
||||||
#include "dwin.h"
|
#include "dwin.h"
|
||||||
|
#include "dwin_popup.h"
|
||||||
#include "../../../feature/bedlevel/bedlevel.h"
|
#include "../../../feature/bedlevel/bedlevel.h"
|
||||||
|
|
||||||
MeshViewerClass MeshViewer;
|
MeshViewerClass MeshViewer;
|
||||||
|
|
||||||
void MeshViewerClass::Draw() {
|
void MeshViewerClass::DrawMesh(bed_mesh_t zval, const uint8_t sizex, const uint8_t sizey) {
|
||||||
const int8_t mx = 25, my = 25; // Margins
|
const int8_t mx = 25, my = 25; // Margins
|
||||||
const int16_t stx = (DWIN_WIDTH - 2 * mx) / (GRID_MAX_POINTS_X - 1), // Steps
|
const int16_t stx = (DWIN_WIDTH - 2 * mx) / (sizex - 1), // Steps
|
||||||
sty = (DWIN_WIDTH - 2 * my) / (GRID_MAX_POINTS_Y - 1);
|
sty = (DWIN_WIDTH - 2 * my) / (sizey - 1);
|
||||||
const int8_t rmax = _MIN(mx - 2, stx / 2);
|
const int8_t rmax = _MIN(mx - 2, stx / 2);
|
||||||
const int8_t rmin = 7;
|
const int8_t rmin = 7;
|
||||||
int16_t zmesh[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y], maxz =-32000, minz = 32000;
|
int16_t zmesh[sizex][sizey];
|
||||||
#define px(xp) (mx + (xp) * stx)
|
#define px(xp) (mx + (xp) * stx)
|
||||||
#define py(yp) (30 + DWIN_WIDTH - my - (yp) * sty)
|
#define py(yp) (30 + DWIN_WIDTH - my - (yp) * sty)
|
||||||
#define rm(z) ((z - minz) * (rmax - rmin) / _MAX(1, (maxz - minz)) + rmin)
|
#define rm(z) ((z - minz) * (rmax - rmin) / _MAX(1, (maxz - minz)) + rmin)
|
||||||
#define DrawMeshValue(xp, yp, zv) DWINUI::Draw_Signed_Float(font6x12, 1, 2, px(xp) - 12, py(yp) - 6, zv)
|
#define DrawMeshValue(xp, yp, zv) DWINUI::Draw_Signed_Float(font6x12, 1, 2, px(xp) - 18, py(yp) - 6, zv)
|
||||||
#define DrawMeshHLine(yp) DWIN_Draw_HLine(HMI_data.SplitLine_Color, px(0), py(yp), DWIN_WIDTH - 2 * mx)
|
#define DrawMeshHLine(yp) DWIN_Draw_HLine(HMI_data.SplitLine_Color, px(0), py(yp), DWIN_WIDTH - 2 * mx)
|
||||||
#define DrawMeshVLine(xp) DWIN_Draw_VLine(HMI_data.SplitLine_Color, px(xp), py(GRID_MAX_POINTS_Y - 1), DWIN_WIDTH - 2 * my)
|
#define DrawMeshVLine(xp) DWIN_Draw_VLine(HMI_data.SplitLine_Color, px(xp), py(sizey - 1), DWIN_WIDTH - 2 * my)
|
||||||
GRID_LOOP(x, y) {
|
int16_t maxz =-32000; int16_t minz = 32000; avg = 0;
|
||||||
const float v = isnan(Z_VALUES(x,y)) ? 0 : round(Z_VALUES(x,y) * 100);
|
LOOP_L_N(y, sizey) LOOP_L_N(x, sizex) {
|
||||||
|
const float v = isnan(zval[x][y]) ? 0 : round(zval[x][y] * 100);
|
||||||
zmesh[x][y] = v;
|
zmesh[x][y] = v;
|
||||||
|
avg += v;
|
||||||
NOLESS(maxz, v);
|
NOLESS(maxz, v);
|
||||||
NOMORE(minz, v);
|
NOMORE(minz, v);
|
||||||
}
|
}
|
||||||
Title.ShowCaption(F("Mesh Viewer"));
|
max = (float)maxz / 100;
|
||||||
|
min = (float)minz / 100;
|
||||||
|
avg = avg / (100 * sizex * sizey);
|
||||||
DWINUI::ClearMenuArea();
|
DWINUI::ClearMenuArea();
|
||||||
DWINUI::Draw_Icon(ICON_Continue_E, 86, 305);
|
DWIN_Draw_Rectangle(0, HMI_data.SplitLine_Color, px(0), py(0), px(sizex - 1), py(sizey - 1));
|
||||||
DWIN_Draw_Rectangle(0, HMI_data.SplitLine_Color, px(0), py(0), px(GRID_MAX_POINTS_X - 1), py(GRID_MAX_POINTS_Y - 1));
|
LOOP_S_L_N(x, 1, sizex - 1) DrawMeshVLine(x);
|
||||||
LOOP_S_L_N(x, 1, GRID_MAX_POINTS_X - 1) DrawMeshVLine(x);
|
LOOP_S_L_N(y, 1, sizey - 1) DrawMeshHLine(y);
|
||||||
LOOP_S_L_N(y, 1, GRID_MAX_POINTS_Y - 1) DrawMeshHLine(y);
|
LOOP_L_N(y, sizey) {
|
||||||
LOOP_L_N(y, GRID_MAX_POINTS_Y) {
|
|
||||||
watchdog_refresh();
|
watchdog_refresh();
|
||||||
LOOP_L_N(x, GRID_MAX_POINTS_X) {
|
LOOP_L_N(x, sizex) {
|
||||||
uint16_t color = DWINUI::RainbowInt(zmesh[x][y], _MIN(-5, minz), _MAX(5, maxz));
|
uint16_t color = DWINUI::RainbowInt(zmesh[x][y], _MIN(-5, minz), _MAX(5, maxz));
|
||||||
uint8_t radius = rm(zmesh[x][y]);
|
uint8_t radius = rm(zmesh[x][y]);
|
||||||
DWINUI::Draw_FillCircle(color, px(x), py(y), radius);
|
DWINUI::Draw_FillCircle(color, px(x), py(y), radius);
|
||||||
if (GRID_MAX_POINTS_X < 9)
|
if (sizex < 9)
|
||||||
DWINUI::Draw_Signed_Float(font6x12, 1, 2, px(x) - 12, py(y) - 6, Z_VALUES(x,y));
|
DWINUI::Draw_Signed_Float(font6x12, 1, 2, px(x) - 18, py(y) - 6, zval[x][y]);
|
||||||
else {
|
else {
|
||||||
char str_1[9];
|
char str_1[9];
|
||||||
str_1[0] = 0;
|
str_1[0] = 0;
|
||||||
switch (zmesh[x][y]) {
|
switch (zmesh[x][y]) {
|
||||||
case -999 ... -100:
|
case -999 ... -100:
|
||||||
DWINUI::Draw_Signed_Float(font6x12, 1, 1, px(x) - 12, py(y) - 6, Z_VALUES(x,y));
|
DWINUI::Draw_Signed_Float(font6x12, 1, 1, px(x) - 18, py(y) - 6, zval[x][y]);
|
||||||
break;
|
break;
|
||||||
case -99 ... -1:
|
case -99 ... -1:
|
||||||
sprintf_P(str_1, PSTR("-.%02i"), -zmesh[x][y]);
|
sprintf_P(str_1, PSTR("-.%02i"), -zmesh[x][y]);
|
||||||
@ -94,7 +96,7 @@ void MeshViewerClass::Draw() {
|
|||||||
sprintf_P(str_1, PSTR(".%02i"), zmesh[x][y]);
|
sprintf_P(str_1, PSTR(".%02i"), zmesh[x][y]);
|
||||||
break;
|
break;
|
||||||
case 100 ... 999:
|
case 100 ... 999:
|
||||||
DWINUI::Draw_Signed_Float(font6x12, 1, 1, px(x) - 12, py(y) - 6, Z_VALUES(x,y));
|
DWINUI::Draw_Signed_Float(font6x12, 1, 1, px(x) - 18, py(y) - 6, zval[x][y]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (str_1[0])
|
if (str_1[0])
|
||||||
@ -102,11 +104,25 @@ void MeshViewerClass::Draw() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MeshViewerClass::Draw(bool withsave /*= false*/) {
|
||||||
|
Title.ShowCaption(F("Mesh Viewer"));
|
||||||
|
DrawMesh(Z_VALUES_ARR, GRID_MAX_POINTS_X, GRID_MAX_POINTS_Y);
|
||||||
|
if (withsave) {
|
||||||
|
DWINUI::Draw_Button(BTN_Save, 26, 305);
|
||||||
|
DWINUI::Draw_Button(BTN_Continue, 146, 305);
|
||||||
|
Draw_Select_Highlight(HMI_flag.select_flag, 305);
|
||||||
|
} else DWINUI::Draw_Button(BTN_Continue, 86, 305);
|
||||||
char str_1[6], str_2[6] = "";
|
char str_1[6], str_2[6] = "";
|
||||||
ui.status_printf(0, F("Mesh minZ: %s, maxZ: %s"),
|
ui.status_printf(0, F("Mesh minZ: %s, maxZ: %s"),
|
||||||
dtostrf((float)minz / 100, 1, 2, str_1),
|
dtostrf(min, 1, 2, str_1),
|
||||||
dtostrf((float)maxz / 100, 1, 2, str_2)
|
dtostrf(max, 1, 2, str_2)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Draw_MeshViewer() { MeshViewer.Draw(true); }
|
||||||
|
void onClick_MeshViewer() { if (HMI_flag.select_flag) WriteEeprom(); HMI_ReturnScreen(); }
|
||||||
|
void Goto_MeshViewer() { if (leveling_is_valid()) Goto_Popup(Draw_MeshViewer, onClick_MeshViewer); else HMI_ReturnScreen(); }
|
||||||
|
|
||||||
#endif // DWIN_LCD_PROUI && HAS_MESH
|
#endif // DWIN_LCD_PROUI && HAS_MESH
|
||||||
|
@ -21,18 +21,23 @@
|
|||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "../../../core/types.h"
|
||||||
|
#include "../../../feature/bedlevel/bedlevel.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DWIN Mesh Viewer
|
* Mesh Viewer for PRO UI
|
||||||
* Author: Miguel A. Risco-Castillo (MRISCOC)
|
* Author: Miguel A. Risco-Castillo (MRISCOC)
|
||||||
* Version: 3.9.1
|
* version: 3.12.1
|
||||||
* Date: 2021/11/09
|
* Date: 2022/02/24
|
||||||
*
|
|
||||||
* Based on the original code provided by Creality under GPL
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class MeshViewerClass {
|
class MeshViewerClass {
|
||||||
public:
|
public:
|
||||||
void Draw();
|
float avg, max, min;
|
||||||
|
void Draw(bool withsave = false);
|
||||||
|
void DrawMesh(bed_mesh_t zval, const uint8_t sizex, const uint8_t sizey);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern MeshViewerClass MeshViewer;
|
extern MeshViewerClass MeshViewer;
|
||||||
|
|
||||||
|
void Goto_MeshViewer();
|
||||||
|
@ -21,12 +21,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DWIN Print Stats page
|
* Print Stats page for PRO UI
|
||||||
* Author: Miguel A. Risco-Castillo (MRISCOC)
|
* Author: Miguel A. Risco-Castillo (MRISCOC)
|
||||||
* Version: 1.1
|
* Version: 1.3.0
|
||||||
* Date: 2022/01/09
|
* Date: 2022/02/24
|
||||||
*
|
|
||||||
* Based on the original code provided by Creality under GPL
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../../../inc/MarlinConfigPre.h"
|
#include "../../../inc/MarlinConfigPre.h"
|
||||||
@ -36,6 +34,7 @@
|
|||||||
#include "printstats.h"
|
#include "printstats.h"
|
||||||
|
|
||||||
#include "../../../core/types.h"
|
#include "../../../core/types.h"
|
||||||
|
#include "../../../MarlinCore.h"
|
||||||
#include "../../marlinui.h"
|
#include "../../marlinui.h"
|
||||||
#include "../../../module/printcounter.h"
|
#include "../../../module/printcounter.h"
|
||||||
#include "dwin_lcd.h"
|
#include "dwin_lcd.h"
|
||||||
@ -53,7 +52,7 @@ void PrintStatsClass::Draw() {
|
|||||||
Title.ShowCaption(GET_TEXT_F(MSG_INFO_STATS_MENU));
|
Title.ShowCaption(GET_TEXT_F(MSG_INFO_STATS_MENU));
|
||||||
DWINUI::ClearMenuArea();
|
DWINUI::ClearMenuArea();
|
||||||
Draw_Popup_Bkgd();
|
Draw_Popup_Bkgd();
|
||||||
DWINUI::Draw_Icon(ICON_Continue_E, 86, 250);
|
DWINUI::Draw_Button(BTN_Continue, 86, 250);
|
||||||
printStatistics ps = print_job_timer.getStats();
|
printStatistics ps = print_job_timer.getStats();
|
||||||
|
|
||||||
sprintf_P(buf, PSTR(S_FMT ": %i"), GET_TEXT(MSG_INFO_PRINT_COUNT), ps.totalPrints);
|
sprintf_P(buf, PSTR(S_FMT ": %i"), GET_TEXT(MSG_INFO_PRINT_COUNT), ps.totalPrints);
|
||||||
@ -75,4 +74,9 @@ void PrintStatsClass::Reset() {
|
|||||||
HMI_AudioFeedback();
|
HMI_AudioFeedback();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Goto_PrintStats() {
|
||||||
|
PrintStats.Draw();
|
||||||
|
HMI_SaveProcessID(WaitResponse);
|
||||||
|
}
|
||||||
|
|
||||||
#endif // DWIN_LCD_PROUI && PRINTCOUNTER
|
#endif // DWIN_LCD_PROUI && PRINTCOUNTER
|
||||||
|
@ -22,18 +22,18 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DWIN Print Stats page
|
* Print Stats page for PRO UI
|
||||||
* Author: Miguel A. Risco-Castillo (MRISCOC)
|
* Author: Miguel A. Risco-Castillo (MRISCOC)
|
||||||
* Version: 1.1
|
* Version: 1.3.0
|
||||||
* Date: 2022/01/09
|
* Date: 2022/02/24
|
||||||
*
|
|
||||||
* Based on the original code provided by Creality under GPL
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class PrintStatsClass {
|
class PrintStatsClass {
|
||||||
public:
|
public:
|
||||||
void Draw();
|
static void Draw();
|
||||||
static void Reset();
|
static void Reset();
|
||||||
};
|
};
|
||||||
|
|
||||||
extern PrintStatsClass PrintStats;
|
extern PrintStatsClass PrintStats;
|
||||||
|
|
||||||
|
void Goto_PrintStats();
|
||||||
|
@ -151,6 +151,7 @@ namespace Language_en {
|
|||||||
LSTR MSG_BED_LEVELING = _UxGT("Bed Leveling");
|
LSTR MSG_BED_LEVELING = _UxGT("Bed Leveling");
|
||||||
LSTR MSG_LEVEL_BED = _UxGT("Level Bed");
|
LSTR MSG_LEVEL_BED = _UxGT("Level Bed");
|
||||||
LSTR MSG_BED_TRAMMING = _UxGT("Bed Tramming");
|
LSTR MSG_BED_TRAMMING = _UxGT("Bed Tramming");
|
||||||
|
LSTR MSG_BED_TRAMMING_MANUAL = _UxGT("Manual Tramming");
|
||||||
LSTR MSG_BED_TRAMMING_RAISE = _UxGT("Adjust bed until the probe triggers.");
|
LSTR MSG_BED_TRAMMING_RAISE = _UxGT("Adjust bed until the probe triggers.");
|
||||||
LSTR MSG_BED_TRAMMING_IN_RANGE = _UxGT("Corners within tolerance. Bed trammed.");
|
LSTR MSG_BED_TRAMMING_IN_RANGE = _UxGT("Corners within tolerance. Bed trammed.");
|
||||||
LSTR MSG_BED_TRAMMING_GOOD_POINTS = _UxGT("Good Points: ");
|
LSTR MSG_BED_TRAMMING_GOOD_POINTS = _UxGT("Good Points: ");
|
||||||
@ -402,7 +403,7 @@ namespace Language_en {
|
|||||||
LSTR MSG_ADVANCE_K_E = _UxGT("Advance K *");
|
LSTR MSG_ADVANCE_K_E = _UxGT("Advance K *");
|
||||||
LSTR MSG_CONTRAST = _UxGT("LCD Contrast");
|
LSTR MSG_CONTRAST = _UxGT("LCD Contrast");
|
||||||
LSTR MSG_BRIGHTNESS = _UxGT("LCD Brightness");
|
LSTR MSG_BRIGHTNESS = _UxGT("LCD Brightness");
|
||||||
LSTR MSG_LCD_BKL_TIMEOUT = _UxGT("LCD Sleep (s)");
|
LSTR MSG_BRIGHTNESS_OFF = _UxGT("Turn Off LCD");
|
||||||
LSTR MSG_STORE_EEPROM = _UxGT("Store Settings");
|
LSTR MSG_STORE_EEPROM = _UxGT("Store Settings");
|
||||||
LSTR MSG_LOAD_EEPROM = _UxGT("Load Settings");
|
LSTR MSG_LOAD_EEPROM = _UxGT("Load Settings");
|
||||||
LSTR MSG_RESTORE_DEFAULTS = _UxGT("Restore Defaults");
|
LSTR MSG_RESTORE_DEFAULTS = _UxGT("Restore Defaults");
|
||||||
@ -429,6 +430,8 @@ namespace Language_en {
|
|||||||
LSTR MSG_BUTTON_RESET = _UxGT("Reset");
|
LSTR MSG_BUTTON_RESET = _UxGT("Reset");
|
||||||
LSTR MSG_BUTTON_IGNORE = _UxGT("Ignore");
|
LSTR MSG_BUTTON_IGNORE = _UxGT("Ignore");
|
||||||
LSTR MSG_BUTTON_CANCEL = _UxGT("Cancel");
|
LSTR MSG_BUTTON_CANCEL = _UxGT("Cancel");
|
||||||
|
LSTR MSG_BUTTON_CONFIRM = _UxGT("Confirm");
|
||||||
|
LSTR MSG_BUTTON_CONTINUE = _UxGT("Continue");
|
||||||
LSTR MSG_BUTTON_DONE = _UxGT("Done");
|
LSTR MSG_BUTTON_DONE = _UxGT("Done");
|
||||||
LSTR MSG_BUTTON_BACK = _UxGT("Back");
|
LSTR MSG_BUTTON_BACK = _UxGT("Back");
|
||||||
LSTR MSG_BUTTON_PROCEED = _UxGT("Proceed");
|
LSTR MSG_BUTTON_PROCEED = _UxGT("Proceed");
|
||||||
@ -438,6 +441,7 @@ namespace Language_en {
|
|||||||
LSTR MSG_BUTTON_PAUSE = _UxGT("Pause");
|
LSTR MSG_BUTTON_PAUSE = _UxGT("Pause");
|
||||||
LSTR MSG_BUTTON_RESUME = _UxGT("Resume");
|
LSTR MSG_BUTTON_RESUME = _UxGT("Resume");
|
||||||
LSTR MSG_BUTTON_ADVANCED = _UxGT("Advanced");
|
LSTR MSG_BUTTON_ADVANCED = _UxGT("Advanced");
|
||||||
|
LSTR MSG_BUTTON_SAVE = _UxGT("Save");
|
||||||
LSTR MSG_PAUSING = _UxGT("Pausing...");
|
LSTR MSG_PAUSING = _UxGT("Pausing...");
|
||||||
LSTR MSG_PAUSE_PRINT = _UxGT("Pause Print");
|
LSTR MSG_PAUSE_PRINT = _UxGT("Pause Print");
|
||||||
LSTR MSG_ADVANCED_PAUSE = _UxGT("Advanced Pause");
|
LSTR MSG_ADVANCED_PAUSE = _UxGT("Advanced Pause");
|
||||||
|
@ -48,7 +48,6 @@ MarlinUI ui;
|
|||||||
#if ENABLED(DWIN_CREALITY_LCD)
|
#if ENABLED(DWIN_CREALITY_LCD)
|
||||||
#include "e3v2/creality/dwin.h"
|
#include "e3v2/creality/dwin.h"
|
||||||
#elif ENABLED(DWIN_LCD_PROUI)
|
#elif ENABLED(DWIN_LCD_PROUI)
|
||||||
#include "fontutils.h"
|
|
||||||
#include "e3v2/proui/dwin.h"
|
#include "e3v2/proui/dwin.h"
|
||||||
#elif ENABLED(DWIN_CREALITY_LCD_JYERSUI)
|
#elif ENABLED(DWIN_CREALITY_LCD_JYERSUI)
|
||||||
#include "e3v2/jyersui/dwin.h"
|
#include "e3v2/jyersui/dwin.h"
|
||||||
@ -1441,8 +1440,10 @@ void MarlinUI::init() {
|
|||||||
else if (print_job_timer.needsService(3)) msg = FPSTR(service3);
|
else if (print_job_timer.needsService(3)) msg = FPSTR(service3);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
else if (!no_welcome)
|
else if (!no_welcome) msg = GET_TEXT_F(WELCOME_MSG);
|
||||||
msg = GET_TEXT_F(WELCOME_MSG);
|
|
||||||
|
else if (ENABLED(DWIN_LCD_PROUI))
|
||||||
|
msg = F("");
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -367,15 +367,6 @@ public:
|
|||||||
static void set_status(FSTR_P const fstr, const int8_t level=0);
|
static void set_status(FSTR_P const fstr, const int8_t level=0);
|
||||||
static void status_printf(const uint8_t level, FSTR_P const fmt, ...);
|
static void status_printf(const uint8_t level, FSTR_P const fmt, ...);
|
||||||
|
|
||||||
#if EITHER(HAS_DISPLAY, DWIN_LCD_PROUI)
|
|
||||||
static void kill_screen(FSTR_P const lcd_error, FSTR_P const lcd_component);
|
|
||||||
#if DISABLED(LIGHTWEIGHT_UI)
|
|
||||||
static void draw_status_message(const bool blink);
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
static void kill_screen(FSTR_P const, FSTR_P const) {}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if HAS_DISPLAY
|
#if HAS_DISPLAY
|
||||||
|
|
||||||
static void update();
|
static void update();
|
||||||
@ -489,11 +480,16 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void draw_kill_screen();
|
static void draw_kill_screen();
|
||||||
|
static void kill_screen(FSTR_P const lcd_error, FSTR_P const lcd_component);
|
||||||
|
#if DISABLED(LIGHTWEIGHT_UI)
|
||||||
|
static void draw_status_message(const bool blink);
|
||||||
|
#endif
|
||||||
|
|
||||||
#else // No LCD
|
#else // No LCD
|
||||||
|
|
||||||
static void update() {}
|
static void update() {}
|
||||||
static void return_to_status() {}
|
static void return_to_status() {}
|
||||||
|
static void kill_screen(FSTR_P const, FSTR_P const) {}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1467,16 +1467,18 @@ void MarlinSettings::postprocess() {
|
|||||||
//
|
//
|
||||||
#if ENABLED(DWIN_LCD_PROUI)
|
#if ENABLED(DWIN_LCD_PROUI)
|
||||||
{
|
{
|
||||||
|
_FIELD_TEST(dwin_data);
|
||||||
char dwin_data[eeprom_data_size] = { 0 };
|
char dwin_data[eeprom_data_size] = { 0 };
|
||||||
DWIN_StoreSettings(dwin_data);
|
DWIN_StoreSettings(dwin_data);
|
||||||
_FIELD_TEST(dwin_data);
|
|
||||||
EEPROM_WRITE(dwin_data);
|
EEPROM_WRITE(dwin_data);
|
||||||
}
|
}
|
||||||
#elif ENABLED(DWIN_CREALITY_LCD_JYERSUI)
|
#endif
|
||||||
|
|
||||||
|
#if ENABLED(DWIN_CREALITY_LCD_JYERSUI)
|
||||||
{
|
{
|
||||||
|
_FIELD_TEST(dwin_settings);
|
||||||
char dwin_settings[CrealityDWIN.eeprom_data_size] = { 0 };
|
char dwin_settings[CrealityDWIN.eeprom_data_size] = { 0 };
|
||||||
CrealityDWIN.Save_Settings(dwin_settings);
|
CrealityDWIN.Save_Settings(dwin_settings);
|
||||||
_FIELD_TEST(dwin_settings);
|
|
||||||
EEPROM_WRITE(dwin_settings);
|
EEPROM_WRITE(dwin_settings);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -497,6 +497,9 @@ void Stepper::enable_axis(const AxisEnum axis) {
|
|||||||
|
|
||||||
bool Stepper::disable_axis(const AxisEnum axis) {
|
bool Stepper::disable_axis(const AxisEnum axis) {
|
||||||
mark_axis_disabled(axis);
|
mark_axis_disabled(axis);
|
||||||
|
|
||||||
|
TERN_(DWIN_LCD_PROUI, set_axis_untrusted(axis)); // MRISCOC workaround: https://github.com/MarlinFirmware/Marlin/issues/23095
|
||||||
|
|
||||||
// If all the axes that share the enabled bit are disabled
|
// If all the axes that share the enabled bit are disabled
|
||||||
const bool can_disable = can_axis_disable(axis);
|
const bool can_disable = can_axis_disable(axis);
|
||||||
if (can_disable) {
|
if (can_disable) {
|
||||||
|
@ -821,7 +821,7 @@ volatile bool Temperature::raw_temps_ready = false;
|
|||||||
hal.idletask();
|
hal.idletask();
|
||||||
|
|
||||||
// Run UI update
|
// Run UI update
|
||||||
TERN(HAS_DWIN_E3V2_BASIC, DWIN_Update(), ui.update());
|
TERN(DWIN_CREALITY_LCD, DWIN_Update(), ui.update());
|
||||||
}
|
}
|
||||||
wait_for_heatup = false;
|
wait_for_heatup = false;
|
||||||
|
|
||||||
|
@ -235,7 +235,7 @@
|
|||||||
#define TFTGLCD_CS PA9
|
#define TFTGLCD_CS PA9
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#elif ENABLED(FYSETC_MINI_12864_2_1)
|
#elif ENABLED(FYSETC_MINI_12864_2_1)
|
||||||
|
|
||||||
#error "CAUTION! FYSETC_MINI_12864_2_1 / MKS_MINI_12864_V3 / BTT_MINI_12864_V1 requires wiring modifications. See 'pins_BTT_SKR_MINI_E3_common.h' for details. Comment out this line to continue."
|
#error "CAUTION! FYSETC_MINI_12864_2_1 / MKS_MINI_12864_V3 / BTT_MINI_12864_V1 requires wiring modifications. See 'pins_BTT_SKR_MINI_E3_common.h' for details. Comment out this line to continue."
|
||||||
|
@ -28,7 +28,11 @@
|
|||||||
#include "env_validate.h"
|
#include "env_validate.h"
|
||||||
|
|
||||||
#if HAS_MULTI_HOTEND || E_STEPPERS > 1
|
#if HAS_MULTI_HOTEND || E_STEPPERS > 1
|
||||||
#error "Creality V4 only supports one hotend / E-stepper. Comment out this line to continue."
|
#error "Creality V24S1 only supports one hotend / E-stepper. Comment out this line to continue."
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if BOTH(BLTOUCH, Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
|
||||||
|
#error "Disable Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN when using BLTOUCH with Creality V24S1-301."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define BOARD_INFO_NAME "Creality V24S1-301"
|
#define BOARD_INFO_NAME "Creality V24S1-301"
|
||||||
@ -44,7 +48,7 @@
|
|||||||
//
|
//
|
||||||
// Limit Switches
|
// Limit Switches
|
||||||
//
|
//
|
||||||
#define Z_STOP_PIN PC14
|
#define Z_STOP_PIN PA15
|
||||||
|
|
||||||
#ifndef Z_MIN_PROBE_PIN
|
#ifndef Z_MIN_PROBE_PIN
|
||||||
#define Z_MIN_PROBE_PIN PC14 // BLTouch IN
|
#define Z_MIN_PROBE_PIN PC14 // BLTouch IN
|
||||||
@ -63,4 +67,22 @@
|
|||||||
#define HEATER_BED_PIN PA7 // HOT BED
|
#define HEATER_BED_PIN PA7 // HOT BED
|
||||||
#define FAN1_PIN PC0 // extruder fan
|
#define FAN1_PIN PC0 // extruder fan
|
||||||
|
|
||||||
|
//
|
||||||
|
// SD Card
|
||||||
|
//
|
||||||
|
#define ONBOARD_SPI_DEVICE 1
|
||||||
|
#define ONBOARD_SD_CS_PIN PA4 // SDSS
|
||||||
|
|
||||||
|
//
|
||||||
|
// M3/M4/M5 - Spindle/Laser Control
|
||||||
|
//
|
||||||
|
#if HAS_CUTTER
|
||||||
|
//#define HEATER_0_PIN -1
|
||||||
|
//#define HEATER_BED_PIN -1
|
||||||
|
#define FAN_PIN -1
|
||||||
|
#define SPINDLE_LASER_ENA_PIN PA0 // FET 1
|
||||||
|
#define SPINDLE_LASER_PWM_PIN PA0 // Bed FET
|
||||||
|
#define SPINDLE_DIR_PIN PA0 // FET 4
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "pins_CREALITY_V4.h"
|
#include "pins_CREALITY_V4.h"
|
||||||
|
@ -195,7 +195,7 @@ char *createFilename(char * const buffer, const dir_t &p) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Return 'true' if the item is something Marlin can read
|
// Return 'true' if the item is a folder, G-code file or Binary file
|
||||||
//
|
//
|
||||||
bool CardReader::is_visible_entity(const dir_t &p OPTARG(CUSTOM_FIRMWARE_UPLOAD, bool onlyBin/*=false*/)) {
|
bool CardReader::is_visible_entity(const dir_t &p OPTARG(CUSTOM_FIRMWARE_UPLOAD, bool onlyBin/*=false*/)) {
|
||||||
//uint8_t pn0 = p.name[0];
|
//uint8_t pn0 = p.name[0];
|
||||||
@ -212,14 +212,15 @@ bool CardReader::is_visible_entity(const dir_t &p OPTARG(CUSTOM_FIRMWARE_UPLOAD,
|
|||||||
) return false;
|
) return false;
|
||||||
|
|
||||||
flag.filenameIsDir = DIR_IS_SUBDIR(&p); // We know it's a File or Folder
|
flag.filenameIsDir = DIR_IS_SUBDIR(&p); // We know it's a File or Folder
|
||||||
|
setBinFlag(p.name[8] == 'B' && // List .bin files (a firmware file for flashing)
|
||||||
|
p.name[9] == 'I' &&
|
||||||
|
p.name[10]== 'N');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
flag.filenameIsDir // All Directories are ok
|
flag.filenameIsDir // All Directories are ok
|
||||||
|
|| fileIsBinary() // BIN files are accepted
|
||||||
|| (!onlyBin && p.name[8] == 'G'
|
|| (!onlyBin && p.name[8] == 'G'
|
||||||
&& p.name[9] != '~') // Non-backup *.G* files are accepted
|
&& p.name[9] != '~') // Non-backup *.G* files are accepted
|
||||||
|| ( onlyBin && p.name[8] == 'B'
|
|
||||||
&& p.name[9] == 'I'
|
|
||||||
&& p.name[10] == 'N') // BIN files are accepted
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -867,6 +868,7 @@ void CardReader::selectFileByIndex(const uint16_t nr) {
|
|||||||
strcpy(filename, sortshort[nr]);
|
strcpy(filename, sortshort[nr]);
|
||||||
strcpy(longFilename, sortnames[nr]);
|
strcpy(longFilename, sortnames[nr]);
|
||||||
flag.filenameIsDir = IS_DIR(nr);
|
flag.filenameIsDir = IS_DIR(nr);
|
||||||
|
setBinFlag(strcmp_P(strrchr(filename, '.'), PSTR(".BIN")) == 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -884,6 +886,7 @@ void CardReader::selectFileByName(const char * const match) {
|
|||||||
strcpy(filename, sortshort[nr]);
|
strcpy(filename, sortshort[nr]);
|
||||||
strcpy(longFilename, sortnames[nr]);
|
strcpy(longFilename, sortnames[nr]);
|
||||||
flag.filenameIsDir = IS_DIR(nr);
|
flag.filenameIsDir = IS_DIR(nr);
|
||||||
|
setBinFlag(strcmp_P(strrchr(filename, '.'), PSTR(".BIN")) == 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -80,6 +80,9 @@ typedef struct {
|
|||||||
filenameIsDir:1,
|
filenameIsDir:1,
|
||||||
workDirIsRoot:1,
|
workDirIsRoot:1,
|
||||||
abort_sd_printing:1
|
abort_sd_printing:1
|
||||||
|
#if DO_LIST_BIN_FILES
|
||||||
|
, filenameIsBin:1
|
||||||
|
#endif
|
||||||
#if ENABLED(BINARY_FILE_TRANSFER)
|
#if ENABLED(BINARY_FILE_TRANSFER)
|
||||||
, binary_mode:1
|
, binary_mode:1
|
||||||
#endif
|
#endif
|
||||||
@ -218,6 +221,10 @@ public:
|
|||||||
static void removeJobRecoveryFile();
|
static void removeJobRecoveryFile();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Binary flag for the current file
|
||||||
|
static bool fileIsBinary() { return TERN0(DO_LIST_BIN_FILES, flag.filenameIsBin); }
|
||||||
|
static void setBinFlag(const bool bin) { TERN(DO_LIST_BIN_FILES, flag.filenameIsBin = bin, UNUSED(bin)); }
|
||||||
|
|
||||||
// Current Working Dir - Set by cd, cdup, cdroot, and diveToFile(true, ...)
|
// Current Working Dir - Set by cd, cdup, cdroot, and diveToFile(true, ...)
|
||||||
static char* getWorkDirName() { workDir.getDosName(filename); return filename; }
|
static char* getWorkDirName() { workDir.getDosName(filename); return filename; }
|
||||||
static SdFile& getWorkDir() { return workDir.isOpen() ? workDir : root; }
|
static SdFile& getWorkDir() { return workDir.isOpen() ? workDir : root; }
|
||||||
|
@ -15,8 +15,9 @@ exec_test $1 $2 "Ender 3 v2 with CrealityUI" "$3"
|
|||||||
|
|
||||||
use_example_configs "Creality/Ender-3 V2/CrealityV422/CrealityUI"
|
use_example_configs "Creality/Ender-3 V2/CrealityV422/CrealityUI"
|
||||||
opt_disable DWIN_CREALITY_LCD
|
opt_disable DWIN_CREALITY_LCD
|
||||||
opt_enable DWIN_LCD_PROUI BLTOUCH AUTO_BED_LEVELING_UBL Z_SAFE_HOMING INDIVIDUAL_AXIS_HOMING_SUBMENU LCD_SET_PROGRESS_MANUALLY STATUS_MESSAGE_SCROLLING BAUD_RATE_GCODE
|
opt_enable BLTOUCH AUTO_BED_LEVELING_UBL Z_SAFE_HOMING INDIVIDUAL_AXIS_HOMING_SUBMENU LCD_SET_PROGRESS_MANUALLY STATUS_MESSAGE_SCROLLING BAUD_RATE_GCODE \
|
||||||
exec_test $1 $2 "Ender 3 v2 with Pro UI" "$3"
|
DWIN_LCD_PROUI SOUND_MENU_ITEM PRINTCOUNTER
|
||||||
|
exec_test $1 $2 "Ender 3 v2 with ProUI" "$3"
|
||||||
|
|
||||||
use_example_configs "Creality/Ender-3 V2/CrealityV422/CrealityUI"
|
use_example_configs "Creality/Ender-3 V2/CrealityV422/CrealityUI"
|
||||||
opt_disable DWIN_CREALITY_LCD
|
opt_disable DWIN_CREALITY_LCD
|
||||||
|
Loading…
Reference in New Issue
Block a user