Skip to content

Commit

Permalink
tweak enums
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed May 23, 2021
1 parent f80c580 commit 8f59da2
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions Marlin/src/module/temperature.h
Original file line number Diff line number Diff line change
Expand Up @@ -395,21 +395,21 @@ class Temperature {
} heater_idle_t;

// Indices and size for the heater_idle array
#define _ENUM_FOR_E(N) IDLE_INDEX_E##N,
enum IdleIndex : uint8_t {
REPEAT(HOTENDS, _ENUM_FOR_E)
#if ENABLED(HAS_HEATED_BED)
IDLE_INDEX_BED,
#endif
NR_HEATER_IDLE
_ = -1

#define _IDLE_INDEX_E(N) ,IDLE_INDEX_E##N
REPEAT(HOTENDS, _IDLE_INDEX_E)
#undef _IDLE_INDEX_E

OPTARG(HAS_HEATED_BED, IDLE_INDEX_BED)

, NR_HEATER_IDLE
};
#undef _ENUM_FOR_E

// Convert the given heater_id_t to idle array index
static inline IdleIndex idle_index_for_id(const int8_t heater_id) {
#if HAS_HEATED_BED
if (heater_id == H_BED) return IDLE_INDEX_BED;
#endif
TERN_(HAS_HEATED_BED, if (heater_id == H_BED) return IDLE_INDEX_BED);
return (IdleIndex)_MAX(heater_id, 0);
}

Expand Down Expand Up @@ -919,18 +919,18 @@ class Temperature {
#if HAS_THERMAL_PROTECTION

// Indices and size for the tr_state_machine array. One for each protected heater.
#define _ENUM_FOR_E(N) ,RUNAWAY_IND_E##N
enum RunawayIndex : int8_t {
_ = -1
#if ENABLED(THERMAL_PROTECTION_HOTENDS)
REPEAT(HOTENDS, _ENUM_FOR_E)
#define _RUNAWAY_IND_E(N) ,RUNAWAY_IND_E##N
REPEAT(HOTENDS, _RUNAWAY_IND_E)
#undef _RUNAWAY_IND_E
#endif
OPTARG(HAS_THERMALLY_PROTECTED_BED, RUNAWAY_IND_BED)
OPTARG(THERMAL_PROTECTION_CHAMBER, RUNAWAY_IND_CHAMBER)
OPTARG(THERMAL_PROTECTION_COOLER, RUNAWAY_IND_COOLER)
, NR_HEATER_RUNAWAY
};
#undef _ENUM_FOR_E

// Convert the given heater_id_t to runaway state array index
static inline RunawayIndex runaway_index_for_id(const int8_t heater_id) {
Expand Down

0 comments on commit 8f59da2

Please sign in to comment.