From 8cb04816b53ef73733a81fb1ace4622ea2c75c70 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 25 Mar 2016 19:22:33 -0700 Subject: [PATCH] Apply PID_AUTOTUNE_MENU option to ultralcd.cpp --- Marlin/ultralcd.cpp | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 56f12a17b..c41d83c9d 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -1094,7 +1094,7 @@ static void lcd_control_menu() { * */ -#if ENABLED(PIDTEMP) || ENABLED(PIDTEMPBED) +#if ENABLED(PID_AUTOTUNE_MENU) #if ENABLED(PIDTEMP) int autotune_temp[EXTRUDERS] = { 150 }; @@ -1119,7 +1119,7 @@ static void lcd_control_menu() { enqueue_and_echo_command_now(cmd); } -#endif //PIDTEMP || PIDTEMPBED +#endif //PID_AUTOTUNE_MENU #if ENABLED(PIDTEMP) @@ -1133,10 +1133,17 @@ static void lcd_control_menu() { PID_PARAM(Kd, e) = scalePID_d(raw_Kd); updatePID(); } - #define _PIDTEMP_FUNCTIONS(eindex) \ + #define _PIDTEMP_BASE_FUNCTIONS(eindex) \ void copy_and_scalePID_i_E ## eindex() { copy_and_scalePID_i(eindex); } \ - void copy_and_scalePID_d_E ## eindex() { copy_and_scalePID_d(eindex); } \ - void lcd_autotune_callback_E ## eindex() { _lcd_autotune(eindex); } + void copy_and_scalePID_d_E ## eindex() { copy_and_scalePID_d(eindex); } + + #if ENABLED(PID_AUTOTUNE_MENU) + #define _PIDTEMP_FUNCTIONS(eindex) \ + _PIDTEMP_BASE_FUNCTIONS(eindex); \ + void lcd_autotune_callback_E ## eindex() { _lcd_autotune(eindex); } + #else + #define _PIDTEMP_FUNCTIONS(eindex) _PIDTEMP_BASE_FUNCTIONS(eindex); + #endif _PIDTEMP_FUNCTIONS(0); #if ENABLED(PID_PARAMS_PER_EXTRUDER) @@ -1254,9 +1261,13 @@ static void lcd_control_temperature_menu() { #define _PID_MENU_ITEMS(ELABEL, eindex) _PID_BASE_MENU_ITEMS(ELABEL, eindex) #endif - #define PID_MENU_ITEMS(ELABEL, eindex) \ - _PID_MENU_ITEMS(ELABEL, eindex); \ - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_PID_AUTOTUNE ELABEL, &autotune_temp[eindex], 150, heater_maxtemp[eindex] - 15, lcd_autotune_callback_E ## eindex) + #if ENABLED(PID_AUTOTUNE_MENU) + #define PID_MENU_ITEMS(ELABEL, eindex) \ + _PID_MENU_ITEMS(ELABEL, eindex); \ + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(int3, MSG_PID_AUTOTUNE ELABEL, &autotune_temp[eindex], 150, heater_maxtemp[eindex] - 15, lcd_autotune_callback_E ## eindex) + #else + #define PID_MENU_ITEMS(ELABEL, eindex) _PID_MENU_ITEMS(ELABEL, eindex) + #endif #if ENABLED(PID_PARAMS_PER_EXTRUDER) && EXTRUDERS > 1 PID_MENU_ITEMS(MSG_E1, 0);