Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature 0516 #31

Merged
merged 6 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Marlin/src/inc/Version.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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

/**
Expand Down
30 changes: 25 additions & 5 deletions Marlin/src/module/AxisManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand All @@ -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);
Expand Down
8 changes: 8 additions & 0 deletions Marlin/src/module/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions Marlin/src/module/temperature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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)
Expand Down
14 changes: 14 additions & 0 deletions snapmaker/gcode/contorl/M2000.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 2 additions & 0 deletions snapmaker/module/exception.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 2 additions & 0 deletions snapmaker/module/exception.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion snapmaker/module/filament_sensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
1 change: 1 addition & 0 deletions snapmaker/module/filament_sensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading