🩹 No PE_MAGNET_ON_STATE without PARKING_EXTRUDER
This commit is contained in:
parent
cc4c2c2f98
commit
b0a400da72
@ -27,17 +27,11 @@
|
||||
#include "solenoid.h"
|
||||
|
||||
#include "../module/motion.h" // for active_extruder
|
||||
|
||||
// PARKING_EXTRUDER options alter the default behavior of solenoids, this ensures compliance of M380-381
|
||||
|
||||
#if ENABLED(PARKING_EXTRUDER)
|
||||
#include "../module/tool_change.h"
|
||||
#endif
|
||||
|
||||
// Used primarily with MANUAL_SOLENOID_CONTROL
|
||||
static void set_solenoid(const uint8_t num, const bool active) {
|
||||
const uint8_t value = active ? PE_MAGNET_ON_STATE : !PE_MAGNET_ON_STATE;
|
||||
#define _SOL_CASE(N) case N: TERN_(HAS_SOLENOID_##N, OUT_WRITE(SOL##N##_PIN, value)); break;
|
||||
static void set_solenoid(const uint8_t num, const uint8_t state) {
|
||||
#define _SOL_CASE(N) case N: TERN_(HAS_SOLENOID_##N, OUT_WRITE(SOL##N##_PIN, state)); break;
|
||||
switch (num) {
|
||||
REPEAT(8, _SOL_CASE)
|
||||
default: SERIAL_ECHO_MSG(STR_INVALID_SOLENOID); break;
|
||||
@ -49,9 +43,9 @@ static void set_solenoid(const uint8_t num, const bool active) {
|
||||
#endif
|
||||
}
|
||||
|
||||
void enable_solenoid(const uint8_t num) { set_solenoid(num, true); }
|
||||
void disable_solenoid(const uint8_t num) { set_solenoid(num, false); }
|
||||
void enable_solenoid_on_active_extruder() { }
|
||||
// PARKING_EXTRUDER options alter the default behavior of solenoids to ensure compliance of M380-381
|
||||
void enable_solenoid(const uint8_t num) { set_solenoid(num, TERN1(PARKING_EXTRUDER, PE_MAGNET_ON_STATE)); }
|
||||
void disable_solenoid(const uint8_t num) { set_solenoid(num, TERN0(PARKING_EXTRUDER, !PE_MAGNET_ON_STATE)); }
|
||||
|
||||
void disable_all_solenoids() {
|
||||
#define _SOL_DISABLE(N) TERN_(HAS_SOLENOID_##N, disable_solenoid(N));
|
||||
|
@ -21,7 +21,6 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
void enable_solenoid_on_active_extruder();
|
||||
void disable_all_solenoids();
|
||||
void enable_solenoid(const uint8_t num);
|
||||
void disable_solenoid(const uint8_t num);
|
||||
|
@ -37,7 +37,7 @@ void GcodeSuite::M380() {
|
||||
#if ENABLED(MANUAL_SOLENOID_CONTROL)
|
||||
enable_solenoid(parser.intval('S', active_extruder));
|
||||
#else
|
||||
enable_solenoid_on_active_extruder();
|
||||
enable_solenoid(active_extruder);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -219,8 +219,8 @@
|
||||
* M350 - Set microstepping mode. (Requires digital microstepping pins.)
|
||||
* M351 - Toggle MS1 MS2 pins directly. (Requires digital microstepping pins.)
|
||||
* M355 - Set Case Light on/off and set brightness. (Requires CASE_LIGHT_PIN)
|
||||
* M380 - Activate solenoid on active extruder. (Requires EXT_SOLENOID)
|
||||
* M381 - Disable all solenoids. (Requires EXT_SOLENOID)
|
||||
* M380 - Activate solenoid on active tool (Requires EXT_SOLENOID) or the tool specified by 'S' (Requires MANUAL_SOLENOID_CONTROL).
|
||||
* M381 - Disable solenoids on all tools (Requires EXT_SOLENOID) or the tool specified by 'S' (Requires MANUAL_SOLENOID_CONTROL).
|
||||
* M400 - Finish all moves.
|
||||
* M401 - Deploy and activate Z probe. (Requires a probe)
|
||||
* M402 - Deactivate and stow Z probe. (Requires a probe)
|
||||
|
@ -1292,7 +1292,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
|
||||
|
||||
#if ENABLED(EXT_SOLENOID) && DISABLED(PARKING_EXTRUDER)
|
||||
disable_all_solenoids();
|
||||
enable_solenoid_on_active_extruder();
|
||||
enable_solenoid(active_extruder);
|
||||
#endif
|
||||
|
||||
#if HAS_PRUSA_MMU1
|
||||
|
Loading…
Reference in New Issue
Block a user