1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-27 13:56:24 +00:00

MKS / E3V2 LCD code cleanup

This commit is contained in:
Scott Lahteine 2021-03-19 16:41:47 -05:00 committed by Scott Lahteine
parent 3341e4f88c
commit faa1118ca7
12 changed files with 210 additions and 308 deletions

View File

@ -571,7 +571,7 @@ FORCE_INLINE void _draw_bed_status(const bool blink) {
#if ENABLED(LCD_PROGRESS_BAR) #if ENABLED(LCD_PROGRESS_BAR)
void MarlinUI::draw_progress_bar(const uint8_t percent) { void MarlinUI::draw_progress_bar(const uint8_t percent) {
const int16_t tix = (int16_t)(percent * (LCD_WIDTH) * 3) / 100, const int16_t tix = int16_t(percent * (LCD_WIDTH) * 3) / 100,
cel = tix / 3, cel = tix / 3,
rem = tix % 3; rem = tix % 3;
uint8_t i = LCD_WIDTH; uint8_t i = LCD_WIDTH;

View File

@ -104,17 +104,9 @@
#define MENU_CHAR_LIMIT 24 #define MENU_CHAR_LIMIT 24
#define STATUS_Y 360 #define STATUS_Y 360
// Fan speed limit
#define FANON 255
#define FANOFF 0
// Print speed limit // Print speed limit
#define MAX_PRINT_SPEED 999
#define MIN_PRINT_SPEED 10 #define MIN_PRINT_SPEED 10
#define MAX_PRINT_SPEED 999
#if HAS_HEATED_BED
#define MIN_BED_TEMP BED_MINTEMP
#endif
// Feedspeed limit (max feedspeed = DEFAULT_MAX_FEEDRATE * 2) // Feedspeed limit (max feedspeed = DEFAULT_MAX_FEEDRATE * 2)
#define MIN_MAXFEEDSPEED 1 #define MIN_MAXFEEDSPEED 1
@ -883,11 +875,11 @@ void Draw_Tune_Menu() {
#if HAS_HOTEND #if HAS_HOTEND
Draw_Menu_Line(TUNE_CASE_TEMP, ICON_HotendTemp); Draw_Menu_Line(TUNE_CASE_TEMP, ICON_HotendTemp);
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(TUNE_CASE_TEMP), thermalManager.temp_hotend[0].target); DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(TUNE_CASE_TEMP), thermalManager.degTargetHotend(0));
#endif #endif
#if HAS_HEATED_BED #if HAS_HEATED_BED
Draw_Menu_Line(TUNE_CASE_BED, ICON_BedTemp); Draw_Menu_Line(TUNE_CASE_BED, ICON_BedTemp);
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(TUNE_CASE_BED), thermalManager.temp_bed.target); DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(TUNE_CASE_BED), thermalManager.degTargetBed());
#endif #endif
#if HAS_FAN #if HAS_FAN
Draw_Menu_Line(TUNE_CASE_FAN, ICON_FanSpeed); Draw_Menu_Line(TUNE_CASE_FAN, ICON_FanSpeed);
@ -1394,7 +1386,7 @@ void HMI_Move_Z() {
return; return;
} }
// Bed_Temp limit // Bed_Temp limit
LIMIT(HMI_ValueStruct.Bed_Temp, MIN_BED_TEMP, BED_MAX_TARGET); LIMIT(HMI_ValueStruct.Bed_Temp, BED_MINTEMP, BED_MAX_TARGET);
// Bed_Temp value // Bed_Temp value
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 216, MBASE(bed_line), HMI_ValueStruct.Bed_Temp); DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 216, MBASE(bed_line), HMI_ValueStruct.Bed_Temp);
} }
@ -1438,7 +1430,7 @@ void HMI_Move_Z() {
return; return;
} }
// Fan_speed limit // Fan_speed limit
LIMIT(HMI_ValueStruct.Fan_speed, FANOFF, FANON); LIMIT(HMI_ValueStruct.Fan_speed, 0, 255);
// Fan_speed value // Fan_speed value
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 216, MBASE(fan_line), HMI_ValueStruct.Fan_speed); DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 216, MBASE(fan_line), HMI_ValueStruct.Fan_speed);
} }
@ -1882,9 +1874,9 @@ void Draw_Status_Area(const bool with_update) {
#if HAS_HOTEND #if HAS_HOTEND
DWIN_ICON_Show(ICON, ICON_HotendTemp, 10, 383); DWIN_ICON_Show(ICON, ICON_HotendTemp, 10, 383);
DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, 28, 384, thermalManager.temp_hotend[0].celsius); DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, 28, 384, thermalManager.degHotend(0));
DWIN_Draw_String(false, false, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 25 + 3 * STAT_CHR_W + 5, 384, F("/")); DWIN_Draw_String(false, false, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 25 + 3 * STAT_CHR_W + 5, 384, F("/"));
DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, 25 + 4 * STAT_CHR_W + 6, 384, thermalManager.temp_hotend[0].target); DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, 25 + 4 * STAT_CHR_W + 6, 384, thermalManager.degTargetHotend(0));
DWIN_ICON_Show(ICON, ICON_StepE, 112, 417); DWIN_ICON_Show(ICON, ICON_StepE, 112, 417);
DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, 116 + 2 * STAT_CHR_W, 417, planner.flow_percentage[0]); DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, 116 + 2 * STAT_CHR_W, 417, planner.flow_percentage[0]);
@ -1893,9 +1885,9 @@ void Draw_Status_Area(const bool with_update) {
#if HAS_HEATED_BED #if HAS_HEATED_BED
DWIN_ICON_Show(ICON, ICON_BedTemp, 10, 416); DWIN_ICON_Show(ICON, ICON_BedTemp, 10, 416);
DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, 28, 417, thermalManager.temp_bed.celsius); DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, 28, 417, thermalManager.degBed());
DWIN_Draw_String(false, false, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 25 + 3 * STAT_CHR_W + 5, 417, F("/")); DWIN_Draw_String(false, false, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 25 + 3 * STAT_CHR_W + 5, 417, F("/"));
DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, 25 + 4 * STAT_CHR_W + 6, 417, thermalManager.temp_bed.target); DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, 25 + 4 * STAT_CHR_W + 6, 417, thermalManager.degTargetBed());
#endif #endif
DWIN_ICON_Show(ICON, ICON_Speed, 113, 383); DWIN_ICON_Show(ICON, ICON_Speed, 113, 383);
@ -2158,7 +2150,7 @@ void HMI_SelectFile() {
// All fans on for Ender 3 v2 ? // All fans on for Ender 3 v2 ?
// The slicer should manage this for us. // The slicer should manage this for us.
//for (uint8_t i = 0; i < FAN_COUNT; i++) //for (uint8_t i = 0; i < FAN_COUNT; i++)
// thermalManager.fan_speed[i] = FANON; // thermalManager.fan_speed[i] = 255;
#endif #endif
Goto_PrintProcess(); Goto_PrintProcess();
@ -2539,11 +2531,11 @@ void Draw_Temperature_Menu() {
#define _TMENU_ICON(N) Draw_Menu_Line(++i, ICON_SetEndTemp + (N) - 1) #define _TMENU_ICON(N) Draw_Menu_Line(++i, ICON_SetEndTemp + (N) - 1)
#if HAS_HOTEND #if HAS_HOTEND
_TMENU_ICON(TEMP_CASE_TEMP); _TMENU_ICON(TEMP_CASE_TEMP);
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(i), thermalManager.temp_hotend[0].target); DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(i), thermalManager.degTargetHotend(0));
#endif #endif
#if HAS_HEATED_BED #if HAS_HEATED_BED
_TMENU_ICON(TEMP_CASE_BED); _TMENU_ICON(TEMP_CASE_BED);
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(i), thermalManager.temp_bed.target); DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(i), thermalManager.degTargetBed());
#endif #endif
#if HAS_FAN #if HAS_FAN
_TMENU_ICON(TEMP_CASE_FAN); _TMENU_ICON(TEMP_CASE_FAN);
@ -2711,7 +2703,7 @@ void HMI_AxisMove() {
case 4: // Extruder case 4: // Extruder
// window tips // window tips
#ifdef PREVENT_COLD_EXTRUSION #ifdef PREVENT_COLD_EXTRUSION
if (thermalManager.temp_hotend[0].celsius < EXTRUDE_MINTEMP) { if (thermalManager.degHotend(0) < EXTRUDE_MINTEMP) {
HMI_flag.ETempTooLow_flag = true; HMI_flag.ETempTooLow_flag = true;
Popup_Window_ETempTooLow(); Popup_Window_ETempTooLow();
DWIN_UpdateLCD(); DWIN_UpdateLCD();
@ -2752,16 +2744,16 @@ void HMI_Temperature() {
#if HAS_HOTEND #if HAS_HOTEND
case TEMP_CASE_TEMP: // Nozzle temperature case TEMP_CASE_TEMP: // Nozzle temperature
checkkey = ETemp; checkkey = ETemp;
HMI_ValueStruct.E_Temp = thermalManager.temp_hotend[0].target; HMI_ValueStruct.E_Temp = thermalManager.degTargetHotend(0);
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 216, MBASE(1), thermalManager.temp_hotend[0].target); DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 216, MBASE(1), HMI_ValueStruct.E_Temp);
EncoderRate.enabled = true; EncoderRate.enabled = true;
break; break;
#endif #endif
#if HAS_HEATED_BED #if HAS_HEATED_BED
case TEMP_CASE_BED: // Bed temperature case TEMP_CASE_BED: // Bed temperature
checkkey = BedTemp; checkkey = BedTemp;
HMI_ValueStruct.Bed_Temp = thermalManager.temp_bed.target; HMI_ValueStruct.Bed_Temp = thermalManager.degTargetBed();
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 216, MBASE(2), thermalManager.temp_bed.target); DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 216, MBASE(2), HMI_ValueStruct.Bed_Temp);
EncoderRate.enabled = true; EncoderRate.enabled = true;
break; break;
#endif #endif
@ -2769,7 +2761,7 @@ void HMI_Temperature() {
case TEMP_CASE_FAN: // Fan speed case TEMP_CASE_FAN: // Fan speed
checkkey = FanSpeed; checkkey = FanSpeed;
HMI_ValueStruct.Fan_speed = thermalManager.fan_speed[0]; HMI_ValueStruct.Fan_speed = thermalManager.fan_speed[0];
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 216, MBASE(3), thermalManager.fan_speed[0]); DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 216, MBASE(3), HMI_ValueStruct.Fan_speed);
EncoderRate.enabled = true; EncoderRate.enabled = true;
break; break;
#endif #endif
@ -3285,22 +3277,22 @@ void HMI_Tune() {
case TUNE_CASE_SPEED: // Print speed case TUNE_CASE_SPEED: // Print speed
checkkey = PrintSpeed; checkkey = PrintSpeed;
HMI_ValueStruct.print_speed = feedrate_percentage; HMI_ValueStruct.print_speed = feedrate_percentage;
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 216, MBASE(TUNE_CASE_SPEED + MROWS - index_tune), feedrate_percentage); DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 216, MBASE(TUNE_CASE_SPEED + MROWS - index_tune), HMI_ValueStruct.print_speed);
EncoderRate.enabled = true; EncoderRate.enabled = true;
break; break;
#if HAS_HOTEND #if HAS_HOTEND
case TUNE_CASE_TEMP: // Nozzle temp case TUNE_CASE_TEMP: // Nozzle temp
checkkey = ETemp; checkkey = ETemp;
HMI_ValueStruct.E_Temp = thermalManager.temp_hotend[0].target; HMI_ValueStruct.E_Temp = thermalManager.degTargetHotend(0);
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 216, MBASE(TUNE_CASE_TEMP + MROWS - index_tune), thermalManager.temp_hotend[0].target); DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 216, MBASE(TUNE_CASE_TEMP + MROWS - index_tune), HMI_ValueStruct.E_Temp);
EncoderRate.enabled = true; EncoderRate.enabled = true;
break; break;
#endif #endif
#if HAS_HEATED_BED #if HAS_HEATED_BED
case TUNE_CASE_BED: // Bed temp case TUNE_CASE_BED: // Bed temp
checkkey = BedTemp; checkkey = BedTemp;
HMI_ValueStruct.Bed_Temp = thermalManager.temp_bed.target; HMI_ValueStruct.Bed_Temp = thermalManager.degTargetBed();
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 216, MBASE(TUNE_CASE_BED + MROWS - index_tune), thermalManager.temp_bed.target); DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 216, MBASE(TUNE_CASE_BED + MROWS - index_tune), HMI_ValueStruct.Bed_Temp);
EncoderRate.enabled = true; EncoderRate.enabled = true;
break; break;
#endif #endif
@ -3308,7 +3300,7 @@ void HMI_Tune() {
case TUNE_CASE_FAN: // Fan speed case TUNE_CASE_FAN: // Fan speed
checkkey = FanSpeed; checkkey = FanSpeed;
HMI_ValueStruct.Fan_speed = thermalManager.fan_speed[0]; HMI_ValueStruct.Fan_speed = thermalManager.fan_speed[0];
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 216, MBASE(TUNE_CASE_FAN + MROWS - index_tune), thermalManager.fan_speed[0]); DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 216, MBASE(TUNE_CASE_FAN + MROWS - index_tune), HMI_ValueStruct.Fan_speed);
EncoderRate.enabled = true; EncoderRate.enabled = true;
break; break;
#endif #endif
@ -3626,8 +3618,8 @@ void EachMomentUpdate() {
if (HMI_flag.pause_action && printingIsPaused() && !planner.has_blocks_queued()) { if (HMI_flag.pause_action && printingIsPaused() && !planner.has_blocks_queued()) {
HMI_flag.pause_action = false; HMI_flag.pause_action = false;
#if ENABLED(PAUSE_HEAT) #if ENABLED(PAUSE_HEAT)
TERN_(HAS_HOTEND, resume_hotend_temp = thermalManager.temp_hotend[0].target); TERN_(HAS_HOTEND, resume_hotend_temp = thermalManager.degTargetHotend(0));
TERN_(HAS_HEATED_BED, resume_bed_temp = thermalManager.temp_bed.target); TERN_(HAS_HEATED_BED, resume_bed_temp = thermalManager.degTargetBed());
thermalManager.disable_all_heaters(); thermalManager.disable_all_heaters();
#endif #endif
queue.inject_P(PSTR("G1 F1200 X0 Y0")); queue.inject_P(PSTR("G1 F1200 X0 Y0"));

View File

@ -560,32 +560,31 @@ void AnycubicTFTClass::GetCommandFromTFT() {
switch (a_command) { switch (a_command) {
case 0: { // A0 GET HOTEND TEMP case 0: { // A0 GET HOTEND TEMP
float hotendActualTemp = getActualTemp_celsius((extruder_t) (extruder_t) E0); const float hotendActualTemp = getActualTemp_celsius(E0);
SEND_PGM_VAL("A0V ", int(hotendActualTemp + 0.5)); SEND_PGM_VAL("A0V ", int(hotendActualTemp + 0.5));
} }
break; break;
case 1: { // A1 GET HOTEND TARGET TEMP case 1: { // A1 GET HOTEND TARGET TEMP
float hotendTargetTemp = getTargetTemp_celsius((extruder_t) (extruder_t) E0); const float hotendTargetTemp = getTargetTemp_celsius(E0);
SEND_PGM_VAL("A1V ", int(hotendTargetTemp + 0.5)); SEND_PGM_VAL("A1V ", int(hotendTargetTemp + 0.5));
} }
break; break;
case 2: { // A2 GET HOTBED TEMP case 2: { // A2 GET HOTBED TEMP
float heatedBedActualTemp = getActualTemp_celsius((heater_t) BED); const float heatedBedActualTemp = getActualTemp_celsius(BED);
SEND_PGM_VAL("A2V ", int(heatedBedActualTemp + 0.5)); SEND_PGM_VAL("A2V ", int(heatedBedActualTemp + 0.5));
} }
break; break;
case 3: { // A3 GET HOTBED TARGET TEMP case 3: { // A3 GET HOTBED TARGET TEMP
float heatedBedTargetTemp = getTargetTemp_celsius((heater_t) BED); const float heatedBedTargetTemp = getTargetTemp_celsius(BED);
SEND_PGM_VAL("A3V ", int(heatedBedTargetTemp + 0.5)); SEND_PGM_VAL("A3V ", int(heatedBedTargetTemp + 0.5));
} break; } break;
case 4: { // A4 GET FAN SPEED case 4: { // A4 GET FAN SPEED
float fanPercent = getActualFan_percent(FAN0); const float fanPercent = getActualFan_percent(FAN0);
fanPercent = constrain(fanPercent, 0, 100); SEND_PGM_VAL("A4V ", int(LIMIT(fanPercent, 0, 100)));
SEND_PGM_VAL("A4V ", int(fanPercent));
} break; } break;
case 5: { // A5 GET CURRENT COORDINATE case 5: { // A5 GET CURRENT COORDINATE

View File

@ -111,7 +111,7 @@ void DGUSScreenHandler::DGUSLCD_SendPrintTimeToDisplay_MKS(DGUS_VP_Variable &var
void DGUSScreenHandler::DGUSLCD_SetUint8(DGUS_VP_Variable &var, void *val_ptr) { void DGUSScreenHandler::DGUSLCD_SetUint8(DGUS_VP_Variable &var, void *val_ptr) {
if (var.memadr) { if (var.memadr) {
uint16_t value = swap16(*(uint16_t*)val_ptr); const uint16_t value = swap16(*(uint16_t*)val_ptr);
DEBUG_ECHOLNPAIR("FAN value get:", value); DEBUG_ECHOLNPAIR("FAN value get:", value);
*(uint8_t*)var.memadr = map(constrain(value, 0, 255), 0, 255, 0, 255); *(uint8_t*)var.memadr = map(constrain(value, 0, 255), 0, 255, 0, 255);
DEBUG_ECHOLNPAIR("FAN value change:", *(uint8_t*)var.memadr); DEBUG_ECHOLNPAIR("FAN value change:", *(uint8_t*)var.memadr);
@ -314,7 +314,7 @@ void DGUSScreenHandler::ScreenChangeHook(DGUS_VP_Variable &var, void *val_ptr) {
} }
void DGUSScreenHandler::ScreenBackChange(DGUS_VP_Variable &var, void *val_ptr) { void DGUSScreenHandler::ScreenBackChange(DGUS_VP_Variable &var, void *val_ptr) {
uint16_t target = swap16(*(uint16_t *)val_ptr); const uint16_t target = swap16(*(uint16_t *)val_ptr);
DEBUG_ECHOLNPAIR(" back = 0x%x", target); DEBUG_ECHOLNPAIR(" back = 0x%x", target);
switch (target) { switch (target) {
} }
@ -330,7 +330,7 @@ void DGUSScreenHandler::ZoffsetConfirm(DGUS_VP_Variable &var, void *val_ptr) {
void DGUSScreenHandler::GetTurnOffCtrl(DGUS_VP_Variable &var, void *val_ptr) { void DGUSScreenHandler::GetTurnOffCtrl(DGUS_VP_Variable &var, void *val_ptr) {
DEBUG_ECHOLNPGM("ctrl turn off\n"); DEBUG_ECHOLNPGM("ctrl turn off\n");
uint16_t value = swap16(*(uint16_t *)val_ptr); const uint16_t value = swap16(*(uint16_t *)val_ptr);
switch (value) { switch (value) {
case 0 ... 1: DGUSAutoTurnOff = (bool)value; break; case 0 ... 1: DGUSAutoTurnOff = (bool)value; break;
default: break; default: break;
@ -339,7 +339,7 @@ void DGUSScreenHandler::GetTurnOffCtrl(DGUS_VP_Variable &var, void *val_ptr) {
void DGUSScreenHandler::GetMinExtrudeTemp(DGUS_VP_Variable &var, void *val_ptr) { void DGUSScreenHandler::GetMinExtrudeTemp(DGUS_VP_Variable &var, void *val_ptr) {
DEBUG_ECHOLNPGM("MinExtrudeTempChange DistanceChange"); DEBUG_ECHOLNPGM("MinExtrudeTempChange DistanceChange");
uint16_t value = swap16(*(uint16_t *)val_ptr); const uint16_t value = swap16(*(uint16_t *)val_ptr);
thermalManager.extrude_min_temp = value; thermalManager.extrude_min_temp = value;
min_ex_temp = value; min_ex_temp = value;
settings.save(); settings.save();
@ -347,7 +347,7 @@ void DGUSScreenHandler::GetMinExtrudeTemp(DGUS_VP_Variable &var, void *val_ptr)
void DGUSScreenHandler::GetZoffsetDistance(DGUS_VP_Variable &var, void *val_ptr) { void DGUSScreenHandler::GetZoffsetDistance(DGUS_VP_Variable &var, void *val_ptr) {
DEBUG_ECHOLNPGM("Zoffset DistanceChange"); DEBUG_ECHOLNPGM("Zoffset DistanceChange");
uint16_t value = swap16(*(uint16_t *)val_ptr); const uint16_t value = swap16(*(uint16_t *)val_ptr);
float val_distance = 0; float val_distance = 0;
switch (value) { switch (value) {
case 0: val_distance = 0.01; break; case 0: val_distance = 0.01; break;
@ -365,7 +365,7 @@ void DGUSScreenHandler::GetManualMovestep(DGUS_VP_Variable &var, void *val_ptr)
} }
void DGUSScreenHandler::EEPROM_CTRL(DGUS_VP_Variable &var, void *val_ptr) { void DGUSScreenHandler::EEPROM_CTRL(DGUS_VP_Variable &var, void *val_ptr) {
uint16_t eep_flag = swap16(*(uint16_t *)val_ptr); const uint16_t eep_flag = swap16(*(uint16_t *)val_ptr);
switch (eep_flag) { switch (eep_flag) {
case 0: case 0:
settings.save(); settings.save();
@ -383,7 +383,7 @@ void DGUSScreenHandler::EEPROM_CTRL(DGUS_VP_Variable &var, void *val_ptr) {
} }
void DGUSScreenHandler::Z_offset_select(DGUS_VP_Variable &var, void *val_ptr) { void DGUSScreenHandler::Z_offset_select(DGUS_VP_Variable &var, void *val_ptr) {
uint16_t z_value = swap16(*(uint16_t *)val_ptr); const uint16_t z_value = swap16(*(uint16_t *)val_ptr);
switch (z_value) { switch (z_value) {
case 0: Z_distance = 0.01; break; case 0: Z_distance = 0.01; break;
case 1: Z_distance = 0.1; break; case 1: Z_distance = 0.1; break;
@ -410,7 +410,7 @@ void DGUSScreenHandler::GetOffsetValue(DGUS_VP_Variable &var, void *val_ptr) {
} }
void DGUSScreenHandler::LanguageChange_MKS(DGUS_VP_Variable &var, void *val_ptr) { void DGUSScreenHandler::LanguageChange_MKS(DGUS_VP_Variable &var, void *val_ptr) {
uint16_t lag_flag = swap16(*(uint16_t *)val_ptr); const uint16_t lag_flag = swap16(*(uint16_t *)val_ptr);
switch (lag_flag) { switch (lag_flag) {
case MKS_SimpleChinese: case MKS_SimpleChinese:
DGUS_LanguageDisplay(MKS_SimpleChinese); DGUS_LanguageDisplay(MKS_SimpleChinese);
@ -435,7 +435,7 @@ void DGUSScreenHandler::LanguageChange_MKS(DGUS_VP_Variable &var, void *val_ptr)
#endif #endif
void DGUSScreenHandler::Level_Ctrl_MKS(DGUS_VP_Variable &var, void *val_ptr) { void DGUSScreenHandler::Level_Ctrl_MKS(DGUS_VP_Variable &var, void *val_ptr) {
uint16_t lev_but = swap16(*(uint16_t *)val_ptr); const uint16_t lev_but = swap16(*(uint16_t *)val_ptr);
#if ENABLED(MESH_BED_LEVELING) #if ENABLED(MESH_BED_LEVELING)
auto cs = getCurrentScreen(); auto cs = getCurrentScreen();
#endif #endif
@ -482,7 +482,7 @@ void DGUSScreenHandler::Level_Ctrl_MKS(DGUS_VP_Variable &var, void *val_ptr) {
} }
void DGUSScreenHandler::MeshLevelDistanceConfig(DGUS_VP_Variable &var, void *val_ptr) { void DGUSScreenHandler::MeshLevelDistanceConfig(DGUS_VP_Variable &var, void *val_ptr) {
uint16_t mesh_dist = swap16(*(uint16_t *)val_ptr); const uint16_t mesh_dist = swap16(*(uint16_t *)val_ptr);
switch (mesh_dist) { switch (mesh_dist) {
case 0: mesh_adj_distance = 0.01; break; case 0: mesh_adj_distance = 0.01; break;
case 1: mesh_adj_distance = 0.1; break; case 1: mesh_adj_distance = 0.1; break;
@ -493,7 +493,7 @@ void DGUSScreenHandler::MeshLevelDistanceConfig(DGUS_VP_Variable &var, void *val
void DGUSScreenHandler::MeshLevel(DGUS_VP_Variable &var, void *val_ptr) { void DGUSScreenHandler::MeshLevel(DGUS_VP_Variable &var, void *val_ptr) {
#if ENABLED(MESH_BED_LEVELING) #if ENABLED(MESH_BED_LEVELING)
uint16_t mesh_value = swap16(*(uint16_t *)val_ptr); const uint16_t mesh_value = swap16(*(uint16_t *)val_ptr);
// static uint8_t a_first_level = 1; // static uint8_t a_first_level = 1;
char cmd_buf[30]; char cmd_buf[30];
float offset = mesh_adj_distance; float offset = mesh_adj_distance;
@ -586,20 +586,16 @@ void DGUSScreenHandler::MeshLevel(DGUS_VP_Variable &var, void *val_ptr) {
} }
void DGUSScreenHandler::LCD_BLK_Adjust(DGUS_VP_Variable &var, void *val_ptr) { void DGUSScreenHandler::LCD_BLK_Adjust(DGUS_VP_Variable &var, void *val_ptr) {
const uint16_t lcd_value = swap16(*(uint16_t *)val_ptr);
uint16_t lcd_value = swap16(*(uint16_t *)val_ptr); lcd_default_light = constrain(lcd_value, 10, 100);
if (lcd_value > 100) lcd_value = 100;
else if (lcd_value < 10) lcd_value = 10;
lcd_default_light = lcd_value;
const uint16_t lcd_data[2] = { lcd_default_light, lcd_default_light }; const uint16_t lcd_data[2] = { lcd_default_light, lcd_default_light };
dgusdisplay.WriteVariable(0x0082, &lcd_data, 5, true); dgusdisplay.WriteVariable(0x0082, &lcd_data, 5, true);
} }
void DGUSScreenHandler::ManualAssistLeveling(DGUS_VP_Variable &var, void *val_ptr) { void DGUSScreenHandler::ManualAssistLeveling(DGUS_VP_Variable &var, void *val_ptr) {
int16_t point_value = swap16(*(uint16_t *)val_ptr); const int16_t point_value = swap16(*(uint16_t *)val_ptr);
int16_t level_x_pos, level_y_pos; int16_t level_x_pos, level_y_pos;
char buf_level[32] = {0}; char buf_level[32] = {0};
@ -686,7 +682,7 @@ void DGUSScreenHandler::ManualAssistLeveling(DGUS_VP_Variable &var, void *val_pt
#define mks_max(a, b) ((a) > (b)) ? (a) : (b) #define mks_max(a, b) ((a) > (b)) ? (a) : (b)
void DGUSScreenHandler::TMC_ChangeConfig(DGUS_VP_Variable &var, void *val_ptr) { void DGUSScreenHandler::TMC_ChangeConfig(DGUS_VP_Variable &var, void *val_ptr) {
#if EITHER(HAS_TRINAMIC_CONFIG, HAS_STEALTHCHOP) #if EITHER(HAS_TRINAMIC_CONFIG, HAS_STEALTHCHOP)
uint16_t tmc_value = swap16(*(uint16_t*)val_ptr); const uint16_t tmc_value = swap16(*(uint16_t*)val_ptr);
#endif #endif
switch (var.VP) { switch (var.VP) {
@ -930,7 +926,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
} }
void DGUSScreenHandler::GetParkPos_MKS(DGUS_VP_Variable &var, void *val_ptr) { void DGUSScreenHandler::GetParkPos_MKS(DGUS_VP_Variable &var, void *val_ptr) {
int16_t value_pos = swap16(*(int16_t*)val_ptr); const int16_t value_pos = swap16(*(int16_t*)val_ptr);
switch (var.VP) { switch (var.VP) {
case VP_X_PARK_POS: x_park_pos = value_pos; break; case VP_X_PARK_POS: x_park_pos = value_pos; break;
@ -939,75 +935,76 @@ void DGUSScreenHandler::GetParkPos_MKS(DGUS_VP_Variable &var, void *val_ptr) {
default: break; default: break;
} }
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
return;
} }
void DGUSScreenHandler::HandleChangeLevelPoint_MKS(DGUS_VP_Variable &var, void *val_ptr) { void DGUSScreenHandler::HandleChangeLevelPoint_MKS(DGUS_VP_Variable &var, void *val_ptr) {
DEBUG_ECHOLNPGM("HandleStepPerMMChanged"); DEBUG_ECHOLNPGM("HandleStepPerMMChanged");
int16_t value_raw = swap16(*(int16_t*)val_ptr); const int16_t value_raw = swap16(*(int16_t*)val_ptr);
DEBUG_ECHOLNPAIR_F("value_raw:", value_raw);
DEBUG_ECHOLNPAIR_F("value:", value_raw);
*(int16_t*)var.memadr = value_raw; *(int16_t*)var.memadr = value_raw;
settings.save(); settings.save();
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
return;
} }
void DGUSScreenHandler::HandleStepPerMMChanged_MKS(DGUS_VP_Variable &var, void *val_ptr) { void DGUSScreenHandler::HandleStepPerMMChanged_MKS(DGUS_VP_Variable &var, void *val_ptr) {
DEBUG_ECHOLNPGM("HandleStepPerMMChanged"); DEBUG_ECHOLNPGM("HandleStepPerMMChanged");
uint16_t value_raw = swap16(*(uint16_t*)val_ptr); const uint16_t value_raw = swap16(*(uint16_t*)val_ptr);
const float value = (float)value_raw;
DEBUG_ECHOLNPAIR("value_raw:", value_raw); DEBUG_ECHOLNPAIR("value_raw:", value_raw);
float value = (float)value_raw; DEBUG_ECHOLNPAIR_F("value:", value);
ExtUI::axis_t axis; ExtUI::axis_t axis;
switch (var.VP) { switch (var.VP) {
default: return;
case VP_X_STEP_PER_MM: axis = ExtUI::axis_t::X; break; case VP_X_STEP_PER_MM: axis = ExtUI::axis_t::X; break;
case VP_Y_STEP_PER_MM: axis = ExtUI::axis_t::Y; break; case VP_Y_STEP_PER_MM: axis = ExtUI::axis_t::Y; break;
case VP_Z_STEP_PER_MM: axis = ExtUI::axis_t::Z; break; case VP_Z_STEP_PER_MM: axis = ExtUI::axis_t::Z; break;
default: return;
} }
DEBUG_ECHOLNPAIR_F("value:", value);
ExtUI::setAxisSteps_per_mm(value, axis); ExtUI::setAxisSteps_per_mm(value, axis);
DEBUG_ECHOLNPAIR_F("value_set:", ExtUI::getAxisSteps_per_mm(axis)); DEBUG_ECHOLNPAIR_F("value_set:", ExtUI::getAxisSteps_per_mm(axis));
settings.save(); settings.save();
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
return;
} }
void DGUSScreenHandler::HandleStepPerMMExtruderChanged_MKS(DGUS_VP_Variable &var, void *val_ptr) { void DGUSScreenHandler::HandleStepPerMMExtruderChanged_MKS(DGUS_VP_Variable &var, void *val_ptr) {
DEBUG_ECHOLNPGM("HandleStepPerMMExtruderChanged"); DEBUG_ECHOLNPGM("HandleStepPerMMExtruderChanged");
uint16_t value_raw = swap16(*(uint16_t*)val_ptr); const uint16_t value_raw = swap16(*(uint16_t*)val_ptr);
const float value = (float)value_raw;
DEBUG_ECHOLNPAIR("value_raw:", value_raw); DEBUG_ECHOLNPAIR("value_raw:", value_raw);
float value = (float)value_raw; DEBUG_ECHOLNPAIR_F("value:", value);
ExtUI::extruder_t extruder; ExtUI::extruder_t extruder;
switch (var.VP) { switch (var.VP) {
default: return; default: return;
#if HOTENDS >= 1 #if HAS_HOTEND
case VP_E0_STEP_PER_MM: extruder = ExtUI::extruder_t::E0; break; case VP_E0_STEP_PER_MM: extruder = ExtUI::extruder_t::E0; break;
#endif #endif
#if HOTENDS >= 2 #if HAS_MULTI_HOTEND
#endif
case VP_E1_STEP_PER_MM: extruder = ExtUI::extruder_t::E1; break; case VP_E1_STEP_PER_MM: extruder = ExtUI::extruder_t::E1; break;
#endif
} }
DEBUG_ECHOLNPAIR_F("value:", value);
ExtUI::setAxisSteps_per_mm(value, extruder); ExtUI::setAxisSteps_per_mm(value, extruder);
DEBUG_ECHOLNPAIR_F("value_set:", ExtUI::getAxisSteps_per_mm(extruder)); DEBUG_ECHOLNPAIR_F("value_set:", ExtUI::getAxisSteps_per_mm(extruder));
settings.save(); settings.save();
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
return;
} }
void DGUSScreenHandler::HandleMaxSpeedChange_MKS(DGUS_VP_Variable &var, void *val_ptr) { void DGUSScreenHandler::HandleMaxSpeedChange_MKS(DGUS_VP_Variable &var, void *val_ptr) {
DEBUG_ECHOLNPGM("HandleMaxSpeedChange_MKS"); DEBUG_ECHOLNPGM("HandleMaxSpeedChange_MKS");
uint16_t value_raw = swap16(*(uint16_t*)val_ptr); const uint16_t value_raw = swap16(*(uint16_t*)val_ptr);
const float value = (float)value_raw;
DEBUG_ECHOLNPAIR("value_raw:", value_raw); DEBUG_ECHOLNPAIR("value_raw:", value_raw);
float value = (float)value_raw; DEBUG_ECHOLNPAIR_F("value:", value);
ExtUI::axis_t axis; ExtUI::axis_t axis;
switch (var.VP) { switch (var.VP) {
case VP_X_MAX_SPEED: axis = ExtUI::axis_t::X; break; case VP_X_MAX_SPEED: axis = ExtUI::axis_t::X; break;
@ -1015,59 +1012,57 @@ void DGUSScreenHandler::HandleMaxSpeedChange_MKS(DGUS_VP_Variable &var, void *va
case VP_Z_MAX_SPEED: axis = ExtUI::axis_t::Z; break; case VP_Z_MAX_SPEED: axis = ExtUI::axis_t::Z; break;
default: return; default: return;
} }
DEBUG_ECHOLNPAIR_F("value:", value);
// ExtUI::setAxisSteps_per_mm(value,extruder);
ExtUI::setAxisMaxFeedrate_mm_s(value, axis); ExtUI::setAxisMaxFeedrate_mm_s(value, axis);
DEBUG_ECHOLNPAIR_F("value_set:", ExtUI::getAxisMaxFeedrate_mm_s(axis)); DEBUG_ECHOLNPAIR_F("value_set:", ExtUI::getAxisMaxFeedrate_mm_s(axis));
settings.save(); settings.save();
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
return;
} }
void DGUSScreenHandler::HandleExtruderMaxSpeedChange_MKS(DGUS_VP_Variable &var, void *val_ptr) { void DGUSScreenHandler::HandleExtruderMaxSpeedChange_MKS(DGUS_VP_Variable &var, void *val_ptr) {
DEBUG_ECHOLNPGM("HandleMaxSpeedChange_MKS"); DEBUG_ECHOLNPGM("HandleMaxSpeedChange_MKS");
uint16_t value_raw = swap16(*(uint16_t*)val_ptr); const uint16_t value_raw = swap16(*(uint16_t*)val_ptr);
const float value = (float)value_raw;
DEBUG_ECHOLNPAIR("value_raw:", value_raw); DEBUG_ECHOLNPAIR("value_raw:", value_raw);
float value = (float)value_raw; DEBUG_ECHOLNPAIR_F("value:", value);
ExtUI::extruder_t extruder; ExtUI::extruder_t extruder;
switch (var.VP) { switch (var.VP) {
default: return; default: return;
#if HOTENDS >= 1 #if HAS_HOTEND
case VP_E0_MAX_SPEED: extruder = ExtUI::extruder_t::E0; break; case VP_E0_MAX_SPEED: extruder = ExtUI::extruder_t::E0; break;
#endif #endif
#if HOTENDS >= 2 #if HAS_MULTI_HOTEND
#endif #endif
case VP_E1_MAX_SPEED: extruder = ExtUI::extruder_t::E1; break; case VP_E1_MAX_SPEED: extruder = ExtUI::extruder_t::E1; break;
} }
DEBUG_ECHOLNPAIR_F("value:", value);
// ExtUI::setAxisSteps_per_mm(value,extruder);
ExtUI::setAxisMaxFeedrate_mm_s(value, extruder); ExtUI::setAxisMaxFeedrate_mm_s(value, extruder);
DEBUG_ECHOLNPAIR_F("value_set:", ExtUI::getAxisMaxFeedrate_mm_s(extruder)); DEBUG_ECHOLNPAIR_F("value_set:", ExtUI::getAxisMaxFeedrate_mm_s(extruder));
settings.save(); settings.save();
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
return;
} }
void DGUSScreenHandler::HandleMaxAccChange_MKS(DGUS_VP_Variable &var, void *val_ptr) { void DGUSScreenHandler::HandleMaxAccChange_MKS(DGUS_VP_Variable &var, void *val_ptr) {
DEBUG_ECHOLNPGM("HandleMaxSpeedChange_MKS"); DEBUG_ECHOLNPGM("HandleMaxSpeedChange_MKS");
uint16_t value_raw = swap16(*(uint16_t*)val_ptr); const uint16_t value_raw = swap16(*(uint16_t*)val_ptr);
const float value = (float)value_raw;
DEBUG_ECHOLNPAIR("value_raw:", value_raw); DEBUG_ECHOLNPAIR("value_raw:", value_raw);
float value = (float)value_raw; DEBUG_ECHOLNPAIR_F("value:", value);
ExtUI::axis_t axis; ExtUI::axis_t axis;
switch (var.VP) { switch (var.VP) {
default: return;
case VP_X_ACC_MAX_SPEED: axis = ExtUI::axis_t::X; break; case VP_X_ACC_MAX_SPEED: axis = ExtUI::axis_t::X; break;
case VP_Y_ACC_MAX_SPEED: axis = ExtUI::axis_t::Y; break; case VP_Y_ACC_MAX_SPEED: axis = ExtUI::axis_t::Y; break;
case VP_Z_ACC_MAX_SPEED: axis = ExtUI::axis_t::Z; break; case VP_Z_ACC_MAX_SPEED: axis = ExtUI::axis_t::Z; break;
default: return;
} }
DEBUG_ECHOLNPAIR_F("value:", value);
ExtUI::setAxisMaxAcceleration_mm_s2(value, axis); ExtUI::setAxisMaxAcceleration_mm_s2(value, axis);
DEBUG_ECHOLNPAIR_F("value_set:", ExtUI::getAxisMaxAcceleration_mm_s2(axis)); DEBUG_ECHOLNPAIR_F("value_set:", ExtUI::getAxisMaxAcceleration_mm_s2(axis));
settings.save(); settings.save();
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
return;
} }
void DGUSScreenHandler::HandleExtruderAccChange_MKS(DGUS_VP_Variable &var, void *val_ptr) { void DGUSScreenHandler::HandleExtruderAccChange_MKS(DGUS_VP_Variable &var, void *val_ptr) {
@ -1079,76 +1074,66 @@ void DGUSScreenHandler::HandleExtruderAccChange_MKS(DGUS_VP_Variable &var, void
ExtUI::extruder_t extruder; ExtUI::extruder_t extruder;
switch (var.VP) { switch (var.VP) {
default: return; default: return;
#if HOTENDS >= 1 #if HAS_HOTEND
case VP_E0_ACC_MAX_SPEED: extruder = ExtUI::extruder_t::E0; settings.load(); break; case VP_E0_ACC_MAX_SPEED: extruder = ExtUI::extruder_t::E0; settings.load(); break;
#endif #endif
#if HOTENDS >= 2 #if HAS_MULTI_HOTEND
#endif
case VP_E1_ACC_MAX_SPEED: extruder = ExtUI::extruder_t::E1; settings.load(); break; case VP_E1_ACC_MAX_SPEED: extruder = ExtUI::extruder_t::E1; settings.load(); break;
#endif
} }
DEBUG_ECHOLNPAIR_F("value:", value); DEBUG_ECHOLNPAIR_F("value:", value);
// ExtUI::setAxisSteps_per_mm(value,extruder);
ExtUI::setAxisMaxAcceleration_mm_s2(value, extruder); ExtUI::setAxisMaxAcceleration_mm_s2(value, extruder);
DEBUG_ECHOLNPAIR_F("value_set:", ExtUI::getAxisMaxAcceleration_mm_s2(extruder)); DEBUG_ECHOLNPAIR_F("value_set:", ExtUI::getAxisMaxAcceleration_mm_s2(extruder));
settings.save(); settings.save();
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
return;
} }
void DGUSScreenHandler::HandleTravelAccChange_MKS(DGUS_VP_Variable &var, void *val_ptr) { void DGUSScreenHandler::HandleTravelAccChange_MKS(DGUS_VP_Variable &var, void *val_ptr) {
uint16_t value_travel = swap16(*(uint16_t*)val_ptr); uint16_t value_travel = swap16(*(uint16_t*)val_ptr);
float value = (float)value_travel; planner.settings.travel_acceleration = (float)value_travel;
planner.settings.travel_acceleration = value;
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
return;
} }
void DGUSScreenHandler::HandleFeedRateMinChange_MKS(DGUS_VP_Variable &var, void *val_ptr) { void DGUSScreenHandler::HandleFeedRateMinChange_MKS(DGUS_VP_Variable &var, void *val_ptr) {
uint16_t value_t = swap16(*(uint16_t*)val_ptr); uint16_t value_t = swap16(*(uint16_t*)val_ptr);
float value = (float)value_t; planner.settings.min_feedrate_mm_s = (float)value_t;
planner.settings.min_feedrate_mm_s = value;
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
return;
} }
void DGUSScreenHandler::HandleMin_T_F_MKS(DGUS_VP_Variable &var, void *val_ptr) { void DGUSScreenHandler::HandleMin_T_F_MKS(DGUS_VP_Variable &var, void *val_ptr) {
uint16_t value_t_f = swap16(*(uint16_t*)val_ptr); uint16_t value_t_f = swap16(*(uint16_t*)val_ptr);
float value = (float)value_t_f; planner.settings.min_travel_feedrate_mm_s = (float)value_t_f;
planner.settings.min_travel_feedrate_mm_s = value;
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
return;
} }
void DGUSScreenHandler::HandleAccChange_MKS(DGUS_VP_Variable &var, void *val_ptr) { void DGUSScreenHandler::HandleAccChange_MKS(DGUS_VP_Variable &var, void *val_ptr) {
uint16_t value_acc = swap16(*(uint16_t*)val_ptr); uint16_t value_acc = swap16(*(uint16_t*)val_ptr);
float value = (float)value_acc; planner.settings.acceleration = (float)value_acc;
planner.settings.acceleration = value;
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
return;
} }
void DGUSScreenHandler::HandleGetExMinTemp_MKS(DGUS_VP_Variable &var, void *val_ptr) { void DGUSScreenHandler::HandleGetExMinTemp_MKS(DGUS_VP_Variable &var, void *val_ptr) {
uint16_t value_ex_min_temp = swap16(*(uint16_t*)val_ptr); const uint16_t value_ex_min_temp = swap16(*(uint16_t*)val_ptr);
thermalManager.extrude_min_temp = value_ex_min_temp; thermalManager.extrude_min_temp = value_ex_min_temp;
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
} }
#if HAS_PID_HEATING #if HAS_PID_HEATING
void DGUSScreenHandler::HandleTemperaturePIDChanged(DGUS_VP_Variable &var, void *val_ptr) { void DGUSScreenHandler::HandleTemperaturePIDChanged(DGUS_VP_Variable &var, void *val_ptr) {
uint16_t rawvalue = swap16(*(uint16_t*)val_ptr); const uint16_t rawvalue = swap16(*(uint16_t*)val_ptr);
DEBUG_ECHOLNPAIR("V1:", rawvalue); DEBUG_ECHOLNPAIR("V1:", rawvalue);
float value = (float)rawvalue / 10; const float value = 1.0f * rawvalue;
DEBUG_ECHOLNPAIR("V2:", value); DEBUG_ECHOLNPAIR("V2:", value);
float newvalue = 0; float newvalue = 0;
switch (var.VP) { switch (var.VP) {
default: return; default: return;
#if HOTENDS >= 1 #if HAS_HOTEND
case VP_E0_PID_P: newvalue = value; break; case VP_E0_PID_P: newvalue = value; break;
case VP_E0_PID_I: newvalue = scalePID_i(value); break; case VP_E0_PID_I: newvalue = scalePID_i(value); break;
case VP_E0_PID_D: newvalue = scalePID_d(value); break; case VP_E0_PID_D: newvalue = scalePID_d(value); break;
#endif #endif
#if HOTENDS >= 2 #if HAS_MULTI_HOTEND
case VP_E1_PID_P: newvalue = value; break; case VP_E1_PID_P: newvalue = value; break;
case VP_E1_PID_I: newvalue = scalePID_i(value); break; case VP_E1_PID_I: newvalue = scalePID_i(value); break;
case VP_E1_PID_D: newvalue = scalePID_d(value); break; case VP_E1_PID_D: newvalue = scalePID_d(value); break;
@ -1224,7 +1209,6 @@ void DGUSScreenHandler::GetManualFilament(DGUS_VP_Variable &var, void *val_ptr)
distanceFilament = value; distanceFilament = value;
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
return;
} }
void DGUSScreenHandler::GetManualFilamentSpeed(DGUS_VP_Variable &var, void *val_ptr) { void DGUSScreenHandler::GetManualFilamentSpeed(DGUS_VP_Variable &var, void *val_ptr) {
@ -1237,137 +1221,65 @@ void DGUSScreenHandler::GetManualFilamentSpeed(DGUS_VP_Variable &var, void *val_
FilamentSpeed = value_len; FilamentSpeed = value_len;
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
return;
} }
void DGUSScreenHandler::MKS_FilamentLoad(DGUS_VP_Variable &var, void *val_ptr) { void DGUSScreenHandler::MKS_FilamentLoadUnload(DGUS_VP_Variable &var, void *val_ptr, const int filamentDir) {
DEBUG_ECHOLNPGM("Load Filament"); #if EITHER(HAS_MULTI_HOTEND, SINGLENOZZLE)
char buf[40]; uint8_t swap_tool = 0;
#endif
uint16_t val_t = swap16(*(uint16_t*)val_ptr); #if HAS_HOTEND
uint8_t hotend_too_cold = 0;
#endif
if (!print_job_timer.isPaused() && !queue.ring_buffer.empty()) if (!print_job_timer.isPaused() && !queue.ring_buffer.empty())
return; return;
char buf[40];
const uint16_t val_t = swap16(*(uint16_t*)val_ptr);
switch (val_t) { switch (val_t) {
default: break;
case 0: case 0:
#if HOTENDS >= 1 #if HAS_HOTEND
if (thermalManager.degHotend(0) < thermalManager.extrude_min_temp) { if (thermalManager.tooColdToExtrude(0)) hotend_too_cold = 1; else swap_tool = 1;
if (thermalManager.degTargetHotend(0) < thermalManager.extrude_min_temp)
thermalManager.setTargetHotend(thermalManager.extrude_min_temp, 0);
sendinfoscreen(PSTR("NOTICE"), nullptr, PSTR("Please wait."), PSTR("Nozzle heating!"), true, true, true, true);
SetupConfirmAction(nullptr);
GotoScreen(DGUSLCD_SCREEN_POPUP);
}
else {
queue.enqueue_now_P(PSTR("T0"));
queue.enqueue_now_P(PSTR("G91"));
snprintf_P(buf,40,PSTR("G1 E%d F%d"),(int)distanceFilament,FilamentSpeed * 60);
queue.enqueue_one_now(buf);
queue.enqueue_now_P(PSTR("G90"));
}
#endif #endif
break; break;
case 1: case 1:
#if HOTENDS >= 2 #if HAS_MULTI_HOTEND
if (thermalManager.degHotend(1) < thermalManager.extrude_min_temp) { if (thermalManager.tooColdToExtrude(1)) hotend_too_cold = 2; else swap_tool = 2;
if (thermalManager.degTargetHotend(1) < thermalManager.extrude_min_temp) #elif ENABLED(SINGLENOZZLE)
thermalManager.setTargetHotend(thermalManager.extrude_min_temp, 1); if (thermalManager.tooColdToExtrude(0)) hotend_too_cold = 1; else swap_tool = 2;
sendinfoscreen(PSTR("NOTICE"), nullptr, PSTR("Please wait."), PSTR("Nozzle heating!"), true, true, true, true);
SetupConfirmAction(nullptr);
GotoScreen(DGUSLCD_SCREEN_POPUP);
}
else {
queue.enqueue_now_P(PSTR("T1"));
queue.enqueue_now_P(PSTR("G91"));
snprintf_P(buf,40,PSTR("G1 E%d F%d"),(int)distanceFilament,FilamentSpeed * 60);
queue.enqueue_one_now(buf);
queue.enqueue_now_P(PSTR("G90"));
}
#endif
#if ENABLED(SINGLENOZZLE)
if (thermalManager.degHotend(0) < thermalManager.extrude_min_temp) {
if (thermalManager.degTargetHotend(0) < thermalManager.extrude_min_temp)
thermalManager.setTargetHotend(thermalManager.extrude_min_temp, 0);
sendinfoscreen(PSTR("NOTICE"), nullptr, PSTR("Please wait."), PSTR("Nozzle heating!"), true, true, true, true);
SetupConfirmAction(nullptr);
GotoScreen(DGUSLCD_SCREEN_POPUP);
}
else {
queue.enqueue_now_P(PSTR("T1"));
queue.enqueue_now_P(PSTR("G91"));
snprintf_P(buf,40,PSTR("G1 E%d F%d"),(int)distanceFilament,FilamentSpeed * 60);
queue.enqueue_one_now(buf);
queue.enqueue_now_P(PSTR("G90"));
}
#endif #endif
break; break;
}
default: #if HAS_HOTEND
break; if (hotend_too_cold) {
if (thermalManager.targetTooColdToExtrude(hotend_too_cold - 1)) thermalManager.setTargetHotend(thermalManager.extrude_min_temp, hotend_too_cold - 1);
sendinfoscreen(PSTR("NOTICE"), nullptr, PSTR("Please wait."), PSTR("Nozzle heating!"), true, true, true, true);
SetupConfirmAction(nullptr);
GotoScreen(DGUSLCD_SCREEN_POPUP);
} }
#endif
#if EITHER(HAS_MULTI_HOTEND, SINGLENOZZLE)
if (swap_tool) {
queue.enqueue_now_P(swap_tool == 2 ? PSTR("T1") : PSTR("T0"));
queue.enqueue_now_P(PSTR("G91"));
snprintf_P(buf, 40, PSTR("G1 E%d F%d"), (int)distanceFilament * filamentDir, FilamentSpeed * 60);
queue.enqueue_one_now(buf);
queue.enqueue_now_P(PSTR("G90"));
}
#endif
}
void DGUSScreenHandler::MKS_FilamentLoad(DGUS_VP_Variable &var, void *val_ptr) {
DEBUG_ECHOLNPGM("Load Filament");
MKS_FilamentLoadUnload(var, val_ptr, 1);
} }
void DGUSScreenHandler::MKS_FilamentUnLoad(DGUS_VP_Variable &var, void *val_ptr) { void DGUSScreenHandler::MKS_FilamentUnLoad(DGUS_VP_Variable &var, void *val_ptr) {
DEBUG_ECHOLNPGM("UnLoad Filament"); DEBUG_ECHOLNPGM("UnLoad Filament");
char buf[40]; MKS_FilamentLoadUnload(var, val_ptr, -1);
uint16_t val_t = swap16(*(uint16_t*)val_ptr);
switch (val_t) {
case 0:
#if HOTENDS >= 1
if (thermalManager.degHotend(0) < thermalManager.extrude_min_temp) {
if (thermalManager.degTargetHotend(0) < thermalManager.extrude_min_temp)
thermalManager.setTargetHotend(thermalManager.extrude_min_temp, 0);
sendinfoscreen(PSTR("NOTICE"), nullptr, PSTR("Please wait."), PSTR("Nozzle heating!"), true, true, true, true);
SetupConfirmAction(nullptr);
GotoScreen(DGUSLCD_SCREEN_POPUP);
}
else {
queue.enqueue_now_P(PSTR("T0"));
queue.enqueue_now_P(PSTR("G91"));
snprintf_P(buf,40,PSTR("G1 E-%d F%d"),(int)distanceFilament,FilamentSpeed * 60);
queue.enqueue_one_now(buf);
queue.enqueue_now_P(PSTR("G90"));
}
#endif
break;
case 1:
#if HOTENDS >= 2
if (thermalManager.degHotend(1) < thermalManager.extrude_min_temp) {
if (thermalManager.degTargetHotend(1) < thermalManager.extrude_min_temp)
thermalManager.setTargetHotend(thermalManager.extrude_min_temp, 1);
sendinfoscreen(PSTR("NOTICE"), nullptr, PSTR("Please wait."), PSTR("Nozzle heating!"), true, true, true, true);
SetupConfirmAction(nullptr);
GotoScreen(DGUSLCD_SCREEN_POPUP);
}
else {
queue.enqueue_now_P(PSTR("T1"));
queue.enqueue_now_P(PSTR("G91"));
snprintf_P(buf,40,PSTR("G1 E-%d F%d"),(int)distanceFilament,FilamentSpeed * 60);
queue.enqueue_one_now(buf);
queue.enqueue_now_P(PSTR("G90"));
}
#endif
#if ENABLED(SINGLENOZZLE)
if (thermalManager.degHotend(0) < thermalManager.extrude_min_temp) {
if (thermalManager.degTargetHotend(0) < thermalManager.extrude_min_temp)
thermalManager.setTargetHotend(thermalManager.extrude_min_temp, 0);
sendinfoscreen(PSTR("NOTICE"), nullptr, PSTR("Please wait."), PSTR("Nozzle heating!"), true, true, true, true);
SetupConfirmAction(nullptr);
GotoScreen(DGUSLCD_SCREEN_POPUP);
}
else {
queue.enqueue_now_P(PSTR("T1"));
queue.enqueue_now_P(PSTR("G91"));
snprintf_P(buf,40,PSTR("G1 E-%d F%d"),(int)distanceFilament,FilamentSpeed * 60);
queue.enqueue_one_now(buf);
queue.enqueue_now_P(PSTR("G90"));
}
#endif
break;
}
} }
#if ENABLED(DGUS_FILAMENT_LOADUNLOAD) #if ENABLED(DGUS_FILAMENT_LOADUNLOAD)
@ -1378,17 +1290,15 @@ void DGUSScreenHandler::MKS_FilamentUnLoad(DGUS_VP_Variable &var, void *val_ptr)
uint8_t e_temp = 0; uint8_t e_temp = 0;
filament_data.heated = false; filament_data.heated = false;
uint16_t preheat_option = swap16(*(uint16_t*)val_ptr); uint16_t preheat_option = swap16(*(uint16_t*)val_ptr);
if (preheat_option <= 8) { // Load filament type if (preheat_option >= 10) { // Unload filament type
filament_data.action = 1;
}
else if (preheat_option >= 10) { // Unload filament type
preheat_option -= 10; preheat_option -= 10;
filament_data.action = 2; filament_data.action = 2;
filament_data.purge_length = DGUS_FILAMENT_PURGE_LENGTH; filament_data.purge_length = DGUS_FILAMENT_PURGE_LENGTH;
} }
else { // Cancel filament operation else if (preheat_option <= 8) // Load filament type
filament_data.action = 1;
else // Cancel filament operation
filament_data.action = 0; filament_data.action = 0;
}
switch (preheat_option) { switch (preheat_option) {
case 0: // Load PLA case 0: // Load PLA
@ -1416,10 +1326,10 @@ void DGUSScreenHandler::MKS_FilamentUnLoad(DGUS_VP_Variable &var, void *val_ptr)
} }
if (filament_data.action == 0) { // Go back to utility screen if (filament_data.action == 0) { // Go back to utility screen
#if HOTENDS >= 1 #if HAS_HOTEND
thermalManager.setTargetHotend(e_temp, ExtUI::extruder_t::E0); thermalManager.setTargetHotend(e_temp, ExtUI::extruder_t::E0);
#endif #endif
#if HOTENDS >= 2 #if HAS_MULTI_HOTEND
thermalManager.setTargetHotend(e_temp, ExtUI::extruder_t::E1); thermalManager.setTargetHotend(e_temp, ExtUI::extruder_t::E1);
#endif #endif
GotoScreen(DGUSLCD_SCREEN_UTILITY); GotoScreen(DGUSLCD_SCREEN_UTILITY);
@ -1427,13 +1337,13 @@ void DGUSScreenHandler::MKS_FilamentUnLoad(DGUS_VP_Variable &var, void *val_ptr)
else { // Go to the preheat screen to show the heating progress else { // Go to the preheat screen to show the heating progress
switch (var.VP) { switch (var.VP) {
default: return; default: return;
#if HOTENDS >= 1 #if HAS_HOTEND
case VP_E0_FILAMENT_LOAD_UNLOAD: case VP_E0_FILAMENT_LOAD_UNLOAD:
filament_data.extruder = ExtUI::extruder_t::E0; filament_data.extruder = ExtUI::extruder_t::E0;
thermalManager.setTargetHotend(e_temp, filament_data.extruder); thermalManager.setTargetHotend(e_temp, filament_data.extruder);
break; break;
#endif #endif
#if HOTENDS >= 2 #if HAS_MULTI_HOTEND
case VP_E1_FILAMENT_LOAD_UNLOAD: case VP_E1_FILAMENT_LOAD_UNLOAD:
filament_data.extruder = ExtUI::extruder_t::E1; filament_data.extruder = ExtUI::extruder_t::E1;
thermalManager.setTargetHotend(e_temp, filament_data.extruder); thermalManager.setTargetHotend(e_temp, filament_data.extruder);
@ -1475,6 +1385,7 @@ void DGUSScreenHandler::MKS_FilamentUnLoad(DGUS_VP_Variable &var, void *val_ptr)
ExtUI::setAxisPosition_mm(movevalue, filament_data.extruder); ExtUI::setAxisPosition_mm(movevalue, filament_data.extruder);
} }
} }
#endif // DGUS_FILAMENT_LOADUNLOAD #endif // DGUS_FILAMENT_LOADUNLOAD
bool DGUSScreenHandler::loop() { bool DGUSScreenHandler::loop() {

View File

@ -149,6 +149,7 @@ public:
// Hook for filament load and unload // Hook for filament load and unload
static void HandleFilamentLoadUnload(DGUS_VP_Variable &var); static void HandleFilamentLoadUnload(DGUS_VP_Variable &var);
static void MKS_FilamentLoadUnload(DGUS_VP_Variable &var, void *val_ptr, const int filamentDir);
static void MKS_FilamentLoad(DGUS_VP_Variable &var, void *val_ptr); static void MKS_FilamentLoad(DGUS_VP_Variable &var, void *val_ptr);
static void MKS_FilamentUnLoad(DGUS_VP_Variable &var, void *val_ptr); static void MKS_FilamentUnLoad(DGUS_VP_Variable &var, void *val_ptr);
static void MKS_LOAD_UNLOAD_IDLE(); static void MKS_LOAD_UNLOAD_IDLE();

View File

@ -514,14 +514,14 @@ void filament_dialog_handle() {
queue.inject(public_buf_m); queue.inject(public_buf_m);
} }
if ( ((abs((int)((int)thermalManager.degHotend(uiCfg.extruderIndex) - gCfgItems.filament_limit_temper)) <= 1) if (uiCfg.filament_load_heat_flg) {
|| ((int)thermalManager.degHotend(uiCfg.extruderIndex) > gCfgItems.filament_limit_temper)) const int16_t diff = thermalManager.degHotend(uiCfg.extruderIndex) - gCfgItems.filament_limit_temp;
&& uiCfg.filament_load_heat_flg if (abs(diff) < 2 || diff > 0) {
) {
uiCfg.filament_load_heat_flg = false; uiCfg.filament_load_heat_flg = false;
lv_clear_dialog(); lv_clear_dialog();
lv_draw_dialog(DIALOG_TYPE_FILAMENT_HEAT_LOAD_COMPLETED); lv_draw_dialog(DIALOG_TYPE_FILAMENT_HEAT_LOAD_COMPLETED);
} }
}
if (uiCfg.filament_loading_completed) { if (uiCfg.filament_loading_completed) {
uiCfg.filament_rate = 0; uiCfg.filament_rate = 0;
@ -529,14 +529,15 @@ 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.degHotend(uiCfg.extruderIndex) - gCfgItems.filament_limit_temper)) <= 1)
|| ((int)thermalManager.degHotend(uiCfg.extruderIndex) > gCfgItems.filament_limit_temper)) if (uiCfg.filament_unload_heat_flg) {
&& uiCfg.filament_unload_heat_flg const int16_t diff = thermalManager.degHotend(uiCfg.extruderIndex) - gCfgItems.filament_limit_temp;
) { if (abs(diff) < 2 || diff > 0) {
uiCfg.filament_unload_heat_flg = false; uiCfg.filament_unload_heat_flg = false;
lv_clear_dialog(); lv_clear_dialog();
lv_draw_dialog(DIALOG_TYPE_FILAMENT_HEAT_UNLOAD_COMPLETED); lv_draw_dialog(DIALOG_TYPE_FILAMENT_HEAT_UNLOAD_COMPLETED);
} }
}
if (uiCfg.filament_unloading_completed) { if (uiCfg.filament_unloading_completed) {
uiCfg.filament_rate = 0; uiCfg.filament_rate = 0;

View File

@ -51,15 +51,15 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
case ID_FILAMNT_IN: case ID_FILAMNT_IN:
uiCfg.filament_load_heat_flg = true; uiCfg.filament_load_heat_flg = true;
if ((abs(thermalManager.degTargetHotend(uiCfg.extruderIndex) - thermalManager.degHotend(uiCfg.extruderIndex)) <= 1) if ((abs(thermalManager.degTargetHotend(uiCfg.extruderIndex) - thermalManager.degHotend(uiCfg.extruderIndex)) <= 1)
|| (gCfgItems.filament_limit_temper <= thermalManager.degHotend(uiCfg.extruderIndex))) { || (gCfgItems.filament_limit_temp <= 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.degTargetHotend(uiCfg.extruderIndex) < gCfgItems.filament_limit_temper) { if (thermalManager.degTargetHotend(uiCfg.extruderIndex) < gCfgItems.filament_limit_temp) {
thermalManager.setTargetHotend(gCfgItems.filament_limit_temper, uiCfg.extruderIndex); thermalManager.setTargetHotend(gCfgItems.filament_limit_temp, uiCfg.extruderIndex);
thermalManager.start_watching_hotend(uiCfg.extruderIndex); thermalManager.start_watching_hotend(uiCfg.extruderIndex);
} }
} }
@ -68,7 +68,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
uiCfg.filament_unload_heat_flg = true; uiCfg.filament_unload_heat_flg = true;
if (thermalManager.degTargetHotend(uiCfg.extruderIndex) if (thermalManager.degTargetHotend(uiCfg.extruderIndex)
&& ((abs((int)((int)thermalManager.degTargetHotend(uiCfg.extruderIndex) - thermalManager.degHotend(uiCfg.extruderIndex))) <= 1) && ((abs((int)((int)thermalManager.degTargetHotend(uiCfg.extruderIndex) - thermalManager.degHotend(uiCfg.extruderIndex))) <= 1)
|| ((int)thermalManager.degHotend(uiCfg.extruderIndex) >= gCfgItems.filament_limit_temper)) || ((int)thermalManager.degHotend(uiCfg.extruderIndex) >= gCfgItems.filament_limit_temp))
) { ) {
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,8 +76,8 @@ 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.degTargetHotend(uiCfg.extruderIndex) < gCfgItems.filament_limit_temper) { if (thermalManager.degTargetHotend(uiCfg.extruderIndex) < gCfgItems.filament_limit_temp) {
thermalManager.setTargetHotend(gCfgItems.filament_limit_temper, uiCfg.extruderIndex); thermalManager.setTargetHotend(gCfgItems.filament_limit_temp, uiCfg.extruderIndex);
thermalManager.start_watching_hotend(uiCfg.extruderIndex); thermalManager.start_watching_hotend(uiCfg.extruderIndex);
} }
filament_sprayer_temp(); filament_sprayer_temp();

View File

@ -107,7 +107,7 @@ void lv_draw_filament_settings() {
lv_big_button_create(scr, "F:/bmp_back70x40.bin", machine_menu.next, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y, event_handler, ID_FILAMENT_SET_DOWN, true); lv_big_button_create(scr, "F:/bmp_back70x40.bin", machine_menu.next, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y, event_handler, ID_FILAMENT_SET_DOWN, true);
} }
else { else {
sprintf_P(public_buf_l, PSTR("%d"), gCfgItems.filament_limit_temper); sprintf_P(public_buf_l, PSTR("%d"), gCfgItems.filament_limit_temp);
lv_screen_menu_item_1_edit(scr, machine_menu.FilamentTemperature, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_FILAMENT_SET_TEMP, 0, public_buf_l); lv_screen_menu_item_1_edit(scr, machine_menu.FilamentTemperature, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_FILAMENT_SET_TEMP, 0, public_buf_l);
lv_big_button_create(scr, "F:/bmp_back70x40.bin", machine_menu.previous, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y, event_handler, ID_FILAMENT_SET_UP, true); lv_big_button_create(scr, "F:/bmp_back70x40.bin", machine_menu.previous, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y, event_handler, ID_FILAMENT_SET_UP, true);

View File

@ -261,7 +261,7 @@ static void disp_key_value() {
sprintf_P(public_buf_m, PSTR("%d"), gCfgItems.filamentchange_unload_speed); sprintf_P(public_buf_m, PSTR("%d"), gCfgItems.filamentchange_unload_speed);
break; break;
case filament_temp: case filament_temp:
sprintf_P(public_buf_m, PSTR("%d"), gCfgItems.filament_limit_temper); sprintf_P(public_buf_m, PSTR("%d"), gCfgItems.filament_limit_temp);
break; break;
case x_sensitivity: case x_sensitivity:
#if X_SENSORLESS #if X_SENSORLESS
@ -505,7 +505,7 @@ static void set_value_confirm() {
update_spi_flash(); update_spi_flash();
break; break;
case filament_temp: case filament_temp:
gCfgItems.filament_limit_temper = atoi(key_value); gCfgItems.filament_limit_temp = atoi(key_value);
update_spi_flash(); update_spi_flash();
break; break;
case x_sensitivity: case x_sensitivity:

View File

@ -143,7 +143,7 @@ void gCfgItems_init() {
gCfgItems.filamentchange_load_speed = 1000; gCfgItems.filamentchange_load_speed = 1000;
gCfgItems.filamentchange_unload_length = 200; gCfgItems.filamentchange_unload_length = 200;
gCfgItems.filamentchange_unload_speed = 1000; gCfgItems.filamentchange_unload_speed = 1000;
gCfgItems.filament_limit_temper = 200; gCfgItems.filament_limit_temp = 200;
gCfgItems.encoder_enable = true; gCfgItems.encoder_enable = true;
@ -226,8 +226,8 @@ void ui_cfg_init() {
uiCfg.cloud_port = 10086; uiCfg.cloud_port = 10086;
#endif #endif
uiCfg.filament_loading_time = (uint32_t)((gCfgItems.filamentchange_load_length * 60.0 / gCfgItems.filamentchange_load_speed) + 0.5); uiCfg.filament_loading_time = (uint32_t)((gCfgItems.filamentchange_load_length * 60.0f / gCfgItems.filamentchange_load_speed) + 0.5f);
uiCfg.filament_unloading_time = (uint32_t)((gCfgItems.filamentchange_unload_length * 60.0 / gCfgItems.filamentchange_unload_speed) + 0.5); uiCfg.filament_unloading_time = (uint32_t)((gCfgItems.filamentchange_unload_length * 60.0f / gCfgItems.filamentchange_unload_speed) + 0.5f);
} }
void update_spi_flash() { void update_spi_flash() {

View File

@ -201,11 +201,9 @@ typedef struct {
int filamentchange_load_length, int filamentchange_load_length,
filamentchange_load_speed, filamentchange_load_speed,
filamentchange_unload_length, filamentchange_unload_length,
filamentchange_unload_speed, filamentchange_unload_speed;
filament_limit_temper; int16_t filament_limit_temp;
float pausePosX, float pausePosX, pausePosY, pausePosZ;
pausePosY,
pausePosZ;
uint32_t curFilesize; uint32_t curFilesize;
} CFG_ITMES; } CFG_ITMES;