🧑💻 General and Axis-based bitfield flags (#23989)
This commit is contained in:
committed by
Scott Lahteine
parent
d5f472a6cf
commit
d235bc9e1c
@ -34,7 +34,7 @@
|
||||
#if HAS_AUTO_FAN && EXTRUDER_AUTO_FAN_SPEED != 255 && DISABLED(FOURWIRES_FANS)
|
||||
bool FanCheck::measuring = false;
|
||||
#endif
|
||||
bool FanCheck::tacho_state[TACHO_COUNT];
|
||||
Flags<TACHO_COUNT> FanCheck::tacho_state;
|
||||
uint16_t FanCheck::edge_counter[TACHO_COUNT];
|
||||
uint8_t FanCheck::rps[TACHO_COUNT];
|
||||
FanCheck::TachoError FanCheck::error = FanCheck::TachoError::NONE;
|
||||
@ -103,7 +103,7 @@ void FanCheck::update_tachometers() {
|
||||
|
||||
if (status != tacho_state[f]) {
|
||||
if (measuring) ++edge_counter[f];
|
||||
tacho_state[f] = status;
|
||||
tacho_state.set(f, status);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ class FanCheck {
|
||||
#else
|
||||
static constexpr bool measuring = true;
|
||||
#endif
|
||||
static bool tacho_state[TACHO_COUNT];
|
||||
static Flags<TACHO_COUNT> tacho_state;
|
||||
static uint16_t edge_counter[TACHO_COUNT];
|
||||
static uint8_t rps[TACHO_COUNT];
|
||||
static TachoError error;
|
||||
|
@ -45,7 +45,7 @@ FWRetract fwretract; // Single instance - this calls the constructor
|
||||
// private:
|
||||
|
||||
#if HAS_MULTI_EXTRUDER
|
||||
bool FWRetract::retracted_swap[EXTRUDERS]; // Which extruders are swap-retracted
|
||||
Flags<EXTRUDERS> FWRetract::retracted_swap; // Which extruders are swap-retracted
|
||||
#endif
|
||||
|
||||
// public:
|
||||
@ -56,7 +56,7 @@ fwretract_settings_t FWRetract::settings; // M207 S F Z W, M208 S F
|
||||
bool FWRetract::autoretract_enabled; // M209 S - Autoretract switch
|
||||
#endif
|
||||
|
||||
bool FWRetract::retracted[EXTRUDERS]; // Which extruders are currently retracted
|
||||
Flags<EXTRUDERS> FWRetract::retracted; // Which extruders are currently retracted
|
||||
|
||||
float FWRetract::current_retract[EXTRUDERS], // Retract value used by planner
|
||||
FWRetract::current_hop;
|
||||
@ -73,9 +73,9 @@ void FWRetract::reset() {
|
||||
settings.swap_retract_recover_feedrate_mm_s = RETRACT_RECOVER_FEEDRATE_SWAP;
|
||||
current_hop = 0.0;
|
||||
|
||||
retracted.reset();
|
||||
EXTRUDER_LOOP() {
|
||||
retracted[e] = false;
|
||||
E_TERN_(retracted_swap[e] = false);
|
||||
E_TERN_(retracted_swap.clear(e));
|
||||
current_retract[e] = 0.0;
|
||||
}
|
||||
}
|
||||
@ -173,11 +173,11 @@ void FWRetract::retract(const bool retracting E_OPTARG(bool swapping/*=false*/))
|
||||
|
||||
TERN_(RETRACT_SYNC_MIXING, mixer.T(old_mixing_tool)); // Restore original mixing tool
|
||||
|
||||
retracted[active_extruder] = retracting; // Active extruder now retracted / recovered
|
||||
retracted.set(active_extruder, retracting); // Active extruder now retracted / recovered
|
||||
|
||||
// If swap retract/recover update the retracted_swap flag too
|
||||
#if HAS_MULTI_EXTRUDER
|
||||
if (swapping) retracted_swap[active_extruder] = retracting;
|
||||
if (swapping) retracted_swap.set(active_extruder, retracting);
|
||||
#endif
|
||||
|
||||
/* // debugging
|
||||
|
@ -43,7 +43,7 @@ typedef struct {
|
||||
class FWRetract {
|
||||
private:
|
||||
#if HAS_MULTI_EXTRUDER
|
||||
static bool retracted_swap[EXTRUDERS]; // Which extruders are swap-retracted
|
||||
static Flags<EXTRUDERS> retracted_swap; // Which extruders are swap-retracted
|
||||
#endif
|
||||
|
||||
public:
|
||||
@ -55,7 +55,7 @@ public:
|
||||
static constexpr bool autoretract_enabled = false;
|
||||
#endif
|
||||
|
||||
static bool retracted[EXTRUDERS]; // Which extruders are currently retracted
|
||||
static Flags<EXTRUDERS> retracted; // Which extruders are currently retracted
|
||||
static float current_retract[EXTRUDERS], // Retract value used by planner
|
||||
current_hop; // Hop value used by planner
|
||||
|
||||
@ -63,9 +63,7 @@ public:
|
||||
|
||||
static void reset();
|
||||
|
||||
static void refresh_autoretract() {
|
||||
EXTRUDER_LOOP() retracted[e] = false;
|
||||
}
|
||||
static void refresh_autoretract() { retracted.reset(); }
|
||||
|
||||
static void enable_autoretract(const bool enable) {
|
||||
#if ENABLED(FWRETRACT_AUTORETRACT)
|
||||
|
@ -519,7 +519,7 @@ void PrintJobRecovery::resume() {
|
||||
EXTRUDER_LOOP() {
|
||||
if (info.retract[e] != 0.0) {
|
||||
fwretract.current_retract[e] = info.retract[e];
|
||||
fwretract.retracted[e] = true;
|
||||
fwretract.retracted.set(e);
|
||||
}
|
||||
}
|
||||
fwretract.current_hop = info.retract_hop;
|
||||
|
Reference in New Issue
Block a user