From 7368aee4ad6e0cc1d034ea008ebb6e044f285c04 Mon Sep 17 00:00:00 2001 From: zhangquanyi Date: Sun, 19 May 2024 16:45:25 +0800 Subject: [PATCH 1/6] Feature: increase the distance of filament check detection --- snapmaker/module/filament_sensor.cpp | 2 +- snapmaker/module/filament_sensor.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/snapmaker/module/filament_sensor.cpp b/snapmaker/module/filament_sensor.cpp index f6e9309c94..82c8b64658 100644 --- a/snapmaker/module/filament_sensor.cpp +++ b/snapmaker/module/filament_sensor.cpp @@ -57,7 +57,7 @@ void FilamentSensor::reset() { start_adc[i] = 0; triggered[i] = false; err_times[i] = 0; - check_step_count[i] = filament_param.distance * planner.settings.axis_steps_per_mm[E_AXIS_N(i)]; + check_step_count[i] = (filament_param.distance + FILAMENT_CHECK_EXTRAS_DISTANCE) * planner.settings.axis_steps_per_mm[E_AXIS_N(i)]; } err_mask = ~(0xff << filament_param.check_times); } diff --git a/snapmaker/module/filament_sensor.h b/snapmaker/module/filament_sensor.h index d899cd5936..3a108ce2f1 100644 --- a/snapmaker/module/filament_sensor.h +++ b/snapmaker/module/filament_sensor.h @@ -27,6 +27,7 @@ #define FILAMENT_SENSOR_COUNT 2 #define FILAMENT_LOOP(i) for (uint8_t i = 0; i < FILAMENT_SENSOR_COUNT; i++) #define FILAMENT_CHECK_DISTANCE 2 // mm +#define FILAMENT_CHECK_EXTRAS_DISTANCE 1 // mm #define FILAMENT_THRESHOLD 8 // ADC diff value #define FILAMENT_THRESHOLD_HW2 15 // ADC diff value #define FILAMENT_CHECK_TIMES 3 From 204f3fb35c289336824a48fc85afe6fbbe8f4dd6 Mon Sep 17 00:00:00 2001 From: zhangquanyi Date: Sun, 19 May 2024 18:03:41 +0800 Subject: [PATCH 2/6] Feature: add new nozzle exception code --- Marlin/src/module/temperature.cpp | 8 ++++---- snapmaker/module/exception.cpp | 2 ++ snapmaker/module/exception.h | 2 ++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index a812218d08..716fbf0979 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -1016,9 +1016,9 @@ void Temperature::max_temp_error(const heater_id_t heater_id) { if (heater_id == H_BED) exception_server.trigger_exception(EXCEPTION_TYPE_BED_TEMP); else if (heater_id == 0) - exception_server.trigger_exception(EXCEPTION_TYPE_LEFT_NOZZLE_TEMP); + exception_server.trigger_exception(EXCEPTION_TYPE_LEFT_NOZZLE_OVERTEMP); else if (heater_id == 1) - exception_server.trigger_exception(EXCEPTION_TYPE_RIGHT_NOZZLE_TEMP); + exception_server.trigger_exception(EXCEPTION_TYPE_RIGHT_NOZZLE_OVERTEMP); } void Temperature::min_temp_error(const heater_id_t heater_id) { @@ -1030,9 +1030,9 @@ void Temperature::min_temp_error(const heater_id_t heater_id) { if (heater_id == H_BED) exception_server.trigger_exception(EXCEPTION_TYPE_BED_TEMP); else if (heater_id == 0) - exception_server.trigger_exception(EXCEPTION_TYPE_LEFT_NOZZLE_TEMP); + exception_server.trigger_exception(EXCEPTION_TYPE_LEFT_NOZZLE_OVERTEMP); else if (heater_id == 1) - exception_server.trigger_exception(EXCEPTION_TYPE_RIGHT_NOZZLE_TEMP); + exception_server.trigger_exception(EXCEPTION_TYPE_RIGHT_NOZZLE_OVERTEMP); } #if ANY(PID_DEBUG, PID_BED_DEBUG, PID_CHAMBER_DEBUG) diff --git a/snapmaker/module/exception.cpp b/snapmaker/module/exception.cpp index 2c94018d29..367a2ed0f3 100644 --- a/snapmaker/module/exception.cpp +++ b/snapmaker/module/exception.cpp @@ -58,6 +58,8 @@ const exception_behavior_t exception_behavior_map[] = { {(BIT(EXCEPTION_BAN_MOVE) | BIT(EXCEPTION_BAN_WORK)), EXCEPTION_LEVLE_0}, // EXCEPTION_TYPE_E0_TMC_FILED {(BIT(EXCEPTION_BAN_MOVE) | BIT(EXCEPTION_BAN_WORK)), EXCEPTION_LEVLE_0}, // EXCEPTION_TYPE_E1_TMC_FILED {(BIT(EXCEPTION_BAN_MOVE) | BIT(EXCEPTION_BAN_WORK)), EXCEPTION_LEVLE_0}, // EXCEPTION_TYPE_ALL_TMC_FILED + {(BIT(EXCEPTION_BAN_HEAT_NOZZLE) | BIT(EXCEPTION_BAN_WORK_AND_STOP)), EXCEPTION_LEVLE_0}, // EXCEPTION_TYPE_LEFT_NOZZLE_OVERTEMP + {(BIT(EXCEPTION_BAN_HEAT_NOZZLE) | BIT(EXCEPTION_BAN_WORK_AND_STOP)), EXCEPTION_LEVLE_0}, // EXCEPTION_TYPE_RIGHT_NOZZLE_OVERTEMP }; bool Exception::is_exception() { diff --git a/snapmaker/module/exception.h b/snapmaker/module/exception.h index a72929d22a..5830dd7e71 100644 --- a/snapmaker/module/exception.h +++ b/snapmaker/module/exception.h @@ -76,6 +76,8 @@ typedef enum { EXCEPTION_TYPE_E0_TMC_FILED, EXCEPTION_TYPE_E1_TMC_FILED, EXCEPTION_TYPE_ALL_TMC_FILED, + EXCEPTION_TYPE_LEFT_NOZZLE_OVERTEMP, + EXCEPTION_TYPE_RIGHT_NOZZLE_OVERTEMP, EXCEPTION_TYPE_MAX_COUNT } exception_type_e; From 5731df902c94ab3eba1fe5bfa295205f71826464 Mon Sep 17 00:00:00 2001 From: zhangquanyi Date: Mon, 20 May 2024 10:58:57 +0800 Subject: [PATCH 3/6] Feature: add probe power control command --- snapmaker/gcode/contorl/M2000.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/snapmaker/gcode/contorl/M2000.cpp b/snapmaker/gcode/contorl/M2000.cpp index 3637d376db..5351a351b5 100644 --- a/snapmaker/gcode/contorl/M2000.cpp +++ b/snapmaker/gcode/contorl/M2000.cpp @@ -219,6 +219,20 @@ void GcodeSuite::M2000() { } break; + case 115: + { + LOG_I("trun on probe power\n"); + switch_detect.trun_on_probe_pwr(); + } + break; + + case 116: + { + LOG_I("trun off probe power\n"); + switch_detect.trun_off_probe_pwr(); + } + break; + case 200: { if (print_control.get_mode() >= PRINT_DUPLICATION_MODE) { From f30360d410e4f63e7d76ed45c9745bd049ec7860 Mon Sep 17 00:00:00 2001 From: Scott Huang Date: Wed, 24 Apr 2024 15:11:47 +0800 Subject: [PATCH 4/6] Fix: abnormal settings will cause the system to freeze Signed-off-by: Scott Huang --- Marlin/src/module/settings.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index 81a389a091..aae263b1af 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -1642,6 +1642,8 @@ void MarlinSettings::postprocess() { // Number of esteppers may change uint8_t esteppers; EEPROM_READ_ALWAYS(esteppers); + // make sure esteppers is valid + esteppers = COUNT(planner.settings.axis_steps_per_mm) - LINEAR_AXES; // // Planner Motion @@ -1758,6 +1760,9 @@ void MarlinSettings::postprocess() { for (uint16_t q = mesh_num_x * mesh_num_y; q--;) EEPROM_READ(dummyf); } #else + // make sure grid numbers are valid + mesh_num_x = TERN(MESH_BED_LEVELING, GRID_MAX_POINTS_X, 3), + mesh_num_y = TERN(MESH_BED_LEVELING, GRID_MAX_POINTS_Y, 3); // MBL is disabled - skip the stored data for (uint16_t q = mesh_num_x * mesh_num_y; q--;) EEPROM_READ(dummyf); #endif // MESH_BED_LEVELING @@ -1804,6 +1809,9 @@ void MarlinSettings::postprocess() { else // EEPROM data is stale #endif // AUTO_BED_LEVELING_BILINEAR { + // make sure the grid number is valid + grid_max_x = TERN(AUTO_BED_LEVELING_BILINEAR, GRID_MAX_POINTS_X, 3), + grid_max_y = TERN(AUTO_BED_LEVELING_BILINEAR, GRID_MAX_POINTS_Y, 3); // Skip past disabled (or stale) Bilinear Grid data xy_pos_t bgs, bs; EEPROM_READ(bgs); From d014df87cdbe5ebb066faf734f2f86b2078e67f4 Mon Sep 17 00:00:00 2001 From: zhangquanyi Date: Thu, 23 May 2024 11:35:20 +0800 Subject: [PATCH 5/6] Feature: add M593 command param check --- Marlin/src/module/AxisManager.cpp | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/Marlin/src/module/AxisManager.cpp b/Marlin/src/module/AxisManager.cpp index f677c9ab44..7dafd04d4c 100644 --- a/Marlin/src/module/AxisManager.cpp +++ b/Marlin/src/module/AxisManager.cpp @@ -58,7 +58,7 @@ void AxisManager::input_shaper_reset() { ErrCode AxisManager::input_shaper_set(int axis, int type, float freq, float dampe) { - if (axis != X_AXIS && axis != Y_AXIS) return E_PARAM; + if ((axis != X_AXIS && axis != Y_AXIS) || freq == 0 || (InputShaperType)type > InputShaperType::zvddd) return E_PARAM; AxisInputShaper* axis_input_shaper = axisManager.axis[axis].axis_input_shaper; if (freq != axis_input_shaper->frequency || dampe != axis_input_shaper->zeta || type != (int)axis_input_shaper->type) { @@ -134,11 +134,21 @@ void GcodeSuite::M593() { if (frequency != axis_input_shaper->frequency || zeta != axis_input_shaper->zeta || type != (int)axis_input_shaper->type) { update = true; } - LOG_I("X type: %s, frequency: %lf, zeta: %lf\n", input_shaper_type_name[type], frequency, zeta); + if ((InputShaperType)type <= InputShaperType::zvddd) + LOG_I("X type: %s, frequency: %lf, zeta: %lf\n", input_shaper_type_name[type], frequency, zeta); + else + LOG_I("X type: %d, frequency: %lf, zeta: %lf\n", type, frequency, zeta); + if (!update) { axis_input_shaper->logParams(); } else { - axis_input_shaper->setConfig(type, frequency, zeta); + if (frequency != 0 && (InputShaperType)type <= InputShaperType::zvddd) { + axis_input_shaper->setConfig(type, frequency, zeta); + } + else { + update = false; + LOG_I("X input shaper setting failed, frequency cannot be zero or type error!!!\n"); + } } } if (y) { @@ -149,11 +159,21 @@ void GcodeSuite::M593() { if (frequency != axis_input_shaper->frequency || zeta != axis_input_shaper->zeta || type != (int)axis_input_shaper->type) { update = true; } - LOG_I("Y type: %s, frequency: %lf, zeta: %lf\n", input_shaper_type_name[type], frequency, zeta); + if ((InputShaperType)type <= InputShaperType::zvddd) + LOG_I("Y type: %s, frequency: %lf, zeta: %lf\n", input_shaper_type_name[type], frequency, zeta); + else + LOG_I("Y type: %d, frequency: %lf, zeta: %lf\n", type, frequency, zeta); + if (!update) { axis_input_shaper->logParams(); } else { - axis_input_shaper->setConfig(type, frequency, zeta); + if (frequency != 0 && (InputShaperType)type <= InputShaperType::zvddd) { + axis_input_shaper->setConfig(type, frequency, zeta); + } + else { + update = false; + LOG_I("Y input shaper setting failed, frequency cannot be zero or type error!!!\n"); + } } } LOG_I("update: %d\n", update); From 2663757b08dabc466a63884b7d706f9418e8cd46 Mon Sep 17 00:00:00 2001 From: zhangquanyi Date: Fri, 24 May 2024 16:47:37 +0800 Subject: [PATCH 6/6] Feature: update version to v2.2.14 --- Marlin/src/inc/Version.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 61c9d4f394..71316ba72a 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -21,7 +21,7 @@ */ #pragma once -#define J1_BUILD_VERSION "2.2.13" +#define J1_BUILD_VERSION "2.2.14" /** * Release version. Leave the Marlin version or apply a custom scheme. @@ -44,7 +44,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2024-01-05" + #define STRING_DISTRIBUTION_DATE "2024-05-23" #endif /**