|
@@ -27,17 +27,11 @@
|
27
|
27
|
#include "solenoid.h"
|
28
|
28
|
|
29
|
29
|
#include "../module/motion.h" // for active_extruder
|
30
|
|
-
|
31
|
|
-// PARKING_EXTRUDER options alter the default behavior of solenoids, this ensures compliance of M380-381
|
32
|
|
-
|
33
|
|
-#if ENABLED(PARKING_EXTRUDER)
|
34
|
|
- #include "../module/tool_change.h"
|
35
|
|
-#endif
|
|
30
|
+#include "../module/tool_change.h"
|
36
|
31
|
|
37
|
32
|
// Used primarily with MANUAL_SOLENOID_CONTROL
|
38
|
|
-static void set_solenoid(const uint8_t num, const bool active) {
|
39
|
|
- const uint8_t value = active ? PE_MAGNET_ON_STATE : !PE_MAGNET_ON_STATE;
|
40
|
|
- #define _SOL_CASE(N) case N: TERN_(HAS_SOLENOID_##N, OUT_WRITE(SOL##N##_PIN, value)); break;
|
|
33
|
+static void set_solenoid(const uint8_t num, const uint8_t state) {
|
|
34
|
+ #define _SOL_CASE(N) case N: TERN_(HAS_SOLENOID_##N, OUT_WRITE(SOL##N##_PIN, state)); break;
|
41
|
35
|
switch (num) {
|
42
|
36
|
REPEAT(8, _SOL_CASE)
|
43
|
37
|
default: SERIAL_ECHO_MSG(STR_INVALID_SOLENOID); break;
|
|
@@ -49,9 +43,9 @@ static void set_solenoid(const uint8_t num, const bool active) {
|
49
|
43
|
#endif
|
50
|
44
|
}
|
51
|
45
|
|
52
|
|
-void enable_solenoid(const uint8_t num) { set_solenoid(num, true); }
|
53
|
|
-void disable_solenoid(const uint8_t num) { set_solenoid(num, false); }
|
54
|
|
-void enable_solenoid_on_active_extruder() { }
|
|
46
|
+// PARKING_EXTRUDER options alter the default behavior of solenoids to ensure compliance of M380-381
|
|
47
|
+void enable_solenoid(const uint8_t num) { set_solenoid(num, TERN1(PARKING_EXTRUDER, PE_MAGNET_ON_STATE)); }
|
|
48
|
+void disable_solenoid(const uint8_t num) { set_solenoid(num, TERN0(PARKING_EXTRUDER, !PE_MAGNET_ON_STATE)); }
|
55
|
49
|
|
56
|
50
|
void disable_all_solenoids() {
|
57
|
51
|
#define _SOL_DISABLE(N) TERN_(HAS_SOLENOID_##N, disable_solenoid(N));
|