@ -32,50 +32,31 @@
# if ENABLED(PARKING_EXTRUDER)
# 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
# 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
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 ) {
case 0 :
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 ;
case 0 : OUT_WRITE ( SOL0_PIN , value ) ; break ;
# if HAS_SOLENOID(1)
case 1 :
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 ;
case 1 : OUT_WRITE ( SOL1_PIN , value ) ; break ;
# endif
# if HAS_SOLENOID(2)
case 2 :
OUT_WRITE ( SOL2_PIN , value ) ;
break ;
case 2 : OUT_WRITE ( SOL2_PIN , value ) ; break ;
# endif
# if HAS_SOLENOID(3)
case 3 :
OUT_WRITE ( SOL3_PIN , value ) ;
break ;
case 3 : OUT_WRITE ( SOL3_PIN , value ) ; break ;
# endif
# if HAS_SOLENOID(4)
case 4 :
OUT_WRITE ( SOL4_PIN , value ) ;
break ;
case 4 : OUT_WRITE ( SOL4_PIN , value ) ; break ;
# endif
# if HAS_SOLENOID(5)
case 5 :
OUT_WRITE ( SOL5_PIN , value ) ;
break ;
case 5 : OUT_WRITE ( SOL5_PIN , value ) ; break ;
# endif
default :
SERIAL_ECHO_MSG ( STR_INVALID_SOLENOID ) ;
break ;
default : SERIAL_ECHO_MSG ( STR_INVALID_SOLENOID ) ; break ;
}
}