Skip to content
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
2 changes: 1 addition & 1 deletion Marlin/src/core/drivers.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
#define AXIS_DRIVER_TYPE_X(T) _AXIS_DRIVER_TYPE(X,T)
#define AXIS_DRIVER_TYPE_Y(T) _AXIS_DRIVER_TYPE(Y,T)
#define AXIS_DRIVER_TYPE_Z(T) _AXIS_DRIVER_TYPE(Z,T)
#define AXIS_DRIVER_TYPE_X2(T) (ENABLED(X_DUAL_STEPPER_DRIVERS) || ENABLED(DUAL_X_CARRIAGE)) && _AXIS_DRIVER_TYPE(X2,T)
#define AXIS_DRIVER_TYPE_X2(T) ((ENABLED(X_DUAL_STEPPER_DRIVERS) || ENABLED(DUAL_X_CARRIAGE)) && _AXIS_DRIVER_TYPE(X2,T))
#define AXIS_DRIVER_TYPE_Y2(T) (ENABLED(Y_DUAL_STEPPER_DRIVERS) && _AXIS_DRIVER_TYPE(Y2,T))
#define AXIS_DRIVER_TYPE_Z2(T) (Z_MULTI_STEPPER_DRIVERS && _AXIS_DRIVER_TYPE(Z2,T))
#define AXIS_DRIVER_TYPE_Z3(T) (ENABLED(Z_TRIPLE_STEPPER_DRIVERS) && _AXIS_DRIVER_TYPE(Z3,T))
Expand Down
60 changes: 26 additions & 34 deletions Marlin/src/module/configuration_store.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@
#include "../feature/tmc_util.h"
#define TMC_GET_PWMTHRS(A,Q) _tmc_thrs(stepper##Q.microsteps(), stepper##Q.TPWMTHRS(), planner.axis_steps_per_mm[_AXIS(A)])
#endif
struct tmc_stepper_current_t { uint16_t X, Y, Z, X2, Y2, Z2, Z3, E0, E1, E2, E3, E4, E5; };
struct tmc_hybrid_threshold_t { uint32_t X, Y, Z, X2, Y2, Z2, Z3, E0, E1, E2, E3, E4, E5; };
struct tmc_sgt_t { int16_t X, Y, Z; };
typedef struct { uint16_t X, Y, Z, X2, Y2, Z2, Z3, E0, E1, E2, E3, E4, E5; } tmc_stepper_current_t;
typedef struct { uint32_t X, Y, Z, X2, Y2, Z2, Z3, E0, E1, E2, E3, E4, E5; } tmc_hybrid_threshold_t;
typedef struct { int16_t X, Y, Z; } tmc_sgt_t;

#if ENABLED(FWRETRACT)
#include "../feature/fwretract.h"
Expand All @@ -101,7 +101,7 @@ struct tmc_sgt_t { int16_t X, Y, Z; };

#pragma pack(push, 1) // No padding between variables

typedef struct PID { float Kp, Ki, Kd; } PID;
typedef struct PID { float Kp, Ki, Kd; } PID;
typedef struct PIDC { float Kp, Ki, Kd, Kc; } PIDC;

