From af930ee994e7e761e88086e63a3b3c2c24476c90 Mon Sep 17 00:00:00 2001 From: Sergey Date: Mon, 16 Aug 2021 14:17:06 +0300 Subject: [PATCH] uodate 2.0.x --- Marlin/src/gcode/feature/trinamic/M122.cpp | 11 +++++--- Marlin/src/inc/SanityCheck.h | 18 ++++++++++++ Marlin/src/module/planner.cpp | 33 +++++++++++++++++++++- Marlin/src/sd/cardreader.cpp | 8 +++--- 4 files changed, 61 insertions(+), 9 deletions(-) diff --git a/Marlin/src/gcode/feature/trinamic/M122.cpp b/Marlin/src/gcode/feature/trinamic/M122.cpp index 52a6920f05..fdab548774 100644 --- a/Marlin/src/gcode/feature/trinamic/M122.cpp +++ b/Marlin/src/gcode/feature/trinamic/M122.cpp @@ -43,10 +43,13 @@ void GcodeSuite::M122() { #if ENABLED(TMC_DEBUG) #if ENABLED(MONITOR_DRIVER_STATUS) - uint16_t interval = MONITOR_DRIVER_STATUS_INTERVAL_MS; - if (parser.seen('S') && !parser.value_bool()) interval = 0; - if (parser.seenval('P')) NOMORE(interval, parser.value_ushort()); - tmc_set_report_interval(interval); + const bool sflag = parser.seen_test('S'), sval = sflag && parser.value_bool(); + if (sflag && !sval) + tmc_set_report_interval(0); + else if (parser.seenval('P')) + tmc_set_report_interval(_MAX(250, parser.value_ushort())); + else if (sval) + tmc_set_report_interval(MONITOR_DRIVER_STATUS_INTERVAL_MS); #endif if (parser.seen_test('V')) diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index cb0a52412d..ebbfa1748c 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -1379,6 +1379,12 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #if LINEAR_AXES >= 4 #if AXIS4_NAME != 'A' && AXIS4_NAME != 'B' && AXIS4_NAME != 'C' && AXIS4_NAME != 'U' && AXIS4_NAME != 'V' && AXIS4_NAME != 'W' #error "AXIS4_NAME can only be one of 'A', 'B', 'C', 'U', 'V', or 'W'." + #elif !defined(I_MIN_POS) || !defined(I_MAX_POS) + #error "I_MIN_POS and I_MAX_POS are required with LINEAR_AXES >= 4." + #elif !defined(I_HOME_DIR) + #error "I_HOME_DIR is required with LINEAR_AXES >= 4." + #elif HAS_I_ENABLE && !defined(I_ENABLE_ON) + #error "I_ENABLE_ON is required for your I driver with LINEAR_AXES >= 4." #endif #endif #if LINEAR_AXES >= 5 @@ -1386,6 +1392,12 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #error "AXIS5_NAME must be different from AXIS4_NAME and AXIS6_NAME" #elif AXIS5_NAME != 'A' && AXIS5_NAME != 'B' && AXIS5_NAME != 'C' && AXIS5_NAME != 'U' && AXIS5_NAME != 'V' && AXIS5_NAME != 'W' #error "AXIS5_NAME can only be one of 'A', 'B', 'C', 'U', 'V', or 'W'." + #elif !defined(J_MIN_POS) || !defined(J_MAX_POS) + #error "J_MIN_POS and J_MAX_POS are required with LINEAR_AXES >= 5." + #elif !defined(J_HOME_DIR) + #error "J_HOME_DIR is required with LINEAR_AXES >= 5." + #elif HAS_J_ENABLE && !defined(J_ENABLE_ON) + #error "J_ENABLE_ON is required for your J driver with LINEAR_AXES >= 5." #endif #endif #if LINEAR_AXES >= 6 @@ -1393,6 +1405,12 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #error "AXIS6_NAME must be different from AXIS5_NAME and AXIS4_NAME." #elif AXIS6_NAME != 'A' && AXIS6_NAME != 'B' && AXIS6_NAME != 'C' && AXIS6_NAME != 'U' && AXIS6_NAME != 'V' && AXIS6_NAME != 'W' #error "AXIS6_NAME can only be one of 'A', 'B', 'C', 'U', 'V', or 'W'." + #elif !defined(K_MIN_POS) || !defined(K_MAX_POS) + #error "K_MIN_POS and K_MAX_POS are required with LINEAR_AXES >= 6." + #elif !defined(K_HOME_DIR) + #error "K_HOME_DIR is required with LINEAR_AXES >= 6." + #elif HAS_K_ENABLE && !defined(K_ENABLE_ON) + #error "K_ENABLE_ON is required for your K driver with LINEAR_AXES >= 6." #endif #endif diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index 52ca76308c..7bf672a85d 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -1877,6 +1877,15 @@ bool Planner::_populate_block(block_t * const block, bool split_move, " A:", target.a, " (", da, " steps)" " B:", target.b, " (", db, " steps)" " C:", target.c, " (", dc, " steps)" + #if LINEAR_AXES >= 4 + " " AXIS4_STR ":", target.i, " (", di, " steps)" + #endif + #if LINEAR_AXES >= 5 + " " AXIS5_STR ":", target.j, " (", dj, " steps)" + #endif + #if LINEAR_AXES >= 6 + " " AXIS6_STR ":", target.k, " (", dk, " steps)" + #endif #if HAS_EXTRUDERS " E:", target.e, " (", de, " steps)" #endif @@ -1953,6 +1962,19 @@ bool Planner::_populate_block(block_t * const block, bool split_move, if (dk < 0) SBI(dm, K_AXIS) ); #endif + + #if IS_CORE + #if LINEAR_AXES >= 4 + if (di < 0) SBI(dm, I_AXIS); + #endif + #if LINEAR_AXES >= 5 + if (dj < 0) SBI(dm, J_AXIS); + #endif + #if LINEAR_AXES >= 6 + if (dk < 0) SBI(dm, K_AXIS); + #endif + #endif + #if HAS_EXTRUDERS if (de < 0) SBI(dm, E_AXIS); #endif @@ -2004,7 +2026,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move, */ struct DistanceMM : abce_float_t { #if EITHER(IS_CORE, MARKFORGED_XY) - xyz_pos_t head; + struct { float x, y, z; } head; #endif } steps_dist_mm; #if IS_CORE @@ -2027,6 +2049,15 @@ bool Planner::_populate_block(block_t * const block, bool split_move, steps_dist_mm.b = (db + dc) * steps_to_mm[B_AXIS]; steps_dist_mm.c = CORESIGN(db - dc) * steps_to_mm[C_AXIS]; #endif + #if LINEAR_AXES >= 4 + steps_dist_mm.i = di * steps_to_mm[I_AXIS]; + #endif + #if LINEAR_AXES >= 5 + steps_dist_mm.j = dj * steps_to_mm[J_AXIS]; + #endif + #if LINEAR_AXES >= 6 + steps_dist_mm.k = dk * steps_to_mm[K_AXIS]; + #endif #elif ENABLED(MARKFORGED_XY) steps_dist_mm.head.x = da * steps_to_mm[A_AXIS]; steps_dist_mm.head.y = db * steps_to_mm[B_AXIS]; diff --git a/Marlin/src/sd/cardreader.cpp b/Marlin/src/sd/cardreader.cpp index a5e02e7d48..c697db534d 100644 --- a/Marlin/src/sd/cardreader.cpp +++ b/Marlin/src/sd/cardreader.cpp @@ -1248,7 +1248,7 @@ void CardReader::cdroot() { #if ENABLED(SDSORT_USES_RAM) && DISABLED(SDSORT_CACHE_NAMES) #if ENABLED(SDSORT_DYNAMIC_RAM) for (uint16_t i = 0; i < fileCnt; ++i) free(sortnames[i]); - TERN_(HAS_FOLDER_SORTING, free(isDir)); + TERN_(HAS_FOLDER_SORTING, delete [] isDir); #endif #endif } @@ -1274,14 +1274,14 @@ void CardReader::cdroot() { void CardReader::flush_presort() { if (sort_count > 0) { #if ENABLED(SDSORT_DYNAMIC_RAM) - delete sort_order; + delete [] sort_order; #if ENABLED(SDSORT_CACHE_NAMES) LOOP_L_N(i, sort_count) { free(sortshort[i]); // strdup free(sortnames[i]); // strdup } - delete sortshort; - delete sortnames; + delete [] sortshort; + delete [] sortnames; #endif #endif sort_count = 0;