MKS H43 fixup (#21267)
Co-authored-by: makerbase <4164049@qq.com> Co-authored-by: MKS-Sean <56996910+MKS-Sean@users.noreply.github.com> Co-authored-by: Scott Lahteine <github@thinkyhead.com>
This commit is contained in:
parent
a94fa7b476
commit
72cc5a49e6
|
@ -610,6 +610,14 @@ void GCodeQueue::get_available_commands() {
|
||||||
TERN_(SDSUPPORT, get_sdcard_commands());
|
TERN_(SDSUPPORT, get_sdcard_commands());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run the entire queue in-place. Blocks SD completion/abort until complete.
|
||||||
|
*/
|
||||||
|
void GCodeQueue::exhaust() {
|
||||||
|
while (ring_buffer.occupied()) advance();
|
||||||
|
planner.synchronize();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the next command in the queue, optionally log it to SD, then dispatch it
|
* Get the next command in the queue, optionally log it to SD, then dispatch it
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -93,7 +93,9 @@ public:
|
||||||
|
|
||||||
inline bool full(uint8_t cmdCount=1) const { return length > (BUFSIZE - cmdCount); }
|
inline bool full(uint8_t cmdCount=1) const { return length > (BUFSIZE - cmdCount); }
|
||||||
|
|
||||||
inline bool empty() const { return length == 0; }
|
inline bool occupied() const { return length != 0; }
|
||||||
|
|
||||||
|
inline bool empty() const { return !occupied(); }
|
||||||
|
|
||||||
inline CommandLine& peek_next_command() { return commands[index_r]; }
|
inline CommandLine& peek_next_command() { return commands[index_r]; }
|
||||||
|
|
||||||
|
@ -162,6 +164,11 @@ public:
|
||||||
*/
|
*/
|
||||||
static void advance();
|
static void advance();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run the entire queue in-place
|
||||||
|
*/
|
||||||
|
static void exhaust();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add to the circular command queue the next command from:
|
* Add to the circular command queue the next command from:
|
||||||
* - The command-injection queue (injected_commands_P)
|
* - The command-injection queue (injected_commands_P)
|
||||||
|
|
|
@ -395,20 +395,23 @@ void DGUSScreenHandler::HandleTemperatureChanged(DGUS_VP_Variable &var, void *va
|
||||||
default: return;
|
default: return;
|
||||||
#if HOTENDS >= 1
|
#if HOTENDS >= 1
|
||||||
case VP_T_E0_Set:
|
case VP_T_E0_Set:
|
||||||
|
NOMORE(newvalue, HEATER_0_MAXTEMP);
|
||||||
thermalManager.setTargetHotend(newvalue, 0);
|
thermalManager.setTargetHotend(newvalue, 0);
|
||||||
acceptedvalue = thermalManager.temp_hotend[0].target;
|
acceptedvalue = thermalManager.degTargetHotend(0);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if HOTENDS >= 2
|
#if HOTENDS >= 2
|
||||||
case VP_T_E1_Set:
|
case VP_T_E1_Set:
|
||||||
|
NOMORE(newvalue, HEATER_1_MAXTEMP);
|
||||||
thermalManager.setTargetHotend(newvalue, 1);
|
thermalManager.setTargetHotend(newvalue, 1);
|
||||||
acceptedvalue = thermalManager.temp_hotend[1].target;
|
acceptedvalue = thermalManager.degTargetHotend(1);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if HAS_HEATED_BED
|
#if HAS_HEATED_BED
|
||||||
case VP_T_Bed_Set:
|
case VP_T_Bed_Set:
|
||||||
|
NOMORE(newvalue, BED_MAXTEMP);
|
||||||
thermalManager.setTargetBed(newvalue);
|
thermalManager.setTargetBed(newvalue);
|
||||||
acceptedvalue = thermalManager.temp_bed.target;
|
acceptedvalue = thermalManager.degTargetBed();
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,7 @@ uint16_t z_park_pos = 10;
|
||||||
xyz_pos_t position_before_pause;
|
xyz_pos_t position_before_pause;
|
||||||
|
|
||||||
void MKS_pause_print_move() {
|
void MKS_pause_print_move() {
|
||||||
planner.synchronize();
|
queue.exhaust();
|
||||||
position_before_pause = current_position;
|
position_before_pause = current_position;
|
||||||
do_blocking_move_to(X_MIN_POS + x_park_pos, Y_MIN_POS + y_park_pos, current_position.z + z_park_pos);
|
do_blocking_move_to(X_MIN_POS + x_park_pos, Y_MIN_POS + y_park_pos, current_position.z + z_park_pos);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,10 +23,10 @@
|
||||||
|
|
||||||
#include "../DGUSDisplayDef.h"
|
#include "../DGUSDisplayDef.h"
|
||||||
|
|
||||||
//#define USE_MKS_GREEN_UI
|
#define USE_MKS_GREEN_UI
|
||||||
//#define DGUS_MKS_RUNOUT_SENSOR
|
//#define DGUS_MKS_RUNOUT_SENSOR
|
||||||
|
|
||||||
#define LOGO_TIME_DELAY TERN(USE_MKS_GREEN_UI, 5000, 1500)
|
#define LOGO_TIME_DELAY TERN(USE_MKS_GREEN_UI, 8000, 1500)
|
||||||
|
|
||||||
#if ENABLED(DGUS_MKS_RUNOUT_SENSOR)
|
#if ENABLED(DGUS_MKS_RUNOUT_SENSOR)
|
||||||
#define MT_DET_1_PIN 1
|
#define MT_DET_1_PIN 1
|
||||||
|
@ -178,7 +178,7 @@ enum DGUSLCD_Screens : uint8_t {
|
||||||
MKSLCD_SCREEN_PRINT_CONFIG = 72,
|
MKSLCD_SCREEN_PRINT_CONFIG = 72,
|
||||||
MKSLCD_SCREEN_LEVEL_DATA = 106,
|
MKSLCD_SCREEN_LEVEL_DATA = 106,
|
||||||
MKSLCD_PrintPause_SET = 107,
|
MKSLCD_PrintPause_SET = 107,
|
||||||
//MKSLCD_FILAMENT_DATA = 50,
|
MKSLCD_FILAMENT_DATA = 50,
|
||||||
MKSLCD_ABOUT = 83,
|
MKSLCD_ABOUT = 83,
|
||||||
MKSLCD_PID = 108,
|
MKSLCD_PID = 108,
|
||||||
MKSLCD_PAUSE_SETTING_MOVE = 98,
|
MKSLCD_PAUSE_SETTING_MOVE = 98,
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
#include "../../../../../gcode/gcode.h"
|
#include "../../../../../gcode/gcode.h"
|
||||||
#include "../../../../../pins/pins.h"
|
#include "../../../../../pins/pins.h"
|
||||||
#include "../../../../../libs/nozzle.h"
|
#include "../../../../../libs/nozzle.h"
|
||||||
|
|
||||||
#if ENABLED(HAS_STEALTHCHOP)
|
#if ENABLED(HAS_STEALTHCHOP)
|
||||||
#include "../../../../../module/stepper/trinamic.h"
|
#include "../../../../../module/stepper/trinamic.h"
|
||||||
#include "../../../../../module/stepper/indirection.h"
|
#include "../../../../../module/stepper/indirection.h"
|
||||||
|
@ -60,7 +61,6 @@ uint8_t DGUSLanguageSwitch = 0; // Switch language for MKS DGUS
|
||||||
uint32_t swap32(const uint32_t value) { return (value & 0x000000FFU) << 24U | (value & 0x0000FF00U) << 8U | (value & 0x00FF0000U) >> 8U | (value & 0xFF000000U) >> 24U; }
|
uint32_t swap32(const uint32_t value) { return (value & 0x000000FFU) << 24U | (value & 0x0000FF00U) << 8U | (value & 0x00FF0000U) >> 8U | (value & 0xFF000000U) >> 24U; }
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|
||||||
void DGUSScreenHandler::sendinfoscreen_ch_mks(const uint16_t* line1, const uint16_t* line2, const uint16_t* line3, const uint16_t* line4) {
|
void DGUSScreenHandler::sendinfoscreen_ch_mks(const uint16_t* line1, const uint16_t* line2, const uint16_t* line3, const uint16_t* line4) {
|
||||||
dgusdisplay.WriteVariable(VP_MSGSTR1, line1, 32, true);
|
dgusdisplay.WriteVariable(VP_MSGSTR1, line1, 32, true);
|
||||||
dgusdisplay.WriteVariable(VP_MSGSTR2, line2, 32, true);
|
dgusdisplay.WriteVariable(VP_MSGSTR2, line2, 32, true);
|
||||||
|
@ -264,7 +264,7 @@ void DGUSScreenHandler::DGUSLCD_SendTMCStepValue(DGUS_VP_Variable &var) {
|
||||||
|
|
||||||
void DGUSScreenHandler::SDPrintingFinished() {
|
void DGUSScreenHandler::SDPrintingFinished() {
|
||||||
if (DGUSAutoTurnOff) {
|
if (DGUSAutoTurnOff) {
|
||||||
while (!queue.ring_buffer.empty()) queue.advance();
|
queue.exhaust();
|
||||||
gcode.process_subcommands_now_P(PSTR("M81"));
|
gcode.process_subcommands_now_P(PSTR("M81"));
|
||||||
}
|
}
|
||||||
GotoScreen(MKSLCD_SCREEN_PrintDone);
|
GotoScreen(MKSLCD_SCREEN_PrintDone);
|
||||||
|
@ -465,7 +465,6 @@ void DGUSScreenHandler::Level_Ctrl_MKS(DGUS_VP_Variable &var, void *val_ptr) {
|
||||||
|
|
||||||
cs = getCurrentScreen();
|
cs = getCurrentScreen();
|
||||||
if (cs != MKSLCD_AUTO_LEVEL) GotoScreen(MKSLCD_AUTO_LEVEL);
|
if (cs != MKSLCD_AUTO_LEVEL) GotoScreen(MKSLCD_AUTO_LEVEL);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
GotoScreen(MKSLCD_SCREEN_LEVEL);
|
GotoScreen(MKSLCD_SCREEN_LEVEL);
|
||||||
|
@ -499,14 +498,15 @@ void DGUSScreenHandler::MeshLevel(DGUS_VP_Variable &var, void *val_ptr) {
|
||||||
char cmd_buf[30];
|
char cmd_buf[30];
|
||||||
float offset = mesh_adj_distance;
|
float offset = mesh_adj_distance;
|
||||||
int16_t integer, Deci, Deci2;
|
int16_t integer, Deci, Deci2;
|
||||||
// float f3 = current_position.z;
|
|
||||||
// float f4 = current_position.z;
|
if (!queue.ring_buffer.empty()) return;
|
||||||
|
|
||||||
switch (mesh_value) {
|
switch (mesh_value) {
|
||||||
case 0:
|
case 0:
|
||||||
offset = mesh_adj_distance;
|
offset = mesh_adj_distance;
|
||||||
integer = offset; // get int
|
integer = offset; // get int
|
||||||
Deci = (offset * 100);
|
Deci = (offset * 10);
|
||||||
Deci = Deci % 100;
|
Deci = Deci % 10;
|
||||||
Deci2 = offset * 100;
|
Deci2 = offset * 100;
|
||||||
Deci2 = Deci2 % 10;
|
Deci2 = Deci2 % 10;
|
||||||
soft_endstop._enabled = false;
|
soft_endstop._enabled = false;
|
||||||
|
@ -520,8 +520,8 @@ void DGUSScreenHandler::MeshLevel(DGUS_VP_Variable &var, void *val_ptr) {
|
||||||
case 1:
|
case 1:
|
||||||
offset = mesh_adj_distance;
|
offset = mesh_adj_distance;
|
||||||
integer = offset; // get int
|
integer = offset; // get int
|
||||||
Deci = (offset * 100);
|
Deci = (offset * 10);
|
||||||
Deci = Deci % 100;
|
Deci = Deci % 10;
|
||||||
Deci2 = offset * 100;
|
Deci2 = offset * 100;
|
||||||
Deci2 = Deci2 % 10;
|
Deci2 = Deci2 % 10;
|
||||||
soft_endstop._enabled = false;
|
soft_endstop._enabled = false;
|
||||||
|
@ -589,8 +589,8 @@ void DGUSScreenHandler::LCD_BLK_Adjust(DGUS_VP_Variable &var, void *val_ptr) {
|
||||||
|
|
||||||
uint16_t lcd_value = swap16(*(uint16_t *)val_ptr);
|
uint16_t lcd_value = swap16(*(uint16_t *)val_ptr);
|
||||||
|
|
||||||
if(lcd_value > 100) lcd_value = 100;
|
if (lcd_value > 100) lcd_value = 100;
|
||||||
else if(lcd_value < 10) lcd_value = 10;
|
else if (lcd_value < 10) lcd_value = 10;
|
||||||
|
|
||||||
lcd_default_light = lcd_value;
|
lcd_default_light = lcd_value;
|
||||||
|
|
||||||
|
@ -794,7 +794,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
||||||
|
|
||||||
DEBUG_ECHOLNPAIR("QUEUE LEN:", queue.length);
|
DEBUG_ECHOLNPAIR("QUEUE LEN:", queue.length);
|
||||||
|
|
||||||
if (!print_job_timer.isPaused() && queue.ring_buffer.full(1))
|
if (!print_job_timer.isPaused() && !queue.ring_buffer.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
char axiscode;
|
char axiscode;
|
||||||
|
@ -1249,8 +1249,8 @@ void DGUSScreenHandler::MKS_FilamentLoad(DGUS_VP_Variable &var, void *val_ptr) {
|
||||||
switch (val_t) {
|
switch (val_t) {
|
||||||
case 0:
|
case 0:
|
||||||
#if HOTENDS >= 1
|
#if HOTENDS >= 1
|
||||||
if (thermalManager.temp_hotend[0].celsius < thermalManager.extrude_min_temp) {
|
if (thermalManager.degHotend(0) < thermalManager.extrude_min_temp) {
|
||||||
if (thermalManager.temp_hotend[0].target < thermalManager.extrude_min_temp)
|
if (thermalManager.degTargetHotend(0) < thermalManager.extrude_min_temp)
|
||||||
thermalManager.setTargetHotend(thermalManager.extrude_min_temp, 0);
|
thermalManager.setTargetHotend(thermalManager.extrude_min_temp, 0);
|
||||||
sendinfoscreen(PSTR("NOTICE"), nullptr, PSTR("Please wait."), PSTR("Nozzle heating!"), true, true, true, true);
|
sendinfoscreen(PSTR("NOTICE"), nullptr, PSTR("Please wait."), PSTR("Nozzle heating!"), true, true, true, true);
|
||||||
SetupConfirmAction(nullptr);
|
SetupConfirmAction(nullptr);
|
||||||
|
@ -1268,8 +1268,8 @@ void DGUSScreenHandler::MKS_FilamentLoad(DGUS_VP_Variable &var, void *val_ptr) {
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
#if HOTENDS >= 2
|
#if HOTENDS >= 2
|
||||||
if (thermalManager.temp_hotend[1].celsius < thermalManager.extrude_min_temp) {
|
if (thermalManager.degHotend(1) < thermalManager.extrude_min_temp) {
|
||||||
if (thermalManager.temp_hotend[1].target < thermalManager.extrude_min_temp)
|
if (thermalManager.degTargetHotend(1) < thermalManager.extrude_min_temp)
|
||||||
thermalManager.setTargetHotend(thermalManager.extrude_min_temp, 1);
|
thermalManager.setTargetHotend(thermalManager.extrude_min_temp, 1);
|
||||||
sendinfoscreen(PSTR("NOTICE"), nullptr, PSTR("Please wait."), PSTR("Nozzle heating!"), true, true, true, true);
|
sendinfoscreen(PSTR("NOTICE"), nullptr, PSTR("Please wait."), PSTR("Nozzle heating!"), true, true, true, true);
|
||||||
SetupConfirmAction(nullptr);
|
SetupConfirmAction(nullptr);
|
||||||
|
@ -1284,8 +1284,8 @@ void DGUSScreenHandler::MKS_FilamentLoad(DGUS_VP_Variable &var, void *val_ptr) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if ENABLED(SINGLENOZZLE)
|
#if ENABLED(SINGLENOZZLE)
|
||||||
if (thermalManager.temp_hotend[0].celsius < thermalManager.extrude_min_temp) {
|
if (thermalManager.degHotend(0) < thermalManager.extrude_min_temp) {
|
||||||
if (thermalManager.temp_hotend[0].target < thermalManager.extrude_min_temp)
|
if (thermalManager.degTargetHotend(0) < thermalManager.extrude_min_temp)
|
||||||
thermalManager.setTargetHotend(thermalManager.extrude_min_temp, 0);
|
thermalManager.setTargetHotend(thermalManager.extrude_min_temp, 0);
|
||||||
sendinfoscreen(PSTR("NOTICE"), nullptr, PSTR("Please wait."), PSTR("Nozzle heating!"), true, true, true, true);
|
sendinfoscreen(PSTR("NOTICE"), nullptr, PSTR("Please wait."), PSTR("Nozzle heating!"), true, true, true, true);
|
||||||
SetupConfirmAction(nullptr);
|
SetupConfirmAction(nullptr);
|
||||||
|
@ -1313,8 +1313,8 @@ void DGUSScreenHandler::MKS_FilamentUnLoad(DGUS_VP_Variable &var, void *val_ptr)
|
||||||
switch (val_t) {
|
switch (val_t) {
|
||||||
case 0:
|
case 0:
|
||||||
#if HOTENDS >= 1
|
#if HOTENDS >= 1
|
||||||
if (thermalManager.temp_hotend[0].celsius < thermalManager.extrude_min_temp) {
|
if (thermalManager.degHotend(0) < thermalManager.extrude_min_temp) {
|
||||||
if (thermalManager.temp_hotend[0].target < thermalManager.extrude_min_temp)
|
if (thermalManager.degTargetHotend(0) < thermalManager.extrude_min_temp)
|
||||||
thermalManager.setTargetHotend(thermalManager.extrude_min_temp, 0);
|
thermalManager.setTargetHotend(thermalManager.extrude_min_temp, 0);
|
||||||
sendinfoscreen(PSTR("NOTICE"), nullptr, PSTR("Please wait."), PSTR("Nozzle heating!"), true, true, true, true);
|
sendinfoscreen(PSTR("NOTICE"), nullptr, PSTR("Please wait."), PSTR("Nozzle heating!"), true, true, true, true);
|
||||||
SetupConfirmAction(nullptr);
|
SetupConfirmAction(nullptr);
|
||||||
|
@ -1331,8 +1331,8 @@ void DGUSScreenHandler::MKS_FilamentUnLoad(DGUS_VP_Variable &var, void *val_ptr)
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
#if HOTENDS >= 2
|
#if HOTENDS >= 2
|
||||||
if (thermalManager.temp_hotend[1].celsius < thermalManager.extrude_min_temp) {
|
if (thermalManager.degHotend(1) < thermalManager.extrude_min_temp) {
|
||||||
if (thermalManager.temp_hotend[1].target < thermalManager.extrude_min_temp)
|
if (thermalManager.degTargetHotend(1) < thermalManager.extrude_min_temp)
|
||||||
thermalManager.setTargetHotend(thermalManager.extrude_min_temp, 1);
|
thermalManager.setTargetHotend(thermalManager.extrude_min_temp, 1);
|
||||||
sendinfoscreen(PSTR("NOTICE"), nullptr, PSTR("Please wait."), PSTR("Nozzle heating!"), true, true, true, true);
|
sendinfoscreen(PSTR("NOTICE"), nullptr, PSTR("Please wait."), PSTR("Nozzle heating!"), true, true, true, true);
|
||||||
SetupConfirmAction(nullptr);
|
SetupConfirmAction(nullptr);
|
||||||
|
@ -1348,8 +1348,8 @@ void DGUSScreenHandler::MKS_FilamentUnLoad(DGUS_VP_Variable &var, void *val_ptr)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(SINGLENOZZLE)
|
#if ENABLED(SINGLENOZZLE)
|
||||||
if (thermalManager.temp_hotend[0].celsius < thermalManager.extrude_min_temp) {
|
if (thermalManager.degHotend(0) < thermalManager.extrude_min_temp) {
|
||||||
if (thermalManager.temp_hotend[0].target < thermalManager.extrude_min_temp)
|
if (thermalManager.degTargetHotend(0) < thermalManager.extrude_min_temp)
|
||||||
thermalManager.setTargetHotend(thermalManager.extrude_min_temp, 0);
|
thermalManager.setTargetHotend(thermalManager.extrude_min_temp, 0);
|
||||||
sendinfoscreen(PSTR("NOTICE"), nullptr, PSTR("Please wait."), PSTR("Nozzle heating!"), true, true, true, true);
|
sendinfoscreen(PSTR("NOTICE"), nullptr, PSTR("Please wait."), PSTR("Nozzle heating!"), true, true, true, true);
|
||||||
SetupConfirmAction(nullptr);
|
SetupConfirmAction(nullptr);
|
||||||
|
|
|
@ -191,7 +191,7 @@ static void btn_cancel_event_cb(lv_obj_t *btn, lv_event_t event) {
|
||||||
TERN_(ADVANCED_PAUSE_FEATURE, pause_menu_response = PAUSE_RESPONSE_RESUME_PRINT);
|
TERN_(ADVANCED_PAUSE_FEATURE, pause_menu_response = PAUSE_RESPONSE_RESUME_PRINT);
|
||||||
}
|
}
|
||||||
else if (DIALOG_IS(TYPE_FILAMENT_LOAD_HEAT, TYPE_FILAMENT_UNLOAD_HEAT, TYPE_FILAMENT_HEAT_LOAD_COMPLETED, TYPE_FILAMENT_HEAT_UNLOAD_COMPLETED)) {
|
else if (DIALOG_IS(TYPE_FILAMENT_LOAD_HEAT, TYPE_FILAMENT_UNLOAD_HEAT, TYPE_FILAMENT_HEAT_LOAD_COMPLETED, TYPE_FILAMENT_HEAT_UNLOAD_COMPLETED)) {
|
||||||
thermalManager.temp_hotend[uiCfg.curSprayerChoose].target= uiCfg.desireSprayerTempBak;
|
thermalManager.setTargetHotend(uiCfg.hotendTargetTempBak, uiCfg.extruderIndex);
|
||||||
clear_cur_ui();
|
clear_cur_ui();
|
||||||
draw_return_ui();
|
draw_return_ui();
|
||||||
}
|
}
|
||||||
|
@ -204,7 +204,7 @@ static void btn_cancel_event_cb(lv_obj_t *btn, lv_event_t event) {
|
||||||
uiCfg.filament_loading_time_cnt = 0;
|
uiCfg.filament_loading_time_cnt = 0;
|
||||||
uiCfg.filament_unloading_time_flg = false;
|
uiCfg.filament_unloading_time_flg = false;
|
||||||
uiCfg.filament_unloading_time_cnt = 0;
|
uiCfg.filament_unloading_time_cnt = 0;
|
||||||
thermalManager.temp_hotend[uiCfg.curSprayerChoose].target = uiCfg.desireSprayerTempBak;
|
thermalManager.setTargetHotend(uiCfg.hotendTargetTempBak, uiCfg.extruderIndex);
|
||||||
clear_cur_ui();
|
clear_cur_ui();
|
||||||
draw_return_ui();
|
draw_return_ui();
|
||||||
}
|
}
|
||||||
|
@ -479,9 +479,9 @@ void lv_draw_dialog(uint8_t type) {
|
||||||
|
|
||||||
void filament_sprayer_temp() {
|
void filament_sprayer_temp() {
|
||||||
char buf[20] = {0};
|
char buf[20] = {0};
|
||||||
sprintf(buf, preheat_menu.value_state, (int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].celsius, (int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].target);
|
sprintf(buf, preheat_menu.value_state, (int)thermalManager.degHotend(uiCfg.extruderIndex), (int)thermalManager.degTargetHotend(uiCfg.extruderIndex));
|
||||||
|
|
||||||
strcpy(public_buf_l, uiCfg.curSprayerChoose < 1 ? extrude_menu.ext1 : extrude_menu.ext2);
|
strcpy(public_buf_l, uiCfg.extruderIndex < 1 ? extrude_menu.ext1 : extrude_menu.ext2);
|
||||||
strcat_P(public_buf_l, PSTR(": "));
|
strcat_P(public_buf_l, PSTR(": "));
|
||||||
strcat(public_buf_l, buf);
|
strcat(public_buf_l, buf);
|
||||||
lv_label_set_text(tempText1, public_buf_l);
|
lv_label_set_text(tempText1, public_buf_l);
|
||||||
|
@ -500,7 +500,7 @@ void filament_dialog_handle() {
|
||||||
planner.synchronize();
|
planner.synchronize();
|
||||||
uiCfg.filament_loading_time_flg = true;
|
uiCfg.filament_loading_time_flg = true;
|
||||||
uiCfg.filament_loading_time_cnt = 0;
|
uiCfg.filament_loading_time_cnt = 0;
|
||||||
sprintf_P(public_buf_m, PSTR("T%d\nG91\nG1 E%d F%d\nG90"), uiCfg.curSprayerChoose, gCfgItems.filamentchange_load_length, gCfgItems.filamentchange_load_speed);
|
sprintf_P(public_buf_m, PSTR("T%d\nG91\nG1 E%d F%d\nG90"), uiCfg.extruderIndex, gCfgItems.filamentchange_load_length, gCfgItems.filamentchange_load_speed);
|
||||||
queue.inject(public_buf_m);
|
queue.inject(public_buf_m);
|
||||||
}
|
}
|
||||||
if (uiCfg.filament_heat_completed_unload) {
|
if (uiCfg.filament_heat_completed_unload) {
|
||||||
|
@ -510,13 +510,13 @@ void filament_dialog_handle() {
|
||||||
planner.synchronize();
|
planner.synchronize();
|
||||||
uiCfg.filament_unloading_time_flg = true;
|
uiCfg.filament_unloading_time_flg = true;
|
||||||
uiCfg.filament_unloading_time_cnt = 0;
|
uiCfg.filament_unloading_time_cnt = 0;
|
||||||
sprintf_P(public_buf_m, PSTR("T%d\nG91\nG1 E-%d F%d\nG90"), uiCfg.curSprayerChoose, gCfgItems.filamentchange_unload_length, gCfgItems.filamentchange_unload_speed);
|
sprintf_P(public_buf_m, PSTR("T%d\nG91\nG1 E-%d F%d\nG90"), uiCfg.extruderIndex, gCfgItems.filamentchange_unload_length, gCfgItems.filamentchange_unload_speed);
|
||||||
queue.inject(public_buf_m);
|
queue.inject(public_buf_m);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((abs((int)((int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].celsius - gCfgItems.filament_limit_temper)) <= 1)
|
if ( ((abs((int)((int)thermalManager.degHotend(uiCfg.extruderIndex) - gCfgItems.filament_limit_temper)) <= 1)
|
||||||
|| ((int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].celsius > gCfgItems.filament_limit_temper))
|
|| ((int)thermalManager.degHotend(uiCfg.extruderIndex) > gCfgItems.filament_limit_temper))
|
||||||
&& (uiCfg.filament_load_heat_flg)
|
&& uiCfg.filament_load_heat_flg
|
||||||
) {
|
) {
|
||||||
uiCfg.filament_load_heat_flg = false;
|
uiCfg.filament_load_heat_flg = false;
|
||||||
lv_clear_dialog();
|
lv_clear_dialog();
|
||||||
|
@ -529,8 +529,8 @@ void filament_dialog_handle() {
|
||||||
lv_clear_dialog();
|
lv_clear_dialog();
|
||||||
lv_draw_dialog(DIALOG_TYPE_FILAMENT_LOAD_COMPLETED);
|
lv_draw_dialog(DIALOG_TYPE_FILAMENT_LOAD_COMPLETED);
|
||||||
}
|
}
|
||||||
if (((abs((int)((int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].celsius - gCfgItems.filament_limit_temper)) <= 1)
|
if (((abs((int)((int)thermalManager.degHotend(uiCfg.extruderIndex) - gCfgItems.filament_limit_temper)) <= 1)
|
||||||
|| ((int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].celsius > gCfgItems.filament_limit_temper))
|
|| ((int)thermalManager.degHotend(uiCfg.extruderIndex) > gCfgItems.filament_limit_temper))
|
||||||
&& uiCfg.filament_unload_heat_flg
|
&& uiCfg.filament_unload_heat_flg
|
||||||
) {
|
) {
|
||||||
uiCfg.filament_unload_heat_flg = false;
|
uiCfg.filament_unload_heat_flg = false;
|
||||||
|
|
|
@ -54,7 +54,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
|
||||||
if (event != LV_EVENT_RELEASED) return;
|
if (event != LV_EVENT_RELEASED) return;
|
||||||
switch (obj->mks_obj_id) {
|
switch (obj->mks_obj_id) {
|
||||||
case ID_E_ADD:
|
case ID_E_ADD:
|
||||||
if (thermalManager.temp_hotend[uiCfg.curSprayerChoose].celsius >= EXTRUDE_MINTEMP) {
|
if (thermalManager.degHotend(uiCfg.extruderIndex) >= EXTRUDE_MINTEMP) {
|
||||||
sprintf_P((char *)public_buf_l, PSTR("G91\nG1 E%d F%d\nG90"), uiCfg.extruStep, 60 * uiCfg.extruSpeed);
|
sprintf_P((char *)public_buf_l, PSTR("G91\nG1 E%d F%d\nG90"), uiCfg.extruStep, 60 * uiCfg.extruSpeed);
|
||||||
queue.inject(public_buf_l);
|
queue.inject(public_buf_l);
|
||||||
extrudeAmount += uiCfg.extruStep;
|
extrudeAmount += uiCfg.extruStep;
|
||||||
|
@ -62,7 +62,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ID_E_DEC:
|
case ID_E_DEC:
|
||||||
if (thermalManager.temp_hotend[uiCfg.curSprayerChoose].celsius >= EXTRUDE_MINTEMP) {
|
if (thermalManager.degHotend(uiCfg.extruderIndex) >= EXTRUDE_MINTEMP) {
|
||||||
sprintf_P((char *)public_buf_l, PSTR("G91\nG1 E%d F%d\nG90"), 0 - uiCfg.extruStep, 60 * uiCfg.extruSpeed);
|
sprintf_P((char *)public_buf_l, PSTR("G91\nG1 E%d F%d\nG90"), 0 - uiCfg.extruStep, 60 * uiCfg.extruSpeed);
|
||||||
queue.enqueue_one_now(public_buf_l);
|
queue.enqueue_one_now(public_buf_l);
|
||||||
extrudeAmount -= uiCfg.extruStep;
|
extrudeAmount -= uiCfg.extruStep;
|
||||||
|
@ -71,17 +71,17 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
|
||||||
break;
|
break;
|
||||||
case ID_E_TYPE:
|
case ID_E_TYPE:
|
||||||
if (ENABLED(HAS_MULTI_EXTRUDER)) {
|
if (ENABLED(HAS_MULTI_EXTRUDER)) {
|
||||||
if (uiCfg.curSprayerChoose == 0) {
|
if (uiCfg.extruderIndex == 0) {
|
||||||
uiCfg.curSprayerChoose = 1;
|
uiCfg.extruderIndex = 1;
|
||||||
queue.inject_P(PSTR("T1"));
|
queue.inject_P(PSTR("T1"));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
uiCfg.curSprayerChoose = 0;
|
uiCfg.extruderIndex = 0;
|
||||||
queue.inject_P(PSTR("T0"));
|
queue.inject_P(PSTR("T0"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
uiCfg.curSprayerChoose = 0;
|
uiCfg.extruderIndex = 0;
|
||||||
|
|
||||||
extrudeAmount = 0;
|
extrudeAmount = 0;
|
||||||
disp_hotend_temp();
|
disp_hotend_temp();
|
||||||
|
@ -153,7 +153,7 @@ void lv_draw_extrusion() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void disp_ext_type() {
|
void disp_ext_type() {
|
||||||
if (uiCfg.curSprayerChoose == 1) {
|
if (uiCfg.extruderIndex == 1) {
|
||||||
lv_imgbtn_set_src_both(buttonType, "F:/bmp_extru2.bin");
|
lv_imgbtn_set_src_both(buttonType, "F:/bmp_extru2.bin");
|
||||||
if (gCfgItems.multiple_language) {
|
if (gCfgItems.multiple_language) {
|
||||||
lv_label_set_text(labelType, extrude_menu.ext2);
|
lv_label_set_text(labelType, extrude_menu.ext2);
|
||||||
|
@ -195,7 +195,7 @@ void disp_ext_speed() {
|
||||||
|
|
||||||
void disp_hotend_temp() {
|
void disp_hotend_temp() {
|
||||||
char buf[20] = {0};
|
char buf[20] = {0};
|
||||||
sprintf(buf, extrude_menu.temp_value, (int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].celsius, (int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].target);
|
sprintf(buf, extrude_menu.temp_value, (int)thermalManager.degHotend(uiCfg.extruderIndex), (int)thermalManager.degTargetHotend(uiCfg.extruderIndex));
|
||||||
strcpy(public_buf_l, extrude_menu.temper_text);
|
strcpy(public_buf_l, extrude_menu.temper_text);
|
||||||
strcat(public_buf_l, buf);
|
strcat(public_buf_l, buf);
|
||||||
lv_label_set_text(tempText, public_buf_l);
|
lv_label_set_text(tempText, public_buf_l);
|
||||||
|
@ -213,7 +213,7 @@ void disp_extru_amount() {
|
||||||
sprintf(buf1, extrude_menu.count_value_cm, extrudeAmount / 10);
|
sprintf(buf1, extrude_menu.count_value_cm, extrudeAmount / 10);
|
||||||
else
|
else
|
||||||
sprintf(buf1, extrude_menu.count_value_m, extrudeAmount / 1000);
|
sprintf(buf1, extrude_menu.count_value_m, extrudeAmount / 1000);
|
||||||
strcat(public_buf_l, uiCfg.curSprayerChoose < 1 ? extrude_menu.ext1 : extrude_menu.ext2);
|
strcat(public_buf_l, uiCfg.extruderIndex == 0 ? extrude_menu.ext1 : extrude_menu.ext2);
|
||||||
strcat(public_buf_l, buf1);
|
strcat(public_buf_l, buf1);
|
||||||
|
|
||||||
lv_label_set_text(ExtruText, public_buf_l);
|
lv_label_set_text(ExtruText, public_buf_l);
|
||||||
|
|
|
@ -50,25 +50,25 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
|
||||||
switch (obj->mks_obj_id) {
|
switch (obj->mks_obj_id) {
|
||||||
case ID_FILAMNT_IN:
|
case ID_FILAMNT_IN:
|
||||||
uiCfg.filament_load_heat_flg = true;
|
uiCfg.filament_load_heat_flg = true;
|
||||||
if ((abs(thermalManager.temp_hotend[uiCfg.curSprayerChoose].target - thermalManager.temp_hotend[uiCfg.curSprayerChoose].celsius) <= 1)
|
if ((abs(thermalManager.degTargetHotend(uiCfg.extruderIndex) - thermalManager.degHotend(uiCfg.extruderIndex)) <= 1)
|
||||||
|| (gCfgItems.filament_limit_temper <= thermalManager.temp_hotend[uiCfg.curSprayerChoose].celsius)) {
|
|| (gCfgItems.filament_limit_temper <= thermalManager.degHotend(uiCfg.extruderIndex))) {
|
||||||
lv_clear_filament_change();
|
lv_clear_filament_change();
|
||||||
lv_draw_dialog(DIALOG_TYPE_FILAMENT_HEAT_LOAD_COMPLETED);
|
lv_draw_dialog(DIALOG_TYPE_FILAMENT_HEAT_LOAD_COMPLETED);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
lv_clear_filament_change();
|
lv_clear_filament_change();
|
||||||
lv_draw_dialog(DIALOG_TYPE_FILAMENT_LOAD_HEAT);
|
lv_draw_dialog(DIALOG_TYPE_FILAMENT_LOAD_HEAT);
|
||||||
if (thermalManager.temp_hotend[uiCfg.curSprayerChoose].target < gCfgItems.filament_limit_temper) {
|
if (thermalManager.degTargetHotend(uiCfg.extruderIndex) < gCfgItems.filament_limit_temper) {
|
||||||
thermalManager.temp_hotend[uiCfg.curSprayerChoose].target = gCfgItems.filament_limit_temper;
|
thermalManager.setTargetHotend(gCfgItems.filament_limit_temper, uiCfg.extruderIndex);
|
||||||
thermalManager.start_watching_hotend(uiCfg.curSprayerChoose);
|
thermalManager.start_watching_hotend(uiCfg.extruderIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ID_FILAMNT_OUT:
|
case ID_FILAMNT_OUT:
|
||||||
uiCfg.filament_unload_heat_flg = true;
|
uiCfg.filament_unload_heat_flg = true;
|
||||||
if ((thermalManager.temp_hotend[uiCfg.curSprayerChoose].target > 0)
|
if (thermalManager.degTargetHotend(uiCfg.extruderIndex)
|
||||||
&& ((abs((int)((int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].target - thermalManager.temp_hotend[uiCfg.curSprayerChoose].celsius)) <= 1)
|
&& ((abs((int)((int)thermalManager.degTargetHotend(uiCfg.extruderIndex) - thermalManager.degHotend(uiCfg.extruderIndex))) <= 1)
|
||||||
|| ((int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].celsius >= gCfgItems.filament_limit_temper))
|
|| ((int)thermalManager.degHotend(uiCfg.extruderIndex) >= gCfgItems.filament_limit_temper))
|
||||||
) {
|
) {
|
||||||
lv_clear_filament_change();
|
lv_clear_filament_change();
|
||||||
lv_draw_dialog(DIALOG_TYPE_FILAMENT_HEAT_UNLOAD_COMPLETED);
|
lv_draw_dialog(DIALOG_TYPE_FILAMENT_HEAT_UNLOAD_COMPLETED);
|
||||||
|
@ -76,28 +76,28 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
|
||||||
else {
|
else {
|
||||||
lv_clear_filament_change();
|
lv_clear_filament_change();
|
||||||
lv_draw_dialog(DIALOG_TYPE_FILAMENT_UNLOAD_HEAT);
|
lv_draw_dialog(DIALOG_TYPE_FILAMENT_UNLOAD_HEAT);
|
||||||
if (thermalManager.temp_hotend[uiCfg.curSprayerChoose].target < gCfgItems.filament_limit_temper) {
|
if (thermalManager.degTargetHotend(uiCfg.extruderIndex) < gCfgItems.filament_limit_temper) {
|
||||||
thermalManager.temp_hotend[uiCfg.curSprayerChoose].target = gCfgItems.filament_limit_temper;
|
thermalManager.setTargetHotend(gCfgItems.filament_limit_temper, uiCfg.extruderIndex);
|
||||||
thermalManager.start_watching_hotend(uiCfg.curSprayerChoose);
|
thermalManager.start_watching_hotend(uiCfg.extruderIndex);
|
||||||
}
|
}
|
||||||
filament_sprayer_temp();
|
filament_sprayer_temp();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ID_FILAMNT_TYPE:
|
case ID_FILAMNT_TYPE:
|
||||||
#if HAS_MULTI_EXTRUDER
|
#if HAS_MULTI_EXTRUDER
|
||||||
uiCfg.curSprayerChoose = !uiCfg.curSprayerChoose;
|
uiCfg.extruderIndex = !uiCfg.extruderIndex;
|
||||||
#endif
|
#endif
|
||||||
disp_filament_type();
|
disp_filament_type();
|
||||||
break;
|
break;
|
||||||
case ID_FILAMNT_RETURN:
|
case ID_FILAMNT_RETURN:
|
||||||
#if HAS_MULTI_EXTRUDER
|
#if HAS_MULTI_EXTRUDER
|
||||||
if (uiCfg.print_state != IDLE && uiCfg.print_state != REPRINTED)
|
if (uiCfg.print_state != IDLE && uiCfg.print_state != REPRINTED)
|
||||||
gcode.process_subcommands_now_P(uiCfg.curSprayerChoose_bak == 1 ? PSTR("T1") : PSTR("T0"));
|
gcode.process_subcommands_now_P(uiCfg.extruderIndexBak == 1 ? PSTR("T1") : PSTR("T0"));
|
||||||
#endif
|
#endif
|
||||||
feedrate_mm_s = (float)uiCfg.moveSpeed_bak;
|
feedrate_mm_s = (float)uiCfg.moveSpeed_bak;
|
||||||
if (uiCfg.print_state == PAUSED)
|
if (uiCfg.print_state == PAUSED)
|
||||||
planner.set_e_position_mm((destination.e = current_position.e = uiCfg.current_e_position_bak));
|
planner.set_e_position_mm((destination.e = current_position.e = uiCfg.current_e_position_bak));
|
||||||
thermalManager.temp_hotend[uiCfg.curSprayerChoose].target = uiCfg.desireSprayerTempBak;
|
thermalManager.setTargetHotend(uiCfg.hotendTargetTempBak, uiCfg.extruderIndex);
|
||||||
|
|
||||||
clear_cur_ui();
|
clear_cur_ui();
|
||||||
draw_return_ui();
|
draw_return_ui();
|
||||||
|
@ -132,7 +132,7 @@ void lv_draw_filament_change() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void disp_filament_type() {
|
void disp_filament_type() {
|
||||||
if (uiCfg.curSprayerChoose == 1) {
|
if (uiCfg.extruderIndex == 1) {
|
||||||
lv_imgbtn_set_src_both(buttonType, "F:/bmp_extru2.bin");
|
lv_imgbtn_set_src_both(buttonType, "F:/bmp_extru2.bin");
|
||||||
if (gCfgItems.multiple_language) {
|
if (gCfgItems.multiple_language) {
|
||||||
lv_label_set_text(labelType, preheat_menu.ext2);
|
lv_label_set_text(labelType, preheat_menu.ext2);
|
||||||
|
@ -153,8 +153,8 @@ void disp_filament_temp() {
|
||||||
|
|
||||||
public_buf_l[0] = '\0';
|
public_buf_l[0] = '\0';
|
||||||
|
|
||||||
strcat(public_buf_l, uiCfg.curSprayerChoose < 1 ? preheat_menu.ext1 : preheat_menu.ext2);
|
strcat(public_buf_l, uiCfg.extruderIndex < 1 ? preheat_menu.ext1 : preheat_menu.ext2);
|
||||||
sprintf(buf, preheat_menu.value_state, (int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].celsius, (int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].target);
|
sprintf(buf, preheat_menu.value_state, (int)thermalManager.degHotend(uiCfg.extruderIndex), (int)thermalManager.degTargetHotend(uiCfg.extruderIndex));
|
||||||
|
|
||||||
strcat_P(public_buf_l, PSTR(": "));
|
strcat_P(public_buf_l, PSTR(": "));
|
||||||
strcat(public_buf_l, buf);
|
strcat(public_buf_l, buf);
|
||||||
|
|
|
@ -66,7 +66,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
|
||||||
break;
|
break;
|
||||||
case ID_O_FILAMENT:
|
case ID_O_FILAMENT:
|
||||||
#if HAS_MULTI_EXTRUDER
|
#if HAS_MULTI_EXTRUDER
|
||||||
uiCfg.curSprayerChoose_bak = active_extruder;
|
uiCfg.extruderIndexBak = active_extruder;
|
||||||
#endif
|
#endif
|
||||||
if (uiCfg.print_state == WORKING) {
|
if (uiCfg.print_state == WORKING) {
|
||||||
#if ENABLED(SDSUPPORT)
|
#if ENABLED(SDSUPPORT)
|
||||||
|
@ -76,7 +76,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
uiCfg.moveSpeed_bak = (uint16_t)feedrate_mm_s;
|
uiCfg.moveSpeed_bak = (uint16_t)feedrate_mm_s;
|
||||||
uiCfg.desireSprayerTempBak = thermalManager.temp_hotend[active_extruder].target;
|
uiCfg.hotendTargetTempBak = thermalManager.degTargetHotend(active_extruder);
|
||||||
lv_clear_operation();
|
lv_clear_operation();
|
||||||
lv_draw_filament_change();
|
lv_draw_filament_change();
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -48,47 +48,46 @@ enum {
|
||||||
static void event_handler(lv_obj_t *obj, lv_event_t event) {
|
static void event_handler(lv_obj_t *obj, lv_event_t event) {
|
||||||
if (event != LV_EVENT_RELEASED) return;
|
if (event != LV_EVENT_RELEASED) return;
|
||||||
switch (obj->mks_obj_id) {
|
switch (obj->mks_obj_id) {
|
||||||
case ID_P_ADD:
|
case ID_P_ADD: {
|
||||||
if (uiCfg.curTempType == 0) {
|
if (uiCfg.curTempType == 0) {
|
||||||
thermalManager.temp_hotend[uiCfg.curSprayerChoose].target += uiCfg.stepHeat;
|
int16_t max_target;
|
||||||
if (uiCfg.curSprayerChoose == 0) {
|
thermalManager.temp_hotend[uiCfg.extruderIndex].target += uiCfg.stepHeat;
|
||||||
if ((int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].target > (HEATER_0_MAXTEMP - (WATCH_TEMP_INCREASE + TEMP_HYSTERESIS + 1))) {
|
if (uiCfg.extruderIndex == 0)
|
||||||
thermalManager.temp_hotend[uiCfg.curSprayerChoose].target = (float)HEATER_0_MAXTEMP - (WATCH_TEMP_INCREASE + TEMP_HYSTERESIS + 1);
|
max_target = HEATER_0_MAXTEMP - (WATCH_TEMP_INCREASE + TEMP_HYSTERESIS + 1);
|
||||||
}
|
|
||||||
}
|
|
||||||
#if HAS_MULTI_HOTEND
|
#if HAS_MULTI_HOTEND
|
||||||
else if ((int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].target > (HEATER_1_MAXTEMP - (WATCH_TEMP_INCREASE + TEMP_HYSTERESIS + 1))) {
|
else
|
||||||
thermalManager.temp_hotend[uiCfg.curSprayerChoose].target = (float)HEATER_1_MAXTEMP - (WATCH_TEMP_INCREASE + TEMP_HYSTERESIS + 1);
|
max_target = HEATER_1_MAXTEMP - (WATCH_TEMP_INCREASE + TEMP_HYSTERESIS + 1);
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
thermalManager.start_watching_hotend(uiCfg.curSprayerChoose);
|
if (thermalManager.degTargetHotend(uiCfg.extruderIndex) > max_target)
|
||||||
|
thermalManager.setTargetHotend(max_target, uiCfg.extruderIndex);
|
||||||
|
thermalManager.start_watching_hotend(uiCfg.extruderIndex);
|
||||||
}
|
}
|
||||||
#if HAS_HEATED_BED
|
#if HAS_HEATED_BED
|
||||||
else {
|
else {
|
||||||
|
constexpr int16_t max_target = BED_MAXTEMP - (WATCH_BED_TEMP_INCREASE + TEMP_BED_HYSTERESIS + 1);
|
||||||
thermalManager.temp_bed.target += uiCfg.stepHeat;
|
thermalManager.temp_bed.target += uiCfg.stepHeat;
|
||||||
if ((int)thermalManager.temp_bed.target > BED_MAXTEMP - (WATCH_BED_TEMP_INCREASE + TEMP_BED_HYSTERESIS + 1)) {
|
if (thermalManager.degTargetBed() > max_target)
|
||||||
thermalManager.temp_bed.target = (float)BED_MAXTEMP - (WATCH_BED_TEMP_INCREASE + TEMP_BED_HYSTERESIS + 1);
|
thermalManager.setTargetBed(max_target);
|
||||||
}
|
|
||||||
thermalManager.start_watching_bed();
|
thermalManager.start_watching_bed();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
disp_desire_temp();
|
disp_desire_temp();
|
||||||
break;
|
} break;
|
||||||
|
|
||||||
case ID_P_DEC:
|
case ID_P_DEC:
|
||||||
if (uiCfg.curTempType == 0) {
|
if (uiCfg.curTempType == 0) {
|
||||||
if ((int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].target > uiCfg.stepHeat)
|
if ((int)thermalManager.degTargetHotend(uiCfg.extruderIndex) > uiCfg.stepHeat)
|
||||||
thermalManager.temp_hotend[uiCfg.curSprayerChoose].target -= uiCfg.stepHeat;
|
thermalManager.temp_hotend[uiCfg.extruderIndex].target -= uiCfg.stepHeat;
|
||||||
else
|
else
|
||||||
thermalManager.temp_hotend[uiCfg.curSprayerChoose].target = 0;
|
thermalManager.setTargetHotend(0, uiCfg.extruderIndex);
|
||||||
|
thermalManager.start_watching_hotend(uiCfg.extruderIndex);
|
||||||
thermalManager.start_watching_hotend(uiCfg.curSprayerChoose);
|
|
||||||
}
|
}
|
||||||
#if HAS_HEATED_BED
|
#if HAS_HEATED_BED
|
||||||
else {
|
else {
|
||||||
if ((int)thermalManager.temp_bed.target > uiCfg.stepHeat)
|
if ((int)thermalManager.temp_bed.target > uiCfg.stepHeat)
|
||||||
thermalManager.temp_bed.target -= uiCfg.stepHeat;
|
thermalManager.temp_bed.target -= uiCfg.stepHeat;
|
||||||
else
|
else
|
||||||
thermalManager.temp_bed.target = 0;
|
thermalManager.setTargetBed(0);
|
||||||
|
|
||||||
thermalManager.start_watching_bed();
|
thermalManager.start_watching_bed();
|
||||||
}
|
}
|
||||||
|
@ -98,20 +97,20 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
|
||||||
case ID_P_TYPE:
|
case ID_P_TYPE:
|
||||||
if (uiCfg.curTempType == 0) {
|
if (uiCfg.curTempType == 0) {
|
||||||
if (ENABLED(HAS_MULTI_EXTRUDER)) {
|
if (ENABLED(HAS_MULTI_EXTRUDER)) {
|
||||||
if (uiCfg.curSprayerChoose == 0) {
|
if (uiCfg.extruderIndex == 0) {
|
||||||
uiCfg.curSprayerChoose = 1;
|
uiCfg.extruderIndex = 1;
|
||||||
}
|
}
|
||||||
else if (uiCfg.curSprayerChoose == 1) {
|
else if (uiCfg.extruderIndex == 1) {
|
||||||
if (TEMP_SENSOR_BED != 0) {
|
if (TEMP_SENSOR_BED != 0) {
|
||||||
uiCfg.curTempType = 1;
|
uiCfg.curTempType = 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
uiCfg.curTempType = 0;
|
uiCfg.curTempType = 0;
|
||||||
uiCfg.curSprayerChoose = 0;
|
uiCfg.extruderIndex = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (uiCfg.curSprayerChoose == 0) {
|
else if (uiCfg.extruderIndex == 0) {
|
||||||
if (TEMP_SENSOR_BED != 0)
|
if (TEMP_SENSOR_BED != 0)
|
||||||
uiCfg.curTempType = 1;
|
uiCfg.curTempType = 1;
|
||||||
else
|
else
|
||||||
|
@ -119,7 +118,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (uiCfg.curTempType == 1) {
|
else if (uiCfg.curTempType == 1) {
|
||||||
uiCfg.curSprayerChoose = 0;
|
uiCfg.extruderIndex = 0;
|
||||||
uiCfg.curTempType = 0;
|
uiCfg.curTempType = 0;
|
||||||
}
|
}
|
||||||
disp_temp_type();
|
disp_temp_type();
|
||||||
|
@ -135,8 +134,8 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
|
||||||
break;
|
break;
|
||||||
case ID_P_OFF:
|
case ID_P_OFF:
|
||||||
if (uiCfg.curTempType == 0) {
|
if (uiCfg.curTempType == 0) {
|
||||||
thermalManager.temp_hotend[uiCfg.curSprayerChoose].target = 0;
|
thermalManager.setTargetHotend(0, uiCfg.extruderIndex);
|
||||||
thermalManager.start_watching_hotend(uiCfg.curSprayerChoose);
|
thermalManager.start_watching_hotend(uiCfg.extruderIndex);
|
||||||
}
|
}
|
||||||
#if HAS_HEATED_BED
|
#if HAS_HEATED_BED
|
||||||
else {
|
else {
|
||||||
|
@ -186,7 +185,7 @@ void lv_draw_preHeat() {
|
||||||
|
|
||||||
void disp_temp_type() {
|
void disp_temp_type() {
|
||||||
if (uiCfg.curTempType == 0) {
|
if (uiCfg.curTempType == 0) {
|
||||||
if (uiCfg.curSprayerChoose == 1) {
|
if (uiCfg.extruderIndex == 1) {
|
||||||
lv_imgbtn_set_src_both(buttonType, "F:/bmp_extru2.bin");
|
lv_imgbtn_set_src_both(buttonType, "F:/bmp_extru2.bin");
|
||||||
if (gCfgItems.multiple_language) {
|
if (gCfgItems.multiple_language) {
|
||||||
lv_label_set_text(labelType, preheat_menu.ext2);
|
lv_label_set_text(labelType, preheat_menu.ext2);
|
||||||
|
@ -217,8 +216,8 @@ void disp_desire_temp() {
|
||||||
public_buf_l[0] = '\0';
|
public_buf_l[0] = '\0';
|
||||||
|
|
||||||
if (uiCfg.curTempType == 0) {
|
if (uiCfg.curTempType == 0) {
|
||||||
strcat(public_buf_l, uiCfg.curSprayerChoose < 1 ? preheat_menu.ext1 : preheat_menu.ext2);
|
strcat(public_buf_l, uiCfg.extruderIndex < 1 ? preheat_menu.ext1 : preheat_menu.ext2);
|
||||||
sprintf(buf, preheat_menu.value_state, (int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].celsius, (int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].target);
|
sprintf(buf, preheat_menu.value_state, (int)thermalManager.degHotend(uiCfg.extruderIndex), (int)thermalManager.degTargetHotend(uiCfg.extruderIndex));
|
||||||
}
|
}
|
||||||
#if HAS_HEATED_BED
|
#if HAS_HEATED_BED
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -203,11 +203,11 @@ void lv_draw_printing() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void disp_ext_temp() {
|
void disp_ext_temp() {
|
||||||
sprintf(public_buf_l, printing_menu.temp1, (int)thermalManager.temp_hotend[0].celsius, (int)thermalManager.temp_hotend[0].target);
|
sprintf(public_buf_l, printing_menu.temp1, (int)thermalManager.degHotend(0), (int)thermalManager.degTargetHotend(0));
|
||||||
lv_label_set_text(labelExt1, public_buf_l);
|
lv_label_set_text(labelExt1, public_buf_l);
|
||||||
|
|
||||||
#if HAS_MULTI_EXTRUDER
|
#if HAS_MULTI_EXTRUDER
|
||||||
sprintf(public_buf_l, printing_menu.temp1, (int)thermalManager.temp_hotend[1].celsius, (int)thermalManager.temp_hotend[1].target);
|
sprintf(public_buf_l, printing_menu.temp1, (int)thermalManager.degHotend(1), (int)thermalManager.degTargetHotend(1));
|
||||||
lv_label_set_text(labelExt2, public_buf_l);
|
lv_label_set_text(labelExt2, public_buf_l);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,10 +98,10 @@ void disp_det_error() {
|
||||||
lv_obj_t *e1, *e2, *e3, *bed;
|
lv_obj_t *e1, *e2, *e3, *bed;
|
||||||
void mks_disp_test() {
|
void mks_disp_test() {
|
||||||
char buf[30] = {0};
|
char buf[30] = {0};
|
||||||
sprintf_P(buf, PSTR("e1:%d"), (int)thermalManager.temp_hotend[0].celsius);
|
sprintf_P(buf, PSTR("e1:%d"), (int)thermalManager.degHotend(0));
|
||||||
lv_label_set_text(e1, buf);
|
lv_label_set_text(e1, buf);
|
||||||
#if HAS_MULTI_HOTEND
|
#if HAS_MULTI_HOTEND
|
||||||
sprintf_P(buf, PSTR("e2:%d"), (int)thermalManager.temp_hotend[1].celsius);
|
sprintf_P(buf, PSTR("e2:%d"), (int)thermalManager.degHotend(1));
|
||||||
lv_label_set_text(e2, buf);
|
lv_label_set_text(e2, buf);
|
||||||
#endif
|
#endif
|
||||||
#if HAS_HEATED_BED
|
#if HAS_HEATED_BED
|
||||||
|
@ -133,12 +133,12 @@ void lv_draw_ready_print() {
|
||||||
#if 1
|
#if 1
|
||||||
e1 = lv_label_create_empty(scr);
|
e1 = lv_label_create_empty(scr);
|
||||||
lv_obj_set_pos(e1, 20, 20);
|
lv_obj_set_pos(e1, 20, 20);
|
||||||
sprintf_P(buf, PSTR("e1: %d"), (int)thermalManager.temp_hotend[0].celsius);
|
sprintf_P(buf, PSTR("e1: %d"), (int)thermalManager.degHotend(0));
|
||||||
lv_label_set_text(e1, buf);
|
lv_label_set_text(e1, buf);
|
||||||
#if HAS_MULTI_HOTEND
|
#if HAS_MULTI_HOTEND
|
||||||
e2 = lv_label_create_empty(scr);
|
e2 = lv_label_create_empty(scr);
|
||||||
lv_obj_set_pos(e2, 20, 45);
|
lv_obj_set_pos(e2, 20, 45);
|
||||||
sprintf_P(buf, PSTR("e1: %d"), (int)thermalManager.temp_hotend[1].celsius);
|
sprintf_P(buf, PSTR("e1: %d"), (int)thermalManager.degHotend(1));
|
||||||
lv_label_set_text(e2, buf);
|
lv_label_set_text(e2, buf);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case ID_T_FILAMENT:
|
case ID_T_FILAMENT:
|
||||||
uiCfg.desireSprayerTempBak = thermalManager.temp_hotend[uiCfg.curSprayerChoose].target;
|
uiCfg.hotendTargetTempBak = thermalManager.degTargetHotend(uiCfg.extruderIndex);
|
||||||
lv_draw_filament_change();
|
lv_draw_filament_change();
|
||||||
break;
|
break;
|
||||||
case ID_T_MORE:
|
case ID_T_MORE:
|
||||||
|
|
|
@ -179,7 +179,7 @@ void gCfgItems_init() {
|
||||||
|
|
||||||
void ui_cfg_init() {
|
void ui_cfg_init() {
|
||||||
uiCfg.curTempType = 0;
|
uiCfg.curTempType = 0;
|
||||||
uiCfg.curSprayerChoose = 0;
|
uiCfg.extruderIndex = 0;
|
||||||
uiCfg.stepHeat = 10;
|
uiCfg.stepHeat = 10;
|
||||||
uiCfg.leveling_first_time = false;
|
uiCfg.leveling_first_time = false;
|
||||||
uiCfg.para_ui_page = false;
|
uiCfg.para_ui_page = false;
|
||||||
|
|
|
@ -211,9 +211,9 @@ typedef struct {
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t curTempType:1,
|
uint8_t curTempType:1,
|
||||||
curSprayerChoose:3,
|
extruderIndex:3,
|
||||||
stepHeat:4,
|
stepHeat:4,
|
||||||
curSprayerChoose_bak:4;
|
extruderIndexBak:4;
|
||||||
bool leveling_first_time:1,
|
bool leveling_first_time:1,
|
||||||
para_ui_page:1,
|
para_ui_page:1,
|
||||||
configWifi:1,
|
configWifi:1,
|
||||||
|
@ -246,7 +246,7 @@ typedef struct {
|
||||||
filament_loading_time_cnt,
|
filament_loading_time_cnt,
|
||||||
filament_unloading_time_cnt;
|
filament_unloading_time_cnt;
|
||||||
float move_dist;
|
float move_dist;
|
||||||
float desireSprayerTempBak;
|
float hotendTargetTempBak;
|
||||||
float current_x_position_bak,
|
float current_x_position_bak,
|
||||||
current_y_position_bak,
|
current_y_position_bak,
|
||||||
current_z_position_bak,
|
current_z_position_bak,
|
||||||
|
|
|
@ -885,9 +885,9 @@ static void wifi_gcode_exec(uint8_t *cmd_line) {
|
||||||
char *outBuf = (char *)tempBuf;
|
char *outBuf = (char *)tempBuf;
|
||||||
char str_1[16], tbuf[34];
|
char str_1[16], tbuf[34];
|
||||||
|
|
||||||
dtostrf(thermalManager.temp_hotend[0].celsius, 1, 1, tbuf);
|
dtostrf(thermalManager.degHotend(0), 1, 1, tbuf);
|
||||||
strcat_P(tbuf, PSTR(" /"));
|
strcat_P(tbuf, PSTR(" /"));
|
||||||
strcat(tbuf, dtostrf(thermalManager.temp_hotend[0].target, 1, 1, str_1));
|
strcat(tbuf, dtostrf(thermalManager.degTargetHotend(0), 1, 1, str_1));
|
||||||
|
|
||||||
const int tlen = strlen(tbuf);
|
const int tlen = strlen(tbuf);
|
||||||
|
|
||||||
|
@ -912,9 +912,9 @@ static void wifi_gcode_exec(uint8_t *cmd_line) {
|
||||||
strcat_P(outBuf, PSTR(" T1:"));
|
strcat_P(outBuf, PSTR(" T1:"));
|
||||||
outBuf += 4;
|
outBuf += 4;
|
||||||
#if HAS_MULTI_HOTEND
|
#if HAS_MULTI_HOTEND
|
||||||
strcat(outBuf, dtostrf(thermalManager.temp_hotend[1].celsius, 1, 1, str_1));
|
strcat(outBuf, dtostrf(thermalManager.degHotend(1), 1, 1, str_1));
|
||||||
strcat_P(outBuf, PSTR(" /"));
|
strcat_P(outBuf, PSTR(" /"));
|
||||||
strcat(outBuf, dtostrf(thermalManager.temp_hotend[1].target, 1, 1, str_1));
|
strcat(outBuf, dtostrf(thermalManager.degTargetHotend(1), 1, 1, str_1));
|
||||||
#else
|
#else
|
||||||
strcat_P(outBuf, PSTR("0 /0"));
|
strcat_P(outBuf, PSTR("0 /0"));
|
||||||
#endif
|
#endif
|
||||||
|
@ -924,15 +924,15 @@ static void wifi_gcode_exec(uint8_t *cmd_line) {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sprintf_P((char *)tempBuf, PSTR("T:%d /%d B:%d /%d T0:%d /%d T1:%d /%d @:0 B@:0\r\n"),
|
sprintf_P((char *)tempBuf, PSTR("T:%d /%d B:%d /%d T0:%d /%d T1:%d /%d @:0 B@:0\r\n"),
|
||||||
(int)thermalManager.temp_hotend[0].celsius, (int)thermalManager.temp_hotend[0].target,
|
(int)thermalManager.degHotend(0), (int)thermalManager.degTargetHotend(0),
|
||||||
#if HAS_HEATED_BED
|
#if HAS_HEATED_BED
|
||||||
(int)thermalManager.temp_bed.celsius, (int)thermalManager.temp_bed.target,
|
(int)thermalManager.temp_bed.celsius, (int)thermalManager.temp_bed.target,
|
||||||
#else
|
#else
|
||||||
0, 0,
|
0, 0,
|
||||||
#endif
|
#endif
|
||||||
(int)thermalManager.temp_hotend[0].celsius, (int)thermalManager.temp_hotend[0].target,
|
(int)thermalManager.degHotend(0), (int)thermalManager.degTargetHotend(0),
|
||||||
#if HAS_MULTI_HOTEND
|
#if HAS_MULTI_HOTEND
|
||||||
(int)thermalManager.temp_hotend[1].celsius, (int)thermalManager.temp_hotend[1].target
|
(int)thermalManager.degHotend(1), (int)thermalManager.degTargetHotend(1)
|
||||||
#else
|
#else
|
||||||
0, 0
|
0, 0
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue