Skip to content

Commit

Permalink
Merge branch 'bugfix-2.0.x' of https://github.com/MarlinFirmware/Marlin
Browse files Browse the repository at this point in the history
… into bugfix-2.0.x
  • Loading branch information
crysxd committed Sep 28, 2020
2 parents 111de8b + d9d920e commit 752a696
Show file tree
Hide file tree
Showing 10 changed files with 67 additions and 119 deletions.
10 changes: 2 additions & 8 deletions Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -524,18 +524,12 @@
//#define MIN_BED_POWER 0
//#define PID_BED_DEBUG // Sends debug data to the serial port.

//120V 250W silicone heater into 4mm borosilicate (MendelMax 1.5+)
//from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10)
// 120V 250W silicone heater into 4mm borosilicate (MendelMax 1.5+)
// from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10)
#define DEFAULT_bedKp 10.00
#define DEFAULT_bedKi .023
#define DEFAULT_bedKd 305.4

//120V 250W silicone heater into 4mm borosilicate (MendelMax 1.5+)
//from pidautotune
//#define DEFAULT_bedKp 97.1
//#define DEFAULT_bedKi 1.41
//#define DEFAULT_bedKd 1675.16

// FIND YOUR OWN: "M303 E-1 C8 S90" to run autotune on the bed at 90 degreesC for 8 cycles.
#endif // PIDTEMPBED

Expand Down
2 changes: 1 addition & 1 deletion Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -3252,7 +3252,7 @@
*/
//#define MMU_EXTRUDER_SENSOR
#if ENABLED(MMU_EXTRUDER_SENSOR)
#define MMU_LOADING_ATTEMPTS_NR 5 //max. number of attempts to load filament if first load fail
#define MMU_LOADING_ATTEMPTS_NR 5 // max. number of attempts to load filament if first load fail
#endif

/**
Expand Down
6 changes: 2 additions & 4 deletions Marlin/src/feature/mmu2/mmu2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -838,8 +838,7 @@ void MMU2::manage_response(const bool move_axes, const bool turn_off_nozzle) {

if (move_axes && all_axes_homed()) {
LCD_MESSAGEPGM(MSG_MMU2_RESUMING);
BUZZ(200, 404);
BUZZ(200, 404);
BUZZ(198, 404); BUZZ(4, 0); BUZZ(198, 404);

// Move XY to starting position, then Z
do_blocking_move_to_xy(resume_position, feedRate_t(NOZZLE_PARK_XY_FEEDRATE));
Expand All @@ -848,8 +847,7 @@ void MMU2::manage_response(const bool move_axes, const bool turn_off_nozzle) {
do_blocking_move_to_z(resume_position.z, feedRate_t(NOZZLE_PARK_Z_FEEDRATE));
}
else {
BUZZ(200, 404);
BUZZ(200, 404);
BUZZ(198, 404); BUZZ(4, 0); BUZZ(198, 404);
LCD_MESSAGEPGM(MSG_MMU2_RESUMING);
}
}
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/gcode/config/M302.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
*
* M302 ; report current cold extrusion state
* M302 P0 ; enable cold extrusion checking
* M302 P1 ; disables cold extrusion checking
* M302 P1 ; disable cold extrusion checking
* M302 S0 ; always allow extrusion (disables checking)
* M302 S170 ; only allow extrusion above 170
* M302 S170 P1 ; set min extrude temp to 170 but leave disabled
Expand Down
4 changes: 3 additions & 1 deletion Marlin/src/gcode/sd/M24_M25.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ void GcodeSuite::M25() {

print_job_timer.pause();

TERN(DWIN_CREALITY_LCD,,ui.reset_status());
#if DISABLED(DWIN_CREALITY_LCD)
ui.reset_status();
#endif

#if ENABLED(HOST_ACTION_COMMANDS)
TERN_(HOST_PROMPT_SUPPORT, host_prompt_open(PROMPT_PAUSE_RESUME, PSTR("Pause SD"), PSTR("Resume")));
Expand Down
2 changes: 2 additions & 0 deletions Marlin/src/gcode/sd/M524.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ void GcodeSuite::M524() {

if (IS_SD_PRINTING())
card.flag.abort_sd_printing = true;
else if (card.isMounted())
card.closefile();

}

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/inc/Version.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
* version was tagged.
*/
#ifndef STRING_DISTRIBUTION_DATE
#define STRING_DISTRIBUTION_DATE "2020-09-27"
#define STRING_DISTRIBUTION_DATE "2020-09-28"
#endif

