|
@ -181,9 +181,7 @@ typedef struct SettingsDataStruct { |
|
|
//
|
|
|
//
|
|
|
// SERVO_ANGLES
|
|
|
// SERVO_ANGLES
|
|
|
//
|
|
|
//
|
|
|
#if HAS_SERVOS |
|
|
uint16_t servo_angles[MAX_SERVOS][2]; // M281 P L U
|
|
|
uint8_t servo_angles[NUM_SERVOS][2]; |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
//
|
|
|
// DELTA / [XYZ]_DUAL_ENDSTOPS
|
|
|
// DELTA / [XYZ]_DUAL_ENDSTOPS
|
|
@ -543,9 +541,25 @@ void MarlinSettings::postprocess() { |
|
|
EEPROM_WRITE(storage_slot); |
|
|
EEPROM_WRITE(storage_slot); |
|
|
#endif // AUTO_BED_LEVELING_UBL
|
|
|
#endif // AUTO_BED_LEVELING_UBL
|
|
|
|
|
|
|
|
|
#if HAS_SERVOS |
|
|
#if !HAS_SERVOS || DISABLED(EDITABLE_SERVO_ANGLES) |
|
|
EEPROM_WRITE(servo_angles); |
|
|
#if ENABLED(SWITCHING_EXTRUDER) |
|
|
|
|
|
constexpr uint16_t sesa[][2] = SWITCHING_EXTRUDER_SERVO_ANGLES; |
|
|
|
|
|
#endif |
|
|
|
|
|
constexpr uint16_t servo_angles[MAX_SERVOS][2] = { |
|
|
|
|
|
#if ENABLED(SWITCHING_EXTRUDER) |
|
|
|
|
|
[SWITCHING_EXTRUDER_SERVO_NR] = { sesa[0], sesa[1] } |
|
|
|
|
|
#if EXTRUDERS > 3 |
|
|
|
|
|
, [SWITCHING_EXTRUDER_E23_SERVO_NR] = { sesa[2], sesa[3] } |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
#elif ENABLED(SWITCHING_NOZZLE) |
|
|
|
|
|
[SWITCHING_NOZZLE_SERVO_NR] = SWITCHING_NOZZLE_SERVO_ANGLES |
|
|
|
|
|
#elif defined(Z_SERVO_ANGLES) && defined(Z_PROBE_SERVO_NR) |
|
|
|
|
|
[Z_PROBE_SERVO_NR] = Z_SERVO_ANGLES |
|
|
|
|
|
#endif |
|
|
|
|
|
}; |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
EEPROM_WRITE(servo_angles); |
|
|
|
|
|
|
|
|
// 11 floats for DELTA / [XYZ]_DUAL_ENDSTOPS
|
|
|
// 11 floats for DELTA / [XYZ]_DUAL_ENDSTOPS
|
|
|
#if ENABLED(DELTA) |
|
|
#if ENABLED(DELTA) |
|
@ -1153,10 +1167,10 @@ void MarlinSettings::postprocess() { |
|
|
//
|
|
|
//
|
|
|
// SERVO_ANGLES
|
|
|
// SERVO_ANGLES
|
|
|
//
|
|
|
//
|
|
|
#if HAS_SERVOS |
|
|
#if !HAS_SERVOS || DISABLED(EDITABLE_SERVO_ANGLES) |
|
|
EEPROM_READ(servo_angles); |
|
|
uint16_t servo_angles[MAX_SERVOS][2]; |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
EEPROM_READ(servo_angles); |
|
|
|
|
|
|
|
|
//
|
|
|
//
|
|
|
// DELTA Geometry or Dual Endstops offsets
|
|
|
// DELTA Geometry or Dual Endstops offsets
|
|
@ -1801,33 +1815,40 @@ void MarlinSettings::reset(PORTARG_SOLO) { |
|
|
// Servo Angles
|
|
|
// Servo Angles
|
|
|
//
|
|
|
//
|
|
|
|
|
|
|
|
|
#if HAS_SERVOS |
|
|
#if HAS_SERVOS && ENABLED(EDITABLE_SERVO_ANGLES) |
|
|
|
|
|
|
|
|
#if ENABLED(SWITCHING_EXTRUDER) |
|
|
#if ENABLED(SWITCHING_EXTRUDER) |
|
|
|
|
|
|
|
|
#if EXTRUDERS > 3 |
|
|
#if EXTRUDERS > 3 |
|
|
#define REQ_ANGLES 4 |
|
|
#define REQ_ANGLES 4 |
|
|
#else |
|
|
#else |
|
|
#define REQ_ANGLES 2 |
|
|
#define REQ_ANGLES 2 |
|
|
#endif |
|
|
#endif |
|
|
const uint8_t extruder_angles[2] = SWITCHING_EXTRUDER_SERVO_ANGLES; |
|
|
constexpr uint16_t extruder_angles[] = SWITCHING_EXTRUDER_SERVO_ANGLES; |
|
|
static_assert(COUNT(extruder_angles) == REQ_ANGLES, "SWITCHING_EXTRUDER_SERVO_ANGLES needs " STRINGIFY(REQ_ANGLES) " angles."); |
|
|
static_assert(COUNT(extruder_angles) == REQ_ANGLES, "SWITCHING_EXTRUDER_SERVO_ANGLES needs " STRINGIFY(REQ_ANGLES) " angles."); |
|
|
servo_angles[SWITCHING_EXTRUDER_SERVO_NR][0] = extruder_angles[0]; |
|
|
servo_angles[SWITCHING_EXTRUDER_SERVO_NR][0] = extruder_angles[0]; |
|
|
servo_angles[SWITCHING_EXTRUDER_SERVO_NR][1] = extruder_angles[1]; |
|
|
servo_angles[SWITCHING_EXTRUDER_SERVO_NR][1] = extruder_angles[1]; |
|
|
|
|
|
#if EXTRUDERS > 3 |
|
|
|
|
|
servo_angles[SWITCHING_EXTRUDER_E23_SERVO_NR][0] = extruder_angles[2]; |
|
|
|
|
|
servo_angles[SWITCHING_EXTRUDER_E23_SERVO_NR][1] = extruder_angles[3]; |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
#if ENABLED(SWITCHING_NOZZLE) |
|
|
#elif ENABLED(SWITCHING_NOZZLE) |
|
|
const uint8_t nozzel_angles[2] = SWITCHING_NOZZLE_SERVO_ANGLES; |
|
|
|
|
|
servo_angles[SWITCHING_NOZZLE_SERVO_NR][0] = nozzel_angles[0]; |
|
|
constexpr uint16_t nozzle_angles[2] = SWITCHING_NOZZLE_SERVO_ANGLES; |
|
|
servo_angles[SWITCHING_NOZZLE_SERVO_NR][1] = nozzel_angles[1]; |
|
|
servo_angles[SWITCHING_NOZZLE_SERVO_NR][0] = nozzle_angles[0]; |
|
|
#endif |
|
|
servo_angles[SWITCHING_NOZZLE_SERVO_NR][1] = nozzle_angles[1]; |
|
|
|
|
|
|
|
|
#if defined(Z_SERVO_ANGLES) && defined(Z_PROBE_SERVO_NR) |
|
|
#elif defined(Z_SERVO_ANGLES) && defined(Z_PROBE_SERVO_NR) |
|
|
const uint8_t z_probe_angles[2] = Z_SERVO_ANGLES; |
|
|
|
|
|
|
|
|
constexpr uint16_t z_probe_angles[2] = Z_SERVO_ANGLES; |
|
|
servo_angles[Z_PROBE_SERVO_NR][0] = z_probe_angles[0]; |
|
|
servo_angles[Z_PROBE_SERVO_NR][0] = z_probe_angles[0]; |
|
|
servo_angles[Z_PROBE_SERVO_NR][1] = z_probe_angles[1]; |
|
|
servo_angles[Z_PROBE_SERVO_NR][1] = z_probe_angles[1]; |
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
#endif // HAS_SERVOS && EDITABLE_SERVO_ANGLES
|
|
|
|
|
|
|
|
|
#if ENABLED(DELTA) |
|
|
#if ENABLED(DELTA) |
|
|
const float adj[ABC] = DELTA_ENDSTOP_ADJ, |
|
|
const float adj[ABC] = DELTA_ENDSTOP_ADJ, |
|
|
dta[ABC] = DELTA_TOWER_ANGLE_TRIM; |
|
|
dta[ABC] = DELTA_TOWER_ANGLE_TRIM; |
|
@ -2306,19 +2327,34 @@ void MarlinSettings::reset(PORTARG_SOLO) { |
|
|
|
|
|
|
|
|
#endif // HAS_LEVELING
|
|
|
#endif // HAS_LEVELING
|
|
|
|
|
|
|
|
|
#if HAS_SERVOS |
|
|
#if HAS_SERVOS && ENABLED(EDITABLE_SERVO_ANGLES) |
|
|
|
|
|
|
|
|
if (!forReplay) { |
|
|
if (!forReplay) { |
|
|
CONFIG_ECHO_START; |
|
|
CONFIG_ECHO_START; |
|
|
SERIAL_ECHOLNPGM_P(port, "Servo Angles:"); |
|
|
SERIAL_ECHOLNPGM_P(port, "Servo Angles:"); |
|
|
} |
|
|
} |
|
|
for (uint8_t i = 0; i < NUM_SERVOS; i++) { |
|
|
for (uint8_t i = 0; i < NUM_SERVOS; i++) { |
|
|
|
|
|
switch (i) { |
|
|
|
|
|
#if ENABLED(SWITCHING_EXTRUDER) |
|
|
|
|
|
case SWITCHING_EXTRUDER_SERVO_NR: |
|
|
|
|
|
#if EXTRUDERS > 3 |
|
|
|
|
|
case SWITCHING_EXTRUDER_E23_SERVO_NR: |
|
|
|
|
|
#endif |
|
|
|
|
|
#elif ENABLED(SWITCHING_NOZZLE) |
|
|
|
|
|
case SWITCHING_NOZZLE_SERVO_NR: |
|
|
|
|
|
#elif defined(Z_SERVO_ANGLES) && defined(Z_PROBE_SERVO_NR) |
|
|
|
|
|
case Z_PROBE_SERVO_NR: |
|
|
|
|
|
#endif |
|
|
CONFIG_ECHO_START; |
|
|
CONFIG_ECHO_START; |
|
|
SERIAL_ECHOPAIR_P(port, " M281 P", i); |
|
|
SERIAL_ECHOPAIR_P(port, " M281 P", int(i)); |
|
|
SERIAL_ECHOPAIR_P(port, " L",servo_angles[i][0]); |
|
|
SERIAL_ECHOPAIR_P(port, " L", servo_angles[i][0]); |
|
|
SERIAL_ECHOPAIR_P(port, " U",servo_angles[i][1]); |
|
|
SERIAL_ECHOPAIR_P(port, " U", servo_angles[i][1]); |
|
|
SERIAL_EOL_P(port); |
|
|
SERIAL_EOL_P(port); |
|
|
|
|
|
default: break; |
|
|
} |
|
|
} |
|
|
#endif |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#endif // HAS_SERVOS && EDITABLE_SERVO_ANGLES
|
|
|
|
|
|
|
|
|
#if ENABLED(DELTA) |
|
|
#if ENABLED(DELTA) |
|
|
|
|
|
|
|
|