Marlin 2.0 for Flying Bear 4S/5
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

270 lines
6.1 KiB

4 years ago
/**
* 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
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#pragma once
/**
* DWIN by Creality3D
*/
#include "dwin_lcd.h"
4 years ago
#include "rotary_encoder.h"
#include "../../../libs/BL24CXX.h"
4 years ago
#include "../../../inc/MarlinConfigPre.h"
4 years ago
#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 {
4 years ago
// Process ID
MainMenu,
SelectFile,
Prepare,
Control,
Leveling,
PrintProcess,
AxisMove,
TemperatureID,
Motion,
Info,
Tune,
#if HAS_PREHEAT
4 years ago
PLAPreheat,
ABSPreheat,
#endif
MaxSpeed,
MaxSpeed_value,
MaxAcceleration,
MaxAcceleration_value,
MaxJerk,
MaxJerk_value,
4 years ago
Step,
Step_value,
3 years ago
HomeOff,
HomeOffX,
HomeOffY,
HomeOffZ,
4 years ago
// Last Process ID
Last_Prepare,
3 years ago
// Advance Settings
AdvSet,
ProbeOff,
ProbeOffX,
ProbeOffY,
4 years ago
// Back Process ID
Back_Main,
Back_Print,
// Date variable ID
Move_X,
Move_Y,
Move_Z,
#if HAS_HOTEND
Extruder,
4 years ago
ETemp,
#endif
Homeoffset,
4 years ago
#if HAS_HEATED_BED
BedTemp,
#endif
#if HAS_FAN
FanSpeed,
#endif
PrintSpeed,
// Window ID
Print_window,
Popup_Window
};
extern uint8_t checkkey;
4 years ago
extern float zprobe_zoffset;
extern char print_filename[16];
extern millis_t dwin_heat_time;
typedef struct {
3 years ago
#if HAS_HOTEND
3 years ago
celsius_t E_Temp = 0;
#endif
3 years ago
#if HAS_HEATED_BED
3 years ago
celsius_t Bed_Temp = 0;
#endif
3 years ago
#if HAS_FAN
3 years ago
int16_t Fan_speed = 0;
#endif
4 years ago
int16_t print_speed = 100;
float Max_Feedspeed = 0;
float Max_Acceleration = 0;
3 years ago
float Max_Jerk_scaled = 0;
float Max_Step_scaled = 0;
float Move_X_scaled = 0;
float Move_Y_scaled = 0;
float Move_Z_scaled = 0;
#if HAS_HOTEND
3 years ago
float Move_E_scaled = 0;
4 years ago
#endif
float offset_value = 0;
3 years ago
int8_t show_mode = 0; // -1: Temperature control 0: Printing temperature
float Home_OffX_scaled = 0;
float Home_OffY_scaled = 0;
float Home_OffZ_scaled = 0;
float Probe_OffX_scaled = 0;
float Probe_OffY_scaled = 0;
4 years ago
} HMI_value_t;
#define DWIN_CHINESE 123
#define DWIN_ENGLISH 0
4 years ago
typedef struct {
uint8_t language;
4 years ago
bool pause_flag:1;
bool pause_action:1;
4 years ago
bool print_finish:1;
bool done_confirm_flag:1;
4 years ago
bool select_flag:1;
bool home_flag:1;
bool heat_flag:1; // 0: heating done 1: during heating
#if ENABLED(PREVENT_COLD_EXTRUSION)
4 years ago
bool ETempTooLow_flag:1;
#endif
#if HAS_LEVELING
bool leveling_offset_flag:1;
#endif
3 years ago
AxisEnum feedspeed_axis, acc_axis, jerk_axis, step_axis;
} HMI_Flag_t;
4 years ago
extern HMI_value_t HMI_ValueStruct;
extern HMI_Flag_t HMI_flag;
4 years ago
// Show ICO
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);
#if HAS_HOTEND || HAS_HEATED_BED
// Popup message window
void DWIN_Popup_Temperature(const bool toohigh);
#endif
4 years ago
#if HAS_HOTEND
void Popup_Window_ETempTooLow();
4 years ago
#endif
void Popup_Window_Resume();
void Popup_Window_Home(const bool parking=false);
void Popup_Window_Leveling();
4 years ago
void Goto_PrintProcess();
void Goto_MainMenu();
4 years ago
// Variable control
void HMI_Move_X();
void HMI_Move_Y();
void HMI_Move_Z();
void HMI_Move_E();
4 years ago
void HMI_Zoffset();
4 years ago
3 years ago
#if HAS_HOTEND
3 years ago
void HMI_ETemp();
#endif
3 years ago
#if HAS_HEATED_BED
3 years ago
void HMI_BedTemp();
#endif
3 years ago
#if HAS_FAN
3 years ago
void HMI_FanSpeed();
#endif
4 years ago
void HMI_PrintSpeed();
4 years ago
void HMI_MaxFeedspeedXYZE();
void HMI_MaxAccelerationXYZE();
void HMI_MaxJerkXYZE();
void HMI_StepXYZE();
void HMI_SetLanguageCache();
4 years ago
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);
4 years ago
// SD Card
void HMI_SDCardInit();
void HMI_SDCardUpdate();
4 years ago
// Main Process
void Icon_print(bool value);
void Icon_control(bool value);
void Icon_temperature(bool value);
void Icon_leveling(bool value);
// Other
void Draw_Status_Area(const bool with_update); // Status Area
void HMI_StartFrame(const bool with_update); // Prepare the menu view
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
4 years ago
#endif
void HMI_MaxSpeed(); // Maximum speed submenu
void HMI_MaxAcceleration(); // Maximum acceleration submenu
void HMI_MaxJerk(); // Maximum jerk speed submenu
void HMI_Step(); // Transmission ratio
4 years ago
void HMI_Init();
void DWIN_Update();
void EachMomentUpdate();
void DWIN_HandleScreen();
3 years ago
void DWIN_StatusChanged(const char *text);
3 years ago
void DWIN_StatusChanged_P(PGM_P const pstr);
3 years ago
void DWIN_Draw_Checkbox(uint16_t color, uint16_t bcolor, uint16_t x, uint16_t y, bool mode /* = false*/);
inline void DWIN_StartHoming() { HMI_flag.home_flag = true; }
4 years ago
void DWIN_CompletedHoming();
void DWIN_CompletedLeveling();