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 GitHub
parent 5926bacea1
commit 073b7f1e3a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 1357 additions and 1087 deletions

View file

@ -1572,6 +1572,7 @@
#if ENABLED(BABYSTEPPING) #if ENABLED(BABYSTEPPING)
//#define INTEGRATED_BABYSTEPPING // EXPERIMENTAL integration of babystepping into the Stepper ISR //#define INTEGRATED_BABYSTEPPING // EXPERIMENTAL integration of babystepping into the Stepper ISR
//#define BABYSTEP_WITHOUT_HOMING //#define BABYSTEP_WITHOUT_HOMING
//#define BABYSTEP_ALWAYS_AVAILABLE // Allow babystepping at all times (not just during movement).
//#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA!
#define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way
//#define BABYSTEP_MILLIMETER_UNITS // Specify BABYSTEP_MULTIPLICATOR_(XY|Z) in mm instead of micro-steps //#define BABYSTEP_MILLIMETER_UNITS // Specify BABYSTEP_MULTIPLICATOR_(XY|Z) in mm instead of micro-steps
@ -1582,7 +1583,6 @@
#if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING) #if ENABLED(DOUBLECLICK_FOR_Z_BABYSTEPPING)
#define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds.
// Note: Extra time may be added to mitigate controller latency. // Note: Extra time may be added to mitigate controller latency.
//#define BABYSTEP_ALWAYS_AVAILABLE // Allow babystepping at all times (not just during movement).
//#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle. //#define MOVE_Z_WHEN_IDLE // Jump to the move Z menu on doubleclick when printer is idle.
#if ENABLED(MOVE_Z_WHEN_IDLE) #if ENABLED(MOVE_Z_WHEN_IDLE)
#define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size. #define MOVE_Z_IDLE_MULTIPLICATOR 1 // Multiply 1mm by this factor for the move step size.

View file

@ -59,7 +59,7 @@
#if TEMP_SENSOR_BED == 0 #if TEMP_SENSOR_BED == 0
#undef THERMAL_PROTECTION_BED #undef THERMAL_PROTECTION_BED
#undef THERMAL_PROTECTION_BED_PERIOD #undef THERMAL_PROTECTION_BED_PERIOD
#endif #endif
#if TEMP_SENSOR_CHAMBER == 0 #if TEMP_SENSOR_CHAMBER == 0
#undef THERMAL_PROTECTION_CHAMBER #undef THERMAL_PROTECTION_CHAMBER

File diff suppressed because it is too large Load diff

View file

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

View file

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

View file

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

View file

