Skip to content

Commit

Permalink
🔧 Impose Hephestos 2 Bed Kit requirements (MarlinFirmware#25585)
Browse files Browse the repository at this point in the history
  • Loading branch information
ellensp authored and EvilGremlin committed Apr 8, 2023
1 parent 28419cd commit 8ef894b
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 70 deletions.
2 changes: 0 additions & 2 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,6 @@
*/
//#define HEPHESTOS2_HEATED_BED_KIT
#if ENABLED(HEPHESTOS2_HEATED_BED_KIT)
#undef TEMP_SENSOR_BED
#define TEMP_SENSOR_BED 70
#define HEATER_BED_INVERTING true
#endif

Expand Down
65 changes: 11 additions & 54 deletions Marlin/src/inc/Conditionals_post.h
Original file line number Diff line number Diff line change
Expand Up @@ -2799,54 +2799,24 @@
#define HAS_MICROSTEPS 1
#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
#if HAS_HEATER_5 && !defined(HEATER_5_INVERTING)
#define HEATER_5_INVERTING false
#endif
#if HAS_HEATER_6 && !defined(HEATER_6_INVERTING)
#define HEATER_6_INVERTING false
#endif
#if HAS_HEATER_7 && !defined(HEATER_7_INVERTING)
#define HEATER_7_INVERTING false
#endif

/**
* Helper Macros for heaters and extruder fan
*/

#define WRITE_HEATER_0P(v) WRITE(HEATER_0_PIN, (v) ^ HEATER_0_INVERTING)
#define WRITE_HEATER_0P(v) WRITE(HEATER_0_PIN, (v) ^ ENABLED(HEATER_0_INVERTING))
#if EITHER(HAS_MULTI_HOTEND, HEATERS_PARALLEL)
#define WRITE_HEATER_1(v) WRITE(HEATER_1_PIN, (v) ^ HEATER_1_INVERTING)
#define WRITE_HEATER_1(v) WRITE(HEATER_1_PIN, (v) ^ ENABLED(HEATER_1_INVERTING))
#if HOTENDS > 2
#define WRITE_HEATER_2(v) WRITE(HEATER_2_PIN, (v) ^ HEATER_2_INVERTING)
#define WRITE_HEATER_2(v) WRITE(HEATER_2_PIN, (v) ^ ENABLED(HEATER_2_INVERTING))
#if HOTENDS > 3
#define WRITE_HEATER_3(v) WRITE(HEATER_3_PIN, (v) ^ HEATER_3_INVERTING)
#define WRITE_HEATER_3(v) WRITE(HEATER_3_PIN, (v) ^ ENABLED(HEATER_3_INVERTING))
#if HOTENDS > 4
#define WRITE_HEATER_4(v) WRITE(HEATER_4_PIN, (v) ^ HEATER_4_INVERTING)
#define WRITE_HEATER_4(v) WRITE(HEATER_4_PIN, (v) ^ ENABLED(HEATER_4_INVERTING))
#if HOTENDS > 5
#define WRITE_HEATER_5(v) WRITE(HEATER_5_PIN, (v) ^ HEATER_5_INVERTING)
#define WRITE_HEATER_5(v) WRITE(HEATER_5_PIN, (v) ^ ENABLED(HEATER_5_INVERTING))
#if HOTENDS > 6
#define WRITE_HEATER_6(v) WRITE(HEATER_6_PIN, (v) ^ HEATER_6_INVERTING)
#define WRITE_HEATER_6(v) WRITE(HEATER_6_PIN, (v) ^ ENABLED(HEATER_6_INVERTING))
#if HOTENDS > 7
#define WRITE_HEATER_7(v) WRITE(HEATER_7_PIN, (v) ^ HEATER_7_INVERTING)
#define WRITE_HEATER_7(v) WRITE(HEATER_7_PIN, (v) ^ ENABLED(HEATER_7_INVERTING))
#endif // HOTENDS > 7
#endif // HOTENDS > 6
#endif // HOTENDS > 5
Expand All @@ -2860,10 +2830,6 @@
#define WRITE_HEATER_0(v) WRITE_HEATER_0P(v)
#endif

#ifndef MIN_POWER
#define MIN_POWER 0
#endif

/**
* Heated bed requires settings
*/
Expand All @@ -2874,10 +2840,7 @@
#ifndef MAX_BED_POWER
#define MAX_BED_POWER 255
#endif
#ifndef HEATER_BED_INVERTING
#define HEATER_BED_INVERTING false
#endif
#define WRITE_HEATER_BED(v) WRITE(HEATER_BED_PIN, (v) ^ HEATER_BED_INVERTING)
#define WRITE_HEATER_BED(v) WRITE(HEATER_BED_PIN, (v) ^ ENABLED(HEATER_BED_INVERTING))
#endif

/**
Expand All @@ -2890,10 +2853,7 @@
#ifndef MAX_CHAMBER_POWER
#define MAX_CHAMBER_POWER 255
#endif
#ifndef HEATER_CHAMBER_INVERTING
#define HEATER_CHAMBER_INVERTING false
#endif
#define WRITE_HEATER_CHAMBER(v) WRITE(HEATER_CHAMBER_PIN, (v) ^ HEATER_CHAMBER_INVERTING)
#define WRITE_HEATER_CHAMBER(v) WRITE(HEATER_CHAMBER_PIN, (v) ^ ENABLED(HEATER_CHAMBER_INVERTING))
#endif

/**
Expand All @@ -2903,10 +2863,7 @@
#ifndef MAX_COOLER_POWER
#define MAX_COOLER_POWER 255
#endif
#ifndef COOLER_INVERTING
#define COOLER_INVERTING true
#endif
#define WRITE_HEATER_COOLER(v) WRITE(COOLER_PIN, (v) ^ COOLER_INVERTING)
#define WRITE_HEATER_COOLER(v) WRITE(COOLER_PIN, (v) ^ ENABLED(COOLER_INVERTING))
#endif

#if HAS_HOTEND || HAS_HEATED_BED || HAS_HEATED_CHAMBER || HAS_COOLER
Expand Down
11 changes: 11 additions & 0 deletions Marlin/src/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -736,6 +736,17 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L
#undef _ISMAX_1
#undef _ISSNS_1

/**
* Hephestos 2 Heated Bed Kit requirements
*/
#if ENABLED(HEPHESTOS2_HEATED_BED_KIT)
#if TEMP_SENSOR_BED != 70
#error "HEPHESTOS2_HEATED_BED_KIT requires TEMP_SENSOR_BED 70."
#elif DISABLED(HEATER_BED_INVERTING)
#error "HEPHESTOS2_HEATED_BED_KIT requires HEATER_BED_INVERTING."
#endif
#endif

/**
* Probe temp compensation requirements
*/
Expand Down
26 changes: 13 additions & 13 deletions Marlin/src/module/temperature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2630,47 +2630,47 @@ void Temperature::init() {

#if HAS_HEATER_0
#ifdef BOARD_OPENDRAIN_MOSFETS
OUT_WRITE_OD(HEATER_0_PIN, HEATER_0_INVERTING);
OUT_WRITE_OD(HEATER_0_PIN, ENABLED(HEATER_0_INVERTING));
#else
OUT_WRITE(HEATER_0_PIN, HEATER_0_INVERTING);
OUT_WRITE(HEATER_0_PIN, ENABLED(HEATER_0_INVERTING));
#endif
#endif
#if HAS_HEATER_1
OUT_WRITE(HEATER_1_PIN, HEATER_1_INVERTING);
OUT_WRITE(HEATER_1_PIN, ENABLED(HEATER_1_INVERTING));
#endif
#if HAS_HEATER_2
OUT_WRITE(HEATER_2_PIN, HEATER_2_INVERTING);
OUT_WRITE(HEATER_2_PIN, ENABLED(HEATER_2_INVERTING));
#endif
#if HAS_HEATER_3
OUT_WRITE(HEATER_3_PIN, HEATER_3_INVERTING);
OUT_WRITE(HEATER_3_PIN, ENABLED(HEATER_3_INVERTING));
#endif
#if HAS_HEATER_4
OUT_WRITE(HEATER_4_PIN, HEATER_4_INVERTING);
OUT_WRITE(HEATER_4_PIN, ENABLED(HEATER_4_INVERTING));
#endif
#if HAS_HEATER_5
OUT_WRITE(HEATER_5_PIN, HEATER_5_INVERTING);
OUT_WRITE(HEATER_5_PIN, ENABLED(HEATER_5_INVERTING));
#endif
#if HAS_HEATER_6
OUT_WRITE(HEATER_6_PIN, HEATER_6_INVERTING);
OUT_WRITE(HEATER_6_PIN, ENABLED(HEATER_6_INVERTING));
#endif
#if HAS_HEATER_7
OUT_WRITE(HEATER_7_PIN, HEATER_7_INVERTING);
OUT_WRITE(HEATER_7_PIN, ENABLED(HEATER_7_INVERTING));
#endif

#if HAS_HEATED_BED
#ifdef BOARD_OPENDRAIN_MOSFETS
OUT_WRITE_OD(HEATER_BED_PIN, HEATER_BED_INVERTING);
OUT_WRITE_OD(HEATER_BED_PIN, ENABLED(HEATER_BED_INVERTING));
#else
OUT_WRITE(HEATER_BED_PIN, HEATER_BED_INVERTING);
OUT_WRITE(HEATER_BED_PIN, ENABLED(HEATER_BED_INVERTING));
#endif
#endif

#if HAS_HEATED_CHAMBER
OUT_WRITE(HEATER_CHAMBER_PIN, HEATER_CHAMBER_INVERTING);
OUT_WRITE(HEATER_CHAMBER_PIN, ENABLED(HEATER_CHAMBER_INVERTING));
#endif

#if HAS_COOLER
OUT_WRITE(COOLER_PIN, COOLER_INVERTING);
OUT_WRITE(COOLER_PIN, ENABLED(COOLER_INVERTING));
#endif

#if HAS_FAN0
Expand Down
3 changes: 2 additions & 1 deletion Marlin/src/pins/ramps/pins_BQ_ZUM_MEGA_3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,10 @@
#include "pins_RAMPS_13.h" // ... RAMPS

//
// Used by the Hephestos 2 heated bed upgrade kit
// Hephestos 2 heated bed upgrade kit uses pin 8
//
#if ENABLED(HEPHESTOS2_HEATED_BED_KIT)
#undef HEATER_BED_PIN
#define HEATER_BED_PIN 8
#define HEATER_BED_INVERTING true
#endif

0 comments on commit 8ef894b

Please sign in to comment.