mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2024-11-26 13:25:54 +00:00
✨ NUM_REDUNDANT_FANS (#25808)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
parent
40aa398285
commit
5859ff0280
@ -660,9 +660,12 @@
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Use one of the PWM fans as a redundant part-cooling fan
|
||||
* Assign more PWM fans for part cooling, synchronized with Fan 0
|
||||
*/
|
||||
//#define REDUNDANT_PART_COOLING_FAN 2 // Index of the fan to sync with FAN 0.
|
||||
//#define REDUNDANT_PART_COOLING_FAN 1 // Index of the first fan to synchronize with Fan 0
|
||||
#ifdef REDUNDANT_PART_COOLING_FAN
|
||||
//#define NUM_REDUNDANT_FANS 1 // Number of sequential fans to synchronize with Fan 0
|
||||
#endif
|
||||
|
||||
// @section extruder
|
||||
|
||||
|
@ -61,9 +61,7 @@
|
||||
void GcodeSuite::M106() {
|
||||
const uint8_t pfan = parser.byteval('P', _ALT_P);
|
||||
if (pfan >= _CNT_P) return;
|
||||
#if REDUNDANT_PART_COOLING_FAN
|
||||
if (pfan == REDUNDANT_PART_COOLING_FAN) return;
|
||||
#endif
|
||||
if (FAN_IS_REDUNDANT(pfan)) return;
|
||||
|
||||
#if ENABLED(EXTRA_FAN_SPEED)
|
||||
const uint16_t t = parser.intval('T');
|
||||
@ -102,9 +100,7 @@ void GcodeSuite::M106() {
|
||||
void GcodeSuite::M107() {
|
||||
const uint8_t pfan = parser.byteval('P', _ALT_P);
|
||||
if (pfan >= _CNT_P) return;
|
||||
#if REDUNDANT_PART_COOLING_FAN
|
||||
if (pfan == REDUNDANT_PART_COOLING_FAN) return;
|
||||
#endif
|
||||
if (FAN_IS_REDUNDANT(pfan)) return;
|
||||
|
||||
thermalManager.set_fan_speed(pfan, 0);
|
||||
|
||||
|
@ -1280,3 +1280,8 @@
|
||||
#define MULTISTEPPING_LIMIT 128
|
||||
#define MULTISTEPPING_LIMIT_WARNING 1
|
||||
#endif
|
||||
|
||||
// One redundant cooling fan by default
|
||||
#if defined(REDUNDANT_PART_COOLING_FAN) && !defined(NUM_REDUNDANT_FANS)
|
||||
#define NUM_REDUNDANT_FANS 1
|
||||
#endif
|
||||
|
@ -1843,8 +1843,10 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L
|
||||
#ifdef REDUNDANT_PART_COOLING_FAN
|
||||
#if FAN_COUNT < 2
|
||||
#error "REDUNDANT_PART_COOLING_FAN requires a board with at least two PWM fans."
|
||||
#else
|
||||
static_assert(WITHIN(REDUNDANT_PART_COOLING_FAN, 1, FAN_COUNT - 1), "REDUNDANT_PART_COOLING_FAN must be between 1 and " STRINGIFY(DECREMENT(FAN_COUNT)) ".");
|
||||
#elif !WITHIN(REDUNDANT_PART_COOLING_FAN, 1, FAN_COUNT - 1)
|
||||
static_assert(false, "REDUNDANT_PART_COOLING_FAN must be between 1 and " STRINGIFY(DECREMENT(FAN_COUNT)) ".");
|
||||
#elif !WITHIN(REDUNDANT_PART_COOLING_FAN + NUM_REDUNDANT_FANS - 1, 1, FAN_COUNT - 1)
|
||||
#error "Not enough fans available for NUM_REDUNDANT_FANS."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -580,10 +580,10 @@ class MenuItem_bool : public MenuEditItemBase {
|
||||
}while(0)
|
||||
|
||||
#if FAN_COUNT > 1
|
||||
#define FAN_EDIT_ITEMS(F) _FAN_EDIT_ITEMS(F,FAN_SPEED_N)
|
||||
#define FAN_EDIT_ITEMS(F) _FAN_EDIT_ITEMS(F, FAN_SPEED_N)
|
||||
#endif
|
||||
|
||||
#define SNFAN(N) (ENABLED(SINGLENOZZLE_STANDBY_FAN) && !HAS_FAN##N && EXTRUDERS > N)
|
||||
#define SNFAN(N) (ENABLED(SINGLENOZZLE_STANDBY_FAN) && !HAS_FAN##N && (N) < EXTRUDERS)
|
||||
|
||||
#if SNFAN(1) || SNFAN(2) || SNFAN(3) || SNFAN(4) || SNFAN(5) || SNFAN(6) || SNFAN(7)
|
||||
#define DEFINE_SINGLENOZZLE_ITEM() \
|
||||
|
@ -221,40 +221,40 @@ void menu_temperature() {
|
||||
|
||||
DEFINE_SINGLENOZZLE_ITEM();
|
||||
|
||||
#if HAS_FAN0
|
||||
_FAN_EDIT_ITEMS(0,FIRST_FAN_SPEED);
|
||||
#if FAN_IS_M106ABLE(0)
|
||||
_FAN_EDIT_ITEMS(0, FIRST_FAN_SPEED);
|
||||
#endif
|
||||
#if HAS_FAN1 && REDUNDANT_PART_COOLING_FAN != 1
|
||||
#if FAN_IS_M106ABLE(1)
|
||||
FAN_EDIT_ITEMS(1);
|
||||
#elif SNFAN(1)
|
||||
singlenozzle_item(1);
|
||||
#endif
|
||||
#if HAS_FAN2 && REDUNDANT_PART_COOLING_FAN != 2
|
||||
#if FAN_IS_M106ABLE(2)
|
||||
FAN_EDIT_ITEMS(2);
|
||||
#elif SNFAN(2)
|
||||
singlenozzle_item(2);
|
||||
#endif
|
||||
#if HAS_FAN3 && REDUNDANT_PART_COOLING_FAN != 3
|
||||
#if FAN_IS_M106ABLE(3)
|
||||
FAN_EDIT_ITEMS(3);
|
||||
#elif SNFAN(3)
|
||||
singlenozzle_item(3);
|
||||
#endif
|
||||
#if HAS_FAN4 && REDUNDANT_PART_COOLING_FAN != 4
|
||||
#if FAN_IS_M106ABLE(4)
|
||||
FAN_EDIT_ITEMS(4);
|
||||
#elif SNFAN(4)
|
||||
singlenozzle_item(4);
|
||||
#endif
|
||||
#if HAS_FAN5 && REDUNDANT_PART_COOLING_FAN != 5
|
||||
#if FAN_IS_M106ABLE(5)
|
||||
FAN_EDIT_ITEMS(5);
|
||||
#elif SNFAN(5)
|
||||
singlenozzle_item(5);
|
||||
#endif
|
||||
#if HAS_FAN6 && REDUNDANT_PART_COOLING_FAN != 6
|
||||
#if FAN_IS_M106ABLE(6)
|
||||
FAN_EDIT_ITEMS(6);
|
||||
#elif SNFAN(6)
|
||||
singlenozzle_item(6);
|
||||
#endif
|
||||
#if HAS_FAN7 && REDUNDANT_PART_COOLING_FAN != 7
|
||||
#if FAN_IS_M106ABLE(7)
|
||||
FAN_EDIT_ITEMS(7);
|
||||
#elif SNFAN(7)
|
||||
singlenozzle_item(7);
|
||||
|
@ -153,40 +153,40 @@ void menu_tune() {
|
||||
|
||||
DEFINE_SINGLENOZZLE_ITEM();
|
||||
|
||||
#if HAS_FAN0
|
||||
_FAN_EDIT_ITEMS(0,FIRST_FAN_SPEED);
|
||||
#if FAN_IS_M106ABLE(0)
|
||||
_FAN_EDIT_ITEMS(0, FIRST_FAN_SPEED);
|
||||
#endif
|
||||
#if HAS_FAN1 && REDUNDANT_PART_COOLING_FAN != 1
|
||||
#if FAN_IS_M106ABLE(1)
|
||||
FAN_EDIT_ITEMS(1);
|
||||
#elif SNFAN(1)
|
||||
singlenozzle_item(1);
|
||||
#endif
|
||||
#if HAS_FAN2 && REDUNDANT_PART_COOLING_FAN != 2
|
||||
#if FAN_IS_M106ABLE(2)
|
||||
FAN_EDIT_ITEMS(2);
|
||||
#elif SNFAN(2)
|
||||
singlenozzle_item(2);
|
||||
#endif
|
||||
#if HAS_FAN3 && REDUNDANT_PART_COOLING_FAN != 3
|
||||
#if FAN_IS_M106ABLE(3)
|
||||
FAN_EDIT_ITEMS(3);
|
||||
#elif SNFAN(3)
|
||||
singlenozzle_item(3);
|
||||
#endif
|
||||
#if HAS_FAN4 && REDUNDANT_PART_COOLING_FAN != 4
|
||||
#if FAN_IS_M106ABLE(4)
|
||||
FAN_EDIT_ITEMS(4);
|
||||
#elif SNFAN(4)
|
||||
singlenozzle_item(4);
|
||||
#endif
|
||||
#if HAS_FAN5 && REDUNDANT_PART_COOLING_FAN != 5
|
||||
#if FAN_IS_M106ABLE(5)
|
||||
FAN_EDIT_ITEMS(5);
|
||||
#elif SNFAN(5)
|
||||
singlenozzle_item(5);
|
||||
#endif
|
||||
#if HAS_FAN6 && REDUNDANT_PART_COOLING_FAN != 6
|
||||
#if FAN_IS_M106ABLE(6)
|
||||
FAN_EDIT_ITEMS(6);
|
||||
#elif SNFAN(6)
|
||||
singlenozzle_item(6);
|
||||
#endif
|
||||
#if HAS_FAN7 && REDUNDANT_PART_COOLING_FAN != 7
|
||||
#if FAN_IS_M106ABLE(7)
|
||||
FAN_EDIT_ITEMS(7);
|
||||
#elif SNFAN(7)
|
||||
singlenozzle_item(7);
|
||||
|
@ -467,8 +467,12 @@ PGMSTR(str_t_heating_failed, STR_T_HEATING_FAILED);
|
||||
if (fan >= FAN_COUNT) return;
|
||||
|
||||
fan_speed[fan] = speed;
|
||||
#if REDUNDANT_PART_COOLING_FAN
|
||||
if (fan == 0) fan_speed[REDUNDANT_PART_COOLING_FAN] = speed;
|
||||
|
||||
#if NUM_REDUNDANT_FANS
|
||||
if (fan == 0) {
|
||||
for (uint8_t f = REDUNDANT_PART_COOLING_FAN; f < REDUNDANT_PART_COOLING_FAN + NUM_REDUNDANT_FANS; ++f)
|
||||
thermalManager.set_fan_speed(f, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
TERN_(REPORT_FAN_CHANGE, report_fan_speed(fan));
|
||||
|
@ -44,6 +44,17 @@
|
||||
#define HOTEND_INDEX TERN(HAS_MULTI_HOTEND, e, 0)
|
||||
#define E_NAME TERN_(HAS_MULTI_HOTEND, e)
|
||||
|
||||
#if HAS_FAN
|
||||
#if NUM_REDUNDANT_FANS
|
||||
#define FAN_IS_REDUNDANT(Q) WITHIN(Q, REDUNDANT_PART_COOLING_FAN, REDUNDANT_PART_COOLING_FAN + NUM_REDUNDANT_FANS - 1)
|
||||
#else
|
||||
#define FAN_IS_REDUNDANT(Q) false
|
||||
#endif
|
||||
#define FAN_IS_M106ABLE(Q) (HAS_FAN##Q && !FAN_IS_REDUNDANT(Q))
|
||||
#else
|
||||
#define FAN_IS_M106ABLE(Q) false
|
||||
#endif
|
||||
|
||||
// Element identifiers. Positive values are hotends. Negative values are other heaters or coolers.
|
||||
typedef enum : int_fast8_t {
|
||||
H_REDUNDANT = HID_REDUNDANT,
|
||||
|
Loading…
Reference in New Issue
Block a user