2020-06-16 01:45:27 -05:00
|
|
|
|
/**
|
|
|
|
|
* Marlin 3D Printer Firmware
|
|
|
|
|
* Copyright (c) 2020 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
|
2020-07-23 05:20:14 +02:00
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2020-06-16 01:45:27 -05:00
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* DWIN by Creality3D
|
|
|
|
|
*/
|
|
|
|
|
|
2020-09-06 21:40:58 -05:00
|
|
|
|
#include "../dwin_lcd.h"
|
2020-06-16 01:45:27 -05:00
|
|
|
|
#include "rotary_encoder.h"
|
2020-09-06 21:40:58 -05:00
|
|
|
|
#include "../../../libs/BL24CXX.h"
|
2020-06-16 01:45:27 -05:00
|
|
|
|
|
2020-09-17 06:35:04 -04:00
|
|
|
|
#include "../../../inc/MarlinConfigPre.h"
|
2020-06-16 01:45:27 -05:00
|
|
|
|
|
2020-09-17 06:35:04 -04:00
|
|
|
|
#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 {
|
2020-07-14 20:01:29 -05:00
|
|
|
|
// Process ID
|
2020-06-16 01:45:27 -05:00
|
|
|
|
MainMenu,
|
|
|
|
|
SelectFile,
|
|
|
|
|
Prepare,
|
|
|
|
|
Control,
|
|
|
|
|
Leveling,
|
|
|
|
|
PrintProcess,
|
|
|
|
|
AxisMove,
|
|
|
|
|
TemperatureID,
|
|
|
|
|
Motion,
|
|
|
|
|
Info,
|
|
|
|
|
Tune,
|
2020-09-17 06:35:04 -04:00
|
|
|
|
#if HAS_PREHEAT
|
2020-06-24 19:44:50 -05:00
|
|
|
|
PLAPreheat,
|
|
|
|
|
ABSPreheat,
|
|
|
|
|
#endif
|
2020-06-16 01:45:27 -05:00
|
|
|
|
MaxSpeed,
|
|
|
|
|
MaxSpeed_value,
|
|
|
|
|
MaxAcceleration,
|
|
|
|
|
MaxAcceleration_value,
|
2020-09-16 04:35:30 -05:00
|
|
|
|
MaxJerk,
|
|
|
|
|
MaxJerk_value,
|
2020-06-16 01:45:27 -05:00
|
|
|
|
Step,
|
|
|
|
|
Step_value,
|
|
|
|
|
|
2020-07-14 20:01:29 -05:00
|
|
|
|
// Last Process ID
|
2020-06-16 01:45:27 -05:00
|
|
|
|
Last_Prepare,
|
|
|
|
|
|
2020-07-14 20:01:29 -05:00
|
|
|
|
// Back Process ID
|
2020-06-16 01:45:27 -05:00
|
|
|
|
Back_Main,
|
|
|
|
|
Back_Print,
|
|
|
|
|
|
2020-07-14 20:01:29 -05:00
|
|
|
|
// Date variable ID
|
2020-06-16 01:45:27 -05:00
|
|
|
|
Move_X,
|
|
|
|
|
Move_Y,
|
|
|
|
|
Move_Z,
|
2020-06-24 19:44:50 -05:00
|
|
|
|
#if HAS_HOTEND
|
2020-08-19 00:49:23 -05:00
|
|
|
|
Extruder,
|
2020-06-24 19:44:50 -05:00
|
|
|
|
ETemp,
|
|
|
|
|
#endif
|
2020-08-19 00:49:23 -05:00
|
|
|
|
Homeoffset,
|
2020-06-24 19:44:50 -05:00
|
|
|
|
#if HAS_HEATED_BED
|
|
|
|
|
BedTemp,
|
|
|
|
|
#endif
|
|
|
|
|
#if HAS_FAN
|
|
|
|
|
FanSpeed,
|
|
|
|
|
#endif
|
2020-06-16 01:45:27 -05:00
|
|
|
|
PrintSpeed,
|
|
|
|
|
|
2020-07-14 20:01:29 -05:00
|
|
|
|
// Window ID
|
2020-06-16 01:45:27 -05:00
|
|
|
|
Print_window,
|
|
|
|
|
Popup_Window
|
|
|
|
|
};
|
|
|
|
|
|
2020-07-14 20:01:29 -05:00
|
|
|
|
// Picture ID
|
2020-06-16 01:45:27 -05:00
|
|
|
|
#define Start_Process 0
|
|
|
|
|
#define Language_English 1
|
|
|
|
|
#define Language_Chinese 2
|
|
|
|
|
|
2020-07-14 20:01:29 -05:00
|
|
|
|
// ICON ID
|
2020-06-16 01:45:27 -05:00
|
|
|
|
#define ICON 0x09
|
|
|
|
|
#define ICON_LOGO 0
|
|
|
|
|
#define ICON_Print_0 1
|
|
|
|
|
#define ICON_Print_1 2
|
|
|
|
|
#define ICON_Prepare_0 3
|
|
|
|
|
#define ICON_Prepare_1 4
|
|
|
|
|
#define ICON_Control_0 5
|
|
|
|
|
#define ICON_Control_1 6
|
|
|
|
|
#define ICON_Leveling_0 7
|
|
|
|
|
#define ICON_Leveling_1 8
|
|
|
|
|
#define ICON_HotendTemp 9
|
|
|
|
|
#define ICON_BedTemp 10
|
|
|
|
|
#define ICON_Speed 11
|
|
|
|
|
#define ICON_Zoffset 12
|
|
|
|
|
#define ICON_Back 13
|
|
|
|
|
#define ICON_File 14
|
|
|
|
|
#define ICON_PrintTime 15
|
|
|
|
|
#define ICON_RemainTime 16
|
|
|
|
|
#define ICON_Setup_0 17
|
|
|
|
|
#define ICON_Setup_1 18
|
|
|
|
|
#define ICON_Pause_0 19
|
|
|
|
|
#define ICON_Pause_1 20
|
|
|
|
|
#define ICON_Continue_0 21
|
|
|
|
|
#define ICON_Continue_1 22
|
|
|
|
|
#define ICON_Stop_0 23
|
|
|
|
|
#define ICON_Stop_1 24
|
|
|
|
|
#define ICON_Bar 25
|
|
|
|
|
#define ICON_More 26
|
|
|
|
|
|
|
|
|
|
#define ICON_Axis 27
|
|
|
|
|
#define ICON_CloseMotor 28
|
|
|
|
|
#define ICON_Homing 29
|
|
|
|
|
#define ICON_SetHome 30
|
|
|
|
|
#define ICON_PLAPreheat 31
|
|
|
|
|
#define ICON_ABSPreheat 32
|
|
|
|
|
#define ICON_Cool 33
|
|
|
|
|
#define ICON_Language 34
|
|
|
|
|
|
|
|
|
|
#define ICON_MoveX 35
|
|
|
|
|
#define ICON_MoveY 36
|
|
|
|
|
#define ICON_MoveZ 37
|
|
|
|
|
#define ICON_Extruder 38
|
|
|
|
|
|
|
|
|
|
#define ICON_Temperature 40
|
|
|
|
|
#define ICON_Motion 41
|
|
|
|
|
#define ICON_WriteEEPROM 42
|
|
|
|
|
#define ICON_ReadEEPROM 43
|
|
|
|
|
#define ICON_ResumeEEPROM 44
|
|
|
|
|
#define ICON_Info 45
|
|
|
|
|
|
|
|
|
|
#define ICON_SetEndTemp 46
|
|
|
|
|
#define ICON_SetBedTemp 47
|
|
|
|
|
#define ICON_FanSpeed 48
|
|
|
|
|
#define ICON_SetPLAPreheat 49
|
|
|
|
|
#define ICON_SetABSPreheat 50
|
|
|
|
|
|
|
|
|
|
#define ICON_MaxSpeed 51
|
|
|
|
|
#define ICON_MaxAccelerated 52
|
2020-09-16 04:35:30 -05:00
|
|
|
|
#define ICON_MaxJerk 53
|
2020-06-16 01:45:27 -05:00
|
|
|
|
#define ICON_Step 54
|
|
|
|
|
#define ICON_PrintSize 55
|
|
|
|
|
#define ICON_Version 56
|
|
|
|
|
#define ICON_Contact 57
|
|
|
|
|
#define ICON_StockConfiguraton 58
|
|
|
|
|
#define ICON_MaxSpeedX 59
|
|
|
|
|
#define ICON_MaxSpeedY 60
|
|
|
|
|
#define ICON_MaxSpeedZ 61
|
|
|
|
|
#define ICON_MaxSpeedE 62
|
|
|
|
|
#define ICON_MaxAccX 63
|
|
|
|
|
#define ICON_MaxAccY 64
|
|
|
|
|
#define ICON_MaxAccZ 65
|
|
|
|
|
#define ICON_MaxAccE 66
|
2020-09-16 04:35:30 -05:00
|
|
|
|
#define ICON_MaxSpeedJerkX 67
|
|
|
|
|
#define ICON_MaxSpeedJerkY 68
|
|
|
|
|
#define ICON_MaxSpeedJerkZ 69
|
|
|
|
|
#define ICON_MaxSpeedJerkE 70
|
2020-06-16 01:45:27 -05:00
|
|
|
|
#define ICON_StepX 71
|
|
|
|
|
#define ICON_StepY 72
|
|
|
|
|
#define ICON_StepZ 73
|
|
|
|
|
#define ICON_StepE 74
|
|
|
|
|
#define ICON_Setspeed 75
|
|
|
|
|
#define ICON_SetZOffset 76
|
|
|
|
|
#define ICON_Rectangle 77
|
|
|
|
|
#define ICON_BLTouch 78
|
|
|
|
|
#define ICON_TempTooLow 79
|
|
|
|
|
#define ICON_AutoLeveling 80
|
|
|
|
|
#define ICON_TempTooHigh 81
|
|
|
|
|
#define ICON_NoTips_C 82
|
|
|
|
|
#define ICON_NoTips_E 83
|
|
|
|
|
#define ICON_Continue_C 84
|
|
|
|
|
#define ICON_Continue_E 85
|
|
|
|
|
#define ICON_Cancel_C 86
|
|
|
|
|
#define ICON_Cancel_E 87
|
|
|
|
|
#define ICON_Confirm_C 88
|
|
|
|
|
#define ICON_Confirm_E 89
|
|
|
|
|
#define ICON_Info_0 90
|
|
|
|
|
#define ICON_Info_1 91
|
|
|
|
|
|
2020-07-14 20:01:29 -05:00
|
|
|
|
/**
|
|
|
|
|
* 3-.0:The font size, 0x00-0x09, corresponds to the font size below:
|
|
|
|
|
* 0x00=6*12 0x01=8*16 0x02=10*20 0x03=12*24 0x04=14*28
|
|
|
|
|
* 0x05=16*32 0x06=20*40 0x07=24*48 0x08=28*56 0x09=32*64
|
|
|
|
|
*/
|
2020-06-16 01:45:27 -05:00
|
|
|
|
#define font6x12 0x00
|
|
|
|
|
#define font8x16 0x01
|
|
|
|
|
#define font10x20 0x02
|
|
|
|
|
#define font12x24 0x03
|
|
|
|
|
#define font14x28 0x04
|
|
|
|
|
#define font16x32 0x05
|
|
|
|
|
#define font20x40 0x06
|
|
|
|
|
#define font24x48 0x07
|
|
|
|
|
#define font28x56 0x08
|
|
|
|
|
#define font32x64 0x09
|
|
|
|
|
|
2020-07-14 20:01:29 -05:00
|
|
|
|
// Color
|
2020-09-19 07:56:01 -05:00
|
|
|
|
#define Color_White 0xFFFF
|
|
|
|
|
#define Color_Bg_Window 0x31E8 // Popup background color
|
|
|
|
|
#define Color_Bg_Blue 0x1125 // Dark blue background color
|
|
|
|
|
#define Color_Bg_Black 0x0841 // Black background color
|
|
|
|
|
#define Popup_Text_Color 0xD6BA // Popup font background color
|
2020-07-14 20:01:29 -05:00
|
|
|
|
#define Line_Color 0x3A6A // Split line color
|
2020-09-19 07:56:01 -05:00
|
|
|
|
#define Rectangle_Color 0xEE2F // Blue square cursor color
|
|
|
|
|
#define Percent_Color 0xFE29 // Percentage color
|
|
|
|
|
#define BarFill_Color 0x10E4 // Fill color of progress bar
|
|
|
|
|
#define Select_Color 0x33BB // Selected color
|
2020-06-16 01:45:27 -05:00
|
|
|
|
|
2020-09-17 06:35:04 -04:00
|
|
|
|
extern uint8_t checkkey;
|
2020-06-16 01:45:27 -05:00
|
|
|
|
extern float zprobe_zoffset;
|
|
|
|
|
extern char print_filename[16];
|
|
|
|
|
|
2020-06-24 19:44:50 -05:00
|
|
|
|
extern millis_t dwin_heat_time;
|
2020-06-16 01:45:27 -05:00
|
|
|
|
|
|
|
|
|
typedef struct {
|
2020-07-14 20:01:29 -05:00
|
|
|
|
TERN_(HAS_HOTEND, int16_t E_Temp = 0);
|
|
|
|
|
TERN_(HAS_HEATED_BED, int16_t Bed_Temp = 0);
|
2020-09-17 06:35:04 -04:00
|
|
|
|
TERN_(HAS_PREHEAT, int16_t Fan_speed = 0);
|
2020-06-16 01:45:27 -05:00
|
|
|
|
int16_t print_speed = 100;
|
2020-06-24 19:44:50 -05:00
|
|
|
|
float Max_Feedspeed = 0;
|
|
|
|
|
float Max_Acceleration = 0;
|
2020-09-16 04:35:30 -05:00
|
|
|
|
float Max_Jerk = 0;
|
2020-06-24 19:44:50 -05:00
|
|
|
|
float Max_Step = 0;
|
|
|
|
|
float Move_X_scale = 0;
|
|
|
|
|
float Move_Y_scale = 0;
|
|
|
|
|
float Move_Z_scale = 0;
|
2020-09-17 06:35:04 -04:00
|
|
|
|
#if HAS_HOTEND
|
2020-06-24 19:44:50 -05:00
|
|
|
|
float Move_E_scale = 0;
|
|
|
|
|
#endif
|
|
|
|
|
float offset_value = 0;
|
|
|
|
|
char show_mode = 0; // -1: Temperature control 0: Printing temperature
|
2020-06-16 01:45:27 -05:00
|
|
|
|
} HMI_value_t;
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
2020-08-22 14:44:21 +10:00
|
|
|
|
bool language_chinese; // 0: EN, 1: CN
|
2020-06-16 01:45:27 -05:00
|
|
|
|
bool pause_flag:1;
|
2020-09-17 06:35:04 -04:00
|
|
|
|
bool pause_action:1;
|
2020-06-16 01:45:27 -05:00
|
|
|
|
bool print_finish:1;
|
2020-09-17 06:35:04 -04:00
|
|
|
|
bool done_confirm_flag:1;
|
2020-06-16 01:45:27 -05:00
|
|
|
|
bool select_flag:1;
|
|
|
|
|
bool home_flag:1;
|
|
|
|
|
bool heat_flag:1; // 0: heating done 1: during heating
|
2020-09-17 06:35:04 -04:00
|
|
|
|
#if ENABLED(PREVENT_COLD_EXTRUSION)
|
2020-06-24 19:44:50 -05:00
|
|
|
|
bool ETempTooLow_flag:1;
|
|
|
|
|
#endif
|
|
|
|
|
#if HAS_LEVELING
|
|
|
|
|
bool leveling_offset_flag:1;
|
|
|
|
|
#endif
|
|
|
|
|
#if HAS_FAN
|
2020-09-17 06:35:04 -04:00
|
|
|
|
AxisEnum feedspeed_axis;
|
2020-06-24 19:44:50 -05:00
|
|
|
|
#endif
|
2020-09-17 06:35:04 -04:00
|
|
|
|
AxisEnum acc_axis, jerk_axis, step_axis;
|
2020-06-16 01:45:27 -05:00
|
|
|
|
} HMI_Flag;
|
|
|
|
|
|
|
|
|
|
extern HMI_value_t HMI_ValueStruct;
|
|
|
|
|
extern HMI_Flag HMI_flag;
|
|
|
|
|
|
2020-07-14 20:01:29 -05:00
|
|
|
|
// Show ICO
|
2020-06-16 01:45:27 -05:00
|
|
|
|
void ICON_Print(bool show);
|
|
|
|
|
void ICON_Prepare(bool show);
|
|
|
|
|
void ICON_Control(bool show);
|
|
|
|
|
void ICON_Leveling(bool show);
|
|
|
|
|
void ICON_StartInfo(bool show);
|
|
|
|
|
|
|
|
|
|
void ICON_Setting(bool show);
|
|
|
|
|
void ICON_Pause(bool show);
|
|
|
|
|
void ICON_Continue(bool show);
|
|
|
|
|
void ICON_Stop(bool show);
|
|
|
|
|
|
2020-09-17 06:35:04 -04:00
|
|
|
|
#if HAS_HOTEND || HAS_HEATED_BED
|
|
|
|
|
// Popup message window
|
|
|
|
|
void DWIN_Popup_Temperature(const bool toohigh);
|
|
|
|
|
#endif
|
|
|
|
|
|
2020-06-24 19:44:50 -05:00
|
|
|
|
#if HAS_HOTEND
|
2020-09-17 06:35:04 -04:00
|
|
|
|
void Popup_Window_ETempTooLow();
|
2020-06-24 19:44:50 -05:00
|
|
|
|
#endif
|
|
|
|
|
|
2020-09-17 06:35:04 -04:00
|
|
|
|
void Popup_Window_Resume();
|
|
|
|
|
void Popup_Window_Home(const bool parking=false);
|
|
|
|
|
void Popup_Window_Leveling();
|
2020-06-16 01:45:27 -05:00
|
|
|
|
|
2020-09-17 06:35:04 -04:00
|
|
|
|
void Goto_PrintProcess();
|
|
|
|
|
void Goto_MainMenu();
|
2020-06-16 01:45:27 -05:00
|
|
|
|
|
2020-07-14 20:01:29 -05:00
|
|
|
|
// Variable control
|
2020-09-17 06:35:04 -04:00
|
|
|
|
void HMI_Move_X();
|
|
|
|
|
void HMI_Move_Y();
|
|
|
|
|
void HMI_Move_Z();
|
|
|
|
|
void HMI_Move_E();
|
2020-06-16 01:45:27 -05:00
|
|
|
|
|
2020-09-17 06:35:04 -04:00
|
|
|
|
void HMI_Zoffset();
|
2020-06-24 19:44:50 -05:00
|
|
|
|
|
2020-09-17 06:35:04 -04:00
|
|
|
|
TERN_(HAS_HOTEND, void HMI_ETemp());
|
|
|
|
|
TERN_(HAS_HEATED_BED, void HMI_BedTemp());
|
|
|
|
|
TERN_(HAS_FAN, void HMI_FanSpeed());
|
2020-07-14 20:01:29 -05:00
|
|
|
|
|
2020-09-17 06:35:04 -04:00
|
|
|
|
void HMI_PrintSpeed();
|
2020-06-16 01:45:27 -05:00
|
|
|
|
|
2020-09-17 06:35:04 -04:00
|
|
|
|
void HMI_MaxFeedspeedXYZE();
|
|
|
|
|
void HMI_MaxAccelerationXYZE();
|
|
|
|
|
void HMI_MaxJerkXYZE();
|
|
|
|
|
void HMI_StepXYZE();
|
2020-06-16 01:45:27 -05:00
|
|
|
|
|
2020-09-17 06:35:04 -04:00
|
|
|
|
void update_variable();
|
2020-09-14 02:48:45 -05:00
|
|
|
|
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);
|
2020-06-16 01:45:27 -05:00
|
|
|
|
|
2020-07-14 20:01:29 -05:00
|
|
|
|
// SD Card
|
2020-09-17 06:35:04 -04:00
|
|
|
|
void HMI_SDCardInit();
|
|
|
|
|
void HMI_SDCardUpdate();
|
2020-06-16 01:45:27 -05:00
|
|
|
|
|
2020-07-14 20:01:29 -05:00
|
|
|
|
// Main Process
|
2020-06-16 01:45:27 -05:00
|
|
|
|
void Icon_print(bool value);
|
|
|
|
|
void Icon_control(bool value);
|
|
|
|
|
void Icon_temperature(bool value);
|
|
|
|
|
void Icon_leveling(bool value);
|
|
|
|
|
|
2020-07-14 20:01:29 -05:00
|
|
|
|
// Other
|
2020-09-27 16:46:26 -05:00
|
|
|
|
void Draw_Status_Area(const bool with_update); // Status Area
|
|
|
|
|
void HMI_StartFrame(const bool with_update); // Prepare the menu view
|
2020-09-17 06:35:04 -04:00
|
|
|
|
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_PREHEAT
|
|
|
|
|
void HMI_PLAPreheatSetting(); // PLA warm-up setting
|
|
|
|
|
void HMI_ABSPreheatSetting(); // ABS warm-up setting
|
2020-06-24 19:44:50 -05:00
|
|
|
|
#endif
|
|
|
|
|
|
2020-09-17 06:35:04 -04:00
|
|
|
|
void HMI_MaxSpeed(); // Maximum speed submenu
|
|
|
|
|
void HMI_MaxAcceleration(); // Maximum acceleration submenu
|
|
|
|
|
void HMI_MaxJerk(); // Maximum jerk speed submenu
|
|
|
|
|
void HMI_Step(); // Transmission ratio
|
2020-06-16 01:45:27 -05:00
|
|
|
|
|
2020-09-17 06:35:04 -04:00
|
|
|
|
void HMI_Init();
|
|
|
|
|
void DWIN_Update();
|
|
|
|
|
void EachMomentUpdate();
|
|
|
|
|
void DWIN_HandleScreen();
|
2020-06-16 01:45:27 -05:00
|
|
|
|
|
2020-09-17 06:35:04 -04:00
|
|
|
|
void DWIN_CompletedHoming();
|
|
|
|
|
void DWIN_CompletedLeveling();
|