Creality Ender 3 v2 (#17719)

This commit is contained in:
Scott Lahteine
2020-06-16 01:45:27 -05:00
committed by GitHub
parent 642112d3eb
commit f4c258dc23
37 changed files with 5379 additions and 82 deletions

View File

@ -50,6 +50,11 @@
#include "planner.h"
#include "stepper.h"
#include "temperature.h"
#if ENABLED(DWIN_CREALITY_LCD)
#include "../lcd/dwin/dwin.h"
#endif
#include "../lcd/ultralcd.h"
#include "../libs/vector_3.h" // for matrix_3x3
#include "../gcode/gcode.h"
@ -804,6 +809,10 @@ void MarlinSettings::postprocess() {
const int16_t (&ui_preheat_hotend_temp)[2] = ui.preheat_hotend_temp,
(&ui_preheat_bed_temp)[2] = ui.preheat_bed_temp;
const uint8_t (&ui_preheat_fan_speed)[2] = ui.preheat_fan_speed;
#elif ENABLED(DWIN_CREALITY_LCD)
const int16_t (&ui_preheat_hotend_temp)[2] = HMI_ValueStruct.preheat_hotend_temp,
(&ui_preheat_bed_temp)[2] = HMI_ValueStruct.preheat_bed_temp;
const uint8_t (&ui_preheat_fan_speed)[2] = HMI_ValueStruct.preheat_fan_speed;
#else
constexpr int16_t ui_preheat_hotend_temp[2] = { PREHEAT_1_TEMP_HOTEND, PREHEAT_2_TEMP_HOTEND },
ui_preheat_bed_temp[2] = { PREHEAT_1_TEMP_BED, PREHEAT_2_TEMP_BED };
@ -1664,7 +1673,11 @@ void MarlinSettings::postprocess() {
int16_t (&ui_preheat_hotend_temp)[2] = ui.preheat_hotend_temp,
(&ui_preheat_bed_temp)[2] = ui.preheat_bed_temp;
uint8_t (&ui_preheat_fan_speed)[2] = ui.preheat_fan_speed;
#else
#elif ENABLED(DWIN_CREALITY_LCD)
int16_t (&ui_preheat_hotend_temp)[2] = HMI_ValueStruct.preheat_hotend_temp,
(&ui_preheat_bed_temp)[2] = HMI_ValueStruct.preheat_bed_temp;
uint8_t (&ui_preheat_fan_speed)[2] = HMI_ValueStruct.preheat_fan_speed;
#else
int16_t ui_preheat_hotend_temp[2], ui_preheat_bed_temp[2];
uint8_t ui_preheat_fan_speed[2];
#endif
@ -2539,14 +2552,22 @@ void MarlinSettings::reset() {
//
// Preheat parameters
//
#if HAS_HOTEND && HAS_LCD_MENU
ui.preheat_hotend_temp[0] = PREHEAT_1_TEMP_HOTEND;
ui.preheat_hotend_temp[1] = PREHEAT_2_TEMP_HOTEND;
ui.preheat_bed_temp[0] = PREHEAT_1_TEMP_BED;
ui.preheat_bed_temp[1] = PREHEAT_2_TEMP_BED;
ui.preheat_fan_speed[0] = PREHEAT_1_FAN_SPEED;
ui.preheat_fan_speed[1] = PREHEAT_2_FAN_SPEED;
#if HAS_HOTEND
#if ENABLED(DWIN_CREALITY_LCD)
HMI_ValueStruct.preheat_hotend_temp[0] = PREHEAT_1_TEMP_HOTEND;
HMI_ValueStruct.preheat_hotend_temp[1] = PREHEAT_2_TEMP_HOTEND;
HMI_ValueStruct.preheat_bed_temp[0] = PREHEAT_1_TEMP_BED;
HMI_ValueStruct.preheat_bed_temp[1] = PREHEAT_2_TEMP_BED;
HMI_ValueStruct.preheat_fan_speed[0] = PREHEAT_1_FAN_SPEED;
HMI_ValueStruct.preheat_fan_speed[1] = PREHEAT_2_FAN_SPEED;
#elif HAS_LCD_MENU
ui.preheat_hotend_temp[0] = PREHEAT_1_TEMP_HOTEND;
ui.preheat_hotend_temp[1] = PREHEAT_2_TEMP_HOTEND;
ui.preheat_bed_temp[0] = PREHEAT_1_TEMP_BED;
ui.preheat_bed_temp[1] = PREHEAT_2_TEMP_BED;
ui.preheat_fan_speed[0] = PREHEAT_1_FAN_SPEED;
ui.preheat_fan_speed[1] = PREHEAT_2_FAN_SPEED;
#endif
#endif
//

View File

@ -32,6 +32,11 @@
#include "../HAL/shared/Delay.h"
#include "../lcd/ultralcd.h"
#if ENABLED(DWIN_CREALITY_LCD)
#include "../lcd/dwin/dwin.h"
#endif
#if ENABLED(EXTENSIBLE_UI)
#include "../lcd/extui/ui_api.h"
#endif
@ -560,6 +565,7 @@ volatile bool Temperature::raw_temps_ready = false;
#define MAX_CYCLE_TIME_PID_AUTOTUNE 20L
#endif
if (((ms - t1) + (ms - t2)) > (MAX_CYCLE_TIME_PID_AUTOTUNE * 60L * 1000L)) {
TERN_(DWIN_CREALITY_LCD, Popup_Window_Temperature(0));
TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_TUNING_TIMEOUT));
SERIAL_ECHOLNPGM(STR_PID_TIMEOUT);
break;
@ -612,7 +618,7 @@ volatile bool Temperature::raw_temps_ready = false;
goto EXIT_M303;
}
ui.update();
TERN(DWIN_CREALITY_LCD, DWIN_Update(), ui.update());
}
disable_all_heaters();
@ -794,10 +800,12 @@ void Temperature::_temp_error(const heater_ind_t heater, PGM_P const serial_msg,
}
void Temperature::max_temp_error(const heater_ind_t heater) {
TERN_(DWIN_CREALITY_LCD, Popup_Window_Temperature(1));
_temp_error(heater, PSTR(STR_T_MAXTEMP), GET_TEXT(MSG_ERR_MAXTEMP));
}
void Temperature::min_temp_error(const heater_ind_t heater) {
TERN_(DWIN_CREALITY_LCD, Popup_Window_Temperature(0));
_temp_error(heater, PSTR(STR_T_MINTEMP), GET_TEXT(MSG_ERR_MINTEMP));
}
@ -1029,8 +1037,10 @@ void Temperature::manage_heater() {
#if WATCH_HOTENDS
// Make sure temperature is increasing
if (watch_hotend[e].next_ms && ELAPSED(ms, watch_hotend[e].next_ms)) { // Time to check this extruder?
if (degHotend(e) < watch_hotend[e].target) // Failed to increase enough?
if (degHotend(e) < watch_hotend[e].target) { // Failed to increase enough?
TERN_(DWIN_CREALITY_LCD, Popup_Window_Temperature(0));
_temp_error((heater_ind_t)e, str_t_heating_failed, GET_TEXT(MSG_HEATING_FAILED_LCD));
}
else // Start again if the target is still far off
start_watching_hotend(e);
}
@ -1071,8 +1081,10 @@ void Temperature::manage_heater() {
#if WATCH_BED
// Make sure temperature is increasing
if (watch_bed.elapsed(ms)) { // Time to check the bed?
if (degBed() < watch_bed.target) // Failed to increase enough?
if (degBed() < watch_bed.target) { // Failed to increase enough?
TERN_(DWIN_CREALITY_LCD, Popup_Window_Temperature(0));
_temp_error(H_BED, str_t_heating_failed, GET_TEXT(MSG_HEATING_FAILED_LCD));
}
else // Start again if the target is still far off
start_watching_bed();
}
@ -1981,6 +1993,7 @@ void Temperature::init() {
sm.state = TRRunaway;
case TRRunaway:
TERN_(DWIN_CREALITY_LCD, Popup_Window_Temperature(0));
_temp_error(heater_id, str_t_thermal_runaway, GET_TEXT(MSG_THERMAL_RUNAWAY));
}
}
@ -3082,7 +3095,13 @@ void Temperature::tick() {
} while (wait_for_heatup && TEMP_CONDITIONS);
if (wait_for_heatup) {
ui.reset_status();
#if ENABLED(DWIN_CREALITY_LCD)
HMI_flag.heat_flag = 0;
duration_t elapsed = print_job_timer.duration(); // print timer
heat_time = elapsed.value;
#else
ui.reset_status();
#endif
TERN_(PRINTER_EVENT_LEDS, printerEventLEDs.onHeatingDone());
}