@ -576,7 +576,7 @@ volatile bool Temperature::raw_temps_ready = false;
#define MAX_CYCLE_TIME_PID_AUTOTUNE 20L #define MAX_CYCLE_TIME_PID_AUTOTUNE 20L
#endif #endif
if ((ms - _MIN(t1, t2)) > (MAX_CYCLE_TIME_PID_AUTOTUNE * 60L * 1000L)) { if ((ms - _MIN(t1, t2)) > (MAX_CYCLE_TIME_PID_AUTOTUNE * 60L * 1000L)) {
TERN_(DWIN_CREALITY_LCD, Popup_Window_Temperature(0)); TERN_(DWIN_CREALITY_LCD, DWIN_Popup_Temperature(0));
TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_TUNING_TIMEOUT)); TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_TUNING_TIMEOUT));
SERIAL_ECHOLNPGM(STR_PID_TIMEOUT); SERIAL_ECHOLNPGM(STR_PID_TIMEOUT);
break; break;
@ -812,12 +812,16 @@ void Temperature::_temp_error(const heater_id_t heater_id, PGM_P const serial_ms
} }
void Temperature::max_temp_error(const heater_id_t heater_id) { void Temperature::max_temp_error(const heater_id_t heater_id) {
TERN_(DWIN_CREALITY_LCD, Popup_Window_Temperature(1)); #if ENABLED(DWIN_CREALITY_LCD) && (HAS_HOTEND || HAS_HEATED_BED)
DWIN_Popup_Temperature(1);
#endif
_temp_error(heater_id, PSTR(STR_T_MAXTEMP), GET_TEXT(MSG_ERR_MAXTEMP)); _temp_error(heater_id, PSTR(STR_T_MAXTEMP), GET_TEXT(MSG_ERR_MAXTEMP));
} }
void Temperature::min_temp_error(const heater_id_t heater_id) { void Temperature::min_temp_error(const heater_id_t heater_id) {
TERN_(DWIN_CREALITY_LCD, Popup_Window_Temperature(0)); #if ENABLED(DWIN_CREALITY_LCD) && (HAS_HOTEND || HAS_HEATED_BED)
DWIN_Popup_Temperature(0);
#endif
_temp_error(heater_id, PSTR(STR_T_MINTEMP), GET_TEXT(MSG_ERR_MINTEMP)); _temp_error(heater_id, PSTR(STR_T_MINTEMP), GET_TEXT(MSG_ERR_MINTEMP));
} }
@ -1055,7 +1059,7 @@ void Temperature::manage_heater() {
// Make sure temperature is increasing // Make sure temperature is increasing
if (watch_hotend[e].next_ms && ELAPSED(ms, watch_hotend[e].next_ms)) { // Time to check this extruder? if (watch_hotend[e].next_ms && ELAPSED(ms, watch_hotend[e].next_ms)) { // Time to check this extruder?
if (degHotend(e) < watch_hotend[e].target) { // Failed to increase enough? if (degHotend(e) < watch_hotend[e].target) { // Failed to increase enough?
TERN_(DWIN_CREALITY_LCD, Popup_Window_Temperature(0)); TERN_(DWIN_CREALITY_LCD, DWIN_Popup_Temperature(0));
_temp_error((heater_id_t)e, str_t_heating_failed, GET_TEXT(MSG_HEATING_FAILED_LCD)); _temp_error((heater_id_t)e, str_t_heating_failed, GET_TEXT(MSG_HEATING_FAILED_LCD));
} }
else // Start again if the target is still far off else // Start again if the target is still far off
@ -1098,7 +1102,7 @@ void Temperature::manage_heater() {
// Make sure temperature is increasing // Make sure temperature is increasing
if (watch_bed.elapsed(ms)) { // Time to check the bed? if (watch_bed.elapsed(ms)) { // Time to check the bed?
if (degBed() < watch_bed.target) { // Failed to increase enough? if (degBed() < watch_bed.target) { // Failed to increase enough?
TERN_(DWIN_CREALITY_LCD, Popup_Window_Temperature(0)); TERN_(DWIN_CREALITY_LCD, DWIN_Popup_Temperature(0));
_temp_error(H_BED, str_t_heating_failed, GET_TEXT(MSG_HEATING_FAILED_LCD)); _temp_error(H_BED, str_t_heating_failed, GET_TEXT(MSG_HEATING_FAILED_LCD));
} }
else // Start again if the target is still far off else // Start again if the target is still far off
@ -2023,7 +2027,7 @@ void Temperature::init() {
state = TRRunaway; state = TRRunaway;
case TRRunaway: case TRRunaway:
TERN_(DWIN_CREALITY_LCD, Popup_Window_Temperature(0)); TERN_(DWIN_CREALITY_LCD, DWIN_Popup_Temperature(0));
_temp_error(heater_id, str_t_thermal_runaway, GET_TEXT(MSG_THERMAL_RUNAWAY)); _temp_error(heater_id, str_t_thermal_runaway, GET_TEXT(MSG_THERMAL_RUNAWAY));
} }
} }
@ -2440,14 +2444,8 @@ void Temperature::tick() {
#if DISABLED(SLOW_PWM_HEATERS) #if DISABLED(SLOW_PWM_HEATERS)
#if HAS_HOTEND || HAS_HEATED_BED || HAS_HEATED_CHAMBER #if ANY(HAS_HOTEND, HAS_HEATED_BED, HAS_HEATED_CHAMBER, FAN_SOFT_PWM)
constexpr uint8_t pwm_mask = constexpr uint8_t pwm_mask = TERN0(SOFT_PWM_DITHER, _BV(SOFT_PWM_SCALE) - 1);
#if ENABLED(SOFT_PWM_DITHER)
_BV(SOFT_PWM_SCALE) - 1
#else
0
#endif
;
#define _PWM_MOD(N,S,T) do{ \ #define _PWM_MOD(N,S,T) do{ \
const bool on = S.add(pwm_mask, T.soft_pwm_amount); \ const bool on = S.add(pwm_mask, T.soft_pwm_amount); \
WRITE_HEATER_##N(on); \ WRITE_HEATER_##N(on); \

View file

@ -89,10 +89,6 @@
#define HAS_GCODE_M876 #define HAS_GCODE_M876
#endif #endif
#if PREHEAT_COUNT
#define HAS_PREHEAT_COUNT
#endif
#if EXTRUDERS #if EXTRUDERS
#define HAS_EXTRUDERS #define HAS_EXTRUDERS
#if EXTRUDERS > 1 #if EXTRUDERS > 1

View file

@ -153,7 +153,6 @@ default_src_filter = +<src/*> -<src/config> -<src/HAL> +<src/HAL/shared>
-<src/gcode/host/M360.cpp> -<src/gcode/host/M360.cpp>
-<src/gcode/host/M876.cpp> -<src/gcode/host/M876.cpp>
-<src/gcode/lcd/M0_M1.cpp> -<src/gcode/lcd/M0_M1.cpp>
-<src/gcode/lcd/M145.cpp>
-<src/gcode/lcd/M250.cpp> -<src/gcode/lcd/M250.cpp>
-<src/gcode/lcd/M73.cpp> -<src/gcode/lcd/M73.cpp>
-<src/gcode/lcd/M995.cpp> -<src/gcode/lcd/M995.cpp>
@ -330,7 +329,6 @@ HOST_KEEPALIVE_FEATURE = src_filter=+<src/gcode/host/M113.cpp>
REPETIER_GCODE_M360 = src_filter=+<src/gcode/host/M360.cpp> REPETIER_GCODE_M360 = src_filter=+<src/gcode/host/M360.cpp>
HAS_GCODE_M876 = src_filter=+<src/gcode/host/M876.cpp> HAS_GCODE_M876 = src_filter=+<src/gcode/host/M876.cpp>
HAS_RESUME_CONTINUE = src_filter=+<src/gcode/lcd/M0_M1.cpp> HAS_RESUME_CONTINUE = src_filter=+<src/gcode/lcd/M0_M1.cpp>
HAS_PREHEAT_COUNT = src_filter=+<src/gcode/lcd/M145.cpp>
HAS_LCD_CONTRAST = src_filter=+<src/gcode/lcd/M250.cpp> HAS_LCD_CONTRAST = src_filter=+<src/gcode/lcd/M250.cpp>
LCD_SET_PROGRESS_MANUALLY = src_filter=+<src/gcode/lcd/M73.cpp> LCD_SET_PROGRESS_MANUALLY = src_filter=+<src/gcode/lcd/M73.cpp>
TOUCH_SCREEN_CALIBRATION = src_filter=+<src/gcode/lcd/M995.cpp> TOUCH_SCREEN_CALIBRATION = src_filter=+<src/gcode/lcd/M995.cpp>