|
|
@ -72,7 +72,7 @@ |
|
|
|
|
|
|
|
#if HAS_SERVOS |
|
|
|
#include "servo.h" |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
#if HAS_BED_PROBE |
|
|
|
#include "../module/probe.h" |
|
|
@ -181,9 +181,7 @@ typedef struct SettingsDataStruct { |
|
|
|
//
|
|
|
|
// SERVO_ANGLES
|
|
|
|
//
|
|
|
|
#if HAS_SERVOS |
|
|
|
uint8_t servo_angles[NUM_SERVOS][2]; |
|
|
|
#endif |
|
|
|
uint16_t servo_angles[MAX_SERVOS][2]; // M281 P L U
|
|
|
|
|
|
|
|
//
|
|
|
|
// DELTA / [XYZ]_DUAL_ENDSTOPS
|
|
|
@ -543,10 +541,26 @@ void MarlinSettings::postprocess() { |
|
|
|
EEPROM_WRITE(storage_slot); |
|
|
|
#endif // AUTO_BED_LEVELING_UBL
|
|
|
|
|
|
|
|
#if HAS_SERVOS |
|
|
|
EEPROM_WRITE(servo_angles); |
|
|
|
#if !HAS_SERVOS || DISABLED(EDITABLE_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 |
|
|
|
#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
|
|
|
|
#if ENABLED(DELTA) |
|
|
|
|
|
|
@ -1153,10 +1167,10 @@ void MarlinSettings::postprocess() { |
|
|
|
//
|
|
|
|
// SERVO_ANGLES
|
|
|
|
//
|
|
|
|
#if HAS_SERVOS |
|
|
|
EEPROM_READ(servo_angles); |
|
|
|
#if !HAS_SERVOS || DISABLED(EDITABLE_SERVO_ANGLES) |
|
|
|
uint16_t servo_angles[MAX_SERVOS][2]; |
|
|
|
#endif |
|
|
|
|
|
|
|
EEPROM_READ(servo_angles); |
|
|
|
|
|
|
|
//
|
|
|
|
// DELTA Geometry or Dual Endstops offsets
|
|
|
@ -1801,32 +1815,39 @@ void MarlinSettings::reset(PORTARG_SOLO) { |
|
|
|
// Servo Angles
|
|
|
|
//
|
|
|
|
|
|
|
|
#if HAS_SERVOS |
|
|
|
#if HAS_SERVOS && ENABLED(EDITABLE_SERVO_ANGLES) |
|
|
|
|
|
|
|
#if ENABLED(SWITCHING_EXTRUDER) |
|
|
|
|
|
|
|
#if EXTRUDERS > 3 |
|
|
|
#define REQ_ANGLES 4 |
|
|
|
#else |
|
|
|
#define REQ_ANGLES 2 |
|
|
|
#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."); |
|
|
|
servo_angles[SWITCHING_EXTRUDER_SERVO_NR][0] = extruder_angles[0]; |
|
|
|
servo_angles[SWITCHING_EXTRUDER_SERVO_NR][1] = extruder_angles[1]; |
|
|
|
#endif |
|
|
|
#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 |
|
|
|
|
|
|
|
#if ENABLED(SWITCHING_NOZZLE) |
|
|
|
const uint8_t nozzel_angles[2] = SWITCHING_NOZZLE_SERVO_ANGLES; |
|
|
|
servo_angles[SWITCHING_NOZZLE_SERVO_NR][0] = nozzel_angles[0]; |
|
|
|
servo_angles[SWITCHING_NOZZLE_SERVO_NR][1] = nozzel_angles[1]; |
|
|
|
#endif |
|
|
|
#elif ENABLED(SWITCHING_NOZZLE) |
|
|
|
|
|
|
|
#if defined(Z_SERVO_ANGLES) && defined(Z_PROBE_SERVO_NR) |
|
|
|
const uint8_t z_probe_angles[2] = Z_SERVO_ANGLES; |
|
|
|
constexpr uint16_t nozzle_angles[2] = SWITCHING_NOZZLE_SERVO_ANGLES; |
|
|
|
servo_angles[SWITCHING_NOZZLE_SERVO_NR][0] = nozzle_angles[0]; |
|
|
|
servo_angles[SWITCHING_NOZZLE_SERVO_NR][1] = nozzle_angles[1]; |
|
|
|
|
|
|
|
#elif defined(Z_SERVO_ANGLES) && defined(Z_PROBE_SERVO_NR) |
|
|
|
|
|
|
|
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][1] = z_probe_angles[1]; |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
#endif |
|
|
|
#endif // HAS_SERVOS && EDITABLE_SERVO_ANGLES
|
|
|
|
|
|
|
|
#if ENABLED(DELTA) |
|
|
|
const float adj[ABC] = DELTA_ENDSTOP_ADJ, |
|
|
@ -2306,19 +2327,34 @@ void MarlinSettings::reset(PORTARG_SOLO) { |
|
|
|
|
|
|
|
#endif // HAS_LEVELING
|
|
|
|
|
|
|
|
#if HAS_SERVOS |
|
|
|
#if HAS_SERVOS && ENABLED(EDITABLE_SERVO_ANGLES) |
|
|
|
|
|
|
|
if (!forReplay) { |
|
|
|
CONFIG_ECHO_START; |
|
|
|
SERIAL_ECHOLNPGM_P(port, "Servo Angles:"); |
|
|
|
} |
|
|
|
for (uint8_t i = 0; i < NUM_SERVOS; i++) { |
|
|
|
CONFIG_ECHO_START; |
|
|
|
SERIAL_ECHOPAIR_P(port, " M281 P", i); |
|
|
|
SERIAL_ECHOPAIR_P(port, " L",servo_angles[i][0]); |
|
|
|
SERIAL_ECHOPAIR_P(port, " U",servo_angles[i][1]); |
|
|
|
SERIAL_EOL_P(port); |
|
|
|
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; |
|
|
|
SERIAL_ECHOPAIR_P(port, " M281 P", int(i)); |
|
|
|
SERIAL_ECHOPAIR_P(port, " L", servo_angles[i][0]); |
|
|
|
SERIAL_ECHOPAIR_P(port, " U", servo_angles[i][1]); |
|
|
|
SERIAL_EOL_P(port); |
|
|
|
default: break; |
|
|
|
} |
|
|
|
} |
|
|
|
#endif |
|
|
|
|
|
|
|
#endif // HAS_SERVOS && EDITABLE_SERVO_ANGLES
|
|
|
|
|
|
|
|
#if ENABLED(DELTA) |
|
|
|
|
|
|
|