[2.0.x] Optional heater signal inversion (#10260)

This commit is contained in:
Karl Andersson 2018-04-03 02:37:41 +02:00 committed by Scott Lahteine
parent 4d1a61335c
commit 7cbbc2af7a
2 changed files with 36 additions and 11 deletions

View File

@ -831,18 +831,43 @@
#define EXTRUDE_MINTEMP 170
#endif
/**
* Heater signal inversion defaults
*/
#if HAS_HEATER_0 && !defined(HEATER_0_INVERTING)
#define HEATER_0_INVERTING false
#endif
#if HAS_HEATER_1 && !defined(HEATER_1_INVERTING)
#define HEATER_1_INVERTING false
#endif
#if HAS_HEATER_2 && !defined(HEATER_2_INVERTING)
#define HEATER_2_INVERTING false
#endif
#if HAS_HEATER_3 && !defined(HEATER_3_INVERTING)
#define HEATER_3_INVERTING false
#endif
#if HAS_HEATER_4 && !defined(HEATER_4_INVERTING)
#define HEATER_4_INVERTING false
#endif
/**
* Helper Macros for heaters and extruder fan
*/
#define WRITE_HEATER_0P(v) WRITE(HEATER_0_PIN, v)
#define WRITE_HEATER_0P(v) WRITE(HEATER_0_PIN, (v) ^ HEATER_0_INVERTING)
#if HOTENDS > 1 || ENABLED(HEATERS_PARALLEL)
#define WRITE_HEATER_1(v) WRITE(HEATER_1_PIN, v)
#define WRITE_HEATER_1(v) WRITE(HEATER_1_PIN, (v) ^ HEATER_1_INVERTING)
#if HOTENDS > 2
#define WRITE_HEATER_2(v) WRITE(HEATER_2_PIN, v)
#define WRITE_HEATER_2(v) WRITE(HEATER_2_PIN, (v) ^ HEATER_2_INVERTING)
#if HOTENDS > 3
#define WRITE_HEATER_3(v) WRITE(HEATER_3_PIN, v)
#define WRITE_HEATER_3(v) WRITE(HEATER_3_PIN, (v) ^ HEATER_3_INVERTING)
#if HOTENDS > 4
#define WRITE_HEATER_4(v) WRITE(HEATER_4_PIN, v)
#define WRITE_HEATER_4(v) WRITE(HEATER_4_PIN, (v) ^ HEATER_4_INVERTING)
#endif // HOTENDS > 4
#endif // HOTENDS > 3
#endif // HOTENDS > 2

View File

@ -1085,22 +1085,22 @@ void Temperature::init() {
#endif
#if HAS_HEATER_0
SET_OUTPUT(HEATER_0_PIN);
OUT_WRITE(HEATER_0_PIN, HEATER_0_INVERTING);
#endif
#if HAS_HEATER_1
SET_OUTPUT(HEATER_1_PIN);
OUT_WRITE(HEATER_1_PIN, HEATER_1_INVERTING);
#endif
#if HAS_HEATER_2
SET_OUTPUT(HEATER_2_PIN);
OUT_WRITE(HEATER_2_PIN, HEATER_2_INVERTING);
#endif
#if HAS_HEATER_3
SET_OUTPUT(HEATER_3_PIN);
OUT_WRITE(HEATER_3_PIN, HEATER_3_INVERTING);
#endif
#if HAS_HEATER_4
SET_OUTPUT(HEATER_3_PIN);
OUT_WRITE(HEATER_3_PIN, HEATER_4_INVERTING);
#endif
#if HAS_HEATER_BED
SET_OUTPUT(HEATER_BED_PIN);
OUT_WRITE(HEATER_BED_PIN, HEATER_BED_INVERTING);
#endif
#if HAS_FAN0