/**
Expand Down Expand Up @@ -303,7 +303,7 @@ uint16_t MarlinSettings::datasize() { return sizeof(SettingsData); }
#endif

void MarlinSettings::postprocess() {
const float oldpos[] = { current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] };
const float oldpos[XYZE] = { current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS] };

// steps per s2 needs to be updated to agree with units per s2
planner.reset_acceleration_rates();
Expand Down Expand Up @@ -439,7 +439,7 @@ void MarlinSettings::postprocess() {
EEPROM_WRITE(dummy);
#endif
#else
const float planner_max_jerk[] = { float(DEFAULT_XJERK), float(DEFAULT_YJERK), float(DEFAULT_ZJERK), float(DEFAULT_EJERK) };
const float planner_max_jerk[XYZE] = { float(DEFAULT_XJERK), float(DEFAULT_YJERK), float(DEFAULT_ZJERK), float(DEFAULT_EJERK) };
EEPROM_WRITE(planner_max_jerk);
#endif

Expand Down Expand Up @@ -467,11 +467,13 @@ void MarlinSettings::postprocess() {
// Global Leveling
//

#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
const float zfh = planner.z_fade_height;
#else
const float zfh = 10.0;
#endif
const float zfh = (
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
planner.z_fade_height
#else
10.0
#endif
);
EEPROM_WRITE(zfh);

//
Expand All @@ -481,7 +483,7 @@ void MarlinSettings::postprocess() {
#if ENABLED(MESH_BED_LEVELING)
// Compile time test that sizeof(mbl.z_values) is as expected
static_assert(
sizeof(mbl.z_values) == GRID_MAX_POINTS * sizeof(mbl.z_values[0][0]),
sizeof(mbl.z_values) == (GRID_MAX_POINTS) * sizeof(mbl.z_values[0][0]),
"MBL Z array is the wrong size."
);
const uint8_t mesh_num_x = GRID_MAX_POINTS_X, mesh_num_y = GRID_MAX_POINTS_Y;
Expand Down Expand Up @@ -523,7 +525,7 @@ void MarlinSettings::postprocess() {
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
// Compile time test that sizeof(z_values) is as expected
static_assert(
sizeof(z_values) == GRID_MAX_POINTS * sizeof(z_values[0][0]),
sizeof(z_values) == (GRID_MAX_POINTS) * sizeof(z_values[0][0]),
"Bilinear Z array is the wrong size."
);
const uint8_t grid_max_x = GRID_MAX_POINTS_X, grid_max_y = GRID_MAX_POINTS_Y;
Expand Down Expand Up @@ -727,7 +729,7 @@ void MarlinSettings::postprocess() {

_FIELD_TEST(tmc_stepper_current);

tmc_stepper_current_t tmc_stepper_current{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
tmc_stepper_current_t tmc_stepper_current = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };

#if HAS_TRINAMIC
#if AXIS_IS_TMC(X)
Expand Down Expand Up @@ -788,13 +790,11 @@ void MarlinSettings::postprocess() {
// Save TMC Hybrid Threshold, and placeholder values
//


_FIELD_TEST(tmc_hybrid_threshold);

tmc_hybrid_threshold_t tmc_hybrid_threshold{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };

#if ENABLED(HYBRID_THRESHOLD)
#if AXIS_HAS_STEALTHCHOP(X)
tmc_hybrid_threshold_t tmc_hybrid_threshold = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
#if AXIS_HAS_STEALTHCHOP(X)
tmc_hybrid_threshold.X = TMC_GET_PWMTHRS(X, X);
#endif
#if AXIS_HAS_STEALTHCHOP(Y)
Expand Down Expand Up @@ -846,27 +846,20 @@ void MarlinSettings::postprocess() {
#endif // MAX_EXTRUDERS > 1
#endif // MAX_EXTRUDERS
#else
tmc_hybrid_threshold.X = 100;
tmc_hybrid_threshold.Y = 100;
tmc_hybrid_threshold.Z = 3;
tmc_hybrid_threshold.X2 = 100;
tmc_hybrid_threshold.Y2 = 100;
tmc_hybrid_threshold.Z2 = 3;
tmc_hybrid_threshold.Z3 = 3;
tmc_hybrid_threshold.E0 = 30;
tmc_hybrid_threshold.E1 = 30;
tmc_hybrid_threshold.E2 = 30;
tmc_hybrid_threshold.E3 = 30;
tmc_hybrid_threshold.E4 = 30;
tmc_hybrid_threshold.E5 = 30;
const tmc_hybrid_threshold_t tmc_hybrid_threshold = {
.X = 100, .Y = 100, .Z = 3,
.X2 = 100, .Y2 = 100, .Z2 = 3, .Z3 = 3,
.E0 = 30, .E1 = 30, .E2 = 30,
.E3 = 30, .E4 = 30, .E5 = 30
};
#endif
EEPROM_WRITE(tmc_hybrid_threshold);

//
// TMC StallGuard threshold
//

tmc_sgt_t tmc_sgt{ 0, 0, 0 };
tmc_sgt_t tmc_sgt = { 0, 0, 0 };

#if USE_SENSORLESS
#if X_SENSORLESS
Expand Down Expand Up @@ -1893,8 +1886,7 @@ void MarlinSettings::reset(PORTARG_SOLO) {
#endif // HAS_SERVOS && EDITABLE_SERVO_ANGLES

#if ENABLED(DELTA)
const float adj[ABC] = DELTA_ENDSTOP_ADJ,
dta[ABC] = DELTA_TOWER_ANGLE_TRIM;
const float adj[ABC] = DELTA_ENDSTOP_ADJ, dta[ABC] = DELTA_TOWER_ANGLE_TRIM;
delta_height = DELTA_HEIGHT;
COPY(delta_endstop_adj, adj);
delta_radius = DELTA_RADIUS;
Expand Down