Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/bugfix-2.0.x' into P3Steel-Bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
effgarces committed May 2, 2021
2 parents b2d6922 + 05c25b8 commit 1bea497
Show file tree
Hide file tree
Showing 20 changed files with 148 additions and 118 deletions.
3 changes: 2 additions & 1 deletion Marlin/src/gcode/feature/pause/M125.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@ void GcodeSuite::M125() {
// If possible, show an LCD prompt with the 'P' flag
const bool show_lcd = TERN0(HAS_LCD_MENU, parser.boolval('P'));

TERN_(POWER_LOSS_RECOVERY, if (recovery.enabled) recovery.save(true));

if (pause_print(retract, park_point, 0, show_lcd)) {
TERN_(POWER_LOSS_RECOVERY, if (recovery.enabled) recovery.save(true));
if (ENABLED(EXTENSIBLE_UI) || !sd_printing || show_lcd) {
wait_for_confirmation(false, 0);
resume_print(0, 0, -retract, 0);
Expand Down
3 changes: 2 additions & 1 deletion Marlin/src/gcode/gcode_d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,8 @@
} break;

case 102: { // D102 Test SD Read
card.openFileRead("test.gco");
char testfile[] = "test.gco";
card.openFileRead(testfile);
if (!card.isFileOpen()) {
SERIAL_ECHOLNPAIR("Failed to open test.gco to read.");
return;
Expand Down
10 changes: 10 additions & 0 deletions Marlin/src/inc/Conditionals_LCD.h
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,16 @@
#endif
#endif

/**
* Disable unused SINGLENOZZLE sub-options
*/
#if DISABLED(SINGLENOZZLE)
#undef SINGLENOZZLE_STANDBY_TEMP
#endif
#if !BOTH(HAS_FAN, SINGLENOZZLE)
#undef SINGLENOZZLE_STANDBY_FAN
#endif

/**
* DISTINCT_E_FACTORS affects how some E factors are accessed
*/
Expand Down
4 changes: 3 additions & 1 deletion Marlin/src/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -3034,8 +3034,10 @@ static_assert( _ARR_TEST(3,0) && _ARR_TEST(3,1) && _ARR_TEST(3,2)
"BACKLASH_COMPENSATION can only apply to " STRINGIFY(NORMAL_AXIS) " on a MarkForged system.");
#elif IS_CORE
constexpr float backlash_arr[] = BACKLASH_DISTANCE_MM;
static_assert(!backlash_arr[CORE_AXIS_1] && !backlash_arr[CORE_AXIS_2],
#ifndef CORE_BACKLASH
static_assert(!backlash_arr[CORE_AXIS_1] && !backlash_arr[CORE_AXIS_2],
"BACKLASH_COMPENSATION can only apply to " STRINGIFY(NORMAL_AXIS) " with your CORE system.");
#endif
#endif
#endif

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 "2021-04-28"
#define STRING_DISTRIBUTION_DATE "2021-05-01"
#endif

/**
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/HD44780/marlinui_HD44780.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ FORCE_INLINE void _draw_heater_status(const heater_id_t heater_id, const char pr

if (prefix >= 0) lcd_put_wchar(prefix);

lcd_put_u8str(i16tostr3rj(t1));
lcd_put_u8str(t1 < 0 ? "err" : i16tostr3rj(t1));
lcd_put_wchar('/');

#if !HEATER_IDLE_HANDLER
Expand Down
12 changes: 8 additions & 4 deletions Marlin/src/lcd/dogm/status_screen_DOGM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,14 @@
#define PROGRESS_BAR_WIDTH (LCD_PIXEL_WIDTH - PROGRESS_BAR_X)

FORCE_INLINE void _draw_centered_temp(const celsius_t temp, const uint8_t tx, const uint8_t ty) {
const char *str = i16tostr3rj(temp);
const uint8_t len = str[0] != ' ' ? 3 : str[1] != ' ' ? 2 : 1;
lcd_put_u8str(tx - len * (INFO_FONT_WIDTH) / 2 + 1, ty, &str[3-len]);
lcd_put_wchar(LCD_STR_DEGREE[0]);
if (temp < 0)
lcd_put_u8str(tx - 3 * (INFO_FONT_WIDTH) / 2 + 1, ty, "err");
else {
const char *str = i16tostr3rj(temp);
const uint8_t len = str[0] != ' ' ? 3 : str[1] != ' ' ? 2 : 1;
lcd_put_u8str(tx - len * (INFO_FONT_WIDTH) / 2 + 1, ty, &str[3-len]);
lcd_put_wchar(LCD_STR_DEGREE[0]);
}
}

#if DO_DRAW_FLOWMETER
Expand Down
23 changes: 11 additions & 12 deletions Marlin/src/lcd/menu/menu_advanced.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,16 +350,6 @@ void menu_backlash();

#if DISABLED(SLIM_LCD_MENUS)

#if ENABLED(DISTINCT_E_FACTORS)
inline void _reset_e_acceleration_rate(const uint8_t e) { if (e == active_extruder) planner.reset_acceleration_rates(); }
inline void _planner_refresh_e_positioning(const uint8_t e) {
if (e == active_extruder)
planner.refresh_positioning();
else
planner.steps_to_mm[E_AXIS_N(e)] = 1.0f / planner.settings.axis_steps_per_mm[E_AXIS_N(e)];
}
#endif

// M203 / M205 Velocity options
void menu_advanced_velocity() {
// M203 Max Feedrate
Expand Down Expand Up @@ -443,7 +433,10 @@ void menu_backlash();
#if ENABLED(DISTINCT_E_FACTORS)
EDIT_ITEM_FAST(long5_25, MSG_AMAX_E, &planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(active_extruder)], 100, max_accel_edit_scaled.e, []{ planner.reset_acceleration_rates(); });
LOOP_L_N(n, E_STEPPERS)
EDIT_ITEM_FAST_N(long5_25, n, MSG_AMAX_EN, &planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(n)], 100, max_accel_edit_scaled.e, []{ _reset_e_acceleration_rate(MenuItemBase::itemIndex); });
EDIT_ITEM_FAST_N(long5_25, n, MSG_AMAX_EN, &planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(n)], 100, max_accel_edit_scaled.e, []{
if (MenuItemBase::itemIndex == active_extruder)
planner.reset_acceleration_rates();
});
#elif E_STEPPERS
EDIT_ITEM_FAST(long5_25, MSG_AMAX_E, &planner.settings.max_acceleration_mm_per_s2[E_AXIS], 100, max_accel_edit_scaled.e, []{ planner.reset_acceleration_rates(); });
#endif
Expand Down Expand Up @@ -530,7 +523,13 @@ void menu_advanced_steps_per_mm() {

#if ENABLED(DISTINCT_E_FACTORS)
LOOP_L_N(n, E_STEPPERS)
EDIT_ITEM_FAST_N(float51, n, MSG_EN_STEPS, &planner.settings.axis_steps_per_mm[E_AXIS_N(n)], 5, 9999, []{ _planner_refresh_e_positioning(MenuItemBase::itemIndex); });
EDIT_ITEM_FAST_N(float51, n, MSG_EN_STEPS, &planner.settings.axis_steps_per_mm[E_AXIS_N(n)], 5, 9999, []{
const uint8_t e = MenuItemBase::itemIndex;
if (e == active_extruder)
planner.refresh_positioning();
else
planner.steps_to_mm[E_AXIS_N(e)] = 1.0f / planner.settings.axis_steps_per_mm[E_AXIS_N(e)];
});
#elif E_STEPPERS
EDIT_ITEM_FAST(float51, MSG_E_STEPS, &planner.settings.axis_steps_per_mm[E_AXIS], 5, 9999, []{ planner.refresh_positioning(); });
#endif
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/menu/menu_temperature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ void menu_temperature() {

#if ENABLED(SINGLENOZZLE_STANDBY_TEMP)
LOOP_S_L_N(e, 1, EXTRUDERS)
EDIT_ITEM_FAST_N(uint16_3, e, MSG_NOZZLE_STANDBY, &thermalManager.singlenozzle_temp[e], 0, thermalManager.hotend_max_target(0));
EDIT_ITEM_FAST_N(int3, e, MSG_NOZZLE_STANDBY, &thermalManager.singlenozzle_temp[e], 0, thermalManager.hotend_max_target(0));
#endif

//
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/menu/menu_tune.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ void menu_tune() {

#if ENABLED(SINGLENOZZLE_STANDBY_TEMP)
LOOP_S_L_N(e, 1, EXTRUDERS)
EDIT_ITEM_FAST_N(uint16_3, e, MSG_NOZZLE_STANDBY, &thermalManager.singlenozzle_temp[e], 0, thermalManager.hotend_max_target(0));
EDIT_ITEM_FAST_N(int3, e, MSG_NOZZLE_STANDBY, &thermalManager.singlenozzle_temp[e], 0, thermalManager.hotend_max_target(0));
#endif

//
Expand Down
3 changes: 2 additions & 1 deletion Marlin/src/libs/duration_t.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ struct duration_t {
* @brief Formats the duration as a string
* @details String will be formated using a "full" representation of duration
*
* @param buffer The array pointed to must be able to accommodate 21 bytes
* @param buffer The array pointed to must be able to accommodate 22 bytes
* (21 for the string, 1 more for the terminating nul)
*
* Output examples:
* 123456789012345678901 (strlen)
Expand Down
52 changes: 27 additions & 25 deletions Marlin/src/module/temperature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -466,9 +466,9 @@ volatile bool Temperature::raw_temps_ready = false;

#if ENABLED(SINGLENOZZLE_STANDBY_TEMP)
celsius_t Temperature::singlenozzle_temp[EXTRUDERS];
#if HAS_FAN
uint8_t Temperature::singlenozzle_fan_speed[EXTRUDERS];
#endif
#endif
#if ENABLED(SINGLENOZZLE_STANDBY_FAN)
uint8_t Temperature::singlenozzle_fan_speed[EXTRUDERS];
#endif

#if ENABLED(PROBING_HEATERS_OFF)
Expand Down Expand Up @@ -543,7 +543,7 @@ volatile bool Temperature::raw_temps_ready = false;
#define GTV(C,B,H) C_GTV(ischamber, C, B_GTV(isbed, B, H))
const uint16_t watch_temp_period = GTV(WATCH_CHAMBER_TEMP_PERIOD, WATCH_BED_TEMP_PERIOD, WATCH_TEMP_PERIOD);
const uint8_t watch_temp_increase = GTV(WATCH_CHAMBER_TEMP_INCREASE, WATCH_BED_TEMP_INCREASE, WATCH_TEMP_INCREASE);
const celsius_float_t watch_temp_target = celsius_float_t(target - watch_temp_increase + GTV(TEMP_CHAMBER_HYSTERESIS, TEMP_BED_HYSTERESIS, TEMP_HYSTERESIS) + 1);
const celsius_float_t watch_temp_target = celsius_float_t(target - (watch_temp_increase + GTV(TEMP_CHAMBER_HYSTERESIS, TEMP_BED_HYSTERESIS, TEMP_HYSTERESIS) + 1));
millis_t temp_change_ms = next_temp_ms + SEC_TO_MS(watch_temp_period);
celsius_float_t next_watch_temp = 0.0;
bool heated = false;
Expand Down Expand Up @@ -1253,13 +1253,13 @@ 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 (watch_hotend[e].elapsed(ms)) { // Enabled and time to check?
if (watch_hotend[e].check(degHotend(e))) // Increased enough?
start_watching_hotend(e); // If temp reached, turn off elapsed check
else {
TERN_(DWIN_CREALITY_LCD, DWIN_Popup_Temperature(0));
_temp_error((heater_id_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);
}
#endif

Expand Down Expand Up @@ -1296,13 +1296,13 @@ 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 (watch_bed.elapsed(ms)) { // Time to check the bed?
if (watch_bed.check(degBed())) // Increased enough?
start_watching_bed(); // If temp reached, turn off elapsed check
else {
TERN_(DWIN_CREALITY_LCD, DWIN_Popup_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();
}
#endif // WATCH_BED

Expand Down Expand Up @@ -1377,11 +1377,11 @@ void Temperature::manage_heater() {

#if WATCH_CHAMBER
// Make sure temperature is increasing
if (watch_chamber.elapsed(ms)) { // Time to check the chamber?
if (degChamber() < watch_chamber.target) // Failed to increase enough?
_temp_error(H_CHAMBER, str_t_heating_failed, GET_TEXT(MSG_HEATING_FAILED_LCD));
if (watch_chamber.elapsed(ms)) { // Time to check the chamber?
if (watch_chamber.check(degChamber())) // Increased enough? Error below.
start_watching_chamber(); // If temp reached, turn off elapsed check.
else
start_watching_chamber(); // Start again if the target is still far off
_temp_error(H_CHAMBER, str_t_heating_failed, GET_TEXT(MSG_HEATING_FAILED_LCD));
}
#endif

Expand Down Expand Up @@ -2500,20 +2500,22 @@ void Temperature::disable_all_heaters() {

#endif // PROBING_HEATERS_OFF

#if ENABLED(SINGLENOZZLE_STANDBY_TEMP)
#if EITHER(SINGLENOZZLE_STANDBY_TEMP, SINGLENOZZLE_STANDBY_FAN)

void Temperature::singlenozzle_change(const uint8_t old_tool, const uint8_t new_tool) {
#if HAS_FAN
#if ENABLED(SINGLENOZZLE_STANDBY_FAN)
singlenozzle_fan_speed[old_tool] = fan_speed[0];
fan_speed[0] = singlenozzle_fan_speed[new_tool];
#endif
singlenozzle_temp[old_tool] = temp_hotend[0].target;
if (singlenozzle_temp[new_tool] && singlenozzle_temp[new_tool] != singlenozzle_temp[old_tool]) {
setTargetHotend(singlenozzle_temp[new_tool], 0);
TERN_(AUTOTEMP, planner.autotemp_update());
TERN_(HAS_STATUS_MESSAGE, set_heating_message(0));
(void)wait_for_hotend(0, false); // Wait for heating or cooling
}
#if ENABLED(SINGLENOZZLE_STANDBY_TEMP)
singlenozzle_temp[old_tool] = temp_hotend[0].target;
if (singlenozzle_temp[new_tool] && singlenozzle_temp[new_tool] != singlenozzle_temp[old_tool]) {
setTargetHotend(singlenozzle_temp[new_tool], 0);
TERN_(AUTOTEMP, planner.autotemp_update());
TERN_(HAS_STATUS_MESSAGE, set_heating_message(0));
(void)wait_for_hotend(0, false); // Wait for heating or cooling
}
#endif
}

#endif
Expand Down
10 changes: 7 additions & 3 deletions Marlin/src/module/temperature.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,8 @@ struct HeaterWatch {
inline bool elapsed(const millis_t &ms) { return next_ms && ELAPSED(ms, next_ms); }
inline bool elapsed() { return elapsed(millis()); }

inline bool check(const celsius_t curr) { return curr >= target; }

inline void restart(const celsius_t curr, const celsius_t tgt) {
if (tgt) {
const celsius_t newtarget = curr + INCREASE;
Expand Down Expand Up @@ -370,9 +372,11 @@ class Temperature {
static inline bool hotEnoughToExtrude(const uint8_t e) { return !tooColdToExtrude(e); }
static inline bool targetHotEnoughToExtrude(const uint8_t e) { return !targetTooColdToExtrude(e); }

#if ENABLED(SINGLENOZZLE_STANDBY_FAN)
static celsius_t singlenozzle_temp[EXTRUDERS];
#if HAS_FAN
#if EITHER(SINGLENOZZLE_STANDBY_TEMP, SINGLENOZZLE_STANDBY_FAN)
#if ENABLED(SINGLENOZZLE_STANDBY_TEMP)
static celsius_t singlenozzle_temp[EXTRUDERS];
#endif
#if ENABLED(SINGLENOZZLE_STANDBY_FAN)
static uint8_t singlenozzle_fan_speed[EXTRUDERS];
#endif
static void singlenozzle_change(const uint8_t old_tool, const uint8_t new_tool);
Expand Down
4 changes: 3 additions & 1 deletion Marlin/src/module/tool_change.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1194,7 +1194,9 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
const bool should_move = safe_to_move && !no_move && IsRunning();
if (should_move) {

TERN_(SINGLENOZZLE_STANDBY_TEMP, thermalManager.singlenozzle_change(old_tool, new_tool));
#if EITHER(SINGLENOZZLE_STANDBY_TEMP, SINGLENOZZLE_STANDBY_FAN)
thermalManager.singlenozzle_change(old_tool, new_tool);
#endif

#if ENABLED(TOOLCHANGE_FILAMENT_SWAP)
if (should_swap && !too_cold) {
Expand Down
Loading

0 comments on commit 1bea497

Please sign in to comment.