Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/bugfix-2.0.x' into X5SA-2E-Bug…
Browse files Browse the repository at this point in the history
…fix-ColorUI
  • Loading branch information
effgarces committed Dec 4, 2020
2 parents 0f2aae7 + 465840e commit c7476aa
Show file tree
Hide file tree
Showing 14 changed files with 162 additions and 199 deletions.
7 changes: 1 addition & 6 deletions Marlin/src/HAL/STM32F1/eeprom_bl24cxx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,14 @@ bool PersistentStore::access_start() { eeprom_init(); return true; }
bool PersistentStore::access_finish() { return true; }

bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
size_t written = 0;

while (size--) {
uint8_t v = *value;
uint8_t * const p = (uint8_t * const)pos;
// EEPROM has only ~100,000 write cycles,
// so only write bytes that have changed!
if (v != eeprom_read_byte(p)) {
eeprom_write_byte(p, v);
if (++written % 128 == 0)
safe_delay(2); // Avoid triggering watchdog during long EEPROM writes
else
delay(2);
if (size & 0x7F) delay(2); else safe_delay(2); // Avoid triggering watchdog during long EEPROM writes
if (eeprom_read_byte(p) != v) {
SERIAL_ECHO_MSG(STR_ERR_EEPROM_WRITE);
return true;
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/MarlinCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,7 @@ void setup() {
serial_connect_timeout = millis() + 1000UL;
while (!MYSERIAL1 && PENDING(millis(), serial_connect_timeout)) { /*nada*/ }
#endif
SERIAL_ECHO_MSG("start");
SERIAL_ECHOLNPGM("start");

#if BOTH(HAS_TFT_LVGL_UI, MKS_WIFI_MODULE)
mks_esp_wifi_init();
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@

// Start and end in the same cell? No split needed.
if (scel == ecel) {
line_to_destination(scaled_fr_mm_s);
current_position = destination;
line_to_current_position(scaled_fr_mm_s);
return;
}

Expand Down Expand Up @@ -104,8 +104,8 @@
else {
// Must already have been split on these border(s)
// This should be a rare case.
line_to_destination(scaled_fr_mm_s);
current_position = destination;
line_to_current_position(scaled_fr_mm_s);
return;
}

Expand Down
22 changes: 17 additions & 5 deletions Marlin/src/feature/pause.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,18 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l
return true;
}

/**
* Disabling E steppers for manual filament change should be fine
* as long as users don't spin the E motor ridiculously fast and
* send current back to their board, potentially frying it.
*/
inline void disable_active_extruder() {
#if HAS_E_STEPPER_ENABLE
disable_e_stepper(active_extruder);
safe_delay(100);
#endif
}

/**
* Unload filament from the hotend
*
Expand Down Expand Up @@ -357,11 +369,8 @@ bool unload_filament(const float &unload_length, const bool show_lcd/*=false*/,
planner.settings.retract_acceleration = saved_acceleration;
#endif

// Disable E steppers for manual change
#if HAS_E_STEPPER_ENABLE
disable_e_stepper(active_extruder);
safe_delay(100);
#endif
// Disable the Extruder for manual change
disable_active_extruder();

return true;
}
Expand Down Expand Up @@ -447,6 +456,9 @@ bool pause_print(const float &retract, const xyz_pos_t &park_point, const float
set_duplication_enabled(saved_ext_dup_mode, saved_ext);
#endif

// Disable the Extruder for manual change
disable_active_extruder();

return true;
}

Expand Down
1 change: 1 addition & 0 deletions Marlin/src/gcode/gcode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
#if ENABLED(PASSWORD_FEATURE)
if (password.is_locked && !parser.is_command('M', 511)) {
SERIAL_ECHO_MSG(STR_PRINTER_LOCKED);
if (!no_ok) queue.ok_to_send();
return;
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/gcode/motion/G2_G3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ void plan_arc(
#endif

// Do a full circle if angular rotation is near 0 and the target is current position
if ((!angular_travel || NEAR_ZERO(angular_travel)) && NEAR(current_position[p_axis], cart[p_axis]) && NEAR(current_position[q_axis], cart[q_axis])) {
if (!angular_travel || (NEAR_ZERO(angular_travel) && NEAR(current_position[p_axis], cart[p_axis]) && NEAR(current_position[q_axis], cart[q_axis]))) {
// Preserve direction for circles
angular_travel = clockwise ? -RADIANS(360) : RADIANS(360);
}
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-12-01"
#define STRING_DISTRIBUTION_DATE "2020-12-04"
#endif

/**
Expand Down
147 changes: 78 additions & 69 deletions Marlin/src/lcd/dwin/e3v2/dwin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,10 @@ bool dwin_abort_flag = false; // Flag to reset feedrate, return to Home

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

#if HAS_CLASSIC_JERK
constexpr float default_max_jerk[] = { DEFAULT_XJERK, DEFAULT_YJERK, DEFAULT_ZJERK, DEFAULT_EJERK };
#endif

uint8_t Percentrecord = 0;
uint16_t remain_time = 0;
Expand Down Expand Up @@ -213,7 +216,7 @@ void HMI_SetLanguageCache() {
}

void HMI_SetLanguage() {
#if ENABLED(EEPROM_SETTINGS)
#if BOTH(EEPROM_SETTINGS, IIC_BL24CXX_EEPROM)
BL24CXX::read(DWIN_LANGUAGE_EEPROM_ADDRESS, (uint8_t*)&HMI_flag.language, sizeof(HMI_flag.language));
#endif
HMI_SetLanguageCache();
Expand All @@ -222,7 +225,7 @@ void HMI_SetLanguage() {
void HMI_ToggleLanguage() {
HMI_flag.language = HMI_IsChinese() ? DWIN_ENGLISH : DWIN_CHINESE;
HMI_SetLanguageCache();
#if ENABLED(EEPROM_SETTINGS)
#if BOTH(EEPROM_SETTINGS, IIC_BL24CXX_EEPROM)
BL24CXX::write(DWIN_LANGUAGE_EEPROM_ADDRESS, (uint8_t*)&HMI_flag.language, sizeof(HMI_flag.language));
#endif
}
Expand Down Expand Up @@ -1492,8 +1495,8 @@ void HMI_MaxAccelerationXYZE() {
if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Max_Jerk)) {
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);
if (WITHIN(HMI_flag.jerk_axis, X_AXIS, E_AXIS))
planner.set_max_jerk(HMI_flag.jerk_axis, HMI_ValueStruct.Max_Jerk / 10);
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 210, MBASE(select_jerk.now), HMI_ValueStruct.Max_Jerk);
return;
}
Expand Down Expand Up @@ -2955,75 +2958,77 @@ inline void Draw_Max_Accel_Menu() {
#endif
}

inline void Draw_Max_Jerk_Menu() {
Clear_Main_Window();
#if HAS_CLASSIC_JERK
inline void Draw_Max_Jerk_Menu() {
Clear_Main_Window();

if (HMI_IsChinese()) {
DWIN_Frame_TitleCopy(1, 1, 16, 28, 28); // "Jerk"

DWIN_Frame_AreaCopy(1, 173, 133, 200, 147, LBLX , MBASE(1));
DWIN_Frame_AreaCopy(1, 1, 180, 28, 192, LBLX + 27, MBASE(1) + 1);
DWIN_Frame_AreaCopy(1, 202, 133, 228, 147, LBLX + 53, MBASE(1));
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);
DWIN_Frame_AreaCopy(1, 202, 133, 228, 147, LBLX + 53, MBASE(2));
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);
DWIN_Frame_AreaCopy(1, 202, 133, 228, 147, LBLX + 53, MBASE(3));
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
}
else {
#ifdef USE_STRING_HEADINGS
Draw_Title(GET_TEXT_F(MSG_JERK));
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"));
if (HMI_IsChinese()) {
DWIN_Frame_TitleCopy(1, 1, 16, 28, 28); // "Jerk"

DWIN_Frame_AreaCopy(1, 173, 133, 200, 147, LBLX , MBASE(1));
DWIN_Frame_AreaCopy(1, 1, 180, 28, 192, LBLX + 27, MBASE(1) + 1);
DWIN_Frame_AreaCopy(1, 202, 133, 228, 147, LBLX + 53, MBASE(1));
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);
DWIN_Frame_AreaCopy(1, 202, 133, 228, 147, LBLX + 53, MBASE(2));
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);
DWIN_Frame_AreaCopy(1, 202, 133, 228, 147, LBLX + 53, MBASE(3));
DWIN_Frame_AreaCopy(1, 9, 150, 16, 160, LBLX + 83, MBASE(3) + 3); // Max Jerk speed Z
#if HAS_HOTEND
DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(4), F("Max Jerk E"));
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
#else
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"
}
else {
#ifdef USE_STRING_HEADINGS
Draw_Title(GET_TEXT_F(MSG_JERK));
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"));
#if HAS_HOTEND
DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(4), F("Max Jerk E"));
#endif
#else
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"
#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
#endif
}

Draw_Back_First();
LOOP_L_N(i, 3 + ENABLED(HAS_HOTEND)) Draw_Menu_Line(i + 1, ICON_MaxSpeedJerkX + i);
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);
#if HAS_HOTEND
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 210, MBASE(4), planner.max_jerk[E_AXIS] * MINUNITMULT);
#endif
}

Draw_Back_First();
LOOP_L_N(i, 3 + ENABLED(HAS_HOTEND)) Draw_Menu_Line(i + 1, ICON_MaxSpeedJerkX + i);
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);
#if HAS_HOTEND
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 210, MBASE(4), planner.max_jerk[E_AXIS] * MINUNITMULT);
#endif
}
#endif

inline void Draw_Steps_Menu() {
Clear_Main_Window();
Expand Down Expand Up @@ -3636,7 +3641,9 @@ void DWIN_HandleScreen() {
#endif
case MaxSpeed: HMI_MaxSpeed(); break;
case MaxAcceleration: HMI_MaxAcceleration(); break;
case MaxJerk: HMI_MaxJerk(); break;
#if HAS_CLASSIC_JERK
case MaxJerk: HMI_MaxJerk(); break;
#endif
case Step: HMI_Step(); break;
case Move_X: HMI_Move_X(); break;
case Move_Y: HMI_Move_Y(); break;
Expand All @@ -3657,7 +3664,9 @@ void DWIN_HandleScreen() {
case PrintSpeed: HMI_PrintSpeed(); break;
case MaxSpeed_value: HMI_MaxFeedspeedXYZE(); break;
case MaxAcceleration_value: HMI_MaxAccelerationXYZE(); break;
case MaxJerk_value: HMI_MaxJerkXYZE(); break;
#if HAS_CLASSIC_JERK
case MaxJerk_value: HMI_MaxJerkXYZE(); break;
#endif
case Step_value: HMI_StepXYZE(); break;
default: break;
}
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/menu/menu_motion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ void menu_motion() {
#endif

#if ENABLED(LEVEL_BED_CORNERS) && DISABLED(LCD_BED_LEVELING)
ACTION_ITEM(MSG_LEVEL_CORNERS, _lcd_level_bed_corners);
SUBMENU(MSG_LEVEL_CORNERS, _lcd_level_bed_corners);
#endif

#if ENABLED(Z_MIN_PROBE_REPEATABILITY_TEST)
Expand Down
Loading

0 comments on commit c7476aa

Please sign in to comment.