Commit 70ff66cb authored by MagoKimbra's avatar MagoKimbra

Add INVERTED_RELE_PINS

parent 76407d80
......@@ -387,8 +387,10 @@
* *
* Uncomment MKR4 to enable this feature *
* *
* Uncomment INVERTED_RELE_PINS if your relay switches with GND *
***********************************************************************/
//#define MKR4
//#define INVERTED_RELE_PINS
/***********************************************************************/
......
......@@ -6780,104 +6780,104 @@ inline void gcode_T(uint8_t tmp_extruder) {
#endif // HOTENDS > 1
#if ENABLED(MKR4) && (EXTRUDERS > 1)
#if (EXTRUDERS == 4) && (E0E2_CHOICE_PIN >1) && (E1E3_CHOICE_PIN > 1) && (DRIVER_EXTRUDERS == 2)
#if (EXTRUDERS == 4) && HAS(E0E2) && HAS(E1E3) && (DRIVER_EXTRUDERS == 2)
st_synchronize(); // Finish all movement
disable_e();
switch(target_extruder)
{
case 0:
WRITE(E0E2_CHOICE_PIN,LOW);
WRITE(E1E3_CHOICE_PIN,LOW);
WRITE_RELE(E0E2_CHOICE_PIN, LOW);
WRITE_RELE(E1E3_CHOICE_PIN, LOW);
active_driver = 0;
delay(500); // 500 microseconds delay for relay
enable_e0();
break;
case 1:
WRITE(E0E2_CHOICE_PIN,LOW);
WRITE(E1E3_CHOICE_PIN,LOW);
WRITE_RELE(E0E2_CHOICE_PIN, LOW);
WRITE_RELE(E1E3_CHOICE_PIN, LOW);
active_driver = 1;
delay(500); // 500 microseconds delay for relay
enable_e1();
break;
case 2:
WRITE(E0E2_CHOICE_PIN,HIGH);
WRITE(E1E3_CHOICE_PIN,LOW);
WRITE_RELE(E0E2_CHOICE_PIN, HIGH);
WRITE_RELE(E1E3_CHOICE_PIN, LOW);
active_driver = 0;
delay(500); // 500 microseconds delay for relay
enable_e2();
break;
case 3:
WRITE(E0E2_CHOICE_PIN,LOW);
WRITE(E1E3_CHOICE_PIN,HIGH);
WRITE_RELE(E0E2_CHOICE_PIN, LOW);
WRITE_RELE(E1E3_CHOICE_PIN, HIGH);
active_driver = 1;
delay(500); // 500 microseconds delay for relay
enable_e3();
break;
}
#elif (EXTRUDERS == 3) && (E0E2_CHOICE_PIN >1) && (DRIVER_EXTRUDERS == 2)
#elif (EXTRUDERS == 3) && HAS(E0E2) && (DRIVER_EXTRUDERS == 2)
st_synchronize(); // Finish all movement
disable_e();
switch(target_extruder)
{
case 0:
WRITE(E0E2_CHOICE_PIN,LOW);
WRITE_RELE(E0E2_CHOICE_PIN, LOW);
active_driver = 0;
delay(500); // 500 microseconds delay for relay
enable_e0();
break;
case 1:
WRITE(E0E2_CHOICE_PIN,LOW);
WRITE_RELE(E0E2_CHOICE_PIN, LOW);
active_driver = 1;
delay(500); // 500 microseconds delay for relay
enable_e1();
break;
case 2:
WRITE(E0E2_CHOICE_PIN,HIGH);
WRITE_RELE(E0E2_CHOICE_PIN, HIGH);
active_driver = 0;
delay(500); // 500 microseconds delay for relay
enable_e2();
break;
}
#elif (EXTRUDERS == 3) && (E0E1_CHOICE_PIN >1) && (E0E2_CHOICE_PIN >1) && (DRIVER_EXTRUDERS == 1)
#elif (EXTRUDERS == 3) && HAS(E0E1) && HAS(E0E2) && (DRIVER_EXTRUDERS == 1)
st_synchronize(); // Finish all movement
disable_e();
switch(target_extruder)
{
case 0:
WRITE(E0E1_CHOICE_PIN,LOW);
WRITE(E0E2_CHOICE_PIN,LOW);
WRITE_RELE(E0E1_CHOICE_PIN, LOW);
WRITE_RELE(E0E2_CHOICE_PIN, LOW);
active_driver = 0;
delay(500); // 500 microseconds delay for relay
enable_e0();
break;
case 1:
WRITE(E0E1_CHOICE_PIN,HIGH);
WRITE(E0E2_CHOICE_PIN,LOW);
WRITE_RELE(E0E1_CHOICE_PIN, HIGH);
WRITE_RELE(E0E2_CHOICE_PIN, LOW);
active_driver = 0;
delay(500); // 500 microseconds delay for relay
enable_e0();
break;
case 2:
WRITE(E0E1_CHOICE_PIN,HIGH);
WRITE(E0E2_CHOICE_PIN,HIGH);
WRITE_RELE(E0E1_CHOICE_PIN, HIGH);
WRITE_RELE(E0E2_CHOICE_PIN, HIGH);
active_driver = 0;
delay(500); // 500 microseconds delay for relay
enable_e0();
break;
}
#elif (EXTRUDERS == 2) && (E0E1_CHOICE_PIN >1) && (DRIVER_EXTRUDERS == 1)
#elif (EXTRUDERS == 2) && HAS(E0E1) && (DRIVER_EXTRUDERS == 1)
st_synchronize(); // Finish all movement
disable_e();
switch(target_extruder)
{
case 0:
WRITE(E0E1_CHOICE_PIN,LOW);
WRITE_RELE(E0E1_CHOICE_PIN, LOW);
active_driver = 0;
delay(500); // 500 microseconds delay for relay
enable_e0();
break;
case 1:
WRITE(E0E1_CHOICE_PIN,HIGH);
WRITE_RELE(E0E1_CHOICE_PIN, HIGH);
active_driver = 0;
delay(500); // 500 microseconds delay for relay
enable_e0();
......
......@@ -638,12 +638,12 @@
#define HAS_LCD_POWER_SENSOR (HAS_POWER_CONSUMPTION_SENSOR && ENABLED(POWER_CONSUMPTION_LCD_DISPLAY))
/**
* Helper Macros for heaters and extruder fan
* Helper Macros for heaters and extruder fan and rele
*/
#if ENABLED(INVERTED_HEATER_PINS)
#define WRITE_HEATER(pin,value) WRITE(pin,!value)
#define WRITE_HEATER(pin, value) WRITE(pin, !value)
#else
#define WRITE_HEATER(pin,value) WRITE(pin,value)
#define WRITE_HEATER(pin, value) WRITE(pin, value)
#endif
#define WRITE_HEATER_0P(v) WRITE_HEATER(HEATER_0_PIN, v)
#if HOTENDS > 1 || ENABLED(HEATERS_PARALLEL)
......@@ -674,6 +674,13 @@
#define WRITE_FAN(v) WRITE(FAN_PIN, v)
#endif
#endif
#if ENABLED(MKR4)
#if ENABLED(INVERTED_RELE_PINS)
#define WRITE_RELE(pin, value) WRITE(pin, !value)
#else
#define WRITE_RELE(pin, value) WRITE(pin, value)
#endif
#endif
/**
* Buzzer
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment