1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-23 12:04:19 +00:00

Fix Fan Speed menu items (#18400)

This commit is contained in:
Jason Smith 2020-06-26 16:10:11 -07:00 committed by GitHub
parent 90135803a3
commit 5a96695ead
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -210,14 +210,18 @@ void menu_temperature() {
thermalManager.set_fan_speed(MenuItemBase::itemIndex, editable.uint8);
};
#if HAS_FAN1 || HAS_FAN2 || HAS_FAN3 || HAS_FAN4 || HAS_FAN5 || HAS_FAN6 || HAS_FAN7
auto fan_edit_items = [&](const uint8_t f) {
editable.uint8 = thermalManager.fan_speed[f];
EDIT_ITEM_FAST_N(percent, f, MSG_FAN_SPEED_N, &editable.uint8, 0, 255, on_fan_update);
#if ENABLED(EXTRA_FAN_SPEED)
EDIT_ITEM_FAST_N(percent, f, MSG_EXTRA_FAN_SPEED_N, &thermalManager.new_fan_speed[f], 3, 255);
#endif
};
#if ENABLED(EXTRA_FAN_SPEED)
#define EDIT_EXTRA_FAN_SPEED(V...) EDIT_ITEM_FAST_N(V)
#else
#define EDIT_EXTRA_FAN_SPEED(...)
#endif
#if FAN_COUNT > 1
#define FAN_EDIT_ITEMS(F) do{ \
editable.uint8 = thermalManager.fan_speed[F]; \
EDIT_ITEM_FAST_N(percent, F, MSG_FAN_SPEED_N, &editable.uint8, 0, 255, on_fan_update); \
EDIT_EXTRA_FAN_SPEED(percent, F, MSG_EXTRA_FAN_SPEED_N, &thermalManager.new_fan_speed[F], 3, 255); \
}while(0)
#endif
#define SNFAN(N) (ENABLED(SINGLENOZZLE_STANDBY_FAN) && !HAS_FAN##N && EXTRUDERS > N)
@ -236,37 +240,37 @@ void menu_temperature() {
#endif
#endif
#if HAS_FAN1
fan_edit_items(1);
FAN_EDIT_ITEMS(1);
#elif SNFAN(1)
singlenozzle_item(1);
#endif
#if HAS_FAN2
fan_edit_items(2);
FAN_EDIT_ITEMS(2);
#elif SNFAN(2)
singlenozzle_item(1);
#endif
#if HAS_FAN3
fan_edit_items(3);
FAN_EDIT_ITEMS(3);
#elif SNFAN(3)
singlenozzle_item(1);
#endif
#if HAS_FAN4
fan_edit_items(4);
FAN_EDIT_ITEMS(4);
#elif SNFAN(4)
singlenozzle_item(1);
#endif
#if HAS_FAN5
fan_edit_items(5);
FAN_EDIT_ITEMS(5);
#elif SNFAN(5)
singlenozzle_item(1);
#endif
#if HAS_FAN6
fan_edit_items(6);
FAN_EDIT_ITEMS(6);
#elif SNFAN(6)
singlenozzle_item(1);
#endif
#if HAS_FAN7
fan_edit_items(7);
FAN_EDIT_ITEMS(7);
#elif SNFAN(7)
singlenozzle_item(1);
#endif