parent
4b4498be93
commit
efe2859227
@ -32,50 +32,31 @@
|
|||||||
|
|
||||||
#if ENABLED(PARKING_EXTRUDER)
|
#if ENABLED(PARKING_EXTRUDER)
|
||||||
#include "../module/tool_change.h"
|
#include "../module/tool_change.h"
|
||||||
#define SOLENOID_MAGNETIZED_STATE (TERN_(PARKING_EXTRUDER_SOLENOIDS_INVERT,!)PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE)
|
|
||||||
#else
|
|
||||||
#define SOLENOID_MAGNETIZED_STATE HIGH
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define HAS_SOLENOID(N) (HAS_SOLENOID_##N && TERN(MANUAL_SOLENOID_CONTROL, true, EXTRUDERS > N))
|
#define HAS_SOLENOID(N) (HAS_SOLENOID_##N && (ENABLED(MANUAL_SOLENOID_CONTROL) || N < EXTRUDERS))
|
||||||
|
|
||||||
// Used primarily with MANUAL_SOLENOID_CONTROL
|
// Used primarily with MANUAL_SOLENOID_CONTROL
|
||||||
static void set_solenoid(const uint8_t num, const bool active) {
|
static void set_solenoid(const uint8_t num, const bool active) {
|
||||||
const uint8_t value = active ? SOLENOID_MAGNETIZED_STATE : !SOLENOID_MAGNETIZED_STATE;
|
const uint8_t value = active ? PE_MAGNET_ON_STATE : !PE_MAGNET_ON_STATE;
|
||||||
switch (num) {
|
switch (num) {
|
||||||
case 0:
|
case 0: OUT_WRITE(SOL0_PIN, value); break;
|
||||||
OUT_WRITE(SOL0_PIN, value);
|
|
||||||
TERN_(PARKING_EXTRUDER, if (!active && active_extruder == 0) parking_extruder_set_parked()); // If active extruder's solenoid is disabled, carriage is considered parked
|
|
||||||
break;
|
|
||||||
#if HAS_SOLENOID(1)
|
#if HAS_SOLENOID(1)
|
||||||
case 1:
|
case 1: OUT_WRITE(SOL1_PIN, value); break;
|
||||||
OUT_WRITE(SOL1_PIN, value);
|
|
||||||
TERN_(PARKING_EXTRUDER, if (!active && active_extruder == 1) parking_extruder_set_parked()); // If active extruder's solenoid is disabled, carriage is considered parked
|
|
||||||
break;
|
|
||||||
#endif
|
#endif
|
||||||
#if HAS_SOLENOID(2)
|
#if HAS_SOLENOID(2)
|
||||||
case 2:
|
case 2: OUT_WRITE(SOL2_PIN, value); break;
|
||||||
OUT_WRITE(SOL2_PIN, value);
|
|
||||||
break;
|
|
||||||
#endif
|
#endif
|
||||||
#if HAS_SOLENOID(3)
|
#if HAS_SOLENOID(3)
|
||||||
case 3:
|
case 3: OUT_WRITE(SOL3_PIN, value); break;
|
||||||
OUT_WRITE(SOL3_PIN, value);
|
|
||||||
break;
|
|
||||||
#endif
|
#endif
|
||||||
#if HAS_SOLENOID(4)
|
#if HAS_SOLENOID(4)
|
||||||
case 4:
|
case 4: OUT_WRITE(SOL4_PIN, value); break;
|
||||||
OUT_WRITE(SOL4_PIN, value);
|
|
||||||
break;
|
|
||||||
#endif
|
#endif
|
||||||
#if HAS_SOLENOID(5)
|
#if HAS_SOLENOID(5)
|
||||||
case 5:
|
case 5: OUT_WRITE(SOL5_PIN, value); break;
|
||||||
OUT_WRITE(SOL5_PIN, value);
|
|
||||||
break;
|
|
||||||
#endif
|
#endif
|
||||||
default:
|
default: SERIAL_ECHO_MSG(STR_INVALID_SOLENOID); break;
|
||||||
SERIAL_ECHO_MSG(STR_INVALID_SOLENOID);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,11 +260,7 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
|
|||||||
|
|
||||||
void pe_solenoid_init() {
|
void pe_solenoid_init() {
|
||||||
LOOP_LE_N(n, 1)
|
LOOP_LE_N(n, 1)
|
||||||
#if ENABLED(PARKING_EXTRUDER_SOLENOIDS_INVERT)
|
TERN(PARKING_EXTRUDER_SOLENOIDS_INVERT, pe_activate_solenoid, pe_deactivate_solenoid)(n);
|
||||||
pe_activate_solenoid(n);
|
|
||||||
#else
|
|
||||||
pe_deactivate_solenoid(n);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void pe_set_solenoid(const uint8_t extruder_num, const uint8_t state) {
|
void pe_set_solenoid(const uint8_t extruder_num, const uint8_t state) {
|
||||||
|
Loading…
Reference in New Issue
Block a user