2020-06-16 01:45:27 -05:00
|
|
|
/**
|
|
|
|
* Marlin 3D Printer Firmware
|
|
|
|
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|
|
|
*
|
|
|
|
* Based on Sprinter and grbl.
|
|
|
|
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2020-07-22 22:20:14 -05:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2020-06-16 01:45:27 -05:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* DWIN by Creality3D
|
|
|
|
*/
|
|
|
|
|
2020-09-06 21:40:58 -05:00
|
|
|
#include "../../../inc/MarlinConfigPre.h"
|
2020-06-16 01:45:27 -05:00
|
|
|
|
|
|
|
#if ENABLED(DWIN_CREALITY_LCD)
|
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
#include "dwin.h"
|
|
|
|
|
2020-09-03 16:52:31 -05:00
|
|
|
#if ANY(AUTO_BED_LEVELING_BILINEAR, AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_3POINT) && DISABLED(PROBE_MANUALLY)
|
|
|
|
#define HAS_ONESTEP_LEVELING 1
|
|
|
|
#endif
|
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
#if ANY(BABYSTEPPING, HAS_BED_PROBE, HAS_WORKSPACE_OFFSET)
|
|
|
|
#define HAS_ZOFFSET_ITEM 1
|
2020-09-16 06:56:48 -05:00
|
|
|
#endif
|
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
#if !HAS_BED_PROBE && ENABLED(BABYSTEPPING)
|
|
|
|
#define JUST_BABYSTEP 1
|
|
|
|
#endif
|
2020-06-16 01:45:27 -05:00
|
|
|
|
|
|
|
#include <WString.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2020-09-06 21:40:58 -05:00
|
|
|
#include "../../fontutils.h"
|
|
|
|
#include "../../ultralcd.h"
|
2020-06-16 01:45:27 -05:00
|
|
|
|
2020-09-06 21:40:58 -05:00
|
|
|
#include "../../../sd/cardreader.h"
|
2020-06-16 01:45:27 -05:00
|
|
|
|
2020-09-06 21:40:58 -05:00
|
|
|
#include "../../../MarlinCore.h"
|
|
|
|
#include "../../../core/serial.h"
|
|
|
|
#include "../../../core/macros.h"
|
|
|
|
#include "../../../gcode/queue.h"
|
2020-06-16 01:45:27 -05:00
|
|
|
|
2020-09-06 21:40:58 -05:00
|
|
|
#include "../../../module/temperature.h"
|
|
|
|
#include "../../../module/printcounter.h"
|
|
|
|
#include "../../../module/motion.h"
|
|
|
|
#include "../../../module/planner.h"
|
2020-06-16 01:45:27 -05:00
|
|
|
|
2020-09-14 02:48:45 -05:00
|
|
|
#if ENABLED(EEPROM_SETTINGS)
|
|
|
|
#include "../../../module/settings.h"
|
|
|
|
#endif
|
|
|
|
|
2020-08-10 20:04:40 -05:00
|
|
|
#if ENABLED(HOST_ACTION_COMMANDS)
|
2020-09-06 21:40:58 -05:00
|
|
|
#include "../../../feature/host_actions.h"
|
2020-08-10 20:04:40 -05:00
|
|
|
#endif
|
|
|
|
|
2020-09-03 16:52:31 -05:00
|
|
|
#if HAS_ONESTEP_LEVELING
|
2020-09-06 21:40:58 -05:00
|
|
|
#include "../../../feature/bedlevel/bedlevel.h"
|
2020-06-16 01:45:27 -05:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if HAS_BED_PROBE
|
2020-09-06 21:40:58 -05:00
|
|
|
#include "../../../module/probe.h"
|
2020-06-16 01:45:27 -05:00
|
|
|
#endif
|
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
#if EITHER(BABYSTEP_ZPROBE_OFFSET, JUST_BABYSTEP)
|
|
|
|
#include "../../../feature/babystep.h"
|
|
|
|
#endif
|
|
|
|
|
2020-09-14 02:48:45 -05:00
|
|
|
#if ENABLED(POWER_LOSS_RECOVERY)
|
|
|
|
#include "../../../feature/powerloss.h"
|
|
|
|
#endif
|
|
|
|
|
2020-07-14 20:01:29 -05:00
|
|
|
#ifndef MACHINE_SIZE
|
|
|
|
#define MACHINE_SIZE "220x220x250"
|
|
|
|
#endif
|
|
|
|
#ifndef CORP_WEBSITE_C
|
|
|
|
#define CORP_WEBSITE_C "www.cxsw3d.com"
|
|
|
|
#endif
|
|
|
|
#ifndef CORP_WEBSITE_E
|
|
|
|
#define CORP_WEBSITE_E "www.creality.com"
|
|
|
|
#endif
|
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
#define PAUSE_HEAT
|
2020-06-16 01:45:27 -05:00
|
|
|
|
|
|
|
#define USE_STRING_HEADINGS
|
|
|
|
|
2020-09-19 07:56:01 -05:00
|
|
|
#define DWIN_FONT_MENU font8x16
|
|
|
|
#define DWIN_FONT_STAT font10x20
|
|
|
|
#define DWIN_FONT_HEAD font10x20
|
2020-06-16 01:45:27 -05:00
|
|
|
|
2020-07-14 20:01:29 -05:00
|
|
|
#define MENU_CHAR_LIMIT 24
|
2020-09-17 05:35:04 -05:00
|
|
|
#define STATUS_Y 360
|
2020-07-14 20:01:29 -05:00
|
|
|
|
|
|
|
// Fan speed limit
|
|
|
|
#define FANON 255
|
|
|
|
#define FANOFF 0
|
|
|
|
|
|
|
|
// Print speed limit
|
|
|
|
#define MAX_PRINT_SPEED 999
|
|
|
|
#define MIN_PRINT_SPEED 10
|
|
|
|
|
|
|
|
// Temp limits
|
|
|
|
#if HAS_HOTEND
|
|
|
|
#define MAX_E_TEMP (HEATER_0_MAXTEMP - (HOTEND_OVERSHOOT))
|
|
|
|
#define MIN_E_TEMP HEATER_0_MINTEMP
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if HAS_HEATED_BED
|
|
|
|
#define MIN_BED_TEMP BED_MINTEMP
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// Feedspeed limit (max feedspeed = DEFAULT_MAX_FEEDRATE * 2)
|
|
|
|
#define MIN_MAXFEEDSPEED 1
|
|
|
|
#define MIN_MAXACCELERATION 1
|
2020-09-16 06:56:48 -05:00
|
|
|
#define MIN_MAXJERK 0.1
|
2020-07-14 20:01:29 -05:00
|
|
|
#define MIN_STEP 1
|
|
|
|
|
|
|
|
#define FEEDRATE_E (60)
|
|
|
|
|
|
|
|
// Mininum unit (0.1) : multiple (10)
|
|
|
|
#define MINUNITMULT 10
|
|
|
|
|
|
|
|
#define ENCODER_WAIT 20
|
|
|
|
#define DWIN_SCROLL_UPDATE_INTERVAL 2000
|
|
|
|
#define DWIN_REMAIN_TIME_UPDATE_INTERVAL 20000
|
|
|
|
|
|
|
|
constexpr uint16_t TROWS = 6, MROWS = TROWS - 1, // Total rows, and other-than-Back
|
|
|
|
TITLE_HEIGHT = 30, // Title bar height
|
|
|
|
MLINE = 53, // Menu line height
|
|
|
|
LBLX = 60, // Menu item label X
|
2020-06-16 01:45:27 -05:00
|
|
|
MENU_CHR_W = 8, STAT_CHR_W = 10;
|
|
|
|
|
2020-09-16 06:56:48 -05:00
|
|
|
#define MBASE(L) (49 + MLINE * (L))
|
2020-06-16 01:45:27 -05:00
|
|
|
|
2020-09-14 02:48:45 -05:00
|
|
|
#define BABY_Z_VAR TERN(HAS_BED_PROBE, probe.offset.z, dwin_zoffset)
|
2020-06-16 01:45:27 -05:00
|
|
|
|
|
|
|
/* Value Init */
|
|
|
|
HMI_value_t HMI_ValueStruct;
|
2020-07-14 20:01:29 -05:00
|
|
|
HMI_Flag HMI_flag{0};
|
2020-06-16 01:45:27 -05:00
|
|
|
|
2020-06-24 19:44:50 -05:00
|
|
|
millis_t dwin_heat_time = 0;
|
2020-06-16 01:45:27 -05:00
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
uint8_t checkkey = 0;
|
2020-06-16 01:45:27 -05:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
uint8_t now, last;
|
|
|
|
void set(uint8_t v) { now = last = v; }
|
|
|
|
void reset() { set(0); }
|
|
|
|
bool changed() { bool c = (now != last); if (c) last = now; return c; }
|
|
|
|
bool dec() { if (now) now--; return changed(); }
|
2020-09-17 05:35:04 -05:00
|
|
|
bool inc(uint8_t v) { if (now < (v - 1)) now++; else now = (v - 1); return changed(); }
|
2020-06-16 01:45:27 -05:00
|
|
|
} select_t;
|
|
|
|
|
|
|
|
select_t select_page{0}, select_file{0}, select_print{0}, select_prepare{0}
|
2020-07-14 20:01:29 -05:00
|
|
|
, select_control{0}, select_axis{0}, select_temp{0}, select_motion{0}, select_tune{0}
|
|
|
|
, select_PLA{0}, select_ABS{0}
|
|
|
|
, select_speed{0}
|
|
|
|
, select_acc{0}
|
2020-09-16 04:35:30 -05:00
|
|
|
, select_jerk{0}
|
2020-07-14 20:01:29 -05:00
|
|
|
, select_step{0}
|
|
|
|
// , select_leveling{0}
|
|
|
|
;
|
|
|
|
|
|
|
|
uint8_t index_file = MROWS,
|
|
|
|
index_prepare = MROWS,
|
|
|
|
index_control = MROWS,
|
2020-06-16 01:45:27 -05:00
|
|
|
index_leveling = MROWS,
|
2020-09-17 05:35:04 -05:00
|
|
|
index_tune = MROWS;
|
2020-06-16 01:45:27 -05:00
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
bool dwin_abort_flag = false;
|
2020-06-16 01:45:27 -05:00
|
|
|
|
|
|
|
constexpr float default_max_feedrate[] = DEFAULT_MAX_FEEDRATE;
|
|
|
|
constexpr float default_max_acceleration[] = DEFAULT_MAX_ACCELERATION;
|
|
|
|
constexpr float default_max_jerk[] = { DEFAULT_XJERK, DEFAULT_YJERK, DEFAULT_ZJERK, DEFAULT_EJERK };
|
|
|
|
constexpr float default_axis_steps_per_unit[] = DEFAULT_AXIS_STEPS_PER_UNIT;
|
|
|
|
|
|
|
|
uint8_t Percentrecord = 0;
|
2020-09-17 05:35:04 -05:00
|
|
|
uint16_t remain_time = 0;
|
|
|
|
|
|
|
|
#if ENABLED(PAUSE_HEAT)
|
|
|
|
#if HAS_HOTEND
|
|
|
|
uint16_t temphot = 0;
|
|
|
|
#endif
|
|
|
|
#if HAS_HEATED_BED
|
|
|
|
uint16_t tempbed = 0;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if HAS_ZOFFSET_ITEM
|
|
|
|
float dwin_zoffset = 0, last_zoffset = 0;
|
|
|
|
#endif
|
2020-06-16 01:45:27 -05:00
|
|
|
|
2020-07-24 03:09:14 -05:00
|
|
|
#define DWIN_LANGUAGE_EEPROM_ADDRESS 0x01 // Between 0x01 and 0x63 (EEPROM_OFFSET-1)
|
|
|
|
// BL24CXX::check() uses 0x00
|
2020-06-16 01:45:27 -05:00
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
void HMI_SetLanguageCache() {
|
|
|
|
DWIN_JPG_CacheTo1(HMI_flag.language_chinese ? Language_Chinese : Language_English);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
void HMI_SetLanguage() {
|
|
|
|
#if ENABLED(EEPROM_SETTINGS)
|
|
|
|
BL24CXX::read(DWIN_LANGUAGE_EEPROM_ADDRESS, (uint8_t*)&HMI_flag.language_chinese, sizeof(HMI_flag.language_chinese));
|
|
|
|
#endif
|
|
|
|
HMI_SetLanguageCache();
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
2020-09-17 05:35:04 -05:00
|
|
|
|
|
|
|
void HMI_ToggleLanguage() {
|
|
|
|
HMI_flag.language_chinese ^= true;
|
|
|
|
HMI_SetLanguageCache();
|
|
|
|
#if ENABLED(EEPROM_SETTINGS)
|
|
|
|
BL24CXX::write(DWIN_LANGUAGE_EEPROM_ADDRESS, (uint8_t*)&HMI_flag.language_chinese, sizeof(HMI_flag.language_chinese));
|
|
|
|
#endif
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
|
2020-09-14 02:48:45 -05:00
|
|
|
void DWIN_Draw_Signed_Float(uint8_t size, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, long value) {
|
2020-06-16 01:45:27 -05:00
|
|
|
if (value < 0) {
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_String(false, true, size, Color_White, bColor, x - 6, y, F("-"));
|
|
|
|
DWIN_Draw_FloatValue(true, true, 0, size, Color_White, bColor, iNum, fNum, x, y, -value);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
else {
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_String(false, true, size, Color_White, bColor, x - 6, y, F(" "));
|
|
|
|
DWIN_Draw_FloatValue(true, true, 0, size, Color_White, bColor, iNum, fNum, x, y, value);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ICON_Print() {
|
|
|
|
if (select_page.now == 0) {
|
2020-07-14 20:01:29 -05:00
|
|
|
DWIN_ICON_Show(ICON, ICON_Print_1, 17, 130);
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_Rectangle(0, Color_White, 17, 130, 126, 229);
|
2020-08-21 23:44:21 -05:00
|
|
|
if (HMI_flag.language_chinese)
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 1, 447, 28, 460, 58, 201);
|
2020-06-16 01:45:27 -05:00
|
|
|
else
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 1, 451, 31, 463, 57, 201);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
else {
|
2020-07-14 20:01:29 -05:00
|
|
|
DWIN_ICON_Show(ICON, ICON_Print_0, 17, 130);
|
2020-08-21 23:44:21 -05:00
|
|
|
if (HMI_flag.language_chinese)
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 1, 405, 28, 420, 58, 201);
|
2020-06-16 01:45:27 -05:00
|
|
|
else
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 1, 423, 31, 435, 57, 201);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ICON_Prepare() {
|
|
|
|
if (select_page.now == 1) {
|
2020-07-14 20:01:29 -05:00
|
|
|
DWIN_ICON_Show(ICON, ICON_Prepare_1, 145, 130);
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_Rectangle(0, Color_White, 145, 130, 254, 229);
|
2020-08-21 23:44:21 -05:00
|
|
|
if (HMI_flag.language_chinese)
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 31, 447, 58, 460, 186, 201);
|
2020-06-16 01:45:27 -05:00
|
|
|
else
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 33, 451, 82, 466, 175, 201);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
else {
|
2020-07-14 20:01:29 -05:00
|
|
|
DWIN_ICON_Show(ICON, ICON_Prepare_0, 145, 130);
|
2020-08-21 23:44:21 -05:00
|
|
|
if (HMI_flag.language_chinese)
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 31, 405, 58, 420, 186, 201);
|
2020-06-16 01:45:27 -05:00
|
|
|
else
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 33, 423, 82, 438, 175, 201);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ICON_Control() {
|
|
|
|
if (select_page.now == 2) {
|
2020-07-14 20:01:29 -05:00
|
|
|
DWIN_ICON_Show(ICON, ICON_Control_1, 17, 246);
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_Rectangle(0, Color_White, 17, 246, 126, 345);
|
2020-08-21 23:44:21 -05:00
|
|
|
if (HMI_flag.language_chinese)
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 61, 447, 88, 460, 58, 318);
|
2020-06-16 01:45:27 -05:00
|
|
|
else
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 85, 451, 132, 463, 48, 318);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
else {
|
2020-07-14 20:01:29 -05:00
|
|
|
DWIN_ICON_Show(ICON, ICON_Control_0, 17, 246);
|
2020-08-21 23:44:21 -05:00
|
|
|
if (HMI_flag.language_chinese)
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 61, 405, 88, 420, 58, 318);
|
2020-06-16 01:45:27 -05:00
|
|
|
else
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 85, 423, 132, 434, 48, 318);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ICON_StartInfo(bool show) {
|
|
|
|
if (show) {
|
2020-07-14 20:01:29 -05:00
|
|
|
DWIN_ICON_Show(ICON, ICON_Info_1, 145, 246);
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_Rectangle(0, Color_White, 145, 246, 254, 345);
|
2020-08-21 23:44:21 -05:00
|
|
|
if (HMI_flag.language_chinese)
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 91, 447, 118, 460, 186, 318);
|
2020-06-16 01:45:27 -05:00
|
|
|
else
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 132, 451, 159, 466, 186, 318);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
else {
|
2020-07-14 20:01:29 -05:00
|
|
|
DWIN_ICON_Show(ICON, ICON_Info_0, 145, 246);
|
2020-08-21 23:44:21 -05:00
|
|
|
if (HMI_flag.language_chinese)
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 91, 405, 118, 420, 186, 318);
|
2020-06-16 01:45:27 -05:00
|
|
|
else
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 132, 423, 159, 435, 186, 318);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ICON_Leveling(bool show) {
|
|
|
|
if (show) {
|
2020-07-14 20:01:29 -05:00
|
|
|
DWIN_ICON_Show(ICON, ICON_Leveling_1, 145, 246);
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_Rectangle(0, Color_White, 145, 246, 254, 345);
|
2020-08-21 23:44:21 -05:00
|
|
|
if (HMI_flag.language_chinese)
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 211, 447, 238, 460, 186, 318);
|
2020-06-16 01:45:27 -05:00
|
|
|
else
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 84, 437, 120, 449, 182, 318);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
else {
|
2020-07-14 20:01:29 -05:00
|
|
|
DWIN_ICON_Show(ICON, ICON_Leveling_0, 145, 246);
|
2020-08-21 23:44:21 -05:00
|
|
|
if (HMI_flag.language_chinese)
|
2020-06-16 01:45:27 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 211, 405, 238, 420, 186, 318);
|
|
|
|
else
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 84, 465, 120, 478, 182, 318);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ICON_Tune() {
|
|
|
|
if (select_print.now == 0) {
|
2020-07-14 20:01:29 -05:00
|
|
|
DWIN_ICON_Show(ICON, ICON_Setup_1, 8, 252);
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_Rectangle(0, Color_White, 8, 252, 87, 351);
|
2020-08-21 23:44:21 -05:00
|
|
|
if (HMI_flag.language_chinese)
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 121, 447, 148, 458, 34, 325);
|
2020-06-16 01:45:27 -05:00
|
|
|
else
|
2020-09-17 05:35:04 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 0, 466, 34, 476, 31, 325);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
else {
|
2020-07-14 20:01:29 -05:00
|
|
|
DWIN_ICON_Show(ICON, ICON_Setup_0, 8, 252);
|
2020-08-21 23:44:21 -05:00
|
|
|
if (HMI_flag.language_chinese)
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 121, 405, 148, 420, 34, 325);
|
2020-06-16 01:45:27 -05:00
|
|
|
else
|
2020-09-17 05:35:04 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 0, 438, 32, 448, 31, 325);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ICON_Pause() {
|
|
|
|
if (select_print.now == 1) {
|
2020-07-14 20:01:29 -05:00
|
|
|
DWIN_ICON_Show(ICON, ICON_Pause_1, 96, 252);
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_Rectangle(0, Color_White, 96, 252, 175, 351);
|
2020-08-21 23:44:21 -05:00
|
|
|
if (HMI_flag.language_chinese)
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 181, 447, 208, 459, 124, 325);
|
2020-06-16 01:45:27 -05:00
|
|
|
else
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 177, 451, 216, 462, 116, 325);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
else {
|
2020-07-14 20:01:29 -05:00
|
|
|
DWIN_ICON_Show(ICON, ICON_Pause_0, 96, 252);
|
2020-08-21 23:44:21 -05:00
|
|
|
if (HMI_flag.language_chinese)
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 181, 405, 208, 420, 124, 325);
|
2020-06-16 01:45:27 -05:00
|
|
|
else
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 177, 423, 215, 433, 116, 325);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ICON_Continue() {
|
|
|
|
if (select_print.now == 1) {
|
2020-07-14 20:01:29 -05:00
|
|
|
DWIN_ICON_Show(ICON, ICON_Continue_1, 96, 252);
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_Rectangle(0, Color_White, 96, 252, 175, 351);
|
2020-08-21 23:44:21 -05:00
|
|
|
if (HMI_flag.language_chinese)
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 1, 447, 28, 460, 124, 325);
|
2020-06-16 01:45:27 -05:00
|
|
|
else
|
2020-09-17 05:35:04 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 1, 452, 32, 464, 121, 325);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
else {
|
2020-07-14 20:01:29 -05:00
|
|
|
DWIN_ICON_Show(ICON, ICON_Continue_0, 96, 252);
|
2020-08-21 23:44:21 -05:00
|
|
|
if (HMI_flag.language_chinese)
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 1, 405, 28, 420, 124, 325);
|
2020-06-16 01:45:27 -05:00
|
|
|
else
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 1, 424, 31, 434, 121, 325);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ICON_Stop() {
|
|
|
|
if (select_print.now == 2) {
|
2020-07-14 20:01:29 -05:00
|
|
|
DWIN_ICON_Show(ICON, ICON_Stop_1, 184, 252);
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_Rectangle(0, Color_White, 184, 252, 263, 351);
|
2020-08-21 23:44:21 -05:00
|
|
|
if (HMI_flag.language_chinese)
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 151, 447, 178, 459, 210, 325);
|
2020-06-16 01:45:27 -05:00
|
|
|
else
|
2020-09-17 05:35:04 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 218, 452, 249, 466, 209, 325);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
else {
|
2020-07-14 20:01:29 -05:00
|
|
|
DWIN_ICON_Show(ICON, ICON_Stop_0, 184, 252);
|
2020-08-21 23:44:21 -05:00
|
|
|
if (HMI_flag.language_chinese)
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 151, 405, 178, 420, 210, 325);
|
2020-06-16 01:45:27 -05:00
|
|
|
else
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 218, 423, 247, 436, 209, 325);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
inline void Clear_Title_Bar() {
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_Rectangle(1, Color_Bg_Blue, 0, 0, DWIN_WIDTH, 30);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
inline void Draw_Title(const char * const title) {
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_String(false, false, DWIN_FONT_HEAD, Color_White, Color_Bg_Blue, 14, 4, (char*)title);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
|
2020-08-02 20:00:06 -05:00
|
|
|
inline void Draw_Title(const __FlashStringHelper * title) {
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_String(false, false, DWIN_FONT_HEAD, Color_White, Color_Bg_Blue, 14, 4, (char*)title);
|
2020-08-02 20:00:06 -05:00
|
|
|
}
|
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
inline void Clear_Menu_Area() {
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_Rectangle(1, Color_Bg_Black, 0, 31, DWIN_WIDTH, STATUS_Y);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
inline void Clear_Main_Window() {
|
2020-06-16 01:45:27 -05:00
|
|
|
Clear_Title_Bar();
|
|
|
|
Clear_Menu_Area();
|
|
|
|
}
|
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
inline void Clear_Popup_Area() {
|
2020-06-16 01:45:27 -05:00
|
|
|
Clear_Title_Bar();
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_Rectangle(1, Color_Bg_Black, 0, 31, DWIN_WIDTH, DWIN_HEIGHT);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
void Draw_Popup_Bkgd_105() {
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_Rectangle(1, Color_Bg_Window, 14, 105, 258, 374);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
inline void Draw_More_Icon(const uint8_t line) {
|
2020-09-16 06:56:48 -05:00
|
|
|
DWIN_ICON_Show(ICON, ICON_More, 226, MBASE(line) - 3);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
inline void Draw_Menu_Cursor(const uint8_t line) {
|
2020-09-16 06:56:48 -05:00
|
|
|
// DWIN_ICON_Show(ICON,ICON_Rectangle, 0, MBASE(line) - 18);
|
|
|
|
DWIN_Draw_Rectangle(1, Rectangle_Color, 0, MBASE(line) - 18, 14, MBASE(line + 1) - 20);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
inline void Erase_Menu_Cursor(const uint8_t line) {
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_Rectangle(1, Color_Bg_Black, 0, MBASE(line) - 18, 14, MBASE(line + 1) - 20);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
inline void Move_Highlight(const int16_t from, const uint16_t newline) {
|
|
|
|
Erase_Menu_Cursor(newline - from);
|
|
|
|
Draw_Menu_Cursor(newline);
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void Add_Menu_Line() {
|
|
|
|
Move_Highlight(1, MROWS);
|
2020-09-16 06:56:48 -05:00
|
|
|
DWIN_Draw_Line(Line_Color, 16, MBASE(MROWS + 1) - 20, 256, MBASE(MROWS + 1) - 19);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
inline void Scroll_Menu(const uint8_t dir) {
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Frame_AreaMove(1, dir, MLINE, Color_Bg_Black, 0, 31, DWIN_WIDTH, 349);
|
2020-06-16 01:45:27 -05:00
|
|
|
switch (dir) {
|
|
|
|
case DWIN_SCROLL_DOWN: Move_Highlight(-1, 0); break;
|
|
|
|
case DWIN_SCROLL_UP: Add_Menu_Line(); break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
inline uint16_t nr_sd_menu_items() {
|
|
|
|
return card.get_num_Files() + !card.flag.workDirIsRoot;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void Draw_Menu_Icon(const uint8_t line, const uint8_t icon) {
|
2020-09-16 06:56:48 -05:00
|
|
|
DWIN_ICON_Show(ICON, icon, 26, MBASE(line) - 3);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
inline void Erase_Menu_Text(const uint8_t line) {
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_Rectangle(1, Color_Bg_Black, LBLX, MBASE(line) - 14, 271, MBASE(line) + 28);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
inline void Draw_Menu_Line(const uint8_t line, const uint8_t icon=0, const char * const label=nullptr) {
|
2020-09-19 07:56:01 -05:00
|
|
|
if (label) DWIN_Draw_String(false, false, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(line) - 1, (char*)label);
|
2020-06-16 01:45:27 -05:00
|
|
|
if (icon) Draw_Menu_Icon(line, icon);
|
2020-09-16 06:56:48 -05:00
|
|
|
DWIN_Draw_Line(Line_Color, 16, MBASE(line) + 33, 256, MBASE(line) + 34);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// The "Back" label is always on the first line
|
2020-09-17 05:35:04 -05:00
|
|
|
inline void Draw_Back_Label() {
|
2020-08-21 23:44:21 -05:00
|
|
|
if (HMI_flag.language_chinese)
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 129, 72, 156, 84, LBLX, MBASE(0));
|
2020-06-16 01:45:27 -05:00
|
|
|
else
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 226, 179, 256, 189, LBLX, MBASE(0));
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// Draw "Back" line at the top
|
|
|
|
inline void Draw_Back_First(const bool is_sel=true) {
|
|
|
|
Draw_Menu_Line(0, ICON_Back);
|
|
|
|
Draw_Back_Label();
|
|
|
|
if (is_sel) Draw_Menu_Cursor(0);
|
|
|
|
}
|
|
|
|
|
2020-09-27 16:46:26 -05:00
|
|
|
inline bool Apply_Encoder(const ENCODER_DiffState &encoder_diffState, auto &valref) {
|
|
|
|
if (encoder_diffState == ENCODER_DIFF_CW)
|
|
|
|
valref += EncoderRate.encoderMoveValue;
|
|
|
|
else if (encoder_diffState == ENCODER_DIFF_CCW)
|
|
|
|
valref -= EncoderRate.encoderMoveValue;
|
|
|
|
else if (encoder_diffState == ENCODER_DIFF_ENTER)
|
|
|
|
return true;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2020-06-16 01:45:27 -05:00
|
|
|
//
|
|
|
|
// Draw Menus
|
|
|
|
//
|
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
#define MOTION_CASE_RATE 1
|
|
|
|
#define MOTION_CASE_ACCEL 2
|
|
|
|
#define MOTION_CASE_JERK (MOTION_CASE_ACCEL + ENABLED(HAS_CLASSIC_JERK))
|
|
|
|
#define MOTION_CASE_STEPS (MOTION_CASE_JERK + 1)
|
|
|
|
#define MOTION_CASE_TOTAL MOTION_CASE_STEPS
|
|
|
|
|
|
|
|
#define PREPARE_CASE_MOVE 1
|
|
|
|
#define PREPARE_CASE_DISA 2
|
|
|
|
#define PREPARE_CASE_HOME 3
|
|
|
|
#define PREPARE_CASE_ZOFF (PREPARE_CASE_HOME + ENABLED(HAS_ZOFFSET_ITEM))
|
|
|
|
#define PREPARE_CASE_PLA (PREPARE_CASE_ZOFF + ENABLED(HAS_HOTEND))
|
|
|
|
#define PREPARE_CASE_ABS (PREPARE_CASE_PLA + ENABLED(HAS_HOTEND))
|
|
|
|
#define PREPARE_CASE_COOL (PREPARE_CASE_ABS + EITHER(HAS_HOTEND, HAS_HEATED_BED))
|
|
|
|
#define PREPARE_CASE_LANG (PREPARE_CASE_COOL + 1)
|
|
|
|
#define PREPARE_CASE_TOTAL PREPARE_CASE_LANG
|
|
|
|
|
|
|
|
#define CONTROL_CASE_TEMP 1
|
|
|
|
#define CONTROL_CASE_MOVE (CONTROL_CASE_TEMP + 1)
|
|
|
|
#define CONTROL_CASE_SAVE (CONTROL_CASE_MOVE + ENABLED(EEPROM_SETTINGS))
|
|
|
|
#define CONTROL_CASE_LOAD (CONTROL_CASE_SAVE + ENABLED(EEPROM_SETTINGS))
|
|
|
|
#define CONTROL_CASE_RESET (CONTROL_CASE_LOAD + ENABLED(EEPROM_SETTINGS))
|
|
|
|
#define CONTROL_CASE_INFO (CONTROL_CASE_RESET + 1)
|
|
|
|
#define CONTROL_CASE_TOTAL CONTROL_CASE_INFO
|
|
|
|
|
|
|
|
#define TUNE_CASE_SPEED 1
|
|
|
|
#define TUNE_CASE_TEMP (TUNE_CASE_SPEED + ENABLED(HAS_HOTEND))
|
|
|
|
#define TUNE_CASE_BED (TUNE_CASE_TEMP + ENABLED(HAS_HEATED_BED))
|
|
|
|
#define TUNE_CASE_FAN (TUNE_CASE_BED + ENABLED(HAS_FAN))
|
|
|
|
#define TUNE_CASE_ZOFF (TUNE_CASE_FAN + ENABLED(HAS_ZOFFSET_ITEM))
|
|
|
|
#define TUNE_CASE_TOTAL TUNE_CASE_ZOFF
|
|
|
|
|
|
|
|
#define TEMP_CASE_TEMP (0 + ENABLED(HAS_HOTEND))
|
|
|
|
#define TEMP_CASE_BED (TEMP_CASE_TEMP + ENABLED(HAS_HEATED_BED))
|
|
|
|
#define TEMP_CASE_FAN (TEMP_CASE_BED + ENABLED(HAS_FAN))
|
|
|
|
#define TEMP_CASE_PLA (TEMP_CASE_FAN + ENABLED(HAS_HOTEND))
|
|
|
|
#define TEMP_CASE_ABS (TEMP_CASE_PLA + ENABLED(HAS_HOTEND))
|
|
|
|
#define TEMP_CASE_TOTAL TEMP_CASE_ABS
|
|
|
|
|
|
|
|
#define PREHEAT_CASE_TEMP (0 + ENABLED(HAS_HOTEND))
|
|
|
|
#define PREHEAT_CASE_BED (PREHEAT_CASE_TEMP + ENABLED(HAS_HEATED_BED))
|
|
|
|
#define PREHEAT_CASE_FAN (PREHEAT_CASE_BED + ENABLED(HAS_FAN))
|
|
|
|
#define PREHEAT_CASE_SAVE (PREHEAT_CASE_FAN + ENABLED(EEPROM_SETTINGS))
|
|
|
|
#define PREHEAT_CASE_TOTAL PREHEAT_CASE_SAVE
|
|
|
|
|
|
|
|
//
|
|
|
|
// Draw Menus
|
|
|
|
//
|
|
|
|
|
2020-06-16 01:45:27 -05:00
|
|
|
inline void draw_move_en(const uint16_t line) {
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 69, 61, 102, 71, LBLX, line); // "Move"
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
|
2020-09-16 06:56:48 -05:00
|
|
|
inline void DWIN_Frame_TitleCopy(uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2) { DWIN_Frame_AreaCopy(id, x1, y1, x2, y2, 14, 8); }
|
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
inline void Item_Prepare_Move(const uint8_t row) {
|
2020-08-21 23:44:21 -05:00
|
|
|
if (HMI_flag.language_chinese)
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 159, 70, 200, 84, LBLX, MBASE(row));
|
2020-06-16 01:45:27 -05:00
|
|
|
else
|
|
|
|
draw_move_en(MBASE(row)); // "Move >"
|
|
|
|
Draw_Menu_Line(row, ICON_Axis);
|
|
|
|
Draw_More_Icon(row);
|
|
|
|
}
|
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
inline void Item_Prepare_Disable(const uint8_t row) {
|
2020-08-21 23:44:21 -05:00
|
|
|
if (HMI_flag.language_chinese)
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 204, 70, 259, 82, LBLX, MBASE(row));
|
2020-06-16 01:45:27 -05:00
|
|
|
else
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 103, 59, 200, 74, LBLX, MBASE(row)); // "Disable Stepper"
|
2020-06-16 01:45:27 -05:00
|
|
|
Draw_Menu_Line(row, ICON_CloseMotor);
|
|
|
|
}
|
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
inline void Item_Prepare_Home(const uint8_t row) {
|
2020-08-21 23:44:21 -05:00
|
|
|
if (HMI_flag.language_chinese)
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 0, 89, 41, 101, LBLX, MBASE(row));
|
2020-06-16 01:45:27 -05:00
|
|
|
else
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 202, 61, 271, 71, LBLX, MBASE(row)); // "Auto Home"
|
2020-06-16 01:45:27 -05:00
|
|
|
Draw_Menu_Line(row, ICON_Homing);
|
|
|
|
}
|
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
#if HAS_ZOFFSET_ITEM
|
2020-06-16 01:45:27 -05:00
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
inline void Item_Prepare_Offset(const uint8_t row) {
|
|
|
|
if (HMI_flag.language_chinese) {
|
|
|
|
#if HAS_BED_PROBE
|
|
|
|
DWIN_Frame_AreaCopy(1, 174, 164, 223, 177, LBLX, MBASE(row));
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_Signed_Float(font8x16, Color_Bg_Black, 2, 2, 202, MBASE(row), BABY_Z_VAR * 100);
|
2020-09-17 05:35:04 -05:00
|
|
|
#else
|
|
|
|
DWIN_Frame_AreaCopy(1, 43, 89, 98, 101, LBLX, MBASE(row));
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
#if HAS_BED_PROBE
|
|
|
|
DWIN_Frame_AreaCopy(1, 93, 179, 141, 189, LBLX, MBASE(row)); // "Z-Offset"
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_Signed_Float(font8x16, Color_Bg_Black, 2, 2, 202, MBASE(row), BABY_Z_VAR * 100);
|
2020-09-17 05:35:04 -05:00
|
|
|
#else
|
|
|
|
DWIN_Frame_AreaCopy(1, 1, 76, 106, 86, LBLX, MBASE(row)); // "..."
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
Draw_Menu_Line(row, ICON_SetHome);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if HAS_HOTEND
|
|
|
|
inline void Item_Prepare_PLA(const uint8_t row) {
|
|
|
|
if (HMI_flag.language_chinese) {
|
|
|
|
DWIN_Frame_AreaCopy(1, 100, 89, 151, 101, LBLX, MBASE(row));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
DWIN_Frame_AreaCopy(1, 107, 76, 156, 86, LBLX, MBASE(row)); // "Preheat"
|
|
|
|
DWIN_Frame_AreaCopy(1, 157, 76, 181, 86, LBLX + 52, MBASE(row)); // "PLA"
|
|
|
|
}
|
|
|
|
Draw_Menu_Line(row, ICON_PLAPreheat);
|
2020-07-14 20:01:29 -05:00
|
|
|
}
|
2020-09-17 05:35:04 -05:00
|
|
|
|
|
|
|
inline void Item_Prepare_ABS(const uint8_t row) {
|
|
|
|
if (HMI_flag.language_chinese) {
|
|
|
|
DWIN_Frame_AreaCopy(1, 180, 89, 233, 100, LBLX, MBASE(row));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
DWIN_Frame_AreaCopy(1, 107, 76, 156, 86, LBLX, MBASE(row)); // "Preheat"
|
|
|
|
DWIN_Frame_AreaCopy(1, 172, 76, 198, 86, LBLX + 52, MBASE(row)); // "ABS"
|
|
|
|
}
|
|
|
|
Draw_Menu_Line(row, ICON_ABSPreheat);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
2020-09-17 05:35:04 -05:00
|
|
|
#endif
|
2020-06-16 01:45:27 -05:00
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
#if HAS_PREHEAT
|
|
|
|
inline void Item_Prepare_Cool(const uint8_t row) {
|
|
|
|
if (HMI_flag.language_chinese)
|
|
|
|
DWIN_Frame_AreaCopy(1, 1, 104, 56, 117, LBLX, MBASE(row));
|
|
|
|
else
|
|
|
|
DWIN_Frame_AreaCopy(1, 200, 76, 264, 86, LBLX, MBASE(row)); // "Cooldown"
|
|
|
|
Draw_Menu_Line(row, ICON_Cool);
|
|
|
|
}
|
|
|
|
#endif
|
2020-06-16 01:45:27 -05:00
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
inline void Item_Prepare_Lang(const uint8_t row) {
|
2020-08-21 23:44:21 -05:00
|
|
|
if (HMI_flag.language_chinese) {
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 239, 134, 266, 146, LBLX, MBASE(row));
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_String(false, false, font8x16, Color_White, Color_Bg_Black, 226, MBASE(row), F("CN"));
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
else {
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 0, 194, 121, 207, LBLX, MBASE(row)); // "Language selection"
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_String(false, false, font8x16, Color_White, Color_Bg_Black, 226, MBASE(row), F("EN"));
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
Draw_Menu_Icon(row, ICON_Language);
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void Draw_Prepare_Menu() {
|
|
|
|
Clear_Main_Window();
|
|
|
|
|
2020-07-14 20:01:29 -05:00
|
|
|
const int16_t scroll = MROWS - index_prepare; // Scrolled-up lines
|
2020-06-16 01:45:27 -05:00
|
|
|
#define PSCROL(L) (scroll + (L))
|
|
|
|
#define PVISI(L) WITHIN(PSCROL(L), 0, MROWS)
|
|
|
|
|
2020-08-21 23:44:21 -05:00
|
|
|
if (HMI_flag.language_chinese) {
|
2020-09-16 06:56:48 -05:00
|
|
|
DWIN_Frame_TitleCopy(1, 133, 1, 160, 13); // "Prepare"
|
2020-07-14 20:01:29 -05:00
|
|
|
}
|
2020-06-16 01:45:27 -05:00
|
|
|
else {
|
|
|
|
#ifdef USE_STRING_HEADINGS
|
2020-08-02 20:00:06 -05:00
|
|
|
Draw_Title(GET_TEXT_F(MSG_PREPARE));
|
2020-06-16 01:45:27 -05:00
|
|
|
#else
|
2020-09-16 06:56:48 -05:00
|
|
|
DWIN_Frame_TitleCopy(1, 178, 2, 229, 14); // "Prepare"
|
2020-06-16 01:45:27 -05:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
if (PVISI(0)) Draw_Back_First(select_prepare.now == 0); // < Back
|
|
|
|
if (PVISI(PREPARE_CASE_MOVE)) Item_Prepare_Move(PSCROL(PREPARE_CASE_MOVE)); // Move >
|
|
|
|
if (PVISI(PREPARE_CASE_DISA)) Item_Prepare_Disable(PSCROL(PREPARE_CASE_DISA)); // Disable Stepper
|
|
|
|
if (PVISI(PREPARE_CASE_HOME)) Item_Prepare_Home(PSCROL(PREPARE_CASE_HOME)); // Auto Home
|
|
|
|
#if HAS_ZOFFSET_ITEM
|
|
|
|
if (PVISI(PREPARE_CASE_ZOFF)) Item_Prepare_Offset(PSCROL(PREPARE_CASE_ZOFF)); // Edit Z-Offset / Babystep / Set Home Offset
|
|
|
|
#endif
|
|
|
|
#if HAS_HOTEND
|
|
|
|
if (PVISI(PREPARE_CASE_PLA)) Item_Prepare_PLA(PSCROL(PREPARE_CASE_PLA)); // Preheat PLA
|
|
|
|
if (PVISI(PREPARE_CASE_ABS)) Item_Prepare_ABS(PSCROL(PREPARE_CASE_ABS)); // Preheat ABS
|
|
|
|
#endif
|
|
|
|
#if HAS_PREHEAT
|
|
|
|
if (PVISI(PREPARE_CASE_COOL)) Item_Prepare_Cool(PSCROL(PREPARE_CASE_COOL)); // Cooldown
|
|
|
|
#endif
|
|
|
|
if (PVISI(PREPARE_CASE_LANG)) Item_Prepare_Lang(PSCROL(PREPARE_CASE_LANG)); // Language CN/EN
|
2020-06-16 01:45:27 -05:00
|
|
|
|
|
|
|
if (select_prepare.now) Draw_Menu_Cursor(PSCROL(select_prepare.now));
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void Draw_Control_Menu() {
|
|
|
|
Clear_Main_Window();
|
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
#if CONTROL_CASE_TOTAL >= 6
|
|
|
|
const int16_t scroll = MROWS - index_control; // Scrolled-up lines
|
|
|
|
#define CSCROL(L) (scroll + (L))
|
|
|
|
#else
|
|
|
|
#define CSCROL(L) (L)
|
|
|
|
#endif
|
2020-06-16 01:45:27 -05:00
|
|
|
#define CLINE(L) MBASE(CSCROL(L))
|
|
|
|
#define CVISI(L) WITHIN(CSCROL(L), 0, MROWS)
|
|
|
|
|
2020-09-16 06:56:48 -05:00
|
|
|
if (CVISI(0)) Draw_Back_First(select_control.now == 0); // < Back
|
2020-06-16 01:45:27 -05:00
|
|
|
|
2020-08-21 23:44:21 -05:00
|
|
|
if (HMI_flag.language_chinese) {
|
2020-09-17 05:35:04 -05:00
|
|
|
DWIN_Frame_TitleCopy(1, 103, 1, 130, 14); // "Control"
|
|
|
|
|
|
|
|
DWIN_Frame_AreaCopy(1, 57, 104, 84, 116, LBLX, CLINE(CONTROL_CASE_TEMP)); // Temperature >
|
|
|
|
DWIN_Frame_AreaCopy(1, 87, 104, 114, 116, LBLX, CLINE(CONTROL_CASE_MOVE)); // Motion >
|
|
|
|
|
|
|
|
#if ENABLED(EEPROM_SETTINGS)
|
|
|
|
DWIN_Frame_AreaCopy(1, 117, 104, 172, 116, LBLX, CLINE(CONTROL_CASE_SAVE)); // Store Configuration
|
|
|
|
DWIN_Frame_AreaCopy(1, 174, 103, 229, 116, LBLX, CLINE(CONTROL_CASE_LOAD)); // Read Configuration
|
|
|
|
DWIN_Frame_AreaCopy(1, 1, 118, 56, 131, LBLX, CLINE(CONTROL_CASE_RESET)); // Reset Configuration
|
|
|
|
#endif
|
2020-06-16 01:45:27 -05:00
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
if (CVISI(CONTROL_CASE_INFO))
|
|
|
|
DWIN_Frame_AreaCopy(1, 231, 104, 258, 116, LBLX, CLINE(CONTROL_CASE_TEMP)); // Info >
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
#ifdef USE_STRING_HEADINGS
|
2020-08-02 20:00:06 -05:00
|
|
|
Draw_Title(GET_TEXT_F(MSG_CONTROL));
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(CONTROL_CASE_TEMP), GET_TEXT_F(MSG_TEMPERATURE));
|
|
|
|
DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(CONTROL_CASE_MOVE), GET_TEXT_F(MSG_MOTION));
|
2020-09-14 02:48:45 -05:00
|
|
|
#if ENABLED(EEPROM_SETTINGS)
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(CONTROL_CASE_SAVE), GET_TEXT_F(MSG_STORE_EEPROM));
|
|
|
|
DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(CONTROL_CASE_LOAD), GET_TEXT_F(MSG_LOAD_EEPROM));
|
|
|
|
DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(CONTROL_CASE_RESET), GET_TEXT_F(MSG_RESTORE_DEFAULTS));
|
2020-09-14 02:48:45 -05:00
|
|
|
#endif
|
2020-09-19 07:56:01 -05:00
|
|
|
if (CVISI(CONTROL_CASE_INFO)) DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(CONTROL_CASE_INFO), F("Info"));
|
2020-06-16 01:45:27 -05:00
|
|
|
#else
|
2020-09-17 05:35:04 -05:00
|
|
|
DWIN_Frame_TitleCopy(1, 128, 2, 176, 12); // "Control"
|
|
|
|
DWIN_Frame_AreaCopy(1, 1, 89, 83, 101, LBLX, CLINE(CONTROL_CASE_TEMP)); // Temperature >
|
|
|
|
DWIN_Frame_AreaCopy(1, 84, 89, 128, 99, LBLX, CLINE(CONTROL_CASE_MOVE)); // Motion >
|
2020-09-14 02:48:45 -05:00
|
|
|
#if ENABLED(EEPROM_SETTINGS)
|
2020-09-17 05:35:04 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 148, 89, 268, 101, LBLX , CLINE(CONTROL_CASE_SAVE // "Store Configuration"
|
|
|
|
DWIN_Frame_AreaCopy(1, 26, 104, 57, 114, LBLX , CLINE(CONTROL_CASE_LOAD)); // "Read"
|
|
|
|
DWIN_Frame_AreaCopy(1, 182, 89, 268, 101, LBLX + 34, CLINE(CONTROL_CASE_LOAD)); // "Configuration"
|
|
|
|
DWIN_Frame_AreaCopy(1, 59, 104, 93, 114, LBLX , CLINE(CONTROL_CASE_RESET)); // "Reset"
|
|
|
|
DWIN_Frame_AreaCopy(1, 182, 89, 268, 101, LBLX + 37, CLINE(CONTROL_CASE_RESET)); // "Configuration"
|
2020-09-14 02:48:45 -05:00
|
|
|
#endif
|
2020-09-17 05:35:04 -05:00
|
|
|
if (CVISI(CONTROL_CASE_INFO)) DWIN_Frame_AreaCopy(1, 0, 104, 25, 115, LBLX, CLINE(CONTROL_CASE_INFO)); // Info >
|
2020-06-16 01:45:27 -05:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
if (select_control.now && CVISI(select_control.now))
|
|
|
|
Draw_Menu_Cursor(CSCROL(select_control.now));
|
|
|
|
|
|
|
|
// Draw icons and lines
|
2020-09-17 05:35:04 -05:00
|
|
|
uint8_t i = 0;
|
2020-09-19 10:19:45 -05:00
|
|
|
#define _TEMP_ICON(N) do{ ++i; if (CVISI(i)) Draw_Menu_Line(CSCROL(i), ICON_Temperature + (N) - 1); }while(0)
|
2020-09-17 05:35:04 -05:00
|
|
|
|
|
|
|
_TEMP_ICON(CONTROL_CASE_TEMP);
|
|
|
|
if (CVISI(i)) Draw_More_Icon(CSCROL(i));
|
|
|
|
|
|
|
|
_TEMP_ICON(CONTROL_CASE_MOVE);
|
|
|
|
Draw_More_Icon(CSCROL(i));
|
2020-06-16 01:45:27 -05:00
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
#if ENABLED(EEPROM_SETTINGS)
|
|
|
|
_TEMP_ICON(CONTROL_CASE_SAVE);
|
|
|
|
_TEMP_ICON(CONTROL_CASE_LOAD);
|
|
|
|
_TEMP_ICON(CONTROL_CASE_RESET);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
_TEMP_ICON(CONTROL_CASE_INFO);
|
|
|
|
if (CVISI(CONTROL_CASE_INFO)) Draw_More_Icon(CSCROL(i));
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
inline void Draw_Tune_Menu() {
|
|
|
|
Clear_Main_Window();
|
|
|
|
|
2020-08-21 23:44:21 -05:00
|
|
|
if (HMI_flag.language_chinese) {
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 73, 2, 100, 13, 14, 9);
|
2020-09-17 05:35:04 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 116, 164, 171, 176, LBLX, MBASE(TUNE_CASE_SPEED));
|
|
|
|
#if HAS_HOTEND
|
|
|
|
DWIN_Frame_AreaCopy(1, 1, 134, 56, 146, LBLX, MBASE(TUNE_CASE_TEMP));
|
|
|
|
#endif
|
|
|
|
#if HAS_HEATED_BED
|
|
|
|
DWIN_Frame_AreaCopy(1, 58, 134, 113, 146, LBLX, MBASE(TUNE_CASE_BED));
|
|
|
|
#endif
|
|
|
|
#if HAS_FAN
|
|
|
|
DWIN_Frame_AreaCopy(1, 115, 134, 170, 146, LBLX, MBASE(TUNE_CASE_FAN));
|
|
|
|
#endif
|
|
|
|
#if HAS_ZOFFSET_ITEM
|
|
|
|
DWIN_Frame_AreaCopy(1, 174, 164, 223, 177, LBLX, MBASE(TUNE_CASE_ZOFF));
|
|
|
|
#endif
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
#ifdef USE_STRING_HEADINGS
|
2020-08-02 20:00:06 -05:00
|
|
|
Draw_Title(GET_TEXT_F(MSG_TUNE));
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(TUNE_CASE_SPEED), GET_TEXT_F(MSG_SPEED));
|
2020-09-17 05:35:04 -05:00
|
|
|
#if HAS_HOTEND
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(TUNE_CASE_TEMP), GET_TEXT_F(MSG_UBL_SET_TEMP_HOTEND));
|
2020-09-17 05:35:04 -05:00
|
|
|
#endif
|
|
|
|
#if HAS_HEATED_BED
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(TUNE_CASE_BED), GET_TEXT_F(MSG_UBL_SET_TEMP_BED));
|
2020-09-17 05:35:04 -05:00
|
|
|
#endif
|
|
|
|
#if HAS_FAN
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(TUNE_CASE_FAN), GET_TEXT_F(MSG_FAN_SPEED));
|
2020-09-17 05:35:04 -05:00
|
|
|
#endif
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(TUNE_CASE_ZOFF), GET_TEXT_F(MSG_ZPROBE_ZOFFSET));
|
2020-06-16 01:45:27 -05:00
|
|
|
#else
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 94, 2, 126, 12, 14, 9);
|
2020-09-17 05:35:04 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 1, 179, 92, 190, LBLX, MBASE(TUNE_CASE_SPEED)); // Print speed
|
|
|
|
#if HAS_HOTEND
|
|
|
|
DWIN_Frame_AreaCopy(1, 197, 104, 238, 114, LBLX, MBASE(TUNE_CASE_TEMP)); // Hotend...
|
|
|
|
DWIN_Frame_AreaCopy(1, 1, 89, 83, 101, LBLX + 44, MBASE(TUNE_CASE_TEMP)); // ...Temperature
|
|
|
|
#endif
|
|
|
|
#if HAS_HEATED_BED
|
|
|
|
DWIN_Frame_AreaCopy(1, 240, 104, 264, 114, LBLX, MBASE(TUNE_CASE_BED)); // Bed...
|
|
|
|
DWIN_Frame_AreaCopy(1, 1, 89, 83, 101, LBLX + 27, MBASE(TUNE_CASE_BED)); // ...Temperature
|
|
|
|
#endif
|
|
|
|
#if HAS_FAN
|
|
|
|
DWIN_Frame_AreaCopy(1, 0, 119, 64, 132, LBLX, MBASE(TUNE_CASE_FAN)); // Fan speed
|
|
|
|
#endif
|
|
|
|
#if HAS_ZOFFSET_ITEM
|
|
|
|
DWIN_Frame_AreaCopy(1, 93, 179, 141, 189, LBLX, MBASE(TUNE_CASE_ZOFF)); // Z-offset
|
|
|
|
#endif
|
2020-06-16 01:45:27 -05:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
Draw_Back_First(select_tune.now == 0);
|
|
|
|
if (select_tune.now) Draw_Menu_Cursor(select_tune.now);
|
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
Draw_Menu_Line(TUNE_CASE_SPEED, ICON_Speed);
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(TUNE_CASE_SPEED), feedrate_percentage);
|
2020-06-16 01:45:27 -05:00
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
#if HAS_HOTEND
|
|
|
|
Draw_Menu_Line(TUNE_CASE_TEMP, ICON_HotendTemp);
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(TUNE_CASE_TEMP), thermalManager.temp_hotend[0].target);
|
2020-09-17 05:35:04 -05:00
|
|
|
#endif
|
|
|
|
#if HAS_HEATED_BED
|
|
|
|
Draw_Menu_Line(TUNE_CASE_BED, ICON_BedTemp);
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(TUNE_CASE_BED), thermalManager.temp_bed.target);
|
2020-09-17 05:35:04 -05:00
|
|
|
#endif
|
|
|
|
#if HAS_FAN
|
|
|
|
Draw_Menu_Line(TUNE_CASE_FAN, ICON_FanSpeed);
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(TUNE_CASE_FAN), thermalManager.fan_speed[0]);
|
2020-09-17 05:35:04 -05:00
|
|
|
#endif
|
|
|
|
#if HAS_ZOFFSET_ITEM
|
|
|
|
Draw_Menu_Line(TUNE_CASE_ZOFF, ICON_Zoffset);
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_Signed_Float(font8x16, Color_Bg_Black, 2, 2, 202, MBASE(TUNE_CASE_ZOFF), BABY_Z_VAR * 100);
|
2020-09-17 05:35:04 -05:00
|
|
|
#endif
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
inline void draw_max_en(const uint16_t line) {
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 245, 119, 269, 129, LBLX, line); // "Max"
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
inline void draw_max_accel_en(const uint16_t line) {
|
|
|
|
draw_max_en(line);
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 1, 135, 79, 145, LBLX + 27, line); // "Acceleration"
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
inline void draw_speed_en(const uint16_t inset, const uint16_t line) {
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 184, 119, 224, 132, LBLX + inset, line); // "Speed"
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
2020-09-16 04:35:30 -05:00
|
|
|
inline void draw_jerk_en(const uint16_t line) {
|
|
|
|
DWIN_Frame_AreaCopy(1, 64, 119, 106, 129, LBLX + 27, line); // "Jerk"
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
inline void draw_steps_per_mm(const uint16_t line) {
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 1, 151, 101, 161, LBLX, line); // "Steps-per-mm"
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
inline void say_x(const uint16_t inset, const uint16_t line) {
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 95, 104, 102, 114, LBLX + inset, line); // "X"
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
inline void say_y(const uint16_t inset, const uint16_t line) {
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 104, 104, 110, 114, LBLX + inset, line); // "Y"
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
inline void say_z(const uint16_t inset, const uint16_t line) {
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 112, 104, 120, 114, LBLX + inset, line); // "Z"
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
inline void say_e(const uint16_t inset, const uint16_t line) {
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 237, 119, 244, 129, LBLX + inset, line); // "E"
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
inline void Draw_Motion_Menu() {
|
|
|
|
Clear_Main_Window();
|
|
|
|
|
2020-08-21 23:44:21 -05:00
|
|
|
if (HMI_flag.language_chinese) {
|
2020-09-17 05:35:04 -05:00
|
|
|
DWIN_Frame_TitleCopy(1, 1, 16, 28, 28); // "Motion"
|
|
|
|
DWIN_Frame_AreaCopy(1, 173, 133, 228, 147, LBLX, MBASE(MOTION_CASE_RATE)); // Max speed
|
|
|
|
DWIN_Frame_AreaCopy(1, 173, 133, 200, 147, LBLX, MBASE(MOTION_CASE_ACCEL)); // Max...
|
|
|
|
DWIN_Frame_AreaCopy(1, 28, 149, 69, 161, LBLX + 27, MBASE(MOTION_CASE_ACCEL) + 1); // ...Acceleration
|
|
|
|
#if HAS_CLASSIC_JERK
|
|
|
|
DWIN_Frame_AreaCopy(1, 173, 133, 200, 147, LBLX, MBASE(MOTION_CASE_JERK)); // Max...
|
|
|
|
DWIN_Frame_AreaCopy(1, 1, 180, 28, 192, LBLX + 27, MBASE(MOTION_CASE_JERK) + 1); // ...
|
|
|
|
DWIN_Frame_AreaCopy(1, 202, 133, 228, 147, LBLX + 54, MBASE(MOTION_CASE_JERK)); // ...Jerk
|
|
|
|
#endif
|
|
|
|
DWIN_Frame_AreaCopy(1, 153, 148, 194, 161, LBLX, MBASE(MOTION_CASE_STEPS)); // Flow ratio
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
#ifdef USE_STRING_HEADINGS
|
2020-08-02 20:00:06 -05:00
|
|
|
Draw_Title(GET_TEXT_F(MSG_MOTION));
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(MOTION_CASE_RATE), F("Feedrate"));
|
|
|
|
DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(MOTION_CASE_ACCEL), GET_TEXT_F(MSG_ACCELERATION));
|
2020-09-17 05:35:04 -05:00
|
|
|
#if HAS_CLASSIC_JERK
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(MOTION_CASE_JERK), GET_TEXT_F(MSG_JERK));
|
2020-09-17 05:35:04 -05:00
|
|
|
#endif
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(MOTION_CASE_STEPS), GET_TEXT_F(MSG_STEPS_PER_MM));
|
2020-06-16 01:45:27 -05:00
|
|
|
#else
|
2020-09-17 05:35:04 -05:00
|
|
|
DWIN_Frame_TitleCopy(1, 144, 16, 189, 26); // "Motion"
|
|
|
|
draw_max_en(MBASE(MOTION_CASE_RATE)); draw_speed_en(27, MBASE(MOTION_CASE_RATE)); // "Max Speed"
|
|
|
|
draw_max_accel_en(MBASE(MOTION_CASE_ACCEL)); // "Max Acceleration"
|
|
|
|
#if HAS_CLASSIC_JERK
|
|
|
|
draw_max_en(MBASE(MOTION_CASE_JERK)); draw_jerk_en(MBASE(MOTION_CASE_JERK)); // "Max Jerk"
|
|
|
|
#endif
|
|
|
|
draw_steps_per_mm(MBASE(MOTION_CASE_STEPS)); // "Steps-per-mm"
|
2020-06-16 01:45:27 -05:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
Draw_Back_First(select_motion.now == 0);
|
|
|
|
if (select_motion.now) Draw_Menu_Cursor(select_motion.now);
|
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
uint8_t i = 0;
|
|
|
|
#define _MOTION_ICON(N) Draw_Menu_Line(++i, ICON_MaxSpeed + (N) - 1)
|
|
|
|
_MOTION_ICON(MOTION_CASE_RATE); Draw_More_Icon(i);
|
|
|
|
_MOTION_ICON(MOTION_CASE_ACCEL); Draw_More_Icon(i);
|
|
|
|
#if HAS_CLASSIC_JERK
|
|
|
|
_MOTION_ICON(MOTION_CASE_JERK); Draw_More_Icon(i);
|
|
|
|
#endif
|
|
|
|
_MOTION_ICON(MOTION_CASE_STEPS); Draw_More_Icon(i);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// Draw Popup Windows
|
|
|
|
//
|
2020-09-17 05:35:04 -05:00
|
|
|
#if HAS_HOTEND || HAS_HEATED_BED
|
|
|
|
|
|
|
|
void DWIN_Popup_Temperature(const bool toohigh) {
|
|
|
|
Clear_Popup_Area();
|
|
|
|
Draw_Popup_Bkgd_105();
|
|
|
|
if (toohigh) {
|
|
|
|
DWIN_ICON_Show(ICON, ICON_TempTooHigh, 102, 165);
|
|
|
|
if (HMI_flag.language_chinese) {
|
|
|
|
DWIN_Frame_AreaCopy(1, 103, 371, 237, 386, 52, 285);
|
|
|
|
DWIN_Frame_AreaCopy(1, 151, 389, 185, 402, 187, 285);
|
|
|
|
DWIN_Frame_AreaCopy(1, 189, 389, 271, 402, 95, 310);
|
|
|
|
}
|
|
|
|
else {
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_String(false, true, font8x16, Popup_Text_Color, Color_Bg_Window, 36, 300, F("Nozzle or Bed temperature"));
|
|
|
|
DWIN_Draw_String(false, true, font8x16, Popup_Text_Color, Color_Bg_Window, 92, 300, F("is too high"));
|
2020-09-17 05:35:04 -05:00
|
|
|
}
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
else {
|
2020-09-17 05:35:04 -05:00
|
|
|
DWIN_ICON_Show(ICON, ICON_TempTooLow, 102, 165);
|
|
|
|
if (HMI_flag.language_chinese) {
|
|
|
|
DWIN_Frame_AreaCopy(1, 103, 371, 270, 386, 52, 285);
|
|
|
|
DWIN_Frame_AreaCopy(1, 189, 389, 271, 402, 95, 310);
|
|
|
|
}
|
|
|
|
else {
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_String(false, true, font8x16, Popup_Text_Color, Color_Bg_Window, 36, 300, F("Nozzle or Bed temperature"));
|
|
|
|
DWIN_Draw_String(false, true, font8x16, Popup_Text_Color, Color_Bg_Window, 92, 300, F("is too low"));
|
2020-09-17 05:35:04 -05:00
|
|
|
}
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
}
|
2020-09-17 05:35:04 -05:00
|
|
|
|
|
|
|
#endif
|
2020-06-16 01:45:27 -05:00
|
|
|
|
|
|
|
inline void Draw_Popup_Bkgd_60() {
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_Rectangle(1, Color_Bg_Window, 14, 60, 258, 330);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
|
2020-06-24 19:44:50 -05:00
|
|
|
#if HAS_HOTEND
|
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
void Popup_Window_ETempTooLow() {
|
2020-06-24 19:44:50 -05:00
|
|
|
Clear_Main_Window();
|
|
|
|
Draw_Popup_Bkgd_60();
|
|
|
|
DWIN_ICON_Show(ICON, ICON_TempTooLow, 102, 105);
|
2020-08-21 23:44:21 -05:00
|
|
|
if (HMI_flag.language_chinese) {
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 103, 371, 136, 386, 69, 240);
|
|
|
|
DWIN_Frame_AreaCopy(1, 170, 371, 270, 386, 102, 240);
|
2020-06-24 19:44:50 -05:00
|
|
|
DWIN_ICON_Show(ICON, ICON_Confirm_C, 86, 280);
|
|
|
|
}
|
|
|
|
else {
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_String(false, true, font8x16, Popup_Text_Color, Color_Bg_Window, 20, 235, F("Nozzle is too cold"));
|
2020-06-24 19:44:50 -05:00
|
|
|
DWIN_ICON_Show(ICON, ICON_Confirm_E, 86, 280);
|
|
|
|
}
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
2020-06-24 19:44:50 -05:00
|
|
|
|
|
|
|
#endif
|
2020-06-16 01:45:27 -05:00
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
void Popup_Window_Resume() {
|
2020-06-16 01:45:27 -05:00
|
|
|
Clear_Popup_Area();
|
|
|
|
Draw_Popup_Bkgd_105();
|
2020-08-21 23:44:21 -05:00
|
|
|
if (HMI_flag.language_chinese) {
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 160, 338, 235, 354, 98, 135);
|
|
|
|
DWIN_Frame_AreaCopy(1, 103, 321, 271, 335, 52, 192);
|
2020-06-16 01:45:27 -05:00
|
|
|
DWIN_ICON_Show(ICON, ICON_Continue_C, 26, 307);
|
|
|
|
DWIN_ICON_Show(ICON, ICON_Cancel_C, 146, 307);
|
|
|
|
}
|
|
|
|
else {
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_String(false, true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 14) / 2, 115, F("Continue Print"));
|
|
|
|
DWIN_Draw_String(false, true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 22) / 2, 192, F("It looks like the last"));
|
|
|
|
DWIN_Draw_String(false, true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 22) / 2, 212, F("file was interrupted."));
|
2020-06-16 01:45:27 -05:00
|
|
|
DWIN_ICON_Show(ICON, ICON_Continue_E, 26, 307);
|
|
|
|
DWIN_ICON_Show(ICON, ICON_Cancel_E, 146, 307);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
void Popup_Window_Home(const bool parking/*=false*/) {
|
2020-06-16 01:45:27 -05:00
|
|
|
Clear_Main_Window();
|
|
|
|
Draw_Popup_Bkgd_60();
|
|
|
|
DWIN_ICON_Show(ICON, ICON_BLTouch, 101, 105);
|
2020-08-21 23:44:21 -05:00
|
|
|
if (HMI_flag.language_chinese) {
|
2020-06-16 01:45:27 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 0, 371, 33, 386, 85, 240);
|
|
|
|
DWIN_Frame_AreaCopy(1, 203, 286, 271, 302, 118, 240);
|
|
|
|
DWIN_Frame_AreaCopy(1, 0, 389, 150, 402, 61, 280);
|
|
|
|
}
|
|
|
|
else {
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_String(false, true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * (parking ? 7 : 10)) / 2, 230, parking ? F("Parking") : F("Homing XYZ"));
|
|
|
|
DWIN_Draw_String(false, true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 23) / 2, 260, F("Please wait until done."));
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
#if HAS_ONESTEP_LEVELING
|
|
|
|
|
|
|
|
void Popup_Window_Leveling() {
|
|
|
|
Clear_Main_Window();
|
|
|
|
Draw_Popup_Bkgd_60();
|
|
|
|
DWIN_ICON_Show(ICON, ICON_AutoLeveling, 101, 105);
|
|
|
|
if (HMI_flag.language_chinese) {
|
|
|
|
DWIN_Frame_AreaCopy(1, 0, 371, 100, 386, 84, 240);
|
|
|
|
DWIN_Frame_AreaCopy(1, 0, 389, 150, 402, 61, 280);
|
|
|
|
}
|
|
|
|
else {
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_String(false, true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 13) / 2, 230, GET_TEXT_F(MSG_BED_LEVELING));
|
|
|
|
DWIN_Draw_String(false, true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 23) / 2, 260, F("Please wait until done."));
|
2020-09-17 05:35:04 -05:00
|
|
|
}
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
2020-09-17 05:35:04 -05:00
|
|
|
|
|
|
|
#endif
|
2020-06-16 01:45:27 -05:00
|
|
|
|
|
|
|
void Draw_Select_Highlight(const bool sel) {
|
|
|
|
HMI_flag.select_flag = sel;
|
2020-09-19 07:56:01 -05:00
|
|
|
const uint16_t c1 = sel ? Select_Color : Color_Bg_Window,
|
|
|
|
c2 = sel ? Color_Bg_Window : Select_Color;
|
2020-06-16 01:45:27 -05:00
|
|
|
DWIN_Draw_Rectangle(0, c1, 25, 279, 126, 318);
|
|
|
|
DWIN_Draw_Rectangle(0, c1, 24, 278, 127, 319);
|
|
|
|
DWIN_Draw_Rectangle(0, c2, 145, 279, 246, 318);
|
|
|
|
DWIN_Draw_Rectangle(0, c2, 144, 278, 247, 319);
|
|
|
|
}
|
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
void Popup_window_PauseOrStop() {
|
2020-06-16 01:45:27 -05:00
|
|
|
Clear_Main_Window();
|
|
|
|
Draw_Popup_Bkgd_60();
|
2020-08-21 23:44:21 -05:00
|
|
|
if (HMI_flag.language_chinese) {
|
2020-09-17 05:35:04 -05:00
|
|
|
if (select_print.now == 1) DWIN_Frame_AreaCopy(1, 237, 338, 269, 356, 98, 150);
|
2020-06-16 01:45:27 -05:00
|
|
|
else if (select_print.now == 2) DWIN_Frame_AreaCopy(1, 221, 320, 253, 336, 98, 150);
|
|
|
|
DWIN_Frame_AreaCopy(1, 220, 304, 264, 319, 130, 150);
|
|
|
|
DWIN_ICON_Show(ICON, ICON_Confirm_C, 26, 280);
|
|
|
|
DWIN_ICON_Show(ICON, ICON_Cancel_C, 146, 280);
|
|
|
|
}
|
|
|
|
else {
|
2020-09-19 07:56:01 -05:00
|
|
|
if (select_print.now == 1) DWIN_Draw_String(false, true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 11) / 2, 150, GET_TEXT_F(MSG_PAUSE_PRINT));
|
|
|
|
else if (select_print.now == 2) DWIN_Draw_String(false, true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 10) / 2, 150, GET_TEXT_F(MSG_STOP_PRINT));
|
2020-06-16 01:45:27 -05:00
|
|
|
DWIN_ICON_Show(ICON, ICON_Confirm_E, 26, 280);
|
|
|
|
DWIN_ICON_Show(ICON, ICON_Cancel_E, 146, 280);
|
|
|
|
}
|
|
|
|
Draw_Select_Highlight(true);
|
|
|
|
}
|
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
void Draw_Printing_Screen() {
|
2020-08-21 23:44:21 -05:00
|
|
|
if (HMI_flag.language_chinese) {
|
2020-09-17 05:35:04 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 30, 1, 71, 14, 14, 9); // Tune
|
|
|
|
DWIN_Frame_AreaCopy(1, 0, 72, 63, 86, 41, 188); // Pause
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 65, 72, 128, 86, 176, 188); // Stop
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
else {
|
2020-09-17 05:35:04 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 40, 2, 92, 14, 14, 9); // Tune
|
|
|
|
DWIN_Frame_AreaCopy(1, 0, 44, 96, 58, 41, 188); // Pause
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 98, 44, 152, 58, 176, 188); // Stop
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Draw_Print_ProgressBar() {
|
2020-07-14 20:01:29 -05:00
|
|
|
DWIN_ICON_Show(ICON, ICON_Bar, 15, 93);
|
|
|
|
DWIN_Draw_Rectangle(1, BarFill_Color, 16 + Percentrecord * 240 / 100, 93, 256, 113);
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Percent_Color, Color_Bg_Black, 2, 117, 133, Percentrecord);
|
|
|
|
DWIN_Draw_String(false, false, font8x16, Percent_Color, Color_Bg_Black, 133, 133, F("%"));
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void Draw_Print_ProgressElapsed() {
|
2020-07-14 20:01:29 -05:00
|
|
|
duration_t elapsed = print_job_timer.duration(); // print timer
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 1, font8x16, Color_White, Color_Bg_Black, 2, 42, 212, elapsed.value / 3600);
|
|
|
|
DWIN_Draw_String(false, false, font8x16, Color_White, Color_Bg_Black, 58, 212, F(":"));
|
|
|
|
DWIN_Draw_IntValue(true, true, 1, font8x16, Color_White, Color_Bg_Black, 2, 66, 212, (elapsed.value % 3600) / 60);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void Draw_Print_ProgressRemain() {
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 1, font8x16, Color_White, Color_Bg_Black, 2, 176, 212, remain_time / 3600);
|
|
|
|
DWIN_Draw_String(false, false, font8x16, Color_White, Color_Bg_Black, 192, 212, F(":"));
|
|
|
|
DWIN_Draw_IntValue(true, true, 1, font8x16, Color_White, Color_Bg_Black, 2, 200, 212, (remain_time % 3600) / 60);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
void Goto_PrintProcess() {
|
2020-06-16 01:45:27 -05:00
|
|
|
checkkey = PrintProcess;
|
|
|
|
|
|
|
|
Clear_Main_Window();
|
|
|
|
Draw_Printing_Screen();
|
|
|
|
|
|
|
|
ICON_Tune();
|
|
|
|
if (printingIsPaused()) ICON_Continue(); else ICON_Pause();
|
|
|
|
ICON_Stop();
|
|
|
|
|
|
|
|
// Copy into filebuf string before entry
|
|
|
|
char * const name = card.longest_filename();
|
2020-09-27 02:01:56 -05:00
|
|
|
const int8_t npos = _MAX(0U, DWIN_WIDTH - strlen(name) * MENU_CHR_W) / 2;
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_String(false, false, font8x16, Color_White, Color_Bg_Black, npos, 60, name);
|
2020-06-16 01:45:27 -05:00
|
|
|
|
2020-07-14 20:01:29 -05:00
|
|
|
DWIN_ICON_Show(ICON, ICON_PrintTime, 17, 193);
|
|
|
|
DWIN_ICON_Show(ICON, ICON_RemainTime, 150, 191);
|
2020-06-16 01:45:27 -05:00
|
|
|
|
|
|
|
Draw_Print_ProgressBar();
|
|
|
|
Draw_Print_ProgressElapsed();
|
|
|
|
Draw_Print_ProgressRemain();
|
|
|
|
}
|
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
void Goto_MainMenu() {
|
2020-06-16 01:45:27 -05:00
|
|
|
checkkey = MainMenu;
|
|
|
|
|
|
|
|
Clear_Main_Window();
|
|
|
|
|
2020-08-21 23:44:21 -05:00
|
|
|
if (HMI_flag.language_chinese) {
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 2, 2, 27, 14, 14, 9); // "Home"
|
2020-07-14 20:01:29 -05:00
|
|
|
}
|
2020-06-16 01:45:27 -05:00
|
|
|
else {
|
|
|
|
#ifdef USE_STRING_HEADINGS
|
2020-08-02 20:00:06 -05:00
|
|
|
Draw_Title(GET_TEXT_F(MSG_MAIN));
|
2020-06-16 01:45:27 -05:00
|
|
|
#else
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 0, 2, 39, 12, 14, 9);
|
2020-06-16 01:45:27 -05:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
DWIN_ICON_Show(ICON, ICON_LOGO, 71, 52);
|
|
|
|
|
|
|
|
ICON_Print();
|
|
|
|
ICON_Prepare();
|
|
|
|
ICON_Control();
|
2020-09-03 16:52:31 -05:00
|
|
|
TERN(HAS_ONESTEP_LEVELING, ICON_Leveling, ICON_StartInfo)(select_page.now == 3);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
inline ENCODER_DiffState get_encoder_state() {
|
2020-09-17 05:35:04 -05:00
|
|
|
static millis_t Encoder_ms = 0;
|
2020-06-16 01:45:27 -05:00
|
|
|
const millis_t ms = millis();
|
|
|
|
if (PENDING(ms, Encoder_ms)) return ENCODER_DIFF_NO;
|
|
|
|
const ENCODER_DiffState state = Encoder_ReceiveAnalyze();
|
2020-07-14 20:01:29 -05:00
|
|
|
if (state != ENCODER_DIFF_NO) Encoder_ms = ms + ENCODER_WAIT;
|
2020-06-16 01:45:27 -05:00
|
|
|
return state;
|
|
|
|
}
|
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
void HMI_Move_X() {
|
2020-06-16 01:45:27 -05:00
|
|
|
ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze();
|
|
|
|
if (encoder_diffState != ENCODER_DIFF_NO) {
|
2020-09-27 16:46:26 -05:00
|
|
|
if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Move_X_scale)) {
|
2020-06-16 01:45:27 -05:00
|
|
|
checkkey = AxisMove;
|
2020-09-17 05:35:04 -05:00
|
|
|
EncoderRate.enabled = false;
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 216, MBASE(1), HMI_ValueStruct.Move_X_scale);
|
2020-06-16 01:45:27 -05:00
|
|
|
if (!planner.is_full()) {
|
|
|
|
// Wait for planner moves to finish!
|
|
|
|
planner.synchronize();
|
|
|
|
planner.buffer_line(current_position, MMM_TO_MMS(HOMING_FEEDRATE_XY), active_extruder);
|
|
|
|
}
|
|
|
|
DWIN_UpdateLCD();
|
|
|
|
return;
|
|
|
|
}
|
2020-07-14 20:01:29 -05:00
|
|
|
NOLESS(HMI_ValueStruct.Move_X_scale, (X_MIN_POS) * MINUNITMULT);
|
|
|
|
NOMORE(HMI_ValueStruct.Move_X_scale, (X_MAX_POS) * MINUNITMULT);
|
2020-09-16 06:56:48 -05:00
|
|
|
current_position.x = HMI_ValueStruct.Move_X_scale / 10;
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 1, 216, MBASE(1), HMI_ValueStruct.Move_X_scale);
|
2020-06-16 01:45:27 -05:00
|
|
|
DWIN_UpdateLCD();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
void HMI_Move_Y() {
|
2020-06-16 01:45:27 -05:00
|
|
|
ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze();
|
|
|
|
if (encoder_diffState != ENCODER_DIFF_NO) {
|
2020-09-27 16:46:26 -05:00
|
|
|
if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Move_Y_scale)) {
|
2020-06-16 01:45:27 -05:00
|
|
|
checkkey = AxisMove;
|
2020-09-17 05:35:04 -05:00
|
|
|
EncoderRate.enabled = false;
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 216, MBASE(2), HMI_ValueStruct.Move_Y_scale);
|
2020-06-16 01:45:27 -05:00
|
|
|
if (!planner.is_full()) {
|
|
|
|
// Wait for planner moves to finish!
|
|
|
|
planner.synchronize();
|
|
|
|
planner.buffer_line(current_position, MMM_TO_MMS(HOMING_FEEDRATE_XY), active_extruder);
|
|
|
|
}
|
|
|
|
DWIN_UpdateLCD();
|
|
|
|
return;
|
|
|
|
}
|
2020-07-14 20:01:29 -05:00
|
|
|
NOLESS(HMI_ValueStruct.Move_Y_scale, (Y_MIN_POS) * MINUNITMULT);
|
|
|
|
NOMORE(HMI_ValueStruct.Move_Y_scale, (Y_MAX_POS) * MINUNITMULT);
|
2020-09-16 06:56:48 -05:00
|
|
|
current_position.y = HMI_ValueStruct.Move_Y_scale / 10;
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 1, 216, MBASE(2), HMI_ValueStruct.Move_Y_scale);
|
2020-06-16 01:45:27 -05:00
|
|
|
DWIN_UpdateLCD();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
void HMI_Move_Z() {
|
2020-06-16 01:45:27 -05:00
|
|
|
ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze();
|
|
|
|
if (encoder_diffState != ENCODER_DIFF_NO) {
|
2020-09-27 16:46:26 -05:00
|
|
|
if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Move_Z_scale)) {
|
2020-06-16 01:45:27 -05:00
|
|
|
checkkey = AxisMove;
|
2020-09-17 05:35:04 -05:00
|
|
|
EncoderRate.enabled = false;
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 216, MBASE(3), HMI_ValueStruct.Move_Z_scale);
|
2020-06-16 01:45:27 -05:00
|
|
|
if (!planner.is_full()) {
|
|
|
|
// Wait for planner moves to finish!
|
|
|
|
planner.synchronize();
|
|
|
|
planner.buffer_line(current_position, MMM_TO_MMS(HOMING_FEEDRATE_Z), active_extruder);
|
|
|
|
}
|
|
|
|
DWIN_UpdateLCD();
|
|
|
|
return;
|
|
|
|
}
|
2020-07-14 20:01:29 -05:00
|
|
|
NOLESS(HMI_ValueStruct.Move_Z_scale, Z_MIN_POS * MINUNITMULT);
|
|
|
|
NOMORE(HMI_ValueStruct.Move_Z_scale, Z_MAX_POS * MINUNITMULT);
|
2020-09-16 06:56:48 -05:00
|
|
|
current_position.z = HMI_ValueStruct.Move_Z_scale / 10;
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 1, 216, MBASE(3), HMI_ValueStruct.Move_Z_scale);
|
2020-06-16 01:45:27 -05:00
|
|
|
DWIN_UpdateLCD();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-16 06:56:48 -05:00
|
|
|
#if HAS_HOTEND
|
2020-08-19 00:49:23 -05:00
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
void HMI_Move_E() {
|
|
|
|
static float last_E_scale = 0;
|
2020-08-19 00:49:23 -05:00
|
|
|
ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze();
|
|
|
|
if (encoder_diffState != ENCODER_DIFF_NO) {
|
2020-09-27 16:46:26 -05:00
|
|
|
if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Move_E_scale)) {
|
2020-08-19 00:49:23 -05:00
|
|
|
checkkey = AxisMove;
|
2020-09-17 05:35:04 -05:00
|
|
|
EncoderRate.enabled = false;
|
2020-08-19 00:49:23 -05:00
|
|
|
last_E_scale = HMI_ValueStruct.Move_E_scale;
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_Signed_Float(font8x16, Color_Bg_Black, 3, 1, 216, MBASE(4), HMI_ValueStruct.Move_E_scale);
|
2020-08-19 00:49:23 -05:00
|
|
|
if (!planner.is_full()) {
|
|
|
|
planner.synchronize(); // Wait for planner moves to finish!
|
|
|
|
planner.buffer_line(current_position, MMM_TO_MMS(FEEDRATE_E), active_extruder);
|
|
|
|
}
|
|
|
|
DWIN_UpdateLCD();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if ((HMI_ValueStruct.Move_E_scale - last_E_scale) > (EXTRUDE_MAXLENGTH) * MINUNITMULT)
|
|
|
|
HMI_ValueStruct.Move_E_scale = last_E_scale + (EXTRUDE_MAXLENGTH) * MINUNITMULT;
|
|
|
|
else if ((last_E_scale - HMI_ValueStruct.Move_E_scale) > (EXTRUDE_MAXLENGTH) * MINUNITMULT)
|
|
|
|
HMI_ValueStruct.Move_E_scale = last_E_scale - (EXTRUDE_MAXLENGTH) * MINUNITMULT;
|
|
|
|
current_position.e = HMI_ValueStruct.Move_E_scale / 10;
|
2020-09-14 02:48:45 -05:00
|
|
|
DWIN_Draw_Signed_Float(font8x16, Select_Color, 3, 1, 216, MBASE(4), HMI_ValueStruct.Move_E_scale);
|
2020-06-16 01:45:27 -05:00
|
|
|
DWIN_UpdateLCD();
|
|
|
|
}
|
|
|
|
}
|
2020-08-19 00:49:23 -05:00
|
|
|
|
|
|
|
#endif
|
2020-06-16 01:45:27 -05:00
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
#if HAS_ZOFFSET_ITEM
|
2020-06-16 01:45:27 -05:00
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
bool printer_busy() { return planner.movesplanned() || printingIsActive(); }
|
|
|
|
|
|
|
|
void HMI_Zoffset() {
|
|
|
|
ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze();
|
|
|
|
if (encoder_diffState != ENCODER_DIFF_NO) {
|
|
|
|
uint8_t zoff_line;
|
|
|
|
switch (HMI_ValueStruct.show_mode) {
|
|
|
|
case -4: zoff_line = PREPARE_CASE_ZOFF + MROWS - index_prepare; break;
|
|
|
|
default: zoff_line = TUNE_CASE_ZOFF + MROWS - index_tune;
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
2020-09-27 16:46:26 -05:00
|
|
|
if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.offset_value)) {
|
2020-09-17 05:35:04 -05:00
|
|
|
EncoderRate.enabled = false;
|
|
|
|
#if HAS_BED_PROBE
|
|
|
|
probe.offset.z = dwin_zoffset;
|
|
|
|
TERN_(EEPROM_SETTINGS, settings.save());
|
|
|
|
#endif
|
|
|
|
if (HMI_ValueStruct.show_mode == -4) {
|
|
|
|
checkkey = Prepare;
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_Signed_Float(font8x16, Color_Bg_Black, 2, 2, 202, MBASE(zoff_line), TERN(HAS_BED_PROBE, BABY_Z_VAR * 100, HMI_ValueStruct.offset_value));
|
2020-09-17 05:35:04 -05:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
checkkey = Tune;
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_Signed_Float(font8x16, Color_Bg_Black, 2, 2, 202, MBASE(zoff_line), TERN(HAS_BED_PROBE, BABY_Z_VAR * 100, HMI_ValueStruct.offset_value));
|
2020-09-17 05:35:04 -05:00
|
|
|
}
|
|
|
|
DWIN_UpdateLCD();
|
|
|
|
return;
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
2020-09-17 05:35:04 -05:00
|
|
|
NOLESS(HMI_ValueStruct.offset_value, (Z_PROBE_OFFSET_RANGE_MIN) * 100);
|
|
|
|
NOMORE(HMI_ValueStruct.offset_value, (Z_PROBE_OFFSET_RANGE_MAX) * 100);
|
|
|
|
last_zoffset = dwin_zoffset;
|
|
|
|
dwin_zoffset = HMI_ValueStruct.offset_value / 100.0f;
|
|
|
|
#if EITHER(BABYSTEP_ZPROBE_OFFSET, JUST_BABYSTEP)
|
|
|
|
if ( (ENABLED(BABYSTEP_WITHOUT_HOMING) || all_axes_known()) && (ENABLED(BABYSTEP_ALWAYS_AVAILABLE) || printer_busy()) )
|
|
|
|
babystep.add_mm(Z_AXIS, dwin_zoffset - last_zoffset);
|
|
|
|
#endif
|
|
|
|
DWIN_Draw_Signed_Float(font8x16, Select_Color, 2, 2, 202, MBASE(zoff_line), HMI_ValueStruct.offset_value);
|
2020-06-16 01:45:27 -05:00
|
|
|
DWIN_UpdateLCD();
|
|
|
|
}
|
|
|
|
}
|
2020-09-17 05:35:04 -05:00
|
|
|
|
|
|
|
#endif // HAS_ZOFFSET_ITEM
|
2020-06-16 01:45:27 -05:00
|
|
|
|
2020-06-24 19:44:50 -05:00
|
|
|
#if HAS_HOTEND
|
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
void HMI_ETemp() {
|
2020-06-24 19:44:50 -05:00
|
|
|
ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze();
|
|
|
|
if (encoder_diffState != ENCODER_DIFF_NO) {
|
2020-09-17 05:35:04 -05:00
|
|
|
uint8_t temp_line;
|
|
|
|
switch (HMI_ValueStruct.show_mode) {
|
|
|
|
case -1: temp_line = TEMP_CASE_TEMP; break;
|
|
|
|
case -2: temp_line = PREHEAT_CASE_TEMP; break;
|
|
|
|
case -3: temp_line = PREHEAT_CASE_TEMP; break;
|
|
|
|
default: temp_line = TUNE_CASE_TEMP + MROWS - index_tune;
|
|
|
|
}
|
2020-09-27 16:46:26 -05:00
|
|
|
if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.E_Temp)) {
|
2020-09-17 05:35:04 -05:00
|
|
|
EncoderRate.enabled = false;
|
2020-06-24 19:44:50 -05:00
|
|
|
if (HMI_ValueStruct.show_mode == -1) { // temperature
|
|
|
|
checkkey = TemperatureID;
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(temp_line), HMI_ValueStruct.E_Temp);
|
2020-06-24 19:44:50 -05:00
|
|
|
}
|
|
|
|
else if (HMI_ValueStruct.show_mode == -2) {
|
|
|
|
checkkey = PLAPreheat;
|
|
|
|
ui.material_preset[0].hotend_temp = HMI_ValueStruct.E_Temp;
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(temp_line), ui.material_preset[0].hotend_temp);
|
2020-06-24 19:44:50 -05:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
else if (HMI_ValueStruct.show_mode == -3) {
|
|
|
|
checkkey = ABSPreheat;
|
|
|
|
ui.material_preset[1].hotend_temp = HMI_ValueStruct.E_Temp;
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(temp_line), ui.material_preset[1].hotend_temp);
|
2020-06-24 19:44:50 -05:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
else { // tune
|
|
|
|
checkkey = Tune;
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(temp_line), HMI_ValueStruct.E_Temp);
|
2020-06-24 19:44:50 -05:00
|
|
|
}
|
|
|
|
thermalManager.setTargetHotend(HMI_ValueStruct.E_Temp, 0);
|
2020-06-16 01:45:27 -05:00
|
|
|
return;
|
|
|
|
}
|
2020-06-24 19:44:50 -05:00
|
|
|
// E_Temp limit
|
2020-07-14 20:01:29 -05:00
|
|
|
NOMORE(HMI_ValueStruct.E_Temp, MAX_E_TEMP);
|
|
|
|
NOLESS(HMI_ValueStruct.E_Temp, MIN_E_TEMP);
|
2020-06-24 19:44:50 -05:00
|
|
|
// E_Temp value
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 216, MBASE(temp_line), HMI_ValueStruct.E_Temp);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-14 02:48:45 -05:00
|
|
|
#endif // HAS_HOTEND
|
2020-06-24 19:44:50 -05:00
|
|
|
|
|
|
|
#if HAS_HEATED_BED
|
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
void HMI_BedTemp() {
|
2020-06-24 19:44:50 -05:00
|
|
|
ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze();
|
|
|
|
if (encoder_diffState != ENCODER_DIFF_NO) {
|
2020-09-17 05:35:04 -05:00
|
|
|
uint8_t bed_line;
|
|
|
|
switch (HMI_ValueStruct.show_mode) {
|
|
|
|
case -1: bed_line = TEMP_CASE_BED; break;
|
|
|
|
case -2: bed_line = PREHEAT_CASE_BED; break;
|
|
|
|
case -3: bed_line = PREHEAT_CASE_BED; break;
|
|
|
|
default: bed_line = TUNE_CASE_BED + MROWS - index_tune;
|
|
|
|
}
|
2020-09-27 16:46:26 -05:00
|
|
|
if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Bed_Temp)) {
|
2020-09-17 05:35:04 -05:00
|
|
|
EncoderRate.enabled = false;
|
2020-06-24 19:44:50 -05:00
|
|
|
if (HMI_ValueStruct.show_mode == -1) {
|
|
|
|
checkkey = TemperatureID;
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(bed_line), HMI_ValueStruct.Bed_Temp);
|
2020-06-24 19:44:50 -05:00
|
|
|
}
|
|
|
|
else if (HMI_ValueStruct.show_mode == -2) {
|
|
|
|
checkkey = PLAPreheat;
|
|
|
|
ui.material_preset[0].bed_temp = HMI_ValueStruct.Bed_Temp;
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(bed_line), ui.material_preset[0].bed_temp);
|
2020-06-24 19:44:50 -05:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
else if (HMI_ValueStruct.show_mode == -3) {
|
|
|
|
checkkey = ABSPreheat;
|
|
|
|
ui.material_preset[1].bed_temp = HMI_ValueStruct.Bed_Temp;
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(bed_line), ui.material_preset[1].bed_temp);
|
2020-06-24 19:44:50 -05:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
checkkey = Tune;
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(bed_line), HMI_ValueStruct.Bed_Temp);
|
2020-06-24 19:44:50 -05:00
|
|
|
}
|
|
|
|
thermalManager.setTargetBed(HMI_ValueStruct.Bed_Temp);
|
2020-06-16 01:45:27 -05:00
|
|
|
return;
|
|
|
|
}
|
2020-07-14 20:01:29 -05:00
|
|
|
// Bed_Temp limit
|
|
|
|
NOMORE(HMI_ValueStruct.Bed_Temp, BED_MAX_TARGET);
|
|
|
|
NOLESS(HMI_ValueStruct.Bed_Temp, MIN_BED_TEMP);
|
|
|
|
// Bed_Temp value
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 216, MBASE(bed_line), HMI_ValueStruct.Bed_Temp);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-14 02:48:45 -05:00
|
|
|
#endif // HAS_HEATED_BED
|
2020-06-24 19:44:50 -05:00
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
#if HAS_PREHEAT
|
2020-06-24 19:44:50 -05:00
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
void HMI_FanSpeed() {
|
2020-06-24 19:44:50 -05:00
|
|
|
ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze();
|
|
|
|
if (encoder_diffState != ENCODER_DIFF_NO) {
|
2020-09-17 05:35:04 -05:00
|
|
|
uint8_t fan_line;
|
|
|
|
switch (HMI_ValueStruct.show_mode) {
|
|
|
|
case -1: fan_line = TEMP_CASE_FAN; break;
|
|
|
|
case -2: fan_line = PREHEAT_CASE_FAN; break;
|
|
|
|
case -3: fan_line = PREHEAT_CASE_FAN; break;
|
|
|
|
default: fan_line = TUNE_CASE_FAN + MROWS - index_tune;
|
|
|
|
}
|
|
|
|
|
2020-09-27 16:46:26 -05:00
|
|
|
if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Fan_speed)) {
|
2020-09-17 05:35:04 -05:00
|
|
|
EncoderRate.enabled = false;
|
2020-06-24 19:44:50 -05:00
|
|
|
if (HMI_ValueStruct.show_mode == -1) {
|
|
|
|
checkkey = TemperatureID;
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(fan_line), HMI_ValueStruct.Fan_speed);
|
2020-06-24 19:44:50 -05:00
|
|
|
}
|
|
|
|
else if (HMI_ValueStruct.show_mode == -2) {
|
|
|
|
checkkey = PLAPreheat;
|
|
|
|
ui.material_preset[0].fan_speed = HMI_ValueStruct.Fan_speed;
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(fan_line), ui.material_preset[0].fan_speed);
|
2020-06-24 19:44:50 -05:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
else if (HMI_ValueStruct.show_mode == -3) {
|
|
|
|
checkkey = ABSPreheat;
|
|
|
|
ui.material_preset[1].fan_speed = HMI_ValueStruct.Fan_speed;
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(fan_line), ui.material_preset[1].fan_speed);
|
2020-06-24 19:44:50 -05:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
checkkey = Tune;
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(fan_line), HMI_ValueStruct.Fan_speed);
|
2020-06-24 19:44:50 -05:00
|
|
|
}
|
|
|
|
thermalManager.set_fan_speed(0, HMI_ValueStruct.Fan_speed);
|
2020-06-16 01:45:27 -05:00
|
|
|
return;
|
|
|
|
}
|
2020-07-14 20:01:29 -05:00
|
|
|
// Fan_speed limit
|
|
|
|
NOMORE(HMI_ValueStruct.Fan_speed, FANON);
|
|
|
|
NOLESS(HMI_ValueStruct.Fan_speed, FANOFF);
|
2020-06-24 19:44:50 -05:00
|
|
|
// Fan_speed value
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 216, MBASE(fan_line), HMI_ValueStruct.Fan_speed);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
}
|
2020-06-24 19:44:50 -05:00
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
#endif // HAS_PREHEAT
|
2020-06-16 01:45:27 -05:00
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
void HMI_PrintSpeed() {
|
2020-06-16 01:45:27 -05:00
|
|
|
ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze();
|
|
|
|
if (encoder_diffState != ENCODER_DIFF_NO) {
|
2020-09-27 16:46:26 -05:00
|
|
|
if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.print_speed)) {
|
2020-06-16 01:45:27 -05:00
|
|
|
checkkey = Tune;
|
2020-09-17 05:35:04 -05:00
|
|
|
EncoderRate.enabled = false;
|
2020-09-16 06:56:48 -05:00
|
|
|
feedrate_percentage = HMI_ValueStruct.print_speed;
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(select_tune.now + MROWS - index_tune), HMI_ValueStruct.print_speed);
|
2020-06-16 01:45:27 -05:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
// print_speed limit
|
2020-07-14 20:01:29 -05:00
|
|
|
NOMORE(HMI_ValueStruct.print_speed, MAX_PRINT_SPEED);
|
|
|
|
NOLESS(HMI_ValueStruct.print_speed, MIN_PRINT_SPEED);
|
2020-06-16 01:45:27 -05:00
|
|
|
// print_speed value
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 216, MBASE(select_tune.now + MROWS - index_tune), HMI_ValueStruct.print_speed);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
void HMI_MaxFeedspeedXYZE() {
|
2020-06-16 01:45:27 -05:00
|
|
|
ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze();
|
|
|
|
if (encoder_diffState != ENCODER_DIFF_NO) {
|
2020-09-27 16:46:26 -05:00
|
|
|
if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Max_Feedspeed)) {
|
2020-06-16 01:45:27 -05:00
|
|
|
checkkey = MaxSpeed;
|
2020-09-17 05:35:04 -05:00
|
|
|
EncoderRate.enabled = false;
|
|
|
|
if (WITHIN(HMI_flag.feedspeed_axis, X_AXIS, E_AXIS))
|
|
|
|
planner.set_max_feedrate(HMI_flag.feedspeed_axis, HMI_ValueStruct.Max_Feedspeed);
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 4, 210, MBASE(select_speed.now), HMI_ValueStruct.Max_Feedspeed);
|
2020-06-16 01:45:27 -05:00
|
|
|
return;
|
|
|
|
}
|
2020-07-14 20:01:29 -05:00
|
|
|
// MaxFeedspeed limit
|
2020-09-17 05:35:04 -05:00
|
|
|
if (WITHIN(HMI_flag.feedspeed_axis, X_AXIS, E_AXIS))
|
|
|
|
NOMORE(HMI_ValueStruct.Max_Feedspeed, default_max_feedrate[HMI_flag.feedspeed_axis] * 2);
|
2020-07-14 20:01:29 -05:00
|
|
|
if (HMI_ValueStruct.Max_Feedspeed < MIN_MAXFEEDSPEED) HMI_ValueStruct.Max_Feedspeed = MIN_MAXFEEDSPEED;
|
|
|
|
// MaxFeedspeed value
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 4, 210, MBASE(select_speed.now), HMI_ValueStruct.Max_Feedspeed);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
void HMI_MaxAccelerationXYZE() {
|
2020-06-16 01:45:27 -05:00
|
|
|
ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze();
|
|
|
|
if (encoder_diffState != ENCODER_DIFF_NO) {
|
2020-09-27 16:46:26 -05:00
|
|
|
if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Max_Acceleration)) {
|
2020-06-16 01:45:27 -05:00
|
|
|
checkkey = MaxAcceleration;
|
2020-09-17 05:35:04 -05:00
|
|
|
EncoderRate.enabled = false;
|
|
|
|
if (HMI_flag.acc_axis == X_AXIS) planner.set_max_acceleration(X_AXIS, HMI_ValueStruct.Max_Acceleration);
|
|
|
|
else if (HMI_flag.acc_axis == Y_AXIS) planner.set_max_acceleration(Y_AXIS, HMI_ValueStruct.Max_Acceleration);
|
|
|
|
else if (HMI_flag.acc_axis == Z_AXIS) planner.set_max_acceleration(Z_AXIS, HMI_ValueStruct.Max_Acceleration);
|
2020-06-24 19:44:50 -05:00
|
|
|
#if HAS_HOTEND
|
2020-09-17 05:35:04 -05:00
|
|
|
else if (HMI_flag.acc_axis == E_AXIS) planner.set_max_acceleration(E_AXIS, HMI_ValueStruct.Max_Acceleration);
|
2020-06-24 19:44:50 -05:00
|
|
|
#endif
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 4, 210, MBASE(select_acc.now), HMI_ValueStruct.Max_Acceleration);
|
2020-06-16 01:45:27 -05:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
// MaxAcceleration limit
|
2020-09-17 05:35:04 -05:00
|
|
|
if (WITHIN(HMI_flag.acc_axis, X_AXIS, E_AXIS))
|
|
|
|
NOMORE(HMI_ValueStruct.Max_Acceleration, default_max_acceleration[HMI_flag.acc_axis] * 2);
|
2020-07-14 20:01:29 -05:00
|
|
|
if (HMI_ValueStruct.Max_Acceleration < MIN_MAXACCELERATION) HMI_ValueStruct.Max_Acceleration = MIN_MAXACCELERATION;
|
2020-06-16 01:45:27 -05:00
|
|
|
// MaxAcceleration value
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 4, 210, MBASE(select_acc.now), HMI_ValueStruct.Max_Acceleration);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
#if HAS_CLASSIC_JERK
|
|
|
|
|
|
|
|
void HMI_MaxJerkXYZE() {
|
|
|
|
ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze();
|
|
|
|
if (encoder_diffState != ENCODER_DIFF_NO) {
|
2020-09-27 16:46:26 -05:00
|
|
|
if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Max_Jerk)) {
|
2020-09-17 05:35:04 -05:00
|
|
|
checkkey = MaxJerk;
|
|
|
|
EncoderRate.enabled = false;
|
|
|
|
if (WITHIN(HMI_flag.step_axis, X_AXIS, E_AXIS))
|
|
|
|
planner.set_max_jerk(HMI_flag.step_axis, HMI_ValueStruct.Max_Jerk / 10);
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 210, MBASE(select_jerk.now), HMI_ValueStruct.Max_Jerk);
|
2020-09-17 05:35:04 -05:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
// MaxJerk limit
|
|
|
|
if (WITHIN(HMI_flag.jerk_axis, X_AXIS, E_AXIS))
|
|
|
|
NOMORE(HMI_ValueStruct.Max_Jerk, default_max_jerk[HMI_flag.jerk_axis] * 2 * MINUNITMULT);
|
|
|
|
NOLESS(HMI_ValueStruct.Max_Jerk, (MIN_MAXJERK) * MINUNITMULT);
|
|
|
|
// MaxJerk value
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 1, 210, MBASE(select_jerk.now), HMI_ValueStruct.Max_Jerk);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
#endif // HAS_CLASSIC_JERK
|
|
|
|
|
|
|
|
void HMI_StepXYZE() {
|
2020-06-16 01:45:27 -05:00
|
|
|
ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze();
|
|
|
|
if (encoder_diffState != ENCODER_DIFF_NO) {
|
2020-09-27 16:46:26 -05:00
|
|
|
if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Max_Step)) {
|
2020-06-16 01:45:27 -05:00
|
|
|
checkkey = Step;
|
2020-09-17 05:35:04 -05:00
|
|
|
EncoderRate.enabled = false;
|
|
|
|
if (WITHIN(HMI_flag.step_axis, X_AXIS, E_AXIS))
|
|
|
|
planner.settings.axis_steps_per_mm[HMI_flag.step_axis] = HMI_ValueStruct.Max_Step / 10;
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 210, MBASE(select_step.now), HMI_ValueStruct.Max_Step);
|
2020-06-16 01:45:27 -05:00
|
|
|
return;
|
|
|
|
}
|
2020-07-14 20:01:29 -05:00
|
|
|
// Step limit
|
2020-09-17 05:35:04 -05:00
|
|
|
if (WITHIN(HMI_flag.step_axis, X_AXIS, E_AXIS))
|
|
|
|
NOMORE(HMI_ValueStruct.Max_Step, default_axis_steps_per_unit[HMI_flag.step_axis] * 2 * MINUNITMULT);
|
2020-07-14 20:01:29 -05:00
|
|
|
NOLESS(HMI_ValueStruct.Max_Step, MIN_STEP);
|
|
|
|
// Step value
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 1, 210, MBASE(select_step.now), HMI_ValueStruct.Max_Step);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
void update_variable() {
|
|
|
|
#if HAS_HOTEND
|
|
|
|
static float last_temp_hotend_target = 0, last_temp_hotend_current = 0;
|
|
|
|
#endif
|
|
|
|
#if HAS_HEATED_BED
|
|
|
|
static float last_temp_bed_target = 0, last_temp_bed_current = 0;
|
|
|
|
#endif
|
|
|
|
#if HAS_FAN
|
|
|
|
static uint8_t last_fan_speed = 0;
|
|
|
|
#endif
|
|
|
|
|
2020-06-16 01:45:27 -05:00
|
|
|
/* Tune page temperature update */
|
|
|
|
if (checkkey == Tune) {
|
2020-09-17 05:35:04 -05:00
|
|
|
#if HAS_HOTEND
|
|
|
|
if (last_temp_hotend_target != thermalManager.temp_hotend[0].target)
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(TUNE_CASE_TEMP + MROWS - index_tune), thermalManager.temp_hotend[0].target);
|
2020-09-17 05:35:04 -05:00
|
|
|
#endif
|
|
|
|
#if HAS_HEATED_BED
|
|
|
|
if (last_temp_bed_target != thermalManager.temp_bed.target)
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(TUNE_CASE_BED + MROWS - index_tune), thermalManager.temp_bed.target);
|
2020-09-17 05:35:04 -05:00
|
|
|
#endif
|
|
|
|
#if HAS_FAN
|
|
|
|
if (last_fan_speed != thermalManager.fan_speed[0]) {
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(TUNE_CASE_FAN + MROWS - index_tune), thermalManager.fan_speed[0]);
|
2020-09-17 05:35:04 -05:00
|
|
|
last_fan_speed = thermalManager.fan_speed[0];
|
|
|
|
}
|
|
|
|
#endif
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Temperature page temperature update */
|
|
|
|
if (checkkey == TemperatureID) {
|
2020-09-17 05:35:04 -05:00
|
|
|
#if HAS_HOTEND
|
|
|
|
if (last_temp_hotend_target != thermalManager.temp_hotend[0].target)
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(TEMP_CASE_TEMP), thermalManager.temp_hotend[0].target);
|
2020-09-17 05:35:04 -05:00
|
|
|
#endif
|
|
|
|
#if HAS_HEATED_BED
|
|
|
|
if (last_temp_bed_target != thermalManager.temp_bed.target)
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(TEMP_CASE_BED), thermalManager.temp_bed.target);
|
2020-09-17 05:35:04 -05:00
|
|
|
#endif
|
|
|
|
#if HAS_FAN
|
|
|
|
if (last_fan_speed != thermalManager.fan_speed[0]) {
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(TEMP_CASE_FAN), thermalManager.fan_speed[0]);
|
2020-09-17 05:35:04 -05:00
|
|
|
last_fan_speed = thermalManager.fan_speed[0];
|
|
|
|
}
|
|
|
|
#endif
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Bottom temperature update */
|
2020-09-17 05:35:04 -05:00
|
|
|
#if HAS_HOTEND
|
|
|
|
if (last_temp_hotend_current != thermalManager.temp_hotend[0].celsius) {
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, 33, 382, thermalManager.temp_hotend[0].celsius);
|
2020-09-17 05:35:04 -05:00
|
|
|
last_temp_hotend_current = thermalManager.temp_hotend[0].celsius;
|
|
|
|
}
|
|
|
|
if (last_temp_hotend_target != thermalManager.temp_hotend[0].target) {
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, 33 + 4 * STAT_CHR_W + 6, 382, thermalManager.temp_hotend[0].target);
|
2020-09-17 05:35:04 -05:00
|
|
|
last_temp_hotend_target = thermalManager.temp_hotend[0].target;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#if HAS_HEATED_BED
|
|
|
|
if (last_temp_bed_current != thermalManager.temp_bed.celsius) {
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, 178, 382, thermalManager.temp_bed.celsius);
|
2020-09-17 05:35:04 -05:00
|
|
|
last_temp_bed_current = thermalManager.temp_bed.celsius;
|
|
|
|
}
|
|
|
|
if (last_temp_bed_target != thermalManager.temp_bed.target) {
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, 178 + 4 * STAT_CHR_W + 6, 382, thermalManager.temp_bed.target);
|
2020-09-17 05:35:04 -05:00
|
|
|
last_temp_bed_target = thermalManager.temp_bed.target;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
static uint16_t last_speed = 0;
|
2020-06-16 01:45:27 -05:00
|
|
|
if (last_speed != feedrate_percentage) {
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, 33 + 2 * STAT_CHR_W, 429, feedrate_percentage);
|
2020-06-16 01:45:27 -05:00
|
|
|
last_speed = feedrate_percentage;
|
|
|
|
}
|
2020-09-17 05:35:04 -05:00
|
|
|
#if HAS_ZOFFSET_ITEM
|
|
|
|
if (last_zoffset != BABY_Z_VAR) {
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_Signed_Float(DWIN_FONT_STAT, Color_Bg_Black, 2, 2, 178 + STAT_CHR_W, 429, BABY_Z_VAR * 100);
|
2020-09-17 05:35:04 -05:00
|
|
|
last_zoffset = BABY_Z_VAR;
|
|
|
|
}
|
|
|
|
#endif
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-09-14 02:48:45 -05:00
|
|
|
* Read and cache the working directory.
|
|
|
|
*
|
|
|
|
* TODO: New code can follow the pattern of menu_media.cpp
|
|
|
|
* and rely on Marlin caching for performance. No need to
|
|
|
|
* cache files here.
|
|
|
|
*
|
|
|
|
*/
|
2020-06-16 01:45:27 -05:00
|
|
|
|
|
|
|
#ifndef strcasecmp_P
|
2020-07-14 20:01:29 -05:00
|
|
|
#define strcasecmp_P(a, b) strcasecmp((a), (b))
|
2020-06-16 01:45:27 -05:00
|
|
|
#endif
|
|
|
|
|
2020-09-06 21:40:58 -05:00
|
|
|
inline void make_name_without_ext(char *dst, char *src, size_t maxlen=MENU_CHAR_LIMIT) {
|
2020-06-16 01:45:27 -05:00
|
|
|
char * const name = card.longest_filename();
|
2020-07-14 20:01:29 -05:00
|
|
|
size_t pos = strlen(name); // index of ending nul
|
2020-06-16 01:45:27 -05:00
|
|
|
|
|
|
|
// For files, remove the extension
|
|
|
|
// which may be .gcode, .gco, or .g
|
|
|
|
if (!card.flag.filenameIsDir)
|
|
|
|
while (pos && src[pos] != '.') pos--; // find last '.' (stop at 0)
|
|
|
|
|
2020-08-13 21:30:12 -05:00
|
|
|
size_t len = pos; // nul or '.'
|
2020-07-14 20:01:29 -05:00
|
|
|
if (len > maxlen) { // Keep the name short
|
|
|
|
pos = len = maxlen; // move nul down
|
|
|
|
dst[--pos] = '.'; // insert dots
|
2020-06-16 01:45:27 -05:00
|
|
|
dst[--pos] = '.';
|
|
|
|
dst[--pos] = '.';
|
|
|
|
}
|
|
|
|
|
2020-07-14 20:01:29 -05:00
|
|
|
dst[len] = '\0'; // end it
|
2020-06-16 01:45:27 -05:00
|
|
|
|
|
|
|
// Copy down to 0
|
|
|
|
while (pos--) dst[pos] = src[pos];
|
|
|
|
}
|
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
inline void HMI_SDCardInit() { card.cdroot(); }
|
2020-06-16 01:45:27 -05:00
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
void MarlinUI::refresh() { /* Nothing to see here */ }
|
2020-06-16 01:45:27 -05:00
|
|
|
|
|
|
|
#define ICON_Folder ICON_More
|
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
#if ENABLED(SCROLL_LONG_FILENAMES)
|
2020-06-16 01:45:27 -05:00
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
char shift_name[LONG_FILENAME_LENGTH + 1];
|
|
|
|
int8_t shift_amt; // = 0
|
|
|
|
millis_t shift_ms; // = 0
|
|
|
|
|
|
|
|
// Init the shift name based on the highlighted item
|
|
|
|
inline void Init_Shift_Name() {
|
|
|
|
const bool is_subdir = !card.flag.workDirIsRoot;
|
|
|
|
const int8_t filenum = select_file.now - 1 - is_subdir; // Skip "Back" and ".."
|
|
|
|
const uint16_t fileCnt = card.get_num_Files();
|
|
|
|
if (WITHIN(filenum, 0, fileCnt - 1)) {
|
|
|
|
card.getfilename_sorted(SD_ORDER(filenum, fileCnt));
|
|
|
|
char * const name = card.longest_filename();
|
|
|
|
make_name_without_ext(shift_name, name, 100);
|
|
|
|
}
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
inline void Init_SDItem_Shift() {
|
|
|
|
shift_amt = 0;
|
|
|
|
shift_ms = select_file.now > 0 && strlen(shift_name) > MENU_CHAR_LIMIT
|
|
|
|
? millis() + 750UL : 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
2020-06-16 01:45:27 -05:00
|
|
|
|
|
|
|
/**
|
2020-07-16 22:20:55 -05:00
|
|
|
* Display an SD item, adding a CDUP for subfolders.
|
|
|
|
*/
|
2020-06-16 01:45:27 -05:00
|
|
|
inline void Draw_SDItem(const uint16_t item, int16_t row=-1) {
|
2020-07-14 20:01:29 -05:00
|
|
|
if (row < 0) row = item + 1 + MROWS - index_file;
|
2020-06-16 01:45:27 -05:00
|
|
|
const bool is_subdir = !card.flag.workDirIsRoot;
|
|
|
|
if (is_subdir && item == 0) {
|
2020-09-10 20:52:00 -05:00
|
|
|
Draw_Menu_Line(row, ICON_Folder, "..");
|
2020-06-16 01:45:27 -05:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
card.getfilename_sorted(item - is_subdir);
|
|
|
|
char * const name = card.longest_filename();
|
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
#if ENABLED(SCROLL_LONG_FILENAMES)
|
|
|
|
// Init the current selected name
|
|
|
|
// This is used during scroll drawing
|
|
|
|
if (item == select_file.now - 1) {
|
|
|
|
make_name_without_ext(shift_name, name, 100);
|
|
|
|
Init_SDItem_Shift();
|
|
|
|
}
|
|
|
|
#endif
|
2020-06-16 01:45:27 -05:00
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
// Draw the file/folder with name aligned left
|
2020-06-16 01:45:27 -05:00
|
|
|
char str[strlen(name) + 1];
|
|
|
|
make_name_without_ext(str, name);
|
|
|
|
Draw_Menu_Line(row, card.flag.filenameIsDir ? ICON_Folder : ICON_File, str);
|
|
|
|
}
|
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
#if ENABLED(SCROLL_LONG_FILENAMES)
|
2020-06-16 01:45:27 -05:00
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
inline void Draw_SDItem_Shifted(int8_t &shift) {
|
|
|
|
// Limit to the number of chars past the cutoff
|
|
|
|
const size_t len = strlen(shift_name);
|
2020-09-27 02:01:56 -05:00
|
|
|
NOMORE(shift, _MAX(len - MENU_CHAR_LIMIT, 0U));
|
2020-06-16 01:45:27 -05:00
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
// Shorten to the available space
|
|
|
|
const size_t lastchar = _MIN((signed)len, shift + MENU_CHAR_LIMIT);
|
2020-06-16 01:45:27 -05:00
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
const char c = shift_name[lastchar];
|
|
|
|
shift_name[lastchar] = '\0';
|
2020-06-16 01:45:27 -05:00
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
const uint8_t row = select_file.now + MROWS - index_file; // skip "Back" and scroll
|
|
|
|
Erase_Menu_Text(row);
|
|
|
|
Draw_Menu_Line(row, 0, &shift_name[shift]);
|
|
|
|
|
|
|
|
shift_name[lastchar] = c;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
2020-06-16 01:45:27 -05:00
|
|
|
|
|
|
|
// Redraw the first set of SD Files
|
|
|
|
inline void Redraw_SD_List() {
|
|
|
|
select_file.reset();
|
|
|
|
index_file = MROWS;
|
|
|
|
|
|
|
|
Clear_Menu_Area(); // Leave title bar unchanged
|
|
|
|
|
|
|
|
Draw_Back_First();
|
|
|
|
|
|
|
|
// As many files as will fit
|
|
|
|
LOOP_L_N(i, _MIN(nr_sd_menu_items(), MROWS))
|
2020-07-16 22:20:55 -05:00
|
|
|
Draw_SDItem(i, i + 1);
|
2020-06-16 01:45:27 -05:00
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
TERN_(SCROLL_LONG_FILENAMES, Init_SDItem_Shift());
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
bool DWIN_lcd_sd_status = false;
|
|
|
|
|
|
|
|
inline void SDCard_Up() {
|
2020-06-16 01:45:27 -05:00
|
|
|
card.cdup();
|
|
|
|
Redraw_SD_List();
|
|
|
|
DWIN_lcd_sd_status = false; // On next DWIN_Update
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void SDCard_Folder(char * const dirname) {
|
|
|
|
card.cd(dirname);
|
|
|
|
Redraw_SD_List();
|
|
|
|
DWIN_lcd_sd_status = false; // On next DWIN_Update
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// Watch for media mount / unmount
|
|
|
|
//
|
2020-09-17 05:35:04 -05:00
|
|
|
void HMI_SDCardUpdate() {
|
2020-06-16 01:45:27 -05:00
|
|
|
if (HMI_flag.home_flag) return;
|
|
|
|
if (DWIN_lcd_sd_status != card.isMounted()) {
|
|
|
|
DWIN_lcd_sd_status = card.isMounted();
|
2020-07-14 20:01:29 -05:00
|
|
|
// SERIAL_ECHOLNPAIR("HMI_SDCardUpdate: ", int(DWIN_lcd_sd_status));
|
2020-09-27 16:46:26 -05:00
|
|
|
if (DWIN_lcd_sd_status) {
|
2020-06-16 01:45:27 -05:00
|
|
|
if (checkkey == SelectFile)
|
|
|
|
Redraw_SD_List();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
// clean file icon
|
2020-07-14 20:01:29 -05:00
|
|
|
if (checkkey == SelectFile) {
|
2020-06-16 01:45:27 -05:00
|
|
|
Redraw_SD_List();
|
2020-07-14 20:01:29 -05:00
|
|
|
}
|
2020-06-16 01:45:27 -05:00
|
|
|
else if (checkkey == PrintProcess || checkkey == Tune || printingIsActive()) {
|
|
|
|
// TODO: Move card removed abort handling
|
|
|
|
// to CardReader::manage_media.
|
|
|
|
card.flag.abort_sd_printing = true;
|
2020-09-17 05:35:04 -05:00
|
|
|
wait_for_heatup = false;
|
|
|
|
dwin_abort_flag = true;
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
DWIN_UpdateLCD();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-27 16:46:26 -05:00
|
|
|
//
|
|
|
|
// The status area is always on-screen, except during
|
|
|
|
// full-screen modal dialogs. (TODO: Keep alive during dialogs)
|
|
|
|
//
|
|
|
|
void Draw_Status_Area(const bool with_update) {
|
2020-06-16 01:45:27 -05:00
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
// Clear the bottom area of the screen
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_Rectangle(1, Color_Bg_Black, 0, STATUS_Y, DWIN_WIDTH, DWIN_HEIGHT - 1);
|
2020-06-16 01:45:27 -05:00
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
//
|
|
|
|
// Status Area
|
|
|
|
//
|
|
|
|
#if HAS_HOTEND
|
|
|
|
DWIN_ICON_Show(ICON, ICON_HotendTemp, 13, 381);
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, 33, 382, thermalManager.temp_hotend[0].celsius);
|
|
|
|
DWIN_Draw_String(false, false, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 33 + 3 * STAT_CHR_W + 5, 383, F("/"));
|
|
|
|
DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, 33 + 4 * STAT_CHR_W + 6, 382, thermalManager.temp_hotend[0].target);
|
2020-09-17 05:35:04 -05:00
|
|
|
#endif
|
2020-06-16 01:45:27 -05:00
|
|
|
#if HOTENDS > 1
|
2020-07-14 20:01:29 -05:00
|
|
|
// DWIN_ICON_Show(ICON,ICON_HotendTemp, 13, 381);
|
2020-06-16 01:45:27 -05:00
|
|
|
#endif
|
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
#if HAS_HEATED_BED
|
|
|
|
DWIN_ICON_Show(ICON, ICON_BedTemp, 158, 381);
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, 178, 382, thermalManager.temp_bed.celsius);
|
|
|
|
DWIN_Draw_String(false, false, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 178 + 3 * STAT_CHR_W + 5, 383, F("/"));
|
|
|
|
DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, 178 + 4 * STAT_CHR_W + 6, 382, thermalManager.temp_bed.target);
|
2020-09-17 05:35:04 -05:00
|
|
|
#endif
|
2020-06-16 01:45:27 -05:00
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
DWIN_ICON_Show(ICON, ICON_Speed, 13, 429);
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, 33 + 2 * STAT_CHR_W, 429, feedrate_percentage);
|
|
|
|
DWIN_Draw_String(false, false, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 33 + 5 * STAT_CHR_W + 2, 429, F("%"));
|
2020-06-16 01:45:27 -05:00
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
#if HAS_ZOFFSET_ITEM
|
|
|
|
DWIN_ICON_Show(ICON, ICON_Zoffset, 158, 428);
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_Signed_Float(DWIN_FONT_STAT, Color_Bg_Black, 2, 2, 178, 429, BABY_Z_VAR * 100);
|
2020-09-17 05:35:04 -05:00
|
|
|
#endif
|
2020-06-16 01:45:27 -05:00
|
|
|
|
|
|
|
if (with_update) {
|
|
|
|
DWIN_UpdateLCD();
|
|
|
|
delay(5);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-27 16:46:26 -05:00
|
|
|
void HMI_StartFrame(const bool with_update) {
|
|
|
|
Goto_MainMenu();
|
|
|
|
Draw_Status_Area(with_update);
|
|
|
|
}
|
|
|
|
|
2020-06-16 01:45:27 -05:00
|
|
|
inline void Draw_Info_Menu() {
|
|
|
|
Clear_Main_Window();
|
|
|
|
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_String(false, false, font8x16, Color_White, Color_Bg_Black, (DWIN_WIDTH - strlen(MACHINE_SIZE) * MENU_CHR_W) / 2, 122, (char*)MACHINE_SIZE);
|
|
|
|
DWIN_Draw_String(false, false, font8x16, Color_White, Color_Bg_Black, (DWIN_WIDTH - strlen(SHORT_BUILD_VERSION) * MENU_CHR_W) / 2, 195, (char*)SHORT_BUILD_VERSION);
|
2020-06-16 01:45:27 -05:00
|
|
|
|
2020-08-21 23:44:21 -05:00
|
|
|
if (HMI_flag.language_chinese) {
|
2020-09-16 06:56:48 -05:00
|
|
|
DWIN_Frame_TitleCopy(1, 30, 17, 57, 29); // "Info"
|
2020-06-16 01:45:27 -05:00
|
|
|
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 197, 149, 252, 161, 108, 102);
|
|
|
|
DWIN_Frame_AreaCopy(1, 1, 164, 56, 176, 108, 175);
|
|
|
|
DWIN_Frame_AreaCopy(1, 58, 164, 113, 176, 105, 248);
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_String(false, false, font8x16, Color_White, Color_Bg_Black, (DWIN_WIDTH - strlen(CORP_WEBSITE_C) * MENU_CHR_W) / 2, 268, (char*)CORP_WEBSITE_C);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
#ifdef USE_STRING_HEADINGS
|
2020-08-02 20:00:06 -05:00
|
|
|
Draw_Title(GET_TEXT_F(MSG_INFO_SCREEN));
|
2020-06-16 01:45:27 -05:00
|
|
|
#else
|
2020-09-16 06:56:48 -05:00
|
|
|
DWIN_Frame_TitleCopy(1, 190, 16, 215, 26); // "Info"
|
2020-06-16 01:45:27 -05:00
|
|
|
#endif
|
|
|
|
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 120, 150, 146, 161, 124, 102);
|
|
|
|
DWIN_Frame_AreaCopy(1, 146, 151, 254, 161, 82, 175);
|
|
|
|
DWIN_Frame_AreaCopy(1, 0, 165, 94, 175, 89, 248);
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_String(false, false, font8x16, Color_White, Color_Bg_Black, (DWIN_WIDTH - strlen(CORP_WEBSITE_E) * MENU_CHR_W) / 2, 268, (char*)CORP_WEBSITE_E);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
Draw_Back_First();
|
|
|
|
LOOP_L_N(i, 3) {
|
2020-07-14 20:01:29 -05:00
|
|
|
DWIN_ICON_Show(ICON, ICON_PrintSize + i, 26, 99 + i * 73);
|
|
|
|
DWIN_Draw_Line(Line_Color, 16, MBASE(2) + i * 73, 256, 156 + i * 73);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void Draw_Print_File_Menu() {
|
|
|
|
Clear_Title_Bar();
|
|
|
|
|
2020-08-21 23:44:21 -05:00
|
|
|
if (HMI_flag.language_chinese) {
|
2020-09-16 06:56:48 -05:00
|
|
|
DWIN_Frame_TitleCopy(1, 0, 31, 55, 44); // "Print file"
|
2020-07-14 20:01:29 -05:00
|
|
|
}
|
2020-06-16 01:45:27 -05:00
|
|
|
else {
|
|
|
|
#ifdef USE_STRING_HEADINGS
|
|
|
|
Draw_Title("Print file"); // TODO: GET_TEXT_F
|
|
|
|
#else
|
2020-09-16 06:56:48 -05:00
|
|
|
DWIN_Frame_TitleCopy(1, 52, 31, 137, 41); // "Print file"
|
2020-06-16 01:45:27 -05:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
Redraw_SD_List();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Main Process */
|
2020-09-17 05:35:04 -05:00
|
|
|
void HMI_MainMenu() {
|
2020-06-16 01:45:27 -05:00
|
|
|
ENCODER_DiffState encoder_diffState = get_encoder_state();
|
|
|
|
if (encoder_diffState == ENCODER_DIFF_NO) return;
|
|
|
|
|
|
|
|
if (encoder_diffState == ENCODER_DIFF_CW) {
|
2020-09-17 05:35:04 -05:00
|
|
|
if (select_page.inc(4)) {
|
2020-06-16 01:45:27 -05:00
|
|
|
switch (select_page.now) {
|
|
|
|
case 0: ICON_Print(); break;
|
|
|
|
case 1: ICON_Print(); ICON_Prepare(); break;
|
|
|
|
case 2: ICON_Prepare(); ICON_Control(); break;
|
2020-09-03 16:52:31 -05:00
|
|
|
case 3: ICON_Control(); TERN(HAS_ONESTEP_LEVELING, ICON_Leveling, ICON_StartInfo)(1); break;
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (encoder_diffState == ENCODER_DIFF_CCW) {
|
|
|
|
if (select_page.dec()) {
|
|
|
|
switch (select_page.now) {
|
|
|
|
case 0: ICON_Print(); ICON_Prepare(); break;
|
|
|
|
case 1: ICON_Prepare(); ICON_Control(); break;
|
2020-09-03 16:52:31 -05:00
|
|
|
case 2: ICON_Control(); TERN(HAS_ONESTEP_LEVELING, ICON_Leveling, ICON_StartInfo)(0); break;
|
|
|
|
case 3: TERN(HAS_ONESTEP_LEVELING, ICON_Leveling, ICON_StartInfo)(1); break;
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (encoder_diffState == ENCODER_DIFF_ENTER) {
|
|
|
|
switch (select_page.now) {
|
2020-09-16 06:56:48 -05:00
|
|
|
case 0: // Print File
|
2020-06-16 01:45:27 -05:00
|
|
|
checkkey = SelectFile;
|
|
|
|
Draw_Print_File_Menu();
|
|
|
|
break;
|
|
|
|
|
2020-09-16 06:56:48 -05:00
|
|
|
case 1: // Prepare
|
2020-06-16 01:45:27 -05:00
|
|
|
checkkey = Prepare;
|
|
|
|
select_prepare.reset();
|
|
|
|
index_prepare = MROWS;
|
|
|
|
Draw_Prepare_Menu();
|
|
|
|
break;
|
|
|
|
|
2020-09-16 06:56:48 -05:00
|
|
|
case 2: // Control
|
2020-06-16 01:45:27 -05:00
|
|
|
checkkey = Control;
|
|
|
|
select_control.reset();
|
|
|
|
index_control = MROWS;
|
|
|
|
Draw_Control_Menu();
|
|
|
|
break;
|
|
|
|
|
2020-09-16 06:56:48 -05:00
|
|
|
case 3: // Leveling or Info
|
2020-09-03 16:52:31 -05:00
|
|
|
#if HAS_ONESTEP_LEVELING
|
2020-06-16 01:45:27 -05:00
|
|
|
checkkey = Leveling;
|
|
|
|
HMI_Leveling();
|
|
|
|
#else
|
|
|
|
checkkey = Info;
|
|
|
|
Draw_Info_Menu();
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
DWIN_UpdateLCD();
|
|
|
|
}
|
|
|
|
|
2020-09-16 06:56:48 -05:00
|
|
|
// Select (and Print) File
|
2020-09-17 05:35:04 -05:00
|
|
|
void HMI_SelectFile() {
|
2020-06-16 01:45:27 -05:00
|
|
|
ENCODER_DiffState encoder_diffState = get_encoder_state();
|
|
|
|
|
|
|
|
const uint16_t hasUpDir = !card.flag.workDirIsRoot;
|
|
|
|
|
|
|
|
if (encoder_diffState == ENCODER_DIFF_NO) {
|
2020-09-17 05:35:04 -05:00
|
|
|
#if ENABLED(SCROLL_LONG_FILENAMES)
|
|
|
|
if (shift_ms && select_file.now >= 1 + hasUpDir) {
|
|
|
|
// Scroll selected filename every second
|
|
|
|
const millis_t ms = millis();
|
|
|
|
if (ELAPSED(ms, shift_ms)) {
|
|
|
|
const bool was_reset = shift_amt < 0;
|
|
|
|
shift_ms = ms + 375UL + was_reset * 250UL; // ms per character
|
|
|
|
int8_t shift_new = shift_amt + 1; // Try to shift by...
|
|
|
|
Draw_SDItem_Shifted(shift_new); // Draw the item
|
|
|
|
if (!was_reset && shift_new == 0) // Was it limited to 0?
|
|
|
|
shift_ms = 0; // No scrolling needed
|
|
|
|
else if (shift_new == shift_amt) // Scroll reached the end
|
|
|
|
shift_new = -1; // Reset
|
|
|
|
shift_amt = shift_new; // Set new scroll
|
|
|
|
}
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
2020-09-17 05:35:04 -05:00
|
|
|
#endif
|
2020-06-16 01:45:27 -05:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// First pause is long. Easy.
|
|
|
|
// On reset, long pause must be after 0.
|
|
|
|
|
|
|
|
const uint16_t fullCnt = nr_sd_menu_items();
|
|
|
|
|
|
|
|
if (encoder_diffState == ENCODER_DIFF_CW && fullCnt) {
|
2020-09-17 05:35:04 -05:00
|
|
|
if (select_file.inc(1 + fullCnt)) {
|
2020-07-14 20:01:29 -05:00
|
|
|
const uint8_t itemnum = select_file.now - 1; // -1 for "Back"
|
2020-09-17 05:35:04 -05:00
|
|
|
if (TERN0(SCROLL_LONG_FILENAMES, shift_ms)) { // If line was shifted
|
|
|
|
Erase_Menu_Text(itemnum + MROWS - index_file); // Erase and
|
2020-07-14 20:01:29 -05:00
|
|
|
Draw_SDItem(itemnum - 1); // redraw
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
2020-07-14 20:01:29 -05:00
|
|
|
if (select_file.now > MROWS && select_file.now > index_file) { // Cursor past the bottom
|
|
|
|
index_file = select_file.now; // New bottom line
|
2020-06-16 01:45:27 -05:00
|
|
|
Scroll_Menu(DWIN_SCROLL_UP);
|
2020-07-14 20:01:29 -05:00
|
|
|
Draw_SDItem(itemnum, MROWS); // Draw and init the shift name
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
else {
|
2020-07-14 20:01:29 -05:00
|
|
|
Move_Highlight(1, select_file.now + MROWS - index_file); // Just move highlight
|
2020-09-17 05:35:04 -05:00
|
|
|
TERN_(SCROLL_LONG_FILENAMES, Init_Shift_Name()); // ...and init the shift name
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
2020-09-17 05:35:04 -05:00
|
|
|
TERN_(SCROLL_LONG_FILENAMES, Init_SDItem_Shift());
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (encoder_diffState == ENCODER_DIFF_CCW && fullCnt) {
|
|
|
|
if (select_file.dec()) {
|
2020-07-14 20:01:29 -05:00
|
|
|
const uint8_t itemnum = select_file.now - 1; // -1 for "Back"
|
2020-09-17 05:35:04 -05:00
|
|
|
if (TERN0(SCROLL_LONG_FILENAMES, shift_ms)) { // If line was shifted
|
2020-07-14 20:01:29 -05:00
|
|
|
Erase_Menu_Text(select_file.now + 1 + MROWS - index_file); // Erase and
|
|
|
|
Draw_SDItem(itemnum + 1); // redraw
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
2020-07-14 20:01:29 -05:00
|
|
|
if (select_file.now < index_file - MROWS) { // Cursor past the top
|
|
|
|
index_file--; // New bottom line
|
2020-06-16 01:45:27 -05:00
|
|
|
Scroll_Menu(DWIN_SCROLL_DOWN);
|
|
|
|
if (index_file == MROWS) {
|
|
|
|
Draw_Back_First();
|
2020-09-17 05:35:04 -05:00
|
|
|
TERN_(SCROLL_LONG_FILENAMES, shift_ms = 0);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
2020-07-14 20:01:29 -05:00
|
|
|
else {
|
|
|
|
Draw_SDItem(itemnum, 0); // Draw the item (and init shift name)
|
|
|
|
}
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
else {
|
2020-07-14 20:01:29 -05:00
|
|
|
Move_Highlight(-1, select_file.now + MROWS - index_file); // Just move highlight
|
2020-09-17 05:35:04 -05:00
|
|
|
TERN_(SCROLL_LONG_FILENAMES, Init_Shift_Name()); // ...and init the shift name
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
2020-09-17 05:35:04 -05:00
|
|
|
TERN_(SCROLL_LONG_FILENAMES, Init_SDItem_Shift()); // Reset left. Init timer.
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (encoder_diffState == ENCODER_DIFF_ENTER) {
|
2020-09-17 05:35:04 -05:00
|
|
|
if (select_file.now == 0) { // Back
|
2020-06-16 01:45:27 -05:00
|
|
|
select_page.set(0);
|
|
|
|
Goto_MainMenu();
|
|
|
|
}
|
2020-09-17 05:35:04 -05:00
|
|
|
else if (hasUpDir && select_file.now == 1) { // CD-Up
|
2020-06-16 01:45:27 -05:00
|
|
|
SDCard_Up();
|
|
|
|
goto HMI_SelectFileExit;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
const uint16_t filenum = select_file.now - 1 - hasUpDir;
|
2020-07-16 22:20:55 -05:00
|
|
|
card.getfilename_sorted(SD_ORDER(filenum, card.get_num_Files()));
|
2020-06-16 01:45:27 -05:00
|
|
|
|
|
|
|
// Enter that folder!
|
|
|
|
if (card.flag.filenameIsDir) {
|
|
|
|
SDCard_Folder(card.filename);
|
|
|
|
goto HMI_SelectFileExit;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Reset highlight for next entry
|
|
|
|
select_print.reset();
|
|
|
|
select_file.reset();
|
|
|
|
|
|
|
|
// Start choice and print SD file
|
2020-09-17 05:35:04 -05:00
|
|
|
HMI_flag.heat_flag = true;
|
|
|
|
HMI_flag.print_finish = false;
|
2020-06-16 01:45:27 -05:00
|
|
|
HMI_ValueStruct.show_mode = 0;
|
|
|
|
|
|
|
|
card.openAndPrintFile(card.filename);
|
|
|
|
|
|
|
|
#if FAN_COUNT > 0
|
|
|
|
// All fans on for Ender 3 v2 ?
|
|
|
|
// The slicer should manage this for us.
|
2020-07-14 20:01:29 -05:00
|
|
|
// for (uint8_t i = 0; i < FAN_COUNT; i++)
|
|
|
|
// thermalManager.fan_speed[i] = FANON;
|
2020-06-16 01:45:27 -05:00
|
|
|
#endif
|
|
|
|
|
|
|
|
Goto_PrintProcess();
|
|
|
|
}
|
|
|
|
}
|
2020-07-14 20:01:29 -05:00
|
|
|
HMI_SelectFileExit:
|
|
|
|
DWIN_UpdateLCD();
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Printing */
|
2020-09-17 05:35:04 -05:00
|
|
|
void HMI_Printing() {
|
2020-06-16 01:45:27 -05:00
|
|
|
ENCODER_DiffState encoder_diffState = get_encoder_state();
|
|
|
|
if (encoder_diffState == ENCODER_DIFF_NO) return;
|
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
if (HMI_flag.done_confirm_flag) {
|
2020-06-16 01:45:27 -05:00
|
|
|
if (encoder_diffState == ENCODER_DIFF_ENTER) {
|
2020-09-17 05:35:04 -05:00
|
|
|
HMI_flag.done_confirm_flag = false;
|
|
|
|
dwin_abort_flag = true;
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Avoid flicker by updating only the previous menu
|
|
|
|
if (encoder_diffState == ENCODER_DIFF_CW) {
|
2020-09-17 05:35:04 -05:00
|
|
|
if (select_print.inc(3)) {
|
2020-06-16 01:45:27 -05:00
|
|
|
switch (select_print.now) {
|
|
|
|
case 0: ICON_Tune(); break;
|
|
|
|
case 1:
|
|
|
|
ICON_Tune();
|
|
|
|
if (printingIsPaused()) ICON_Continue(); else ICON_Pause();
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
if (printingIsPaused()) ICON_Continue(); else ICON_Pause();
|
|
|
|
ICON_Stop();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (encoder_diffState == ENCODER_DIFF_CCW) {
|
|
|
|
if (select_print.dec()) {
|
|
|
|
switch (select_print.now) {
|
|
|
|
case 0:
|
|
|
|
ICON_Tune();
|
|
|
|
if (printingIsPaused()) ICON_Continue(); else ICON_Pause();
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
if (printingIsPaused()) ICON_Continue(); else ICON_Pause();
|
|
|
|
ICON_Stop();
|
|
|
|
break;
|
|
|
|
case 2: ICON_Stop(); break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (encoder_diffState == ENCODER_DIFF_ENTER) {
|
|
|
|
switch (select_print.now) {
|
2020-09-17 05:35:04 -05:00
|
|
|
case 0: // Tune
|
2020-06-16 01:45:27 -05:00
|
|
|
checkkey = Tune;
|
|
|
|
HMI_ValueStruct.show_mode = 0;
|
|
|
|
select_tune.reset();
|
2020-09-17 05:35:04 -05:00
|
|
|
index_tune = MROWS;
|
2020-06-16 01:45:27 -05:00
|
|
|
Draw_Tune_Menu();
|
|
|
|
break;
|
2020-09-16 06:56:48 -05:00
|
|
|
case 1: // Pause
|
2020-06-16 01:45:27 -05:00
|
|
|
if (HMI_flag.pause_flag) {
|
|
|
|
ICON_Pause();
|
|
|
|
|
|
|
|
char cmd[40];
|
|
|
|
cmd[0] = '\0';
|
|
|
|
|
|
|
|
#if ENABLED(PAUSE_HEAT)
|
2020-09-17 05:35:04 -05:00
|
|
|
#if HAS_HEATED_BED
|
|
|
|
if (tempbed) sprintf_P(cmd, PSTR("M190 S%i\n"), tempbed);
|
|
|
|
#endif
|
|
|
|
#if HAS_HOTEND
|
|
|
|
if (temphot) sprintf_P(&cmd[strlen(cmd)], PSTR("M109 S%i\n"), temphot);
|
|
|
|
#endif
|
2020-06-16 01:45:27 -05:00
|
|
|
#endif
|
|
|
|
|
|
|
|
strcat_P(cmd, PSTR("M24"));
|
|
|
|
queue.inject(cmd);
|
|
|
|
}
|
|
|
|
else {
|
2020-09-17 05:35:04 -05:00
|
|
|
HMI_flag.select_flag = true;
|
2020-06-16 01:45:27 -05:00
|
|
|
checkkey = Print_window;
|
|
|
|
Popup_window_PauseOrStop();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2020-09-16 06:56:48 -05:00
|
|
|
case 2: // Stop
|
2020-09-17 05:35:04 -05:00
|
|
|
HMI_flag.select_flag = true;
|
2020-06-16 01:45:27 -05:00
|
|
|
checkkey = Print_window;
|
|
|
|
Popup_window_PauseOrStop();
|
|
|
|
break;
|
|
|
|
|
2020-09-16 04:35:30 -05:00
|
|
|
default: break;
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
DWIN_UpdateLCD();
|
|
|
|
}
|
|
|
|
|
2020-09-16 06:56:48 -05:00
|
|
|
/* Pause and Stop window */
|
2020-09-17 05:35:04 -05:00
|
|
|
void HMI_PauseOrStop() {
|
2020-06-16 01:45:27 -05:00
|
|
|
ENCODER_DiffState encoder_diffState = get_encoder_state();
|
|
|
|
if (encoder_diffState == ENCODER_DIFF_NO) return;
|
|
|
|
|
2020-09-27 16:46:26 -05:00
|
|
|
if (encoder_diffState == ENCODER_DIFF_CW)
|
2020-06-16 01:45:27 -05:00
|
|
|
Draw_Select_Highlight(false);
|
2020-09-27 16:46:26 -05:00
|
|
|
else if (encoder_diffState == ENCODER_DIFF_CCW)
|
2020-06-16 01:45:27 -05:00
|
|
|
Draw_Select_Highlight(true);
|
|
|
|
else if (encoder_diffState == ENCODER_DIFF_ENTER) {
|
|
|
|
if (select_print.now == 1) { // pause window
|
|
|
|
if (HMI_flag.select_flag) {
|
2020-09-17 05:35:04 -05:00
|
|
|
HMI_flag.pause_action = true;
|
2020-06-16 01:45:27 -05:00
|
|
|
ICON_Continue();
|
|
|
|
#if ENABLED(POWER_LOSS_RECOVERY)
|
|
|
|
if (recovery.enabled) recovery.save(true);
|
|
|
|
#endif
|
|
|
|
queue.inject_P(PSTR("M25"));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
// cancel pause
|
|
|
|
}
|
|
|
|
Goto_PrintProcess();
|
|
|
|
}
|
|
|
|
else if (select_print.now == 2) { // stop window
|
|
|
|
if (HMI_flag.select_flag) {
|
2020-07-14 20:01:29 -05:00
|
|
|
wait_for_heatup = false; // Stop waiting for heater
|
2020-06-16 01:45:27 -05:00
|
|
|
|
|
|
|
#if 0
|
|
|
|
// TODO: In ExtUI or MarlinUI add a common stop event
|
2020-07-14 20:01:29 -05:00
|
|
|
// card.flag.abort_sd_printing = true;
|
2020-06-16 01:45:27 -05:00
|
|
|
#else
|
|
|
|
checkkey = Back_Main;
|
|
|
|
// Wait for planner moves to finish!
|
|
|
|
if (HMI_flag.home_flag) planner.synchronize();
|
|
|
|
card.endFilePrint();
|
|
|
|
#ifdef ACTION_ON_CANCEL
|
|
|
|
host_action_cancel();
|
|
|
|
#endif
|
2020-08-10 20:25:35 -05:00
|
|
|
#ifdef EVENT_GCODE_SD_ABORT
|
2020-09-17 05:35:04 -05:00
|
|
|
Popup_Window_Home(true);
|
2020-08-10 20:25:35 -05:00
|
|
|
queue.inject_P(PSTR(EVENT_GCODE_SD_ABORT));
|
2020-06-16 01:45:27 -05:00
|
|
|
#endif
|
2020-09-17 05:35:04 -05:00
|
|
|
dwin_abort_flag = true;
|
2020-06-16 01:45:27 -05:00
|
|
|
#endif
|
|
|
|
}
|
2020-07-14 20:01:29 -05:00
|
|
|
else {
|
|
|
|
Goto_PrintProcess(); // cancel stop
|
|
|
|
}
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
DWIN_UpdateLCD();
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void Draw_Move_Menu() {
|
|
|
|
Clear_Main_Window();
|
|
|
|
|
2020-08-21 23:44:21 -05:00
|
|
|
if (HMI_flag.language_chinese) {
|
2020-09-16 06:56:48 -05:00
|
|
|
DWIN_Frame_TitleCopy(1, 192, 1, 233, 14); // "Move"
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 58, 118, 106, 132, LBLX, MBASE(1));
|
|
|
|
DWIN_Frame_AreaCopy(1, 109, 118, 157, 132, LBLX, MBASE(2));
|
|
|
|
DWIN_Frame_AreaCopy(1, 160, 118, 209, 132, LBLX, MBASE(3));
|
2020-08-19 00:49:23 -05:00
|
|
|
#if HAS_HOTEND
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 212, 118, 253, 131, LBLX, MBASE(4));
|
2020-08-19 00:49:23 -05:00
|
|
|
#endif
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
#ifdef USE_STRING_HEADINGS
|
2020-08-02 20:00:06 -05:00
|
|
|
Draw_Title(GET_TEXT_F(MSG_MOVE_AXIS));
|
2020-06-16 01:45:27 -05:00
|
|
|
#else
|
2020-09-17 05:35:04 -05:00
|
|
|
DWIN_Frame_TitleCopy(1, 231, 2, 265, 12); // "Move"
|
2020-06-16 01:45:27 -05:00
|
|
|
#endif
|
2020-09-16 04:35:30 -05:00
|
|
|
draw_move_en(MBASE(1)); say_x(36, MBASE(1)); // "Move X"
|
|
|
|
draw_move_en(MBASE(2)); say_y(36, MBASE(2)); // "Move Y"
|
|
|
|
draw_move_en(MBASE(3)); say_z(36, MBASE(3)); // "Move Z"
|
2020-08-19 00:49:23 -05:00
|
|
|
#if HAS_HOTEND
|
2020-09-17 05:35:04 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 123, 192, 176, 202, LBLX, MBASE(4)); // "Extruder"
|
2020-08-19 00:49:23 -05:00
|
|
|
#endif
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
Draw_Back_First(select_axis.now == 0);
|
|
|
|
if (select_axis.now) Draw_Menu_Cursor(select_axis.now);
|
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
// Draw separators and icons
|
2020-09-16 06:56:48 -05:00
|
|
|
LOOP_L_N(i, 3 + ENABLED(HAS_HOTEND)) Draw_Menu_Line(i + 1, ICON_MoveX + i);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
|
2020-09-06 21:40:58 -05:00
|
|
|
#include "../../../libs/buzzer.h"
|
2020-08-19 00:49:23 -05:00
|
|
|
|
|
|
|
void HMI_AudioFeedback(const bool success=true) {
|
|
|
|
if (success) {
|
|
|
|
buzzer.tone(100, 659);
|
|
|
|
buzzer.tone(10, 0);
|
|
|
|
buzzer.tone(100, 698);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
buzzer.tone(40, 440);
|
|
|
|
}
|
|
|
|
|
2020-06-16 01:45:27 -05:00
|
|
|
/* Prepare */
|
2020-09-17 05:35:04 -05:00
|
|
|
void HMI_Prepare() {
|
2020-06-16 01:45:27 -05:00
|
|
|
ENCODER_DiffState encoder_diffState = get_encoder_state();
|
|
|
|
if (encoder_diffState == ENCODER_DIFF_NO) return;
|
|
|
|
|
|
|
|
// Avoid flicker by updating only the previous menu
|
|
|
|
if (encoder_diffState == ENCODER_DIFF_CW) {
|
2020-09-17 05:35:04 -05:00
|
|
|
if (select_prepare.inc(1 + PREPARE_CASE_TOTAL)) {
|
2020-06-16 01:45:27 -05:00
|
|
|
if (select_prepare.now > MROWS && select_prepare.now > index_prepare) {
|
|
|
|
index_prepare = select_prepare.now;
|
|
|
|
|
|
|
|
// Scroll up and draw a blank bottom line
|
|
|
|
Scroll_Menu(DWIN_SCROLL_UP);
|
2020-07-14 20:01:29 -05:00
|
|
|
Draw_Menu_Icon(MROWS, ICON_Axis + select_prepare.now - 1);
|
2020-06-16 01:45:27 -05:00
|
|
|
|
|
|
|
// Draw "More" icon for sub-menus
|
2020-07-14 20:01:29 -05:00
|
|
|
if (index_prepare < 7) Draw_More_Icon(MROWS - index_prepare + 1);
|
2020-06-16 01:45:27 -05:00
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
#if HAS_HOTEND
|
|
|
|
if (index_prepare == PREPARE_CASE_ABS) Item_Prepare_ABS(MROWS);
|
|
|
|
#endif
|
|
|
|
#if HAS_PREHEAT
|
|
|
|
if (index_prepare == PREPARE_CASE_COOL) Item_Prepare_Cool(MROWS);
|
|
|
|
#endif
|
|
|
|
if (index_prepare == PREPARE_CASE_LANG) Item_Prepare_Lang(MROWS);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
2020-07-14 20:01:29 -05:00
|
|
|
else {
|
|
|
|
Move_Highlight(1, select_prepare.now + MROWS - index_prepare);
|
|
|
|
}
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (encoder_diffState == ENCODER_DIFF_CCW) {
|
|
|
|
if (select_prepare.dec()) {
|
2020-07-14 20:01:29 -05:00
|
|
|
if (select_prepare.now < index_prepare - MROWS) {
|
2020-06-16 01:45:27 -05:00
|
|
|
index_prepare--;
|
|
|
|
Scroll_Menu(DWIN_SCROLL_DOWN);
|
|
|
|
|
|
|
|
if (index_prepare == MROWS)
|
|
|
|
Draw_Back_First();
|
|
|
|
else
|
2020-07-14 20:01:29 -05:00
|
|
|
Draw_Menu_Line(0, ICON_Axis + select_prepare.now - 1);
|
2020-06-16 01:45:27 -05:00
|
|
|
|
2020-07-14 20:01:29 -05:00
|
|
|
if (index_prepare < 7) Draw_More_Icon(MROWS - index_prepare + 1);
|
2020-06-16 01:45:27 -05:00
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
if (index_prepare == 6) Item_Prepare_Move(0);
|
|
|
|
else if (index_prepare == 7) Item_Prepare_Disable(0);
|
|
|
|
else if (index_prepare == 8) Item_Prepare_Home(0);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
2020-07-14 20:01:29 -05:00
|
|
|
else {
|
|
|
|
Move_Highlight(-1, select_prepare.now + MROWS - index_prepare);
|
|
|
|
}
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (encoder_diffState == ENCODER_DIFF_ENTER) {
|
|
|
|
switch (select_prepare.now) {
|
2020-09-16 06:56:48 -05:00
|
|
|
case 0: // Back
|
2020-06-16 01:45:27 -05:00
|
|
|
select_page.set(1);
|
|
|
|
Goto_MainMenu();
|
|
|
|
break;
|
2020-09-17 05:35:04 -05:00
|
|
|
case PREPARE_CASE_MOVE: // Axis move
|
2020-06-16 01:45:27 -05:00
|
|
|
checkkey = AxisMove;
|
|
|
|
select_axis.reset();
|
|
|
|
Draw_Move_Menu();
|
|
|
|
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 216, MBASE(1), current_position.x * MINUNITMULT);
|
|
|
|
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 216, MBASE(2), current_position.y * MINUNITMULT);
|
|
|
|
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 216, MBASE(3), current_position.z * MINUNITMULT);
|
2020-09-16 06:56:48 -05:00
|
|
|
#if HAS_HOTEND
|
2020-09-17 05:35:04 -05:00
|
|
|
queue.inject_P(PSTR("G92 E0"));
|
|
|
|
current_position.e = HMI_ValueStruct.Move_E_scale = 0;
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_Signed_Float(font8x16, Color_Bg_Black, 3, 1, 216, MBASE(4), 0);
|
2020-09-16 06:56:48 -05:00
|
|
|
#endif
|
2020-06-16 01:45:27 -05:00
|
|
|
break;
|
2020-09-17 05:35:04 -05:00
|
|
|
case PREPARE_CASE_DISA: // Disable steppers
|
2020-06-16 01:45:27 -05:00
|
|
|
queue.inject_P(PSTR("M84"));
|
|
|
|
break;
|
2020-09-17 05:35:04 -05:00
|
|
|
case PREPARE_CASE_HOME: // Homing
|
2020-06-16 01:45:27 -05:00
|
|
|
checkkey = Last_Prepare;
|
|
|
|
index_prepare = MROWS;
|
|
|
|
queue.inject_P(PSTR("G28")); // G28 will set home_flag
|
|
|
|
Popup_Window_Home();
|
|
|
|
break;
|
2020-09-17 05:35:04 -05:00
|
|
|
#if HAS_ZOFFSET_ITEM
|
|
|
|
case PREPARE_CASE_ZOFF: // Z-offset
|
|
|
|
#if EITHER(HAS_BED_PROBE, BABYSTEPPING)
|
|
|
|
checkkey = Homeoffset;
|
|
|
|
HMI_ValueStruct.show_mode = -4;
|
|
|
|
HMI_ValueStruct.offset_value = BABY_Z_VAR * 100;
|
|
|
|
DWIN_Draw_Signed_Float(font8x16, Select_Color, 2, 2, 202, MBASE(PREPARE_CASE_ZOFF + MROWS - index_prepare), HMI_ValueStruct.offset_value);
|
|
|
|
EncoderRate.enabled = true;
|
|
|
|
#else
|
|
|
|
// Apply workspace offset, making the current position 0,0,0
|
|
|
|
queue.inject_P(PSTR("G92 X0 Y0 Z0"));
|
|
|
|
HMI_AudioFeedback();
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
#if HAS_HOTEND
|
|
|
|
case PREPARE_CASE_PLA: // PLA preheat
|
|
|
|
thermalManager.setTargetHotend(ui.material_preset[0].hotend_temp, 0);
|
|
|
|
thermalManager.setTargetBed(ui.material_preset[0].bed_temp);
|
|
|
|
thermalManager.set_fan_speed(0, ui.material_preset[0].fan_speed);
|
|
|
|
break;
|
|
|
|
case PREPARE_CASE_ABS: // ABS preheat
|
|
|
|
thermalManager.setTargetHotend(ui.material_preset[1].hotend_temp, 0);
|
|
|
|
thermalManager.setTargetBed(ui.material_preset[1].bed_temp);
|
|
|
|
thermalManager.set_fan_speed(0, ui.material_preset[1].fan_speed);
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
#if HAS_PREHEAT
|
|
|
|
case PREPARE_CASE_COOL: // Cool
|
|
|
|
TERN_(HAS_FAN, thermalManager.zero_fan_speeds());
|
|
|
|
#if HAS_HOTEND || HAS_HEATED_BED
|
|
|
|
thermalManager.disable_all_heaters();
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
case PREPARE_CASE_LANG: // Toggle Language
|
|
|
|
HMI_ToggleLanguage();
|
2020-06-16 01:45:27 -05:00
|
|
|
Draw_Prepare_Menu();
|
|
|
|
break;
|
2020-09-16 04:35:30 -05:00
|
|
|
default: break;
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
DWIN_UpdateLCD();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Draw_Temperature_Menu() {
|
|
|
|
Clear_Main_Window();
|
|
|
|
|
2020-08-21 23:44:21 -05:00
|
|
|
if (HMI_flag.language_chinese) {
|
2020-09-17 05:35:04 -05:00
|
|
|
DWIN_Frame_TitleCopy(1, 236, 2, 263, 13); // "Temperature"
|
|
|
|
#if HAS_HOTEND
|
|
|
|
DWIN_Frame_AreaCopy(1, 1, 134, 56, 146, LBLX, MBASE(TEMP_CASE_TEMP));
|
|
|
|
#endif
|
|
|
|
#if HAS_HEATED_BED
|
|
|
|
DWIN_Frame_AreaCopy(1, 58, 134, 113, 146, LBLX, MBASE(TEMP_CASE_BED));
|
|
|
|
#endif
|
|
|
|
#if HAS_FAN
|
|
|
|
DWIN_Frame_AreaCopy(1, 115, 134, 170, 146, LBLX, MBASE(TEMP_CASE_FAN));
|
|
|
|
#endif
|
|
|
|
#if HAS_HOTEND
|
|
|
|
DWIN_Frame_AreaCopy(1, 100, 89, 178, 101, LBLX, MBASE(TEMP_CASE_PLA));
|
|
|
|
DWIN_Frame_AreaCopy(1, 180, 89, 260, 100, LBLX, MBASE(TEMP_CASE_ABS));
|
|
|
|
#endif
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
#ifdef USE_STRING_HEADINGS
|
2020-08-02 20:00:06 -05:00
|
|
|
Draw_Title(GET_TEXT_F(MSG_TEMPERATURE));
|
2020-09-17 05:35:04 -05:00
|
|
|
#if HAS_HOTEND
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(TEMP_CASE_TEMP), GET_TEXT_F(MSG_UBL_SET_TEMP_HOTEND));
|
2020-09-17 05:35:04 -05:00
|
|
|
#endif
|
|
|
|
#if HAS_HEATED_BED
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(TEMP_CASE_BED), GET_TEXT_F(MSG_UBL_SET_TEMP_BED));
|
2020-09-17 05:35:04 -05:00
|
|
|
#endif
|
|
|
|
#if HAS_FAN
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(TEMP_CASE_FAN), GET_TEXT_F(MSG_FAN_SPEED));
|
2020-09-17 05:35:04 -05:00
|
|
|
#endif
|
|
|
|
#if HAS_HOTEND
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(TEMP_CASE_PLA), F("PLA Preheat Settings"));
|
|
|
|
DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(TEMP_CASE_ABS), F("ABS Preheat Settings"));
|
2020-09-17 05:35:04 -05:00
|
|
|
#endif
|
2020-06-16 01:45:27 -05:00
|
|
|
#else
|
2020-09-17 05:35:04 -05:00
|
|
|
DWIN_Frame_TitleCopy(1, 56, 16, 141, 28); // "Temperature"
|
|
|
|
#if HAS_HOTEND
|
|
|
|
DWIN_Frame_AreaCopy(1, 197, 104, 238, 114, LBLX, MBASE(TEMP_CASE_TEMP)); // Nozzle...
|
|
|
|
DWIN_Frame_AreaCopy(1, 1, 89, 83, 101, LBLX + 44, MBASE(TEMP_CASE_TEMP)); // ...Temperature
|
|
|
|
#endif
|
|
|
|
#if HAS_HEATED_BED
|
|
|
|
DWIN_Frame_AreaCopy(1, 240, 104, 264, 114, LBLX, MBASE(TEMP_CASE_BED)); // Bed...
|
|
|
|
DWIN_Frame_AreaCopy(1, 1, 89, 83, 101, LBLX + 27, MBASE(TEMP_CASE_BED)); // ...Temperature
|
|
|
|
#endif
|
|
|
|
#if HAS_FAN
|
|
|
|
DWIN_Frame_AreaCopy(1, 0, 119, 64, 132, LBLX, MBASE(TEMP_CASE_FAN)); // Fan speed
|
|
|
|
#endif
|
|
|
|
#if HAS_HOTEND
|
|
|
|
DWIN_Frame_AreaCopy(1, 107, 76, 156, 86, LBLX, MBASE(TEMP_CASE_PLA)); // Preheat...
|
|
|
|
DWIN_Frame_AreaCopy(1, 157, 76, 181, 86, LBLX + 52, MBASE(TEMP_CASE_PLA)); // ...PLA
|
|
|
|
DWIN_Frame_AreaCopy(1, 131, 119, 182, 132, LBLX + 79, MBASE(TEMP_CASE_PLA)); // PLA setting
|
|
|
|
DWIN_Frame_AreaCopy(1, 107, 76, 156, 86, LBLX, MBASE(TEMP_CASE_ABS)); // Preheat...
|
|
|
|
DWIN_Frame_AreaCopy(1, 172, 76, 198, 86, LBLX + 52, MBASE(TEMP_CASE_ABS)); // ...ABS
|
|
|
|
DWIN_Frame_AreaCopy(1, 131, 119, 182, 132, LBLX + 81, MBASE(TEMP_CASE_ABS)); // ABS setting
|
|
|
|
#endif
|
2020-06-16 01:45:27 -05:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
Draw_Back_First(select_temp.now == 0);
|
|
|
|
if (select_temp.now) Draw_Menu_Cursor(select_temp.now);
|
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
// Draw icons and lines
|
|
|
|
uint8_t i = 0;
|
|
|
|
#define _TMENU_ICON(N) Draw_Menu_Line(++i, ICON_SetEndTemp + (N) - 1)
|
|
|
|
#if HAS_HOTEND
|
|
|
|
_TMENU_ICON(TEMP_CASE_TEMP);
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(i), thermalManager.temp_hotend[0].target);
|
2020-09-17 05:35:04 -05:00
|
|
|
#endif
|
|
|
|
#if HAS_HEATED_BED
|
|
|
|
_TMENU_ICON(TEMP_CASE_BED);
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(i), thermalManager.temp_bed.target);
|
2020-09-17 05:35:04 -05:00
|
|
|
#endif
|
|
|
|
#if HAS_FAN
|
|
|
|
_TMENU_ICON(TEMP_CASE_FAN);
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(i), thermalManager.fan_speed[0]);
|
2020-09-17 05:35:04 -05:00
|
|
|
#endif
|
|
|
|
#if HAS_HOTEND
|
|
|
|
// PLA/ABS items have submenus
|
|
|
|
_TMENU_ICON(TEMP_CASE_PLA);
|
|
|
|
Draw_More_Icon(i);
|
|
|
|
_TMENU_ICON(TEMP_CASE_ABS);
|
|
|
|
Draw_More_Icon(i);
|
|
|
|
#endif
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Control */
|
2020-09-17 05:35:04 -05:00
|
|
|
void HMI_Control() {
|
2020-06-16 01:45:27 -05:00
|
|
|
ENCODER_DiffState encoder_diffState = get_encoder_state();
|
|
|
|
if (encoder_diffState == ENCODER_DIFF_NO) return;
|
|
|
|
|
|
|
|
// Avoid flicker by updating only the previous menu
|
|
|
|
if (encoder_diffState == ENCODER_DIFF_CW) {
|
2020-09-17 05:35:04 -05:00
|
|
|
if (select_control.inc(1 + CONTROL_CASE_TOTAL)) {
|
2020-06-16 01:45:27 -05:00
|
|
|
if (select_control.now > MROWS && select_control.now > index_control) {
|
|
|
|
index_control = select_control.now;
|
|
|
|
Scroll_Menu(DWIN_SCROLL_UP);
|
2020-09-17 05:35:04 -05:00
|
|
|
Draw_Menu_Icon(MROWS, ICON_Temperature + index_control - 1);
|
|
|
|
Draw_More_Icon(CONTROL_CASE_TEMP + MROWS - index_control); // Temperature >
|
|
|
|
Draw_More_Icon(CONTROL_CASE_MOVE + MROWS - index_control); // Motion >
|
2020-06-16 01:45:27 -05:00
|
|
|
if (index_control > MROWS) {
|
2020-09-17 05:35:04 -05:00
|
|
|
Draw_More_Icon(CONTROL_CASE_INFO + MROWS - index_control); // Info >
|
2020-08-21 23:44:21 -05:00
|
|
|
if (HMI_flag.language_chinese)
|
2020-09-17 05:35:04 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 231, 104, 258, 116, LBLX, MBASE(CONTROL_CASE_INFO - 1));
|
2020-06-16 01:45:27 -05:00
|
|
|
else
|
2020-09-17 05:35:04 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 0, 104, 24, 114, LBLX, MBASE(CONTROL_CASE_INFO - 1));
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
}
|
2020-07-14 20:01:29 -05:00
|
|
|
else {
|
|
|
|
Move_Highlight(1, select_control.now + MROWS - index_control);
|
|
|
|
}
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (encoder_diffState == ENCODER_DIFF_CCW) {
|
|
|
|
if (select_control.dec()) {
|
2020-07-14 20:01:29 -05:00
|
|
|
if (select_control.now < index_control - MROWS) {
|
2020-06-16 01:45:27 -05:00
|
|
|
index_control--;
|
|
|
|
Scroll_Menu(DWIN_SCROLL_DOWN);
|
|
|
|
if (index_control == MROWS)
|
|
|
|
Draw_Back_First();
|
|
|
|
else
|
2020-07-14 20:01:29 -05:00
|
|
|
Draw_Menu_Line(0, ICON_Temperature + select_control.now - 1);
|
|
|
|
Draw_More_Icon(0 + MROWS - index_control + 1); // Temperature >
|
|
|
|
Draw_More_Icon(1 + MROWS - index_control + 1); // Motion >
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
Move_Highlight(-1, select_control.now + MROWS - index_control);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (encoder_diffState == ENCODER_DIFF_ENTER) {
|
|
|
|
switch (select_control.now) {
|
2020-09-16 06:56:48 -05:00
|
|
|
case 0: // Back
|
2020-06-16 01:45:27 -05:00
|
|
|
select_page.set(2);
|
|
|
|
Goto_MainMenu();
|
|
|
|
break;
|
2020-09-17 05:35:04 -05:00
|
|
|
case CONTROL_CASE_TEMP: // Temperature
|
2020-06-16 01:45:27 -05:00
|
|
|
checkkey = TemperatureID;
|
|
|
|
HMI_ValueStruct.show_mode = -1;
|
|
|
|
select_temp.reset();
|
|
|
|
Draw_Temperature_Menu();
|
|
|
|
break;
|
2020-09-17 05:35:04 -05:00
|
|
|
case CONTROL_CASE_MOVE: // Motion
|
2020-06-16 01:45:27 -05:00
|
|
|
checkkey = Motion;
|
|
|
|
select_motion.reset();
|
|
|
|
Draw_Motion_Menu();
|
|
|
|
break;
|
2020-09-14 02:48:45 -05:00
|
|
|
#if ENABLED(EEPROM_SETTINGS)
|
2020-09-17 05:35:04 -05:00
|
|
|
case CONTROL_CASE_SAVE: { // Write EEPROM
|
2020-09-14 02:48:45 -05:00
|
|
|
const bool success = settings.save();
|
|
|
|
HMI_AudioFeedback(success);
|
|
|
|
} break;
|
2020-09-17 05:35:04 -05:00
|
|
|
case CONTROL_CASE_LOAD: { // Read EEPROM
|
2020-09-14 02:48:45 -05:00
|
|
|
const bool success = settings.load();
|
|
|
|
HMI_AudioFeedback(success);
|
|
|
|
} break;
|
2020-09-17 05:35:04 -05:00
|
|
|
case CONTROL_CASE_RESET: // Reset EEPROM
|
2020-09-14 02:48:45 -05:00
|
|
|
settings.reset();
|
|
|
|
HMI_AudioFeedback();
|
|
|
|
break;
|
|
|
|
#endif
|
2020-09-17 05:35:04 -05:00
|
|
|
case CONTROL_CASE_INFO: // Info
|
2020-06-16 01:45:27 -05:00
|
|
|
checkkey = Info;
|
|
|
|
Draw_Info_Menu();
|
|
|
|
break;
|
2020-09-16 04:35:30 -05:00
|
|
|
default: break;
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
DWIN_UpdateLCD();
|
|
|
|
}
|
|
|
|
|
2020-09-03 16:52:31 -05:00
|
|
|
|
|
|
|
#if HAS_ONESTEP_LEVELING
|
|
|
|
|
|
|
|
/* Leveling */
|
2020-09-17 05:35:04 -05:00
|
|
|
void HMI_Leveling() {
|
2020-09-03 16:52:31 -05:00
|
|
|
Popup_Window_Leveling();
|
|
|
|
DWIN_UpdateLCD();
|
|
|
|
queue.inject_P(PSTR("G28O\nG29"));
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
2020-06-16 01:45:27 -05:00
|
|
|
|
|
|
|
/* Axis Move */
|
2020-09-17 05:35:04 -05:00
|
|
|
void HMI_AxisMove() {
|
2020-06-16 01:45:27 -05:00
|
|
|
ENCODER_DiffState encoder_diffState = get_encoder_state();
|
|
|
|
if (encoder_diffState == ENCODER_DIFF_NO) return;
|
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
#if ENABLED(PREVENT_COLD_EXTRUSION)
|
2020-06-24 19:44:50 -05:00
|
|
|
// popup window resume
|
|
|
|
if (HMI_flag.ETempTooLow_flag) {
|
|
|
|
if (encoder_diffState == ENCODER_DIFF_ENTER) {
|
2020-09-17 05:35:04 -05:00
|
|
|
HMI_flag.ETempTooLow_flag = false;
|
2020-06-24 19:44:50 -05:00
|
|
|
current_position.e = HMI_ValueStruct.Move_E_scale = 0;
|
2020-09-17 05:35:04 -05:00
|
|
|
Draw_Move_Menu();
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 216, MBASE(1), HMI_ValueStruct.Move_X_scale);
|
|
|
|
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 216, MBASE(2), HMI_ValueStruct.Move_Y_scale);
|
|
|
|
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 216, MBASE(3), HMI_ValueStruct.Move_Z_scale);
|
|
|
|
DWIN_Draw_Signed_Float(font8x16, Color_Bg_Black, 3, 1, 216, MBASE(4), 0);
|
2020-06-24 19:44:50 -05:00
|
|
|
DWIN_UpdateLCD();
|
|
|
|
}
|
|
|
|
return;
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
2020-06-24 19:44:50 -05:00
|
|
|
#endif
|
|
|
|
|
2020-06-16 01:45:27 -05:00
|
|
|
// Avoid flicker by updating only the previous menu
|
|
|
|
if (encoder_diffState == ENCODER_DIFF_CW) {
|
2020-09-17 05:35:04 -05:00
|
|
|
if (select_axis.inc(1 + 3 + ENABLED(HAS_HOTEND))) Move_Highlight(1, select_axis.now);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
else if (encoder_diffState == ENCODER_DIFF_CCW) {
|
|
|
|
if (select_axis.dec()) Move_Highlight(-1, select_axis.now);
|
|
|
|
}
|
|
|
|
else if (encoder_diffState == ENCODER_DIFF_ENTER) {
|
|
|
|
switch (select_axis.now) {
|
2020-09-16 06:56:48 -05:00
|
|
|
case 0: // Back
|
2020-06-16 01:45:27 -05:00
|
|
|
checkkey = Prepare;
|
|
|
|
select_prepare.set(1);
|
|
|
|
index_prepare = MROWS;
|
|
|
|
Draw_Prepare_Menu();
|
|
|
|
break;
|
|
|
|
case 1: // X axis move
|
|
|
|
checkkey = Move_X;
|
2020-09-16 06:56:48 -05:00
|
|
|
HMI_ValueStruct.Move_X_scale = current_position.x * MINUNITMULT;
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 1, 216, MBASE(1), HMI_ValueStruct.Move_X_scale);
|
2020-09-17 05:35:04 -05:00
|
|
|
EncoderRate.enabled = true;
|
2020-06-16 01:45:27 -05:00
|
|
|
break;
|
|
|
|
case 2: // Y axis move
|
|
|
|
checkkey = Move_Y;
|
2020-09-16 06:56:48 -05:00
|
|
|
HMI_ValueStruct.Move_Y_scale = current_position.y * MINUNITMULT;
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 1, 216, MBASE(2), HMI_ValueStruct.Move_Y_scale);
|
2020-09-17 05:35:04 -05:00
|
|
|
EncoderRate.enabled = true;
|
2020-06-16 01:45:27 -05:00
|
|
|
break;
|
|
|
|
case 3: // Z axis move
|
|
|
|
checkkey = Move_Z;
|
2020-09-16 06:56:48 -05:00
|
|
|
HMI_ValueStruct.Move_Z_scale = current_position.z * MINUNITMULT;
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 1, 216, MBASE(3), HMI_ValueStruct.Move_Z_scale);
|
2020-09-17 05:35:04 -05:00
|
|
|
EncoderRate.enabled = true;
|
2020-06-16 01:45:27 -05:00
|
|
|
break;
|
2020-07-14 20:01:29 -05:00
|
|
|
#if HAS_HOTEND
|
|
|
|
case 4: // Extruder
|
|
|
|
// window tips
|
|
|
|
#ifdef PREVENT_COLD_EXTRUSION
|
|
|
|
if (thermalManager.temp_hotend[0].celsius < EXTRUDE_MINTEMP) {
|
2020-09-17 05:35:04 -05:00
|
|
|
HMI_flag.ETempTooLow_flag = true;
|
2020-07-14 20:01:29 -05:00
|
|
|
Popup_Window_ETempTooLow();
|
|
|
|
DWIN_UpdateLCD();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
checkkey = Extruder;
|
|
|
|
HMI_ValueStruct.Move_E_scale = current_position.e * MINUNITMULT;
|
2020-09-14 02:48:45 -05:00
|
|
|
DWIN_Draw_Signed_Float(font8x16, Select_Color, 3, 1, 216, MBASE(4), HMI_ValueStruct.Move_E_scale);
|
2020-09-17 05:35:04 -05:00
|
|
|
EncoderRate.enabled = true;
|
2020-07-14 20:01:29 -05:00
|
|
|
break;
|
|
|
|
#endif
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
DWIN_UpdateLCD();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* TemperatureID */
|
2020-09-17 05:35:04 -05:00
|
|
|
void HMI_Temperature() {
|
2020-06-16 01:45:27 -05:00
|
|
|
ENCODER_DiffState encoder_diffState = get_encoder_state();
|
|
|
|
if (encoder_diffState == ENCODER_DIFF_NO) return;
|
|
|
|
|
|
|
|
// Avoid flicker by updating only the previous menu
|
|
|
|
if (encoder_diffState == ENCODER_DIFF_CW) {
|
2020-09-17 05:35:04 -05:00
|
|
|
if (select_temp.inc(1 + TEMP_CASE_TOTAL)) Move_Highlight(1, select_temp.now);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
else if (encoder_diffState == ENCODER_DIFF_CCW) {
|
|
|
|
if (select_temp.dec()) Move_Highlight(-1, select_temp.now);
|
|
|
|
}
|
|
|
|
else if (encoder_diffState == ENCODER_DIFF_ENTER) {
|
|
|
|
switch (select_temp.now) {
|
2020-09-16 06:56:48 -05:00
|
|
|
case 0: // Back
|
2020-06-16 01:45:27 -05:00
|
|
|
checkkey = Control;
|
|
|
|
select_control.set(1);
|
|
|
|
index_control = MROWS;
|
|
|
|
Draw_Control_Menu();
|
|
|
|
break;
|
2020-09-17 05:35:04 -05:00
|
|
|
#if HAS_HOTEND
|
|
|
|
case TEMP_CASE_TEMP: // Nozzle temperature
|
|
|
|
checkkey = ETemp;
|
|
|
|
HMI_ValueStruct.E_Temp = thermalManager.temp_hotend[0].target;
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 216, MBASE(1), thermalManager.temp_hotend[0].target);
|
2020-09-17 05:35:04 -05:00
|
|
|
EncoderRate.enabled = true;
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
#if HAS_HEATED_BED
|
|
|
|
case TEMP_CASE_BED: // Bed temperature
|
|
|
|
checkkey = BedTemp;
|
|
|
|
HMI_ValueStruct.Bed_Temp = thermalManager.temp_bed.target;
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 216, MBASE(2), thermalManager.temp_bed.target);
|
2020-09-17 05:35:04 -05:00
|
|
|
EncoderRate.enabled = true;
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
#if HAS_FAN
|
|
|
|
case TEMP_CASE_FAN: // Fan speed
|
|
|
|
checkkey = FanSpeed;
|
|
|
|
HMI_ValueStruct.Fan_speed = thermalManager.fan_speed[0];
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 216, MBASE(3), thermalManager.fan_speed[0]);
|
2020-09-17 05:35:04 -05:00
|
|
|
EncoderRate.enabled = true;
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
#if HAS_HOTEND
|
|
|
|
case TEMP_CASE_PLA: { // PLA preheat setting
|
|
|
|
checkkey = PLAPreheat;
|
|
|
|
select_PLA.reset();
|
|
|
|
HMI_ValueStruct.show_mode = -2;
|
|
|
|
|
|
|
|
Clear_Main_Window();
|
|
|
|
|
|
|
|
if (HMI_flag.language_chinese) {
|
|
|
|
DWIN_Frame_TitleCopy(1, 59, 16, 139, 29); // "PLA Settings"
|
|
|
|
DWIN_Frame_AreaCopy(1, 100, 89, 124, 101, LBLX, MBASE(PREHEAT_CASE_TEMP));
|
|
|
|
DWIN_Frame_AreaCopy(1, 1, 134, 56, 146, LBLX + 24, MBASE(PREHEAT_CASE_TEMP)); // PLA nozzle temp
|
|
|
|
#if HAS_HEATED_BED
|
|
|
|
DWIN_Frame_AreaCopy(1, 100, 89, 124, 101, LBLX, MBASE(PREHEAT_CASE_BED));
|
|
|
|
DWIN_Frame_AreaCopy(1, 58, 134, 113, 146, LBLX + 24, MBASE(PREHEAT_CASE_BED)); // PLA bed temp
|
|
|
|
#endif
|
|
|
|
#if HAS_FAN
|
|
|
|
DWIN_Frame_AreaCopy(1, 100, 89, 124, 101, LBLX, MBASE(PREHEAT_CASE_FAN));
|
|
|
|
DWIN_Frame_AreaCopy(1, 115, 134, 170, 146, LBLX + 24, MBASE(PREHEAT_CASE_FAN)); // PLA fan speed
|
|
|
|
#endif
|
2020-09-14 02:48:45 -05:00
|
|
|
#if ENABLED(EEPROM_SETTINGS)
|
2020-09-17 05:35:04 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 72, 148, 151, 162, LBLX, MBASE(PREHEAT_CASE_SAVE)); // Save PLA configuration
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
#ifdef USE_STRING_HEADINGS
|
|
|
|
Draw_Title("PLA Settings"); // TODO: GET_TEXT_F
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(PREHEAT_CASE_TEMP), F("Nozzle Temp"));
|
2020-09-17 05:35:04 -05:00
|
|
|
#if HAS_HEATED_BED
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(PREHEAT_CASE_BED), F("Bed Temp"));
|
2020-09-17 05:35:04 -05:00
|
|
|
#endif
|
|
|
|
#if HAS_FAN
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(PREHEAT_CASE_FAN), GET_TEXT_F(MSG_FAN_SPEED));
|
2020-09-17 05:35:04 -05:00
|
|
|
#endif
|
|
|
|
#if ENABLED(EEPROM_SETTINGS)
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(PREHEAT_CASE_SAVE), GET_TEXT_F(MSG_STORE_EEPROM));
|
2020-09-17 05:35:04 -05:00
|
|
|
#endif
|
|
|
|
#else
|
|
|
|
DWIN_Frame_TitleCopy(1, 56, 16, 141, 28); // "PLA Settings"
|
|
|
|
DWIN_Frame_AreaCopy(1, 157, 76, 181, 86, LBLX, MBASE(PREHEAT_CASE_TEMP));
|
|
|
|
DWIN_Frame_AreaCopy(1, 197, 104, 238, 114, LBLX + 27, MBASE(PREHEAT_CASE_TEMP));
|
|
|
|
DWIN_Frame_AreaCopy(1, 1, 89, 83, 101, LBLX + 71, MBASE(PREHEAT_CASE_TEMP)); // PLA nozzle temp
|
|
|
|
#if HAS_HEATED_BED
|
|
|
|
DWIN_Frame_AreaCopy(1, 157, 76, 181, 86, LBLX, MBASE(PREHEAT_CASE_BED) + 3);
|
|
|
|
DWIN_Frame_AreaCopy(1, 240, 104, 264, 114, LBLX + 27, MBASE(PREHEAT_CASE_BED) + 3);
|
|
|
|
DWIN_Frame_AreaCopy(1, 1, 89, 83, 101, LBLX + 54, MBASE(PREHEAT_CASE_BED) + 3); // PLA bed temp
|
|
|
|
#endif
|
|
|
|
#if HAS_FAN
|
|
|
|
DWIN_Frame_AreaCopy(1, 157, 76, 181, 86, LBLX, MBASE(PREHEAT_CASE_FAN));
|
|
|
|
DWIN_Frame_AreaCopy(1, 0, 119, 64, 132, LBLX + 27, MBASE(PREHEAT_CASE_FAN)); // PLA fan speed
|
|
|
|
#endif
|
|
|
|
#if ENABLED(EEPROM_SETTINGS)
|
|
|
|
DWIN_Frame_AreaCopy(1, 97, 165, 229, 177, LBLX, MBASE(PREHEAT_CASE_SAVE)); // Save PLA configuration
|
|
|
|
#endif
|
2020-09-14 02:48:45 -05:00
|
|
|
#endif
|
2020-09-17 05:35:04 -05:00
|
|
|
}
|
2020-06-16 01:45:27 -05:00
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
Draw_Back_First();
|
2020-06-16 01:45:27 -05:00
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
uint8_t i = 0;
|
|
|
|
Draw_Menu_Line(++i, ICON_SetEndTemp);
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(i), ui.material_preset[0].hotend_temp);
|
2020-09-17 05:35:04 -05:00
|
|
|
#if HAS_HEATED_BED
|
|
|
|
Draw_Menu_Line(++i, ICON_SetBedTemp);
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(i), ui.material_preset[0].bed_temp);
|
2020-09-17 05:35:04 -05:00
|
|
|
#endif
|
|
|
|
#if HAS_FAN
|
|
|
|
Draw_Menu_Line(++i, ICON_FanSpeed);
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(i), ui.material_preset[0].fan_speed);
|
2020-09-17 05:35:04 -05:00
|
|
|
#endif
|
|
|
|
#if ENABLED(EEPROM_SETTINGS)
|
|
|
|
Draw_Menu_Line(++i, ICON_WriteEEPROM);
|
|
|
|
#endif
|
|
|
|
} break;
|
2020-06-16 01:45:27 -05:00
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
case TEMP_CASE_ABS: { // ABS preheat setting
|
|
|
|
checkkey = ABSPreheat;
|
|
|
|
select_ABS.reset();
|
|
|
|
HMI_ValueStruct.show_mode = -3;
|
2020-06-16 01:45:27 -05:00
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
Clear_Main_Window();
|
2020-06-16 01:45:27 -05:00
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
if (HMI_flag.language_chinese) {
|
|
|
|
DWIN_Frame_TitleCopy(1, 142, 16, 223, 29); // "ABS Settings"
|
|
|
|
|
|
|
|
DWIN_Frame_AreaCopy(1, 180, 89, 204, 100, LBLX, MBASE(PREHEAT_CASE_TEMP));
|
|
|
|
DWIN_Frame_AreaCopy(1, 1, 134, 56, 146, LBLX + 24, MBASE(PREHEAT_CASE_TEMP)); // ABS nozzle temp
|
|
|
|
#if HAS_HEATED_BED
|
|
|
|
DWIN_Frame_AreaCopy(1, 180, 89, 204, 100, LBLX, MBASE(PREHEAT_CASE_BED));
|
|
|
|
DWIN_Frame_AreaCopy(1, 58, 134, 113, 146, LBLX + 24, MBASE(PREHEAT_CASE_BED)); // ABS bed temp
|
|
|
|
#endif
|
|
|
|
#if HAS_FAN
|
|
|
|
DWIN_Frame_AreaCopy(1, 180, 89, 204, 100, LBLX, MBASE(PREHEAT_CASE_FAN));
|
|
|
|
DWIN_Frame_AreaCopy(1, 115, 134, 170, 146, LBLX + 24, MBASE(PREHEAT_CASE_FAN)); // ABS fan speed
|
|
|
|
#endif
|
2020-09-14 02:48:45 -05:00
|
|
|
#if ENABLED(EEPROM_SETTINGS)
|
2020-09-17 05:35:04 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 72, 148, 151, 162, LBLX, MBASE(PREHEAT_CASE_SAVE));
|
|
|
|
DWIN_Frame_AreaCopy(1, 180, 89, 204, 100, LBLX + 28, MBASE(PREHEAT_CASE_SAVE) + 2); // Save ABS configuration
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
#ifdef USE_STRING_HEADINGS
|
|
|
|
Draw_Title("ABS Settings"); // TODO: GET_TEXT_F
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(PREHEAT_CASE_TEMP), F("Nozzle Temp"));
|
2020-09-17 05:35:04 -05:00
|
|
|
#if HAS_HEATED_BED
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(PREHEAT_CASE_BED), F("Bed Temp"));
|
2020-09-17 05:35:04 -05:00
|
|
|
#endif
|
|
|
|
#if HAS_FAN
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(PREHEAT_CASE_FAN), GET_TEXT_F(MSG_FAN_SPEED));
|
2020-09-17 05:35:04 -05:00
|
|
|
#endif
|
|
|
|
#if ENABLED(EEPROM_SETTINGS)
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(PREHEAT_CASE_SAVE), GET_TEXT_F(MSG_STORE_EEPROM));
|
2020-09-17 05:35:04 -05:00
|
|
|
#endif
|
|
|
|
#else
|
|
|
|
DWIN_Frame_TitleCopy(1, 56, 16, 141, 28); // "ABS Settings"
|
|
|
|
DWIN_Frame_AreaCopy(1, 172, 76, 198, 86, LBLX, MBASE(PREHEAT_CASE_TEMP));
|
|
|
|
DWIN_Frame_AreaCopy(1, 197, 104, 238, 114, LBLX + 27, MBASE(PREHEAT_CASE_TEMP));
|
|
|
|
DWIN_Frame_AreaCopy(1, 1, 89, 83, 101, LBLX + 71, MBASE(PREHEAT_CASE_TEMP)); // ABS nozzle temp
|
|
|
|
#if HAS_HEATED_BED
|
|
|
|
DWIN_Frame_AreaCopy(1, 172, 76, 198, 86, LBLX, MBASE(PREHEAT_CASE_BED) + 3);
|
|
|
|
DWIN_Frame_AreaCopy(1, 240, 104, 264, 114, LBLX + 27, MBASE(PREHEAT_CASE_BED) + 3);
|
|
|
|
DWIN_Frame_AreaCopy(1, 1, 89, 83, 101, LBLX + 54, MBASE(PREHEAT_CASE_BED) + 3); // ABS bed temp
|
|
|
|
#endif
|
|
|
|
#if HAS_FAN
|
|
|
|
DWIN_Frame_AreaCopy(1, 172, 76, 198, 86, LBLX, MBASE(PREHEAT_CASE_FAN));
|
|
|
|
DWIN_Frame_AreaCopy(1, 0, 119, 64, 132, LBLX + 27, MBASE(PREHEAT_CASE_FAN)); // ABS fan speed
|
|
|
|
#endif
|
|
|
|
#if ENABLED(EEPROM_SETTINGS)
|
|
|
|
DWIN_Frame_AreaCopy(1, 97, 165, 229, 177, LBLX, MBASE(PREHEAT_CASE_SAVE));
|
|
|
|
DWIN_Frame_AreaCopy(1, 172, 76, 198, 86, LBLX + 33, MBASE(PREHEAT_CASE_SAVE)); // Save ABS configuration
|
|
|
|
#endif
|
2020-09-14 02:48:45 -05:00
|
|
|
#endif
|
2020-09-17 05:35:04 -05:00
|
|
|
}
|
2020-06-16 01:45:27 -05:00
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
Draw_Back_First();
|
2020-06-16 01:45:27 -05:00
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
uint8_t i = 0;
|
|
|
|
Draw_Menu_Line(++i, ICON_SetEndTemp);
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(i), ui.material_preset[1].hotend_temp);
|
2020-09-17 05:35:04 -05:00
|
|
|
#if HAS_HEATED_BED
|
|
|
|
Draw_Menu_Line(++i, ICON_SetBedTemp);
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(i), ui.material_preset[1].bed_temp);
|
2020-09-17 05:35:04 -05:00
|
|
|
#endif
|
|
|
|
#if HAS_FAN
|
|
|
|
Draw_Menu_Line(++i, ICON_FanSpeed);
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(i), ui.material_preset[1].fan_speed);
|
2020-09-17 05:35:04 -05:00
|
|
|
#endif
|
|
|
|
#if ENABLED(EEPROM_SETTINGS)
|
|
|
|
Draw_Menu_Line(++i, ICON_WriteEEPROM);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
} break;
|
|
|
|
|
|
|
|
#endif // HAS_HOTEND
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
DWIN_UpdateLCD();
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void Draw_Max_Speed_Menu() {
|
|
|
|
Clear_Main_Window();
|
|
|
|
|
2020-08-21 23:44:21 -05:00
|
|
|
if (HMI_flag.language_chinese) {
|
2020-09-16 06:56:48 -05:00
|
|
|
DWIN_Frame_TitleCopy(1, 1, 16, 28, 28); // "Max Speed (mm/s)"
|
2020-06-16 01:45:27 -05:00
|
|
|
|
|
|
|
auto say_max_speed = [](const uint16_t row) {
|
2020-09-17 05:35:04 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 173, 133, 228, 147, LBLX, row); // "Max speed"
|
2020-06-16 01:45:27 -05:00
|
|
|
};
|
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
say_max_speed(MBASE(1)); // "Max speed"
|
|
|
|
DWIN_Frame_AreaCopy(1, 229, 133, 236, 147, LBLX + 58, MBASE(1)); // X
|
|
|
|
say_max_speed(MBASE(2)); // "Max speed"
|
|
|
|
DWIN_Frame_AreaCopy(1, 1, 150, 7, 160, LBLX + 58, MBASE(2) + 3); // Y
|
|
|
|
say_max_speed(MBASE(3)); // "Max speed"
|
|
|
|
DWIN_Frame_AreaCopy(1, 9, 150, 16, 160, LBLX + 58, MBASE(3) + 3); // Z
|
2020-09-16 06:56:48 -05:00
|
|
|
#if HAS_HOTEND
|
2020-09-17 05:35:04 -05:00
|
|
|
say_max_speed(MBASE(4)); // "Max speed"
|
|
|
|
DWIN_Frame_AreaCopy(1, 18, 150, 25, 160, LBLX + 58, MBASE(4) + 3); // E
|
2020-09-16 06:56:48 -05:00
|
|
|
#endif
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
#ifdef USE_STRING_HEADINGS
|
|
|
|
Draw_Title("Max Speed (mm/s)"); // TODO: GET_TEXT_F
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(1), F("Max Feedrate X"));
|
|
|
|
DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(2), F("Max Feedrate Y"));
|
|
|
|
DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(3), F("Max Feedrate Z"));
|
2020-09-16 06:56:48 -05:00
|
|
|
#if HAS_HOTEND
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(4), F("Max Feedrate E"));
|
2020-09-16 06:56:48 -05:00
|
|
|
#endif
|
2020-06-16 01:45:27 -05:00
|
|
|
#else
|
2020-09-16 06:56:48 -05:00
|
|
|
DWIN_Frame_TitleCopy(1, 144, 16, 189, 26); // "Max Speed (mm/s)"
|
2020-06-16 01:45:27 -05:00
|
|
|
|
2020-09-16 06:56:48 -05:00
|
|
|
draw_max_en(MBASE(1)); // "Max"
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 184, 119, 234, 132, LBLX + 27, MBASE(1)); // "Speed X"
|
2020-06-16 01:45:27 -05:00
|
|
|
|
2020-09-16 06:56:48 -05:00
|
|
|
draw_max_en(MBASE(2)); // "Max"
|
|
|
|
draw_speed_en(27, MBASE(2)); // "Speed"
|
|
|
|
say_y(70, MBASE(2)); // "Y"
|
2020-06-16 01:45:27 -05:00
|
|
|
|
2020-09-16 06:56:48 -05:00
|
|
|
draw_max_en(MBASE(3)); // "Max"
|
|
|
|
draw_speed_en(27, MBASE(3)); // "Speed"
|
|
|
|
say_z(70, MBASE(3)); // "Z"
|
2020-06-16 01:45:27 -05:00
|
|
|
|
2020-09-16 06:56:48 -05:00
|
|
|
#if HAS_HOTEND
|
|
|
|
draw_max_en(MBASE(4)); // "Max"
|
|
|
|
draw_speed_en(27, MBASE(4)); // "Speed"
|
|
|
|
say_e(70, MBASE(4)); // "E"
|
|
|
|
#endif
|
2020-08-21 23:44:21 -05:00
|
|
|
#endif
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
Draw_Back_First();
|
2020-09-16 06:56:48 -05:00
|
|
|
LOOP_L_N(i, 3 + ENABLED(HAS_HOTEND)) Draw_Menu_Line(i + 1, ICON_MaxSpeedX + i);
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 4, 210, MBASE(1), planner.settings.max_feedrate_mm_s[X_AXIS]);
|
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 4, 210, MBASE(2), planner.settings.max_feedrate_mm_s[Y_AXIS]);
|
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 4, 210, MBASE(3), planner.settings.max_feedrate_mm_s[Z_AXIS]);
|
2020-09-16 06:56:48 -05:00
|
|
|
#if HAS_HOTEND
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 4, 210, MBASE(4), planner.settings.max_feedrate_mm_s[E_AXIS]);
|
2020-09-16 06:56:48 -05:00
|
|
|
#endif
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
inline void Draw_Max_Accel_Menu() {
|
|
|
|
Clear_Main_Window();
|
|
|
|
|
2020-08-21 23:44:21 -05:00
|
|
|
if (HMI_flag.language_chinese) {
|
2020-09-16 06:56:48 -05:00
|
|
|
DWIN_Frame_TitleCopy(1, 1, 16, 28, 28); // "Acceleration"
|
2020-09-16 04:35:30 -05:00
|
|
|
|
|
|
|
DWIN_Frame_AreaCopy(1, 173, 133, 200, 147, LBLX, MBASE(1));
|
|
|
|
DWIN_Frame_AreaCopy(1, 28, 149, 69, 161, LBLX + 27, MBASE(1) + 1);
|
|
|
|
DWIN_Frame_AreaCopy(1, 229, 133, 236, 147, LBLX + 71, MBASE(1)); // Max acceleration X
|
|
|
|
DWIN_Frame_AreaCopy(1, 173, 133, 200, 147, LBLX, MBASE(2));
|
|
|
|
DWIN_Frame_AreaCopy(1, 28, 149, 69, 161, LBLX + 27, MBASE(2) + 1);
|
|
|
|
DWIN_Frame_AreaCopy(1, 1, 150, 7, 160, LBLX + 71, MBASE(2) + 2); // Max acceleration Y
|
|
|
|
DWIN_Frame_AreaCopy(1, 173, 133, 200, 147, LBLX, MBASE(3));
|
|
|
|
DWIN_Frame_AreaCopy(1, 28, 149, 69, 161, LBLX + 27, MBASE(3) + 1);
|
|
|
|
DWIN_Frame_AreaCopy(1, 9, 150, 16, 160, LBLX + 71, MBASE(3) + 2); // Max acceleration Z
|
2020-09-16 06:56:48 -05:00
|
|
|
#if HAS_HOTEND
|
|
|
|
DWIN_Frame_AreaCopy(1, 173, 133, 200, 147, LBLX, MBASE(4));
|
|
|
|
DWIN_Frame_AreaCopy(1, 28, 149, 69, 161, LBLX + 27, MBASE(4) + 1);
|
|
|
|
DWIN_Frame_AreaCopy(1, 18, 150, 25, 160, LBLX + 71, MBASE(4) + 2); // Max acceleration E
|
|
|
|
#endif
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
#ifdef USE_STRING_HEADINGS
|
2020-08-21 23:44:21 -05:00
|
|
|
Draw_Title(GET_TEXT_F(MSG_ACCELERATION));
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(1), F("Max Accel X"));
|
|
|
|
DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(2), F("Max Accel Y"));
|
|
|
|
DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(3), F("Max Accel Z"));
|
2020-09-16 06:56:48 -05:00
|
|
|
#if HAS_HOTEND
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(4), F("Max Accel E"));
|
2020-09-16 06:56:48 -05:00
|
|
|
#endif
|
2020-06-16 01:45:27 -05:00
|
|
|
#else
|
2020-09-17 05:35:04 -05:00
|
|
|
DWIN_Frame_TitleCopy(1, 144, 16, 189, 26); // "Acceleration"
|
2020-09-16 06:56:48 -05:00
|
|
|
draw_max_accel_en(MBASE(1)); say_x(108, MBASE(1)); // "Max Acceleration X"
|
|
|
|
draw_max_accel_en(MBASE(2)); say_y(108, MBASE(2)); // "Max Acceleration Y"
|
|
|
|
draw_max_accel_en(MBASE(3)); say_z(108, MBASE(3)); // "Max Acceleration Z"
|
|
|
|
#if HAS_HOTEND
|
|
|
|
draw_max_accel_en(MBASE(4)); say_e(108, MBASE(4)); // "Max Acceleration E"
|
|
|
|
#endif
|
2020-06-16 01:45:27 -05:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
Draw_Back_First();
|
2020-09-16 06:56:48 -05:00
|
|
|
LOOP_L_N(i, 3 + ENABLED(HAS_HOTEND)) Draw_Menu_Line(i + 1, ICON_MaxAccX + i);
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 4, 210, MBASE(1), planner.settings.max_acceleration_mm_per_s2[X_AXIS]);
|
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 4, 210, MBASE(2), planner.settings.max_acceleration_mm_per_s2[Y_AXIS]);
|
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 4, 210, MBASE(3), planner.settings.max_acceleration_mm_per_s2[Z_AXIS]);
|
2020-09-16 06:56:48 -05:00
|
|
|
#if HAS_HOTEND
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 4, 210, MBASE(4), planner.settings.max_acceleration_mm_per_s2[E_AXIS]);
|
2020-09-16 06:56:48 -05:00
|
|
|
#endif
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
inline void Draw_Max_Jerk_Menu() {
|
|
|
|
Clear_Main_Window();
|
|
|
|
|
2020-08-21 23:44:21 -05:00
|
|
|
if (HMI_flag.language_chinese) {
|
2020-09-16 06:56:48 -05:00
|
|
|
DWIN_Frame_TitleCopy(1, 1, 16, 28, 28); // "Jerk"
|
2020-09-16 04:35:30 -05:00
|
|
|
|
2020-09-16 06:56:48 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 173, 133, 200, 147, LBLX , MBASE(1));
|
|
|
|
DWIN_Frame_AreaCopy(1, 1, 180, 28, 192, LBLX + 27, MBASE(1) + 1);
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 202, 133, 228, 147, LBLX + 53, MBASE(1));
|
2020-09-16 06:56:48 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 229, 133, 236, 147, LBLX + 83, MBASE(1)); // Max Jerk speed X
|
|
|
|
DWIN_Frame_AreaCopy(1, 173, 133, 200, 147, LBLX , MBASE(2));
|
|
|
|
DWIN_Frame_AreaCopy(1, 1, 180, 28, 192, LBLX + 27, MBASE(2) + 1);
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 202, 133, 228, 147, LBLX + 53, MBASE(2));
|
2020-09-16 06:56:48 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 1, 150, 7, 160, LBLX + 83, MBASE(2) + 3); // Max Jerk speed Y
|
|
|
|
DWIN_Frame_AreaCopy(1, 173, 133, 200, 147, LBLX , MBASE(3));
|
|
|
|
DWIN_Frame_AreaCopy(1, 1, 180, 28, 192, LBLX + 27, MBASE(3) + 1);
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 202, 133, 228, 147, LBLX + 53, MBASE(3));
|
2020-09-16 06:56:48 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 9, 150, 16, 160, LBLX + 83, MBASE(3) + 3); // Max Jerk speed Z
|
|
|
|
#if HAS_HOTEND
|
|
|
|
DWIN_Frame_AreaCopy(1, 173, 133, 200, 147, LBLX , MBASE(4));
|
|
|
|
DWIN_Frame_AreaCopy(1, 1, 180, 28, 192, LBLX + 27, MBASE(4) + 1);
|
|
|
|
DWIN_Frame_AreaCopy(1, 202, 133, 228, 147, LBLX + 53, MBASE(4));
|
|
|
|
DWIN_Frame_AreaCopy(1, 18, 150, 25, 160, LBLX + 83, MBASE(4) + 3); // Max Jerk speed E
|
|
|
|
#endif
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
#ifdef USE_STRING_HEADINGS
|
2020-08-21 23:44:21 -05:00
|
|
|
Draw_Title(GET_TEXT_F(MSG_JERK));
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(1), F("Max Jerk X"));
|
|
|
|
DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(2), F("Max Jerk Y"));
|
|
|
|
DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(3), F("Max Jerk Z"));
|
2020-09-16 06:56:48 -05:00
|
|
|
#if HAS_HOTEND
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(4), F("Max Jerk E"));
|
2020-09-16 06:56:48 -05:00
|
|
|
#endif
|
2020-06-16 01:45:27 -05:00
|
|
|
#else
|
2020-09-16 06:56:48 -05:00
|
|
|
DWIN_Frame_TitleCopy(1, 144, 16, 189, 26); // "Jerk"
|
|
|
|
draw_max_en(MBASE(1)); // "Max"
|
|
|
|
draw_jerk_en(MBASE(1)); // "Jerk"
|
|
|
|
draw_speed_en(72, MBASE(1)); // "Speed"
|
|
|
|
say_x(115, MBASE(1)); // "X"
|
|
|
|
|
|
|
|
draw_max_en(MBASE(2)); // "Max"
|
|
|
|
draw_jerk_en(MBASE(2)); // "Jerk"
|
|
|
|
draw_speed_en(72, MBASE(2)); // "Speed"
|
|
|
|
say_y(115, MBASE(2)); // "Y"
|
|
|
|
|
|
|
|
draw_max_en(MBASE(3)); // "Max"
|
|
|
|
draw_jerk_en(MBASE(3)); // "Jerk"
|
|
|
|
draw_speed_en(72, MBASE(3)); // "Speed"
|
|
|
|
say_z(115, MBASE(3)); // "Z"
|
|
|
|
|
|
|
|
#if HAS_HOTEND
|
|
|
|
draw_max_en(MBASE(4)); // "Max"
|
|
|
|
draw_jerk_en(MBASE(4)); // "Jerk"
|
|
|
|
draw_speed_en(72, MBASE(4)); // "Speed"
|
|
|
|
say_e(115, MBASE(4)); // "E"
|
|
|
|
#endif
|
2020-06-16 01:45:27 -05:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
Draw_Back_First();
|
2020-09-16 06:56:48 -05:00
|
|
|
LOOP_L_N(i, 3 + ENABLED(HAS_HOTEND)) Draw_Menu_Line(i + 1, ICON_MaxSpeedJerkX + i);
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 210, MBASE(1), planner.max_jerk[X_AXIS] * MINUNITMULT);
|
|
|
|
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 210, MBASE(2), planner.max_jerk[Y_AXIS] * MINUNITMULT);
|
|
|
|
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 210, MBASE(3), planner.max_jerk[Z_AXIS] * MINUNITMULT);
|
2020-09-16 06:56:48 -05:00
|
|
|
#if HAS_HOTEND
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 210, MBASE(4), planner.max_jerk[E_AXIS] * MINUNITMULT);
|
2020-09-16 06:56:48 -05:00
|
|
|
#endif
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
inline void Draw_Steps_Menu() {
|
|
|
|
Clear_Main_Window();
|
|
|
|
|
2020-08-21 23:44:21 -05:00
|
|
|
if (HMI_flag.language_chinese) {
|
2020-09-16 06:56:48 -05:00
|
|
|
DWIN_Frame_TitleCopy(1, 1, 16, 28, 28); // "Steps per mm"
|
2020-06-16 01:45:27 -05:00
|
|
|
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_Frame_AreaCopy(1, 153, 148, 194, 161, LBLX, MBASE(1));
|
|
|
|
DWIN_Frame_AreaCopy(1, 229, 133, 236, 147, LBLX + 44, MBASE(1)); // Transmission Ratio X
|
|
|
|
DWIN_Frame_AreaCopy(1, 153, 148, 194, 161, LBLX, MBASE(2));
|
|
|
|
DWIN_Frame_AreaCopy(1, 1, 150, 7, 160, LBLX + 44, MBASE(2) + 3); // Transmission Ratio Y
|
|
|
|
DWIN_Frame_AreaCopy(1, 153, 148, 194, 161, LBLX, MBASE(3));
|
|
|
|
DWIN_Frame_AreaCopy(1, 9, 150, 16, 160, LBLX + 44, MBASE(3) + 3); // Transmission Ratio Z
|
2020-09-16 06:56:48 -05:00
|
|
|
#if HAS_HOTEND
|
|
|
|
DWIN_Frame_AreaCopy(1, 153, 148, 194, 161, LBLX, MBASE(4));
|
|
|
|
DWIN_Frame_AreaCopy(1, 18, 150, 25, 160, LBLX + 44, MBASE(4) + 3); // Transmission Ratio E
|
|
|
|
#endif
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
#ifdef USE_STRING_HEADINGS
|
2020-08-21 23:44:21 -05:00
|
|
|
Draw_Title(GET_TEXT_F(MSG_STEPS_PER_MM));
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(1), F("Steps/mm X"));
|
|
|
|
DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(2), F("Steps/mm Y"));
|
|
|
|
DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(3), F("Steps/mm Z"));
|
2020-09-16 06:56:48 -05:00
|
|
|
#if HAS_HOTEND
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(4), F("Steps/mm E"));
|
2020-09-16 06:56:48 -05:00
|
|
|
#endif
|
2020-06-16 01:45:27 -05:00
|
|
|
#else
|
2020-09-16 06:56:48 -05:00
|
|
|
DWIN_Frame_TitleCopy(1, 144, 16, 189, 26); // "Steps per mm"
|
2020-09-16 04:35:30 -05:00
|
|
|
draw_steps_per_mm(MBASE(1)); say_x(103, MBASE(1)); // "Steps-per-mm X"
|
|
|
|
draw_steps_per_mm(MBASE(2)); say_y(103, MBASE(2)); // "Y"
|
|
|
|
draw_steps_per_mm(MBASE(3)); say_z(103, MBASE(3)); // "Z"
|
2020-09-16 06:56:48 -05:00
|
|
|
#if HAS_HOTEND
|
|
|
|
draw_steps_per_mm(MBASE(4)); say_e(103, MBASE(4)); // "E"
|
|
|
|
#endif
|
2020-06-16 01:45:27 -05:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
Draw_Back_First();
|
2020-09-16 06:56:48 -05:00
|
|
|
LOOP_L_N(i, 3 + ENABLED(HAS_HOTEND)) Draw_Menu_Line(i + 1, ICON_StepX + i);
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 210, MBASE(1), planner.settings.axis_steps_per_mm[X_AXIS] * MINUNITMULT);
|
|
|
|
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 210, MBASE(2), planner.settings.axis_steps_per_mm[Y_AXIS] * MINUNITMULT);
|
|
|
|
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 210, MBASE(3), planner.settings.axis_steps_per_mm[Z_AXIS] * MINUNITMULT);
|
2020-09-16 06:56:48 -05:00
|
|
|
#if HAS_HOTEND
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 210, MBASE(4), planner.settings.axis_steps_per_mm[E_AXIS] * MINUNITMULT);
|
2020-09-16 06:56:48 -05:00
|
|
|
#endif
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Motion */
|
2020-09-17 05:35:04 -05:00
|
|
|
void HMI_Motion() {
|
2020-06-16 01:45:27 -05:00
|
|
|
ENCODER_DiffState encoder_diffState = get_encoder_state();
|
|
|
|
if (encoder_diffState == ENCODER_DIFF_NO) return;
|
|
|
|
|
|
|
|
// Avoid flicker by updating only the previous menu
|
|
|
|
if (encoder_diffState == ENCODER_DIFF_CW) {
|
2020-09-17 05:35:04 -05:00
|
|
|
if (select_motion.inc(1 + MOTION_CASE_TOTAL)) Move_Highlight(1, select_motion.now);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
else if (encoder_diffState == ENCODER_DIFF_CCW) {
|
|
|
|
if (select_motion.dec()) Move_Highlight(-1, select_motion.now);
|
|
|
|
}
|
|
|
|
else if (encoder_diffState == ENCODER_DIFF_ENTER) {
|
|
|
|
switch (select_motion.now) {
|
2020-09-16 06:56:48 -05:00
|
|
|
case 0: // Back
|
2020-06-16 01:45:27 -05:00
|
|
|
checkkey = Control;
|
2020-09-17 05:35:04 -05:00
|
|
|
select_control.set(CONTROL_CASE_MOVE);
|
2020-06-16 01:45:27 -05:00
|
|
|
index_control = MROWS;
|
|
|
|
Draw_Control_Menu();
|
|
|
|
break;
|
2020-09-17 05:35:04 -05:00
|
|
|
case MOTION_CASE_RATE: // Max speed
|
2020-06-16 01:45:27 -05:00
|
|
|
checkkey = MaxSpeed;
|
|
|
|
select_speed.reset();
|
|
|
|
Draw_Max_Speed_Menu();
|
|
|
|
break;
|
2020-09-17 05:35:04 -05:00
|
|
|
case MOTION_CASE_ACCEL: // Max acceleration
|
2020-06-16 01:45:27 -05:00
|
|
|
checkkey = MaxAcceleration;
|
|
|
|
select_acc.reset();
|
|
|
|
Draw_Max_Accel_Menu();
|
|
|
|
break;
|
2020-09-17 05:35:04 -05:00
|
|
|
#if HAS_CLASSIC_JERK
|
|
|
|
case MOTION_CASE_JERK: // Max jerk
|
|
|
|
checkkey = MaxJerk;
|
|
|
|
select_jerk.reset();
|
|
|
|
Draw_Max_Jerk_Menu();
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
case MOTION_CASE_STEPS: // Steps per mm
|
2020-06-16 01:45:27 -05:00
|
|
|
checkkey = Step;
|
|
|
|
select_step.reset();
|
|
|
|
Draw_Steps_Menu();
|
|
|
|
break;
|
2020-09-16 04:35:30 -05:00
|
|
|
default: break;
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
DWIN_UpdateLCD();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Info */
|
2020-09-17 05:35:04 -05:00
|
|
|
void HMI_Info() {
|
2020-06-16 01:45:27 -05:00
|
|
|
ENCODER_DiffState encoder_diffState = get_encoder_state();
|
|
|
|
if (encoder_diffState == ENCODER_DIFF_NO) return;
|
|
|
|
if (encoder_diffState == ENCODER_DIFF_ENTER) {
|
2020-09-03 16:52:31 -05:00
|
|
|
#if HAS_ONESTEP_LEVELING
|
2020-06-16 01:45:27 -05:00
|
|
|
checkkey = Control;
|
2020-09-17 05:35:04 -05:00
|
|
|
select_control.set(CONTROL_CASE_INFO);
|
2020-06-17 12:59:38 -05:00
|
|
|
Draw_Control_Menu();
|
2020-06-16 01:45:27 -05:00
|
|
|
#else
|
|
|
|
select_page.set(3);
|
|
|
|
Goto_MainMenu();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
DWIN_UpdateLCD();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Tune */
|
2020-09-17 05:35:04 -05:00
|
|
|
void HMI_Tune() {
|
2020-06-16 01:45:27 -05:00
|
|
|
ENCODER_DiffState encoder_diffState = get_encoder_state();
|
|
|
|
if (encoder_diffState == ENCODER_DIFF_NO) return;
|
|
|
|
|
|
|
|
// Avoid flicker by updating only the previous menu
|
|
|
|
if (encoder_diffState == ENCODER_DIFF_CW) {
|
2020-09-17 05:35:04 -05:00
|
|
|
if (select_tune.inc(1 + TUNE_CASE_TOTAL)) {
|
2020-06-16 01:45:27 -05:00
|
|
|
if (select_tune.now > MROWS && select_tune.now > index_tune) {
|
|
|
|
index_tune = select_tune.now;
|
|
|
|
Scroll_Menu(DWIN_SCROLL_UP);
|
|
|
|
}
|
2020-07-14 20:01:29 -05:00
|
|
|
else {
|
|
|
|
Move_Highlight(1, select_tune.now + MROWS - index_tune);
|
|
|
|
}
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (encoder_diffState == ENCODER_DIFF_CCW) {
|
|
|
|
if (select_tune.dec()) {
|
2020-07-14 20:01:29 -05:00
|
|
|
if (select_tune.now < index_tune - MROWS) {
|
2020-06-16 01:45:27 -05:00
|
|
|
index_tune--;
|
|
|
|
Scroll_Menu(DWIN_SCROLL_DOWN);
|
|
|
|
if (index_tune == MROWS) Draw_Back_First();
|
|
|
|
}
|
2020-07-14 20:01:29 -05:00
|
|
|
else {
|
|
|
|
Move_Highlight(-1, select_tune.now + MROWS - index_tune);
|
|
|
|
}
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (encoder_diffState == ENCODER_DIFF_ENTER) {
|
|
|
|
switch (select_tune.now) {
|
2020-07-14 20:01:29 -05:00
|
|
|
case 0: { // Back
|
2020-06-16 01:45:27 -05:00
|
|
|
select_print.set(0);
|
|
|
|
Goto_PrintProcess();
|
2020-07-14 20:01:29 -05:00
|
|
|
}
|
|
|
|
break;
|
2020-09-17 05:35:04 -05:00
|
|
|
case TUNE_CASE_SPEED: // Print speed
|
2020-06-16 01:45:27 -05:00
|
|
|
checkkey = PrintSpeed;
|
|
|
|
HMI_ValueStruct.print_speed = feedrate_percentage;
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 216, MBASE(TUNE_CASE_SPEED + MROWS - index_tune), feedrate_percentage);
|
2020-09-17 05:35:04 -05:00
|
|
|
EncoderRate.enabled = true;
|
2020-06-16 01:45:27 -05:00
|
|
|
break;
|
2020-09-17 05:35:04 -05:00
|
|
|
#if HAS_HOTEND
|
|
|
|
case TUNE_CASE_TEMP: // Nozzle temp
|
|
|
|
checkkey = ETemp;
|
|
|
|
HMI_ValueStruct.E_Temp = thermalManager.temp_hotend[0].target;
|
2020-09-19 07:56:01 -05:00
|
|
|
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);
|
2020-09-17 05:35:04 -05:00
|
|
|
EncoderRate.enabled = true;
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
#if HAS_HEATED_BED
|
|
|
|
case TUNE_CASE_BED: // Bed temp
|
|
|
|
checkkey = BedTemp;
|
|
|
|
HMI_ValueStruct.Bed_Temp = thermalManager.temp_bed.target;
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 216, MBASE(TUNE_CASE_BED + MROWS - index_tune), thermalManager.temp_bed.target);
|
2020-09-17 05:35:04 -05:00
|
|
|
EncoderRate.enabled = true;
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
#if HAS_FAN
|
|
|
|
case TUNE_CASE_FAN: // Fan speed
|
|
|
|
checkkey = FanSpeed;
|
|
|
|
HMI_ValueStruct.Fan_speed = thermalManager.fan_speed[0];
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 216, MBASE(TUNE_CASE_FAN + MROWS - index_tune), thermalManager.fan_speed[0]);
|
2020-09-17 05:35:04 -05:00
|
|
|
EncoderRate.enabled = true;
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
#if HAS_ZOFFSET_ITEM
|
|
|
|
case TUNE_CASE_ZOFF: // Z-offset
|
|
|
|
#if EITHER(HAS_BED_PROBE, BABYSTEPPING)
|
|
|
|
checkkey = Homeoffset;
|
|
|
|
HMI_ValueStruct.offset_value = BABY_Z_VAR * 100;
|
|
|
|
DWIN_Draw_Signed_Float(font8x16, Select_Color, 2, 2, 202, MBASE(TUNE_CASE_ZOFF + MROWS - index_tune), HMI_ValueStruct.offset_value);
|
|
|
|
EncoderRate.enabled = true;
|
|
|
|
#else
|
|
|
|
// Apply workspace offset, making the current position 0,0,0
|
|
|
|
queue.inject_P(PSTR("G92 X0 Y0 Z0"));
|
|
|
|
HMI_AudioFeedback();
|
|
|
|
#endif
|
2020-06-16 01:45:27 -05:00
|
|
|
break;
|
2020-09-17 05:35:04 -05:00
|
|
|
#endif
|
2020-06-16 01:45:27 -05:00
|
|
|
default: break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
DWIN_UpdateLCD();
|
|
|
|
}
|
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
#if HAS_PREHEAT
|
2020-06-16 01:45:27 -05:00
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
/* PLA Preheat */
|
|
|
|
void HMI_PLAPreheatSetting() {
|
|
|
|
ENCODER_DiffState encoder_diffState = get_encoder_state();
|
|
|
|
if (encoder_diffState == ENCODER_DIFF_NO) return;
|
|
|
|
|
|
|
|
// Avoid flicker by updating only the previous menu
|
|
|
|
if (encoder_diffState == ENCODER_DIFF_CW) {
|
|
|
|
if (select_PLA.inc(1 + PREHEAT_CASE_TOTAL)) Move_Highlight(1, select_PLA.now);
|
|
|
|
}
|
|
|
|
else if (encoder_diffState == ENCODER_DIFF_CCW) {
|
|
|
|
if (select_PLA.dec()) Move_Highlight(-1, select_PLA.now);
|
|
|
|
}
|
|
|
|
else if (encoder_diffState == ENCODER_DIFF_ENTER) {
|
|
|
|
switch (select_PLA.now) {
|
|
|
|
case 0: // Back
|
|
|
|
checkkey = TemperatureID;
|
|
|
|
select_temp.now = TEMP_CASE_PLA;
|
|
|
|
HMI_ValueStruct.show_mode = -1;
|
|
|
|
Draw_Temperature_Menu();
|
|
|
|
break;
|
2020-07-14 20:01:29 -05:00
|
|
|
#if HAS_HOTEND
|
2020-09-17 05:35:04 -05:00
|
|
|
case PREHEAT_CASE_TEMP: // Nozzle temperature
|
2020-07-14 20:01:29 -05:00
|
|
|
checkkey = ETemp;
|
|
|
|
HMI_ValueStruct.E_Temp = ui.material_preset[0].hotend_temp;
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 216, MBASE(PREHEAT_CASE_TEMP), ui.material_preset[0].hotend_temp);
|
2020-09-17 05:35:04 -05:00
|
|
|
EncoderRate.enabled = true;
|
2020-07-14 20:01:29 -05:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
#if HAS_HEATED_BED
|
2020-09-17 05:35:04 -05:00
|
|
|
case PREHEAT_CASE_BED: // Bed temperature
|
2020-07-14 20:01:29 -05:00
|
|
|
checkkey = BedTemp;
|
|
|
|
HMI_ValueStruct.Bed_Temp = ui.material_preset[0].bed_temp;
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 216, MBASE(PREHEAT_CASE_BED), ui.material_preset[0].bed_temp);
|
2020-09-17 05:35:04 -05:00
|
|
|
EncoderRate.enabled = true;
|
2020-07-14 20:01:29 -05:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
#if HAS_FAN
|
2020-09-17 05:35:04 -05:00
|
|
|
case PREHEAT_CASE_FAN: // Fan speed
|
2020-07-14 20:01:29 -05:00
|
|
|
checkkey = FanSpeed;
|
|
|
|
HMI_ValueStruct.Fan_speed = ui.material_preset[0].fan_speed;
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 216, MBASE(PREHEAT_CASE_FAN), ui.material_preset[0].fan_speed);
|
2020-09-17 05:35:04 -05:00
|
|
|
EncoderRate.enabled = true;
|
2020-07-14 20:01:29 -05:00
|
|
|
break;
|
|
|
|
#endif
|
2020-09-17 05:35:04 -05:00
|
|
|
#if ENABLED(EEPROM_SETTINGS)
|
|
|
|
case 4: { // Save PLA configuration
|
|
|
|
const bool success = settings.save();
|
|
|
|
HMI_AudioFeedback(success);
|
|
|
|
} break;
|
|
|
|
#endif
|
|
|
|
default: break;
|
|
|
|
}
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
2020-09-17 05:35:04 -05:00
|
|
|
DWIN_UpdateLCD();
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
/* ABS Preheat */
|
|
|
|
void HMI_ABSPreheatSetting() {
|
|
|
|
ENCODER_DiffState encoder_diffState = get_encoder_state();
|
|
|
|
if (encoder_diffState == ENCODER_DIFF_NO) return;
|
2020-06-16 01:45:27 -05:00
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
// Avoid flicker by updating only the previous menu
|
|
|
|
if (encoder_diffState == ENCODER_DIFF_CW) {
|
|
|
|
if (select_ABS.inc(1 + PREHEAT_CASE_TOTAL)) Move_Highlight(1, select_ABS.now);
|
|
|
|
}
|
|
|
|
else if (encoder_diffState == ENCODER_DIFF_CCW) {
|
|
|
|
if (select_ABS.dec()) Move_Highlight(-1, select_ABS.now);
|
|
|
|
}
|
|
|
|
else if (encoder_diffState == ENCODER_DIFF_ENTER) {
|
|
|
|
switch (select_ABS.now) {
|
|
|
|
case 0: // Back
|
|
|
|
checkkey = TemperatureID;
|
|
|
|
select_temp.now = TEMP_CASE_ABS;
|
|
|
|
HMI_ValueStruct.show_mode = -1;
|
|
|
|
Draw_Temperature_Menu();
|
|
|
|
break;
|
2020-07-14 20:01:29 -05:00
|
|
|
#if HAS_HOTEND
|
2020-09-17 05:35:04 -05:00
|
|
|
case PREHEAT_CASE_TEMP: // Set nozzle temperature
|
2020-07-14 20:01:29 -05:00
|
|
|
checkkey = ETemp;
|
|
|
|
HMI_ValueStruct.E_Temp = ui.material_preset[1].hotend_temp;
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 216, MBASE(PREHEAT_CASE_TEMP), ui.material_preset[1].hotend_temp);
|
2020-09-17 05:35:04 -05:00
|
|
|
EncoderRate.enabled = true;
|
2020-07-14 20:01:29 -05:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
#if HAS_HEATED_BED
|
2020-09-17 05:35:04 -05:00
|
|
|
case PREHEAT_CASE_BED: // Set bed temperature
|
2020-07-14 20:01:29 -05:00
|
|
|
checkkey = BedTemp;
|
|
|
|
HMI_ValueStruct.Bed_Temp = ui.material_preset[1].bed_temp;
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 216, MBASE(PREHEAT_CASE_BED), ui.material_preset[1].bed_temp);
|
2020-09-17 05:35:04 -05:00
|
|
|
EncoderRate.enabled = true;
|
2020-07-14 20:01:29 -05:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
#if HAS_FAN
|
2020-09-17 05:35:04 -05:00
|
|
|
case PREHEAT_CASE_FAN: // Set fan speed
|
2020-07-14 20:01:29 -05:00
|
|
|
checkkey = FanSpeed;
|
|
|
|
HMI_ValueStruct.Fan_speed = ui.material_preset[1].fan_speed;
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 216, MBASE(PREHEAT_CASE_FAN), ui.material_preset[1].fan_speed);
|
2020-09-17 05:35:04 -05:00
|
|
|
EncoderRate.enabled = true;
|
2020-07-14 20:01:29 -05:00
|
|
|
break;
|
|
|
|
#endif
|
2020-09-17 05:35:04 -05:00
|
|
|
#if ENABLED(EEPROM_SETTINGS)
|
|
|
|
case PREHEAT_CASE_SAVE: { // Save ABS configuration
|
|
|
|
const bool success = settings.save();
|
|
|
|
HMI_AudioFeedback(success);
|
|
|
|
} break;
|
|
|
|
#endif
|
|
|
|
default: break;
|
|
|
|
}
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
2020-09-17 05:35:04 -05:00
|
|
|
DWIN_UpdateLCD();
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
2020-09-17 05:35:04 -05:00
|
|
|
|
|
|
|
#endif
|
2020-06-16 01:45:27 -05:00
|
|
|
|
|
|
|
/* Max Speed */
|
2020-09-17 05:35:04 -05:00
|
|
|
void HMI_MaxSpeed() {
|
2020-06-16 01:45:27 -05:00
|
|
|
ENCODER_DiffState encoder_diffState = get_encoder_state();
|
|
|
|
if (encoder_diffState == ENCODER_DIFF_NO) return;
|
|
|
|
|
|
|
|
// Avoid flicker by updating only the previous menu
|
|
|
|
if (encoder_diffState == ENCODER_DIFF_CW) {
|
2020-09-17 05:35:04 -05:00
|
|
|
if (select_speed.inc(1 + 3 + ENABLED(HAS_HOTEND))) Move_Highlight(1, select_speed.now);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
else if (encoder_diffState == ENCODER_DIFF_CCW) {
|
|
|
|
if (select_speed.dec()) Move_Highlight(-1, select_speed.now);
|
|
|
|
}
|
|
|
|
else if (encoder_diffState == ENCODER_DIFF_ENTER) {
|
2020-09-16 06:56:48 -05:00
|
|
|
if (WITHIN(select_speed.now, 1, 4)) {
|
|
|
|
checkkey = MaxSpeed_value;
|
2020-09-17 05:35:04 -05:00
|
|
|
HMI_flag.feedspeed_axis = AxisEnum(select_speed.now - 1);
|
|
|
|
HMI_ValueStruct.Max_Feedspeed = planner.settings.max_feedrate_mm_s[HMI_flag.feedspeed_axis];
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 4, 210, MBASE(select_speed.now), HMI_ValueStruct.Max_Feedspeed);
|
2020-09-17 05:35:04 -05:00
|
|
|
EncoderRate.enabled = true;
|
2020-09-16 06:56:48 -05:00
|
|
|
}
|
|
|
|
else { // Back
|
|
|
|
checkkey = Motion;
|
2020-09-17 05:35:04 -05:00
|
|
|
select_motion.now = MOTION_CASE_RATE;
|
2020-09-16 06:56:48 -05:00
|
|
|
Draw_Motion_Menu();
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
DWIN_UpdateLCD();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Max Acceleration */
|
2020-09-17 05:35:04 -05:00
|
|
|
void HMI_MaxAcceleration() {
|
2020-06-16 01:45:27 -05:00
|
|
|
ENCODER_DiffState encoder_diffState = get_encoder_state();
|
|
|
|
if (encoder_diffState == ENCODER_DIFF_NO) return;
|
|
|
|
|
|
|
|
// Avoid flicker by updating only the previous menu
|
|
|
|
if (encoder_diffState == ENCODER_DIFF_CW) {
|
2020-09-17 05:35:04 -05:00
|
|
|
if (select_acc.inc(1 + 3 + ENABLED(HAS_HOTEND))) Move_Highlight(1, select_acc.now);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
else if (encoder_diffState == ENCODER_DIFF_CCW) {
|
|
|
|
if (select_acc.dec()) Move_Highlight(-1, select_acc.now);
|
|
|
|
}
|
|
|
|
else if (encoder_diffState == ENCODER_DIFF_ENTER) {
|
2020-09-16 06:56:48 -05:00
|
|
|
if (WITHIN(select_acc.now, 1, 4)) {
|
|
|
|
checkkey = MaxAcceleration_value;
|
2020-09-17 05:35:04 -05:00
|
|
|
HMI_flag.acc_axis = AxisEnum(select_acc.now - 1);
|
|
|
|
HMI_ValueStruct.Max_Acceleration = planner.settings.max_acceleration_mm_per_s2[HMI_flag.acc_axis];
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 4, 210, MBASE(select_acc.now), HMI_ValueStruct.Max_Acceleration);
|
2020-09-17 05:35:04 -05:00
|
|
|
EncoderRate.enabled = true;
|
2020-09-16 06:56:48 -05:00
|
|
|
}
|
|
|
|
else { // Back
|
|
|
|
checkkey = Motion;
|
2020-09-17 05:35:04 -05:00
|
|
|
select_motion.now = MOTION_CASE_ACCEL;
|
2020-09-16 06:56:48 -05:00
|
|
|
Draw_Motion_Menu();
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
DWIN_UpdateLCD();
|
|
|
|
}
|
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
#if HAS_CLASSIC_JERK
|
|
|
|
/* Max Jerk */
|
|
|
|
void HMI_MaxJerk() {
|
|
|
|
ENCODER_DiffState encoder_diffState = get_encoder_state();
|
|
|
|
if (encoder_diffState == ENCODER_DIFF_NO) return;
|
2020-06-16 01:45:27 -05:00
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
// Avoid flicker by updating only the previous menu
|
|
|
|
if (encoder_diffState == ENCODER_DIFF_CW) {
|
|
|
|
if (select_jerk.inc(1 + 3 + ENABLED(HAS_HOTEND))) Move_Highlight(1, select_jerk.now);
|
2020-09-16 06:56:48 -05:00
|
|
|
}
|
2020-09-17 05:35:04 -05:00
|
|
|
else if (encoder_diffState == ENCODER_DIFF_CCW) {
|
|
|
|
if (select_jerk.dec()) Move_Highlight(-1, select_jerk.now);
|
|
|
|
}
|
|
|
|
else if (encoder_diffState == ENCODER_DIFF_ENTER) {
|
|
|
|
if (WITHIN(select_jerk.now, 1, 4)) {
|
|
|
|
checkkey = MaxJerk_value;
|
|
|
|
HMI_flag.jerk_axis = AxisEnum(select_jerk.now - 1);
|
|
|
|
HMI_ValueStruct.Max_Jerk = planner.max_jerk[HMI_flag.jerk_axis] * MINUNITMULT;
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 1, 210, MBASE(select_jerk.now), HMI_ValueStruct.Max_Jerk);
|
2020-09-17 05:35:04 -05:00
|
|
|
EncoderRate.enabled = true;
|
|
|
|
}
|
|
|
|
else { // Back
|
|
|
|
checkkey = Motion;
|
|
|
|
select_motion.now = MOTION_CASE_JERK;
|
|
|
|
Draw_Motion_Menu();
|
|
|
|
}
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
2020-09-17 05:35:04 -05:00
|
|
|
DWIN_UpdateLCD();
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
2020-09-17 05:35:04 -05:00
|
|
|
#endif // HAS_CLASSIC_JERK
|
2020-06-16 01:45:27 -05:00
|
|
|
|
|
|
|
/* Step */
|
2020-09-17 05:35:04 -05:00
|
|
|
void HMI_Step() {
|
2020-06-16 01:45:27 -05:00
|
|
|
ENCODER_DiffState encoder_diffState = get_encoder_state();
|
|
|
|
if (encoder_diffState == ENCODER_DIFF_NO) return;
|
|
|
|
|
|
|
|
// Avoid flicker by updating only the previous menu
|
|
|
|
if (encoder_diffState == ENCODER_DIFF_CW) {
|
2020-09-17 05:35:04 -05:00
|
|
|
if (select_step.inc(1 + 3 + ENABLED(HAS_HOTEND))) Move_Highlight(1, select_step.now);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
else if (encoder_diffState == ENCODER_DIFF_CCW) {
|
|
|
|
if (select_step.dec()) Move_Highlight(-1, select_step.now);
|
|
|
|
}
|
|
|
|
else if (encoder_diffState == ENCODER_DIFF_ENTER) {
|
2020-09-16 06:56:48 -05:00
|
|
|
if (WITHIN(select_step.now, 1, 4)) {
|
|
|
|
checkkey = Step_value;
|
2020-09-17 05:35:04 -05:00
|
|
|
HMI_flag.step_axis = AxisEnum(select_step.now - 1);
|
|
|
|
HMI_ValueStruct.Max_Step = planner.settings.axis_steps_per_mm[HMI_flag.step_axis] * MINUNITMULT;
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 1, 210, MBASE(select_step.now), HMI_ValueStruct.Max_Step);
|
2020-09-17 05:35:04 -05:00
|
|
|
EncoderRate.enabled = true;
|
2020-09-16 06:56:48 -05:00
|
|
|
}
|
|
|
|
else { // Back
|
|
|
|
checkkey = Motion;
|
2020-09-17 05:35:04 -05:00
|
|
|
select_motion.now = MOTION_CASE_STEPS;
|
2020-09-16 06:56:48 -05:00
|
|
|
Draw_Motion_Menu();
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
DWIN_UpdateLCD();
|
|
|
|
}
|
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
void HMI_Init() {
|
2020-06-16 01:45:27 -05:00
|
|
|
HMI_SDCardInit();
|
|
|
|
|
|
|
|
for (uint16_t t = 0; t <= 100; t += 2) {
|
2020-07-14 20:01:29 -05:00
|
|
|
DWIN_ICON_Show(ICON, ICON_Bar, 15, 260);
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_Rectangle(1, Color_Bg_Black, 15 + t * 242 / 100, 260, 257, 280);
|
2020-06-16 01:45:27 -05:00
|
|
|
DWIN_UpdateLCD();
|
|
|
|
delay(20);
|
|
|
|
}
|
|
|
|
|
2020-08-21 23:44:21 -05:00
|
|
|
HMI_SetLanguage();
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
void DWIN_Update() {
|
2020-07-14 20:01:29 -05:00
|
|
|
EachMomentUpdate(); // Status update
|
|
|
|
HMI_SDCardUpdate(); // SD card update
|
|
|
|
DWIN_HandleScreen(); // Rotary encoder update
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
void EachMomentUpdate() {
|
2020-06-16 01:45:27 -05:00
|
|
|
static millis_t next_rts_update_ms = 0;
|
|
|
|
const millis_t ms = millis();
|
|
|
|
if (PENDING(ms, next_rts_update_ms)) return;
|
|
|
|
next_rts_update_ms = ms + DWIN_SCROLL_UPDATE_INTERVAL;
|
|
|
|
|
|
|
|
// variable update
|
|
|
|
update_variable();
|
|
|
|
|
|
|
|
if (checkkey == PrintProcess) {
|
|
|
|
// if print done
|
2020-09-17 05:35:04 -05:00
|
|
|
if (HMI_flag.print_finish && !HMI_flag.done_confirm_flag) {
|
|
|
|
HMI_flag.print_finish = false;
|
|
|
|
HMI_flag.done_confirm_flag = true;
|
2020-06-16 01:45:27 -05:00
|
|
|
|
|
|
|
TERN_(POWER_LOSS_RECOVERY, recovery.cancel());
|
|
|
|
|
|
|
|
planner.finish_and_disable();
|
|
|
|
|
|
|
|
// show percent bar and value
|
|
|
|
Percentrecord = 0;
|
|
|
|
Draw_Print_ProgressBar();
|
|
|
|
|
|
|
|
// show print done confirm
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_Rectangle(1, Color_Bg_Black, 0, 250, DWIN_WIDTH - 1, STATUS_Y);
|
2020-09-16 04:35:30 -05:00
|
|
|
DWIN_ICON_Show(ICON, HMI_flag.language_chinese ? ICON_Confirm_C : ICON_Confirm_E, 86, 283);
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
else if (HMI_flag.pause_flag != printingIsPaused()) {
|
|
|
|
// print status update
|
|
|
|
HMI_flag.pause_flag = printingIsPaused();
|
|
|
|
if (HMI_flag.pause_flag) ICON_Continue(); else ICON_Pause();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// pause after homing
|
2020-09-17 05:35:04 -05:00
|
|
|
if (HMI_flag.pause_action && printingIsPaused() && !planner.has_blocks_queued()) {
|
|
|
|
HMI_flag.pause_action = false;
|
2020-06-16 01:45:27 -05:00
|
|
|
#if ENABLED(PAUSE_HEAT)
|
2020-09-17 05:35:04 -05:00
|
|
|
#if HAS_HEATED_BED
|
|
|
|
tempbed = thermalManager.temp_bed.target;
|
|
|
|
#endif
|
|
|
|
#if HAS_HOTEND
|
|
|
|
temphot = thermalManager.temp_hotend[0].target;
|
|
|
|
#endif
|
2020-06-16 01:45:27 -05:00
|
|
|
thermalManager.disable_all_heaters();
|
|
|
|
#endif
|
|
|
|
queue.inject_P(PSTR("G1 F1200 X0 Y0"));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (card.isPrinting() && checkkey == PrintProcess) { // print process
|
|
|
|
const uint8_t card_pct = card.percentDone();
|
|
|
|
static uint8_t last_cardpercentValue = 101;
|
|
|
|
if (last_cardpercentValue != card_pct) { // print percent
|
|
|
|
last_cardpercentValue = card_pct;
|
|
|
|
if (card_pct) {
|
|
|
|
Percentrecord = card_pct;
|
|
|
|
Draw_Print_ProgressBar();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-14 20:01:29 -05:00
|
|
|
duration_t elapsed = print_job_timer.duration(); // print timer
|
2020-09-16 06:56:48 -05:00
|
|
|
|
|
|
|
// Print time so far
|
2020-09-17 05:35:04 -05:00
|
|
|
static uint16_t last_Printtime = 0;
|
2020-06-16 01:45:27 -05:00
|
|
|
const uint16_t min = (elapsed.value % 3600) / 60;
|
|
|
|
if (last_Printtime != min) { // 1 minute update
|
|
|
|
last_Printtime = min;
|
|
|
|
Draw_Print_ProgressElapsed();
|
|
|
|
}
|
2020-09-16 06:56:48 -05:00
|
|
|
|
|
|
|
// Estimate remaining time every 20 seconds
|
2020-06-16 01:45:27 -05:00
|
|
|
static millis_t next_remain_time_update = 0;
|
2020-09-17 05:35:04 -05:00
|
|
|
if (Percentrecord > 1 && ELAPSED(ms, next_remain_time_update) && !HMI_flag.heat_flag) {
|
2020-09-16 06:56:48 -05:00
|
|
|
remain_time = (elapsed.value - dwin_heat_time) / (Percentrecord * 0.01f) - (elapsed.value - dwin_heat_time);
|
2020-06-16 01:45:27 -05:00
|
|
|
next_remain_time_update += 20 * 1000UL;
|
|
|
|
Draw_Print_ProgressRemain();
|
|
|
|
}
|
|
|
|
}
|
2020-09-17 05:35:04 -05:00
|
|
|
else if (dwin_abort_flag && !HMI_flag.home_flag) { // Print Stop
|
|
|
|
dwin_abort_flag = false;
|
2020-06-16 01:45:27 -05:00
|
|
|
HMI_ValueStruct.print_speed = feedrate_percentage = 100;
|
2020-09-14 02:48:45 -05:00
|
|
|
dwin_zoffset = TERN0(HAS_BED_PROBE, probe.offset.z);
|
2020-06-16 01:45:27 -05:00
|
|
|
|
|
|
|
planner.finish_and_disable();
|
|
|
|
|
|
|
|
#if DISABLED(SD_ABORT_NO_COOLDOWN)
|
|
|
|
thermalManager.disable_all_heaters();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
select_page.set(0);
|
|
|
|
Goto_MainMenu();
|
|
|
|
}
|
2020-09-14 02:48:45 -05:00
|
|
|
#if ENABLED(POWER_LOSS_RECOVERY)
|
|
|
|
else if (DWIN_lcd_sd_status && recovery.dwin_flag) { // resume print before power off
|
2020-09-17 05:35:04 -05:00
|
|
|
static bool recovery_flag = false;
|
2020-09-14 02:48:45 -05:00
|
|
|
recovery.dwin_flag = false;
|
|
|
|
|
|
|
|
recovery.load();
|
|
|
|
if (!recovery.valid()) return recovery.purge();
|
|
|
|
|
|
|
|
auto draw_first_option = [](const bool sel) {
|
2020-09-19 07:56:01 -05:00
|
|
|
const uint16_t c1 = sel ? Color_Bg_Window : Select_Color;
|
2020-09-14 02:48:45 -05:00
|
|
|
DWIN_Draw_Rectangle(0, c1, 25, 306, 126, 345);
|
|
|
|
DWIN_Draw_Rectangle(0, c1, 24, 305, 127, 346);
|
|
|
|
};
|
|
|
|
|
|
|
|
auto update_selection = [&](const bool sel) {
|
|
|
|
HMI_flag.select_flag = sel;
|
|
|
|
draw_first_option(sel);
|
2020-09-19 07:56:01 -05:00
|
|
|
const uint16_t c2 = sel ? Select_Color : Color_Bg_Window;
|
2020-09-14 02:48:45 -05:00
|
|
|
DWIN_Draw_Rectangle(0, c2, 145, 306, 246, 345);
|
|
|
|
DWIN_Draw_Rectangle(0, c2, 144, 305, 247, 346);
|
|
|
|
};
|
|
|
|
|
|
|
|
const uint16_t fileCnt = card.get_num_Files();
|
|
|
|
for (uint16_t i = 0; i < fileCnt; i++) {
|
|
|
|
// TODO: Resume print via M1000 then update the UI
|
|
|
|
// with the active filename which can come from CardReader.
|
|
|
|
card.getfilename_sorted(SD_ORDER(i, fileCnt));
|
|
|
|
if (!strcmp(card.filename, &recovery.info.sd_filename[1])) { // Resume print before power failure while have the same file
|
2020-09-17 05:35:04 -05:00
|
|
|
recovery_flag = true;
|
|
|
|
HMI_flag.select_flag = true;
|
2020-09-14 02:48:45 -05:00
|
|
|
Popup_Window_Resume();
|
|
|
|
draw_first_option(false);
|
|
|
|
char * const name = card.longest_filename();
|
|
|
|
const int8_t npos = _MAX(0, DWIN_WIDTH - strlen(name) * (MENU_CHR_W)) / 2;
|
2020-09-19 07:56:01 -05:00
|
|
|
DWIN_Draw_String(false, true, font8x16, Popup_Text_Color, Color_Bg_Window, npos, 252, name);
|
2020-09-14 02:48:45 -05:00
|
|
|
DWIN_UpdateLCD();
|
|
|
|
break;
|
|
|
|
}
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
|
2020-09-14 02:48:45 -05:00
|
|
|
// if hasn't resumable G-code file
|
|
|
|
if (!recovery_flag) return;
|
|
|
|
|
|
|
|
while (recovery_flag) {
|
|
|
|
ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze();
|
|
|
|
if (encoder_diffState != ENCODER_DIFF_NO) {
|
|
|
|
if (encoder_diffState == ENCODER_DIFF_ENTER) {
|
2020-09-17 05:35:04 -05:00
|
|
|
recovery_flag = false;
|
2020-09-14 02:48:45 -05:00
|
|
|
if (HMI_flag.select_flag) break;
|
|
|
|
TERN_(POWER_LOSS_RECOVERY, recovery.cancel());
|
|
|
|
HMI_StartFrame(true);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
update_selection(encoder_diffState == ENCODER_DIFF_CCW);
|
2020-06-16 01:45:27 -05:00
|
|
|
|
2020-09-14 02:48:45 -05:00
|
|
|
DWIN_UpdateLCD();
|
2020-06-16 01:45:27 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-14 02:48:45 -05:00
|
|
|
select_print.set(0);
|
|
|
|
HMI_ValueStruct.show_mode = 0;
|
|
|
|
HMI_StartFrame(false);
|
|
|
|
recovery.resume();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
#endif
|
2020-06-16 01:45:27 -05:00
|
|
|
DWIN_UpdateLCD();
|
|
|
|
}
|
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
void DWIN_HandleScreen() {
|
2020-06-16 01:45:27 -05:00
|
|
|
switch (checkkey) {
|
2020-09-16 06:56:48 -05:00
|
|
|
case MainMenu: HMI_MainMenu(); break;
|
|
|
|
case SelectFile: HMI_SelectFile(); break;
|
|
|
|
case Prepare: HMI_Prepare(); break;
|
|
|
|
case Control: HMI_Control(); break;
|
|
|
|
case Leveling: break;
|
|
|
|
case PrintProcess: HMI_Printing(); break;
|
|
|
|
case Print_window: HMI_PauseOrStop(); break;
|
|
|
|
case AxisMove: HMI_AxisMove(); break;
|
|
|
|
case TemperatureID: HMI_Temperature(); break;
|
|
|
|
case Motion: HMI_Motion(); break;
|
|
|
|
case Info: HMI_Info(); break;
|
|
|
|
case Tune: HMI_Tune(); break;
|
2020-09-17 05:35:04 -05:00
|
|
|
#if HAS_PREHEAT
|
|
|
|
case PLAPreheat: HMI_PLAPreheatSetting(); break;
|
|
|
|
case ABSPreheat: HMI_ABSPreheatSetting(); break;
|
|
|
|
#endif
|
2020-09-16 06:56:48 -05:00
|
|
|
case MaxSpeed: HMI_MaxSpeed(); break;
|
|
|
|
case MaxAcceleration: HMI_MaxAcceleration(); break;
|
|
|
|
case MaxJerk: HMI_MaxJerk(); break;
|
|
|
|
case Step: HMI_Step(); break;
|
|
|
|
case Move_X: HMI_Move_X(); break;
|
|
|
|
case Move_Y: HMI_Move_Y(); break;
|
|
|
|
case Move_Z: HMI_Move_Z(); break;
|
2020-06-24 19:44:50 -05:00
|
|
|
#if HAS_HOTEND
|
2020-09-16 06:56:48 -05:00
|
|
|
case Extruder: HMI_Move_E(); break;
|
|
|
|
case ETemp: HMI_ETemp(); break;
|
2020-06-24 19:44:50 -05:00
|
|
|
#endif
|
2020-09-17 05:35:04 -05:00
|
|
|
#if EITHER(HAS_BED_PROBE, BABYSTEPPING)
|
|
|
|
case Homeoffset: HMI_Zoffset(); break;
|
|
|
|
#endif
|
2020-06-24 19:44:50 -05:00
|
|
|
#if HAS_HEATED_BED
|
2020-09-16 06:56:48 -05:00
|
|
|
case BedTemp: HMI_BedTemp(); break;
|
2020-06-24 19:44:50 -05:00
|
|
|
#endif
|
2020-09-17 05:35:04 -05:00
|
|
|
#if HAS_PREHEAT
|
2020-09-16 06:56:48 -05:00
|
|
|
case FanSpeed: HMI_FanSpeed(); break;
|
2020-06-24 19:44:50 -05:00
|
|
|
#endif
|
2020-09-16 06:56:48 -05:00
|
|
|
case PrintSpeed: HMI_PrintSpeed(); break;
|
|
|
|
case MaxSpeed_value: HMI_MaxFeedspeedXYZE(); break;
|
2020-06-16 01:45:27 -05:00
|
|
|
case MaxAcceleration_value: HMI_MaxAccelerationXYZE(); break;
|
2020-09-16 06:56:48 -05:00
|
|
|
case MaxJerk_value: HMI_MaxJerkXYZE(); break;
|
|
|
|
case Step_value: HMI_StepXYZE(); break;
|
2020-06-16 01:45:27 -05:00
|
|
|
default: break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
void DWIN_CompletedHoming() {
|
2020-06-16 01:45:27 -05:00
|
|
|
HMI_flag.home_flag = false;
|
|
|
|
if (checkkey == Last_Prepare) {
|
|
|
|
checkkey = Prepare;
|
2020-09-17 05:35:04 -05:00
|
|
|
select_prepare.now = PREPARE_CASE_HOME;
|
2020-06-16 01:45:27 -05:00
|
|
|
index_prepare = MROWS;
|
|
|
|
Draw_Prepare_Menu();
|
|
|
|
}
|
|
|
|
else if (checkkey == Back_Main) {
|
|
|
|
HMI_ValueStruct.print_speed = feedrate_percentage = 100;
|
2020-09-14 02:48:45 -05:00
|
|
|
dwin_zoffset = TERN0(HAS_BED_PROBE, probe.offset.z);
|
2020-06-16 01:45:27 -05:00
|
|
|
planner.finish_and_disable();
|
|
|
|
Goto_MainMenu();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-17 05:35:04 -05:00
|
|
|
void DWIN_CompletedLeveling() {
|
2020-06-16 01:45:27 -05:00
|
|
|
if (checkkey == Leveling) Goto_MainMenu();
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // DWIN_CREALITY_LCD
|