/**
Expand Down
146 changes: 48 additions & 98 deletions Marlin/src/lcd/dwin/e3v2/dwin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,16 @@ inline void Draw_Back_First(const bool is_sel=true) {
if (is_sel) Draw_Menu_Cursor(0);
}

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;
}

//
// Draw Menus
//
Expand Down Expand Up @@ -1099,7 +1109,7 @@ void Goto_PrintProcess() {

// Copy into filebuf string before entry
char * const name = card.longest_filename();
const int8_t npos = _MAX(0, DWIN_WIDTH - strlen(name) * MENU_CHR_W) / 2;
const int8_t npos = _MAX(0U, DWIN_WIDTH - strlen(name) * MENU_CHR_W) / 2;
DWIN_Draw_String(false, false, font8x16, Color_White, Color_Bg_Black, npos, 60, name);

DWIN_ICON_Show(ICON, ICON_PrintTime, 17, 193);
Expand Down Expand Up @@ -1146,13 +1156,7 @@ inline ENCODER_DiffState get_encoder_state() {
void HMI_Move_X() {
ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze();
if (encoder_diffState != ENCODER_DIFF_NO) {
if (encoder_diffState == ENCODER_DIFF_CW) {
HMI_ValueStruct.Move_X_scale += EncoderRate.encoderMoveValue;
}
else if (encoder_diffState == ENCODER_DIFF_CCW) {
HMI_ValueStruct.Move_X_scale -= EncoderRate.encoderMoveValue;
}
else if (encoder_diffState == ENCODER_DIFF_ENTER) {
if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Move_X_scale)) {
checkkey = AxisMove;
EncoderRate.enabled = false;
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 216, MBASE(1), HMI_ValueStruct.Move_X_scale);
Expand All @@ -1175,13 +1179,7 @@ void HMI_Move_X() {
void HMI_Move_Y() {
ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze();
if (encoder_diffState != ENCODER_DIFF_NO) {
if (encoder_diffState == ENCODER_DIFF_CW) {
HMI_ValueStruct.Move_Y_scale += EncoderRate.encoderMoveValue;
}
else if (encoder_diffState == ENCODER_DIFF_CCW) {
HMI_ValueStruct.Move_Y_scale -= EncoderRate.encoderMoveValue;
}
else if (encoder_diffState == ENCODER_DIFF_ENTER) {
if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Move_Y_scale)) {
checkkey = AxisMove;
EncoderRate.enabled = false;
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 216, MBASE(2), HMI_ValueStruct.Move_Y_scale);
Expand All @@ -1204,13 +1202,7 @@ void HMI_Move_Y() {
void HMI_Move_Z() {
ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze();
if (encoder_diffState != ENCODER_DIFF_NO) {
if (encoder_diffState == ENCODER_DIFF_CW) {
HMI_ValueStruct.Move_Z_scale += EncoderRate.encoderMoveValue;
}
else if (encoder_diffState == ENCODER_DIFF_CCW) {
HMI_ValueStruct.Move_Z_scale -= EncoderRate.encoderMoveValue;
}
else if (encoder_diffState == ENCODER_DIFF_ENTER) {
if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Move_Z_scale)) {
checkkey = AxisMove;
EncoderRate.enabled = false;
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 216, MBASE(3), HMI_ValueStruct.Move_Z_scale);
Expand All @@ -1236,13 +1228,7 @@ void HMI_Move_Z() {
static float last_E_scale = 0;
ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze();
if (encoder_diffState != ENCODER_DIFF_NO) {
if (encoder_diffState == ENCODER_DIFF_CW) {
HMI_ValueStruct.Move_E_scale += EncoderRate.encoderMoveValue;
}
else if (encoder_diffState == ENCODER_DIFF_CCW) {
HMI_ValueStruct.Move_E_scale -= EncoderRate.encoderMoveValue;
}
else if (encoder_diffState == ENCODER_DIFF_ENTER) {
if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Move_E_scale)) {
checkkey = AxisMove;
EncoderRate.enabled = false;
last_E_scale = HMI_ValueStruct.Move_E_scale;
Expand Down Expand Up @@ -1278,11 +1264,7 @@ void HMI_Move_Z() {
case -4: zoff_line = PREPARE_CASE_ZOFF + MROWS - index_prepare; break;
default: zoff_line = TUNE_CASE_ZOFF + MROWS - index_tune;
}
if (encoder_diffState == ENCODER_DIFF_CW)
HMI_ValueStruct.offset_value += EncoderRate.encoderMoveValue;
else if (encoder_diffState == ENCODER_DIFF_CCW)
HMI_ValueStruct.offset_value -= EncoderRate.encoderMoveValue;
else if (encoder_diffState == ENCODER_DIFF_ENTER) {
if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.offset_value)) {
EncoderRate.enabled = false;
#if HAS_BED_PROBE
probe.offset.z = dwin_zoffset;
Expand Down Expand Up @@ -1326,13 +1308,7 @@ void HMI_Move_Z() {
case -3: temp_line = PREHEAT_CASE_TEMP; break;
default: temp_line = TUNE_CASE_TEMP + MROWS - index_tune;
}
if (encoder_diffState == ENCODER_DIFF_CW) {
HMI_ValueStruct.E_Temp += EncoderRate.encoderMoveValue;
}
else if (encoder_diffState == ENCODER_DIFF_CCW) {
HMI_ValueStruct.E_Temp -= EncoderRate.encoderMoveValue;
}
else if (encoder_diffState == ENCODER_DIFF_ENTER) { // return
if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.E_Temp)) {
EncoderRate.enabled = false;
if (HMI_ValueStruct.show_mode == -1) { // temperature
checkkey = TemperatureID;
Expand Down Expand Up @@ -1379,13 +1355,7 @@ void HMI_Move_Z() {
case -3: bed_line = PREHEAT_CASE_BED; break;
default: bed_line = TUNE_CASE_BED + MROWS - index_tune;
}
if (encoder_diffState == ENCODER_DIFF_CW) {
HMI_ValueStruct.Bed_Temp += EncoderRate.encoderMoveValue;
}
else if (encoder_diffState == ENCODER_DIFF_CCW) {
HMI_ValueStruct.Bed_Temp -= EncoderRate.encoderMoveValue;
}
else if (encoder_diffState == ENCODER_DIFF_ENTER) { // return
if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Bed_Temp)) {
EncoderRate.enabled = false;
if (HMI_ValueStruct.show_mode == -1) {
checkkey = TemperatureID;
Expand Down Expand Up @@ -1433,13 +1403,7 @@ void HMI_Move_Z() {
default: fan_line = TUNE_CASE_FAN + MROWS - index_tune;
}

if (encoder_diffState == ENCODER_DIFF_CW) {
HMI_ValueStruct.Fan_speed += EncoderRate.encoderMoveValue;
}
else if (encoder_diffState == ENCODER_DIFF_CCW) {
HMI_ValueStruct.Fan_speed -= EncoderRate.encoderMoveValue;
}
else if (encoder_diffState == ENCODER_DIFF_ENTER) { // return
if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Fan_speed)) {
EncoderRate.enabled = false;
if (HMI_ValueStruct.show_mode == -1) {
checkkey = TemperatureID;
Expand Down Expand Up @@ -1477,13 +1441,7 @@ void HMI_Move_Z() {
void HMI_PrintSpeed() {
ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze();
if (encoder_diffState != ENCODER_DIFF_NO) {
if (encoder_diffState == ENCODER_DIFF_CW) {
HMI_ValueStruct.print_speed += EncoderRate.encoderMoveValue;
}
else if (encoder_diffState == ENCODER_DIFF_CCW) {
HMI_ValueStruct.print_speed -= EncoderRate.encoderMoveValue;
}
else if (encoder_diffState == ENCODER_DIFF_ENTER) { // return
if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.print_speed)) {
checkkey = Tune;
EncoderRate.enabled = false;
feedrate_percentage = HMI_ValueStruct.print_speed;
Expand All @@ -1501,13 +1459,7 @@ void HMI_PrintSpeed() {
void HMI_MaxFeedspeedXYZE() {
ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze();
if (encoder_diffState != ENCODER_DIFF_NO) {
if (encoder_diffState == ENCODER_DIFF_CW) {
HMI_ValueStruct.Max_Feedspeed += EncoderRate.encoderMoveValue;
}
else if (encoder_diffState == ENCODER_DIFF_CCW) {
HMI_ValueStruct.Max_Feedspeed -= EncoderRate.encoderMoveValue;
}
else if (encoder_diffState == ENCODER_DIFF_ENTER) { // return
if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Max_Feedspeed)) {
checkkey = MaxSpeed;
EncoderRate.enabled = false;
if (WITHIN(HMI_flag.feedspeed_axis, X_AXIS, E_AXIS))
Expand All @@ -1527,9 +1479,7 @@ void HMI_MaxFeedspeedXYZE() {
void HMI_MaxAccelerationXYZE() {
ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze();
if (encoder_diffState != ENCODER_DIFF_NO) {
if (encoder_diffState == ENCODER_DIFF_CW) { HMI_ValueStruct.Max_Acceleration += EncoderRate.encoderMoveValue;}
else if (encoder_diffState == ENCODER_DIFF_CCW) { HMI_ValueStruct.Max_Acceleration -= EncoderRate.encoderMoveValue;}
else if (encoder_diffState == ENCODER_DIFF_ENTER) { // return
if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Max_Acceleration)) {
checkkey = MaxAcceleration;
EncoderRate.enabled = false;
if (HMI_flag.acc_axis == X_AXIS) planner.set_max_acceleration(X_AXIS, HMI_ValueStruct.Max_Acceleration);
Expand All @@ -1555,11 +1505,7 @@ void HMI_MaxAccelerationXYZE() {
void HMI_MaxJerkXYZE() {
ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze();
if (encoder_diffState != ENCODER_DIFF_NO) {
if (encoder_diffState == ENCODER_DIFF_CW)
HMI_ValueStruct.Max_Jerk += EncoderRate.encoderMoveValue;
else if (encoder_diffState == ENCODER_DIFF_CCW)
HMI_ValueStruct.Max_Jerk -= EncoderRate.encoderMoveValue;
else if (encoder_diffState == ENCODER_DIFF_ENTER) { // return
if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Max_Jerk)) {
checkkey = MaxJerk;
EncoderRate.enabled = false;
if (WITHIN(HMI_flag.step_axis, X_AXIS, E_AXIS))
Expand All @@ -1581,13 +1527,7 @@ void HMI_MaxAccelerationXYZE() {
void HMI_StepXYZE() {
ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze();
if (encoder_diffState != ENCODER_DIFF_NO) {
if (encoder_diffState == ENCODER_DIFF_CW) {
HMI_ValueStruct.Max_Step += EncoderRate.encoderMoveValue;
}
else if (encoder_diffState == ENCODER_DIFF_CCW) {
HMI_ValueStruct.Max_Step -= EncoderRate.encoderMoveValue;
}
else if (encoder_diffState == ENCODER_DIFF_ENTER) { // return
if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Max_Step)) {
checkkey = Step;
EncoderRate.enabled = false;
if (WITHIN(HMI_flag.step_axis, X_AXIS, E_AXIS))
Expand Down Expand Up @@ -1787,7 +1727,7 @@ inline void Draw_SDItem(const uint16_t item, int16_t row=-1) {
inline void Draw_SDItem_Shifted(int8_t &shift) {
// Limit to the number of chars past the cutoff
const size_t len = strlen(shift_name);
NOMORE(shift, _MAX((signed)len - MENU_CHAR_LIMIT, 0));
NOMORE(shift, _MAX(len - MENU_CHAR_LIMIT, 0U));

// Shorten to the available space
const size_t lastchar = _MIN((signed)len, shift + MENU_CHAR_LIMIT);
Expand All @@ -1813,11 +1753,17 @@ inline void Redraw_SD_List() {

Draw_Back_First();

// As many files as will fit
LOOP_L_N(i, _MIN(nr_sd_menu_items(), MROWS))
Draw_SDItem(i, i + 1);
if (card.isMounted()) {
// As many files as will fit
LOOP_L_N(i, _MIN(nr_sd_menu_items(), MROWS))
Draw_SDItem(i, i + 1);

TERN_(SCROLL_LONG_FILENAMES, Init_SDItem_Shift());
TERN_(SCROLL_LONG_FILENAMES, Init_SDItem_Shift());
}
else {
DWIN_Draw_Rectangle(1, Color_Bg_Red, 10, MBASE(3) - 10, DWIN_WIDTH - 10, MBASE(4));
DWIN_Draw_String(false, false, font16x32, Color_Yellow, Color_Bg_Red, ((DWIN_WIDTH) - 8 * 16) / 2, MBASE(3), F("No Media"));
}
}

bool DWIN_lcd_sd_status = false;
Expand All @@ -1842,7 +1788,7 @@ void HMI_SDCardUpdate() {
if (DWIN_lcd_sd_status != card.isMounted()) {
DWIN_lcd_sd_status = card.isMounted();
// SERIAL_ECHOLNPAIR("HMI_SDCardUpdate: ", int(DWIN_lcd_sd_status));
if (card.isMounted()) {
if (DWIN_lcd_sd_status) {
if (checkkey == SelectFile)
Redraw_SD_List();
}
Expand All @@ -1863,10 +1809,11 @@ void HMI_SDCardUpdate() {
}
}

/* Start Frame */

