From 782eabc2261b43c7667a7c4d7878d4816d84ecab Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 4 Oct 2020 14:46:55 -0500 Subject: [PATCH] Shared singlenozzle item --- Marlin/src/lcd/menu/menu_item.h | 10 ++++++++++ Marlin/src/lcd/menu/menu_temperature.cpp | 7 +------ Marlin/src/lcd/menu/menu_tune.cpp | 7 +------ 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Marlin/src/lcd/menu/menu_item.h b/Marlin/src/lcd/menu/menu_item.h index fe1477288f..bd3af0cec6 100644 --- a/Marlin/src/lcd/menu/menu_item.h +++ b/Marlin/src/lcd/menu/menu_item.h @@ -479,4 +479,14 @@ class MenuItem_bool : public MenuEditItemBase { #define SNFAN(N) (ENABLED(SINGLENOZZLE_STANDBY_FAN) && !HAS_FAN##N && EXTRUDERS > N) + #if SNFAN(1) || SNFAN(2) || SNFAN(3) || SNFAN(4) || SNFAN(5) || SNFAN(6) || SNFAN(7) + #define DEFINE_SINGLENOZZLE_ITEM() \ + auto singlenozzle_item = [&](const uint8_t f) { \ + editable.uint8 = singlenozzle_fan_speed[f]; \ + EDIT_ITEM_FAST_N(percent, f, MSG_STORED_FAN_N, &editable.uint8, 0, 255, on_fan_update); \ + } + #else + #define DEFINE_SINGLENOZZLE_ITEM() NOOP + #endif + #endif // HAS_FAN diff --git a/Marlin/src/lcd/menu/menu_temperature.cpp b/Marlin/src/lcd/menu/menu_temperature.cpp index 1c5493af05..0c70cd7e18 100644 --- a/Marlin/src/lcd/menu/menu_temperature.cpp +++ b/Marlin/src/lcd/menu/menu_temperature.cpp @@ -191,12 +191,7 @@ void menu_temperature() { // #if HAS_FAN - #if SNFAN(1) || SNFAN(2) || SNFAN(3) || SNFAN(4) || SNFAN(5) || SNFAN(6) || SNFAN(7) - auto singlenozzle_item = [&](const uint8_t f) { - editable.uint8 = singlenozzle_fan_speed[f]; - EDIT_ITEM_FAST_N(percent, f, MSG_STORED_FAN_N, &editable.uint8, 0, 255, on_fan_update); - }; - #endif + DEFINE_SINGLENOZZLE_ITEM(); #if HAS_FAN0 _FAN_EDIT_ITEMS(0,FIRST_FAN_SPEED); diff --git a/Marlin/src/lcd/menu/menu_tune.cpp b/Marlin/src/lcd/menu/menu_tune.cpp index 76dab7be8a..6bf5c3a15d 100644 --- a/Marlin/src/lcd/menu/menu_tune.cpp +++ b/Marlin/src/lcd/menu/menu_tune.cpp @@ -142,12 +142,7 @@ void menu_tune() { // #if HAS_FAN - #if SNFAN(1) || SNFAN(2) || SNFAN(3) || SNFAN(4) || SNFAN(5) || SNFAN(6) || SNFAN(7) - auto singlenozzle_item = [&](const uint8_t f) { - editable.uint8 = singlenozzle_fan_speed[f]; - EDIT_ITEM_FAST_N(percent, f, MSG_STORED_FAN_N, &editable.uint8, 0, 255, on_fan_update); - }; - #endif + DEFINE_SINGLENOZZLE_ITEM(); #if HAS_FAN0 _FAN_EDIT_ITEMS(0,FIRST_FAN_SPEED);