E3 V2 DWIN: Z-Offset, cleanup, versatility (#19384)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
cosmoderp
2020-09-17 06:35:04 -04:00
committed by Scott Lahteine
parent c407c08b0b
commit 7e56e6c4ea
9 changed files with 1357 additions and 1087 deletions

File diff suppressed because it is too large Load Diff

View File

@ -29,9 +29,16 @@
#include "rotary_encoder.h"
#include "../../../libs/BL24CXX.h"
#include <stdint.h>
#include "../../../inc/MarlinConfigPre.h"
enum processID {
#if ANY(HAS_HOTEND, HAS_HEATED_BED, HAS_FAN) && PREHEAT_COUNT
#define HAS_PREHEAT 1
#if PREHEAT_COUNT < 2
#error "Creality DWIN requires two material preheat presets."
#endif
#endif
enum processID : uint8_t {
// Process ID
MainMenu,
SelectFile,
@ -44,7 +51,7 @@ enum processID {
Motion,
Info,
Tune,
#if HAS_HOTEND
#if HAS_PREHEAT
PLAPreheat,
ABSPreheat,
#endif
@ -218,7 +225,7 @@ enum processID {
#define BarFill_Color 0x10E4 // fill color of progress bar
#define Select_Color 0x33BB // selected color
extern int checkkey, last_checkkey;
extern uint8_t checkkey;
extern float zprobe_zoffset;
extern char print_filename[16];
@ -227,7 +234,7 @@ extern millis_t dwin_heat_time;
typedef struct {
TERN_(HAS_HOTEND, int16_t E_Temp = 0);
TERN_(HAS_HEATED_BED, int16_t Bed_Temp = 0);
TERN_(HAS_FAN, int16_t Fan_speed = 0);
TERN_(HAS_PREHEAT, int16_t Fan_speed = 0);
int16_t print_speed = 100;
float Max_Feedspeed = 0;
float Max_Acceleration = 0;
@ -236,7 +243,7 @@ typedef struct {
float Move_X_scale = 0;
float Move_Y_scale = 0;
float Move_Z_scale = 0;
#if EXTRUDERS
#if HAS_HOTEND
float Move_E_scale = 0;
#endif
float offset_value = 0;
@ -246,33 +253,27 @@ typedef struct {
typedef struct {
bool language_chinese; // 0: EN, 1: CN
bool pause_flag:1;
bool pause_action:1;
bool print_finish:1;
bool confirm_flag:1;
bool done_confirm_flag:1;
bool select_flag:1;
bool home_flag:1;
bool heat_flag:1; // 0: heating done 1: during heating
#if HAS_HOTEND
#if ENABLED(PREVENT_COLD_EXTRUSION)
bool ETempTooLow_flag:1;
#endif
#if HAS_LEVELING
bool leveling_offset_flag:1;
#endif
#if HAS_FAN
AxisEnum feedspeed_flag;
AxisEnum feedspeed_axis;
#endif
AxisEnum acc_flag;
AxisEnum jerk_flag;
AxisEnum step_flag;
AxisEnum acc_axis, jerk_axis, step_axis;
} HMI_Flag;
extern HMI_value_t HMI_ValueStruct;
extern HMI_Flag HMI_flag;
// Language
void HMI_SetLanguage(void);
void HMI_SetAndSaveLanguageWestern(void);
void HMI_SetAndSaveLanguageChinese(void);
// Show ICO
void ICON_Print(bool show);
void ICON_Prepare(bool show);
@ -285,44 +286,47 @@ void ICON_Pause(bool show);
void ICON_Continue(bool show);
void ICON_Stop(bool show);
// Popup window tips
#if HAS_HOTEND
void Popup_Window_Temperature(const bool toohigh);
void Popup_Window_ETempTooLow(void);
#if HAS_HOTEND || HAS_HEATED_BED
// Popup message window
void DWIN_Popup_Temperature(const bool toohigh);
#endif
void Popup_Window_Resume(void);
void Popup_Window_Home(void);
void Popup_Window_Leveling(void);
#if HAS_HOTEND
void Popup_Window_ETempTooLow();
#endif
void Goto_PrintProcess(void);
void Goto_MainMenu(void);
void Popup_Window_Resume();
void Popup_Window_Home(const bool parking=false);
void Popup_Window_Leveling();
void Goto_PrintProcess();
void Goto_MainMenu();
// Variable control
void HMI_Move_X(void);
void HMI_Move_Y(void);
void HMI_Move_Z(void);
void HMI_Move_E(void);
void HMI_Move_X();
void HMI_Move_Y();
void HMI_Move_Z();
void HMI_Move_E();
void HMI_Zoffset(void);
void HMI_Zoffset();
TERN_(HAS_HOTEND, void HMI_ETemp(void));
TERN_(HAS_HEATED_BED, void HMI_BedTemp(void));
TERN_(HAS_FAN, void HMI_FanSpeed(void));
TERN_(HAS_HOTEND, void HMI_ETemp());
TERN_(HAS_HEATED_BED, void HMI_BedTemp());
TERN_(HAS_FAN, void HMI_FanSpeed());
void HMI_PrintSpeed(void);
void HMI_PrintSpeed();
void HMI_MaxFeedspeedXYZE(void);
void HMI_MaxAccelerationXYZE(void);
void HMI_MaxJerkXYZE(void);
void HMI_StepXYZE(void);
void HMI_MaxFeedspeedXYZE();
void HMI_MaxAccelerationXYZE();
void HMI_MaxJerkXYZE();
void HMI_StepXYZE();
void update_variable(void);
void update_variable();
void DWIN_Draw_Signed_Float(uint8_t size, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, long value);
// SD Card
void HMI_SDCardInit(void);
void HMI_SDCardUpdate(void);
void HMI_SDCardInit();
void HMI_SDCardUpdate();
// Main Process
void Icon_print(bool value);
@ -333,32 +337,32 @@ void Icon_leveling(bool value);
// Other
bool Pause_HeatStatus();
void HMI_StartFrame(const bool with_update); // Startup screen
void HMI_MainMenu(void); // Main process screen
void HMI_SelectFile(void); // File page
void HMI_Printing(void); // Print page
void HMI_Prepare(void); // Prepare page
void HMI_Control(void); // Control page
void HMI_Leveling(void); // Level the page
void HMI_AxisMove(void); // Axis movement menu
void HMI_Temperature(void); // Temperature menu
void HMI_Motion(void); // Sports menu
void HMI_Info(void); // Information menu
void HMI_Tune(void); // Adjust the menu
void HMI_MainMenu(); // Main process screen
void HMI_SelectFile(); // File page
void HMI_Printing(); // Print page
void HMI_Prepare(); // Prepare page
void HMI_Control(); // Control page
void HMI_Leveling(); // Level the page
void HMI_AxisMove(); // Axis movement menu
void HMI_Temperature(); // Temperature menu
void HMI_Motion(); // Sports menu
void HMI_Info(); // Information menu
void HMI_Tune(); // Adjust the menu
#if HAS_HOTEND
void HMI_PLAPreheatSetting(void); // PLA warm-up setting
void HMI_ABSPreheatSetting(void); // ABS warm-up setting
#if HAS_PREHEAT
void HMI_PLAPreheatSetting(); // PLA warm-up setting
void HMI_ABSPreheatSetting(); // ABS warm-up setting
#endif
void HMI_MaxSpeed(void); // Maximum speed submenu
void HMI_MaxAcceleration(void); // Maximum acceleration submenu
void HMI_MaxJerk(void); // Maximum jerk speed submenu
void HMI_Step(void); // Transmission ratio
void HMI_MaxSpeed(); // Maximum speed submenu
void HMI_MaxAcceleration(); // Maximum acceleration submenu
void HMI_MaxJerk(); // Maximum jerk speed submenu
void HMI_Step(); // Transmission ratio
void HMI_Init(void);
void DWIN_Update(void);
void EachMomentUpdate(void);
void DWIN_HandleScreen(void);
void HMI_Init();
void DWIN_Update();
void EachMomentUpdate();
void DWIN_HandleScreen();
void DWIN_CompletedHoming(void);
void DWIN_CompletedLeveling(void);
void DWIN_CompletedHoming();
void DWIN_CompletedLeveling();

View File

@ -124,7 +124,7 @@ ENCODER_DiffState Encoder_ReceiveAnalyze(void) {
int32_t encoderMultiplier = 1;
// if must encoder rati multiplier
if (EncoderRate.encoderRateEnabled) {
if (EncoderRate.enabled) {
const float abs_diff = ABS(temp_diff),
encoderMovementSteps = abs_diff / (ENCODER_PULSES_PER_STEP);
if (EncoderRate.lastEncoderTime) {

View File

@ -44,7 +44,7 @@
#define BUTTON_PRESSED(BN) !READ(BTN_## BN)
typedef struct {
bool encoderRateEnabled = 0;
bool enabled = false;
int encoderMoveValue = 0;
millis_t lastEncoderTime = 0;
} ENCODER_Rate;