void HMI_StartFrame(const bool with_update) {
Goto_MainMenu();
//
// 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) {

// Clear the bottom area of the screen
DWIN_Draw_Rectangle(1, Color_Bg_Black, 0, STATUS_Y, DWIN_WIDTH, DWIN_HEIGHT - 1);
Expand Down Expand Up @@ -1906,6 +1853,11 @@ void HMI_StartFrame(const bool with_update) {
}
}

void HMI_StartFrame(const bool with_update) {
Goto_MainMenu();
Draw_Status_Area(with_update);
}

inline void Draw_Info_Menu() {
Clear_Main_Window();

Expand Down Expand Up @@ -2233,12 +2185,10 @@ void HMI_PauseOrStop() {
ENCODER_DiffState encoder_diffState = get_encoder_state();
if (encoder_diffState == ENCODER_DIFF_NO) return;

if (encoder_diffState == ENCODER_DIFF_CW) {
if (encoder_diffState == ENCODER_DIFF_CW)
Draw_Select_Highlight(false);
}
else if (encoder_diffState == ENCODER_DIFF_CCW) {
else if (encoder_diffState == ENCODER_DIFF_CCW)
Draw_Select_Highlight(true);
}
else if (encoder_diffState == ENCODER_DIFF_ENTER) {
if (select_print.now == 1) { // pause window
if (HMI_flag.select_flag) {
Expand Down
Loading

0 comments on commit 752a696

Please sign in to comment.