Apply PID_AUTOTUNE_MENU option to ultralcd.cpp

This commit is contained in:
Scott Lahteine 2016-03-25 19:22:33 -07:00
parent 4b31c67dce
commit 8cb04816b5

View File

@ -1094,7 +1094,7 @@ static void lcd_control_menu() {
* *
*/ */
#if ENABLED(PIDTEMP) || ENABLED(PIDTEMPBED) #if ENABLED(PID_AUTOTUNE_MENU)
#if ENABLED(PIDTEMP) #if ENABLED(PIDTEMP)
int autotune_temp[EXTRUDERS] = { 150 }; int autotune_temp[EXTRUDERS] = { 150 };
@ -1119,7 +1119,7 @@ static void lcd_control_menu() {
enqueue_and_echo_command_now(cmd); enqueue_and_echo_command_now(cmd);
} }
#endif //PIDTEMP || PIDTEMPBED #endif //PID_AUTOTUNE_MENU
#if ENABLED(PIDTEMP) #if ENABLED(PIDTEMP)
@ -1133,10 +1133,17 @@ static void lcd_control_menu() {
PID_PARAM(Kd, e) = scalePID_d(raw_Kd); PID_PARAM(Kd, e) = scalePID_d(raw_Kd);
updatePID(); 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_i_E ## eindex() { copy_and_scalePID_i(eindex); } \
void copy_and_scalePID_d_E ## eindex() { copy_and_scalePID_d(eindex); } \ void copy_and_scalePID_d_E ## eindex() { copy_and_scalePID_d(eindex); }
void lcd_autotune_callback_E ## eindex() { _lcd_autotune(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); _PIDTEMP_FUNCTIONS(0);
#if ENABLED(PID_PARAMS_PER_EXTRUDER) #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) #define _PID_MENU_ITEMS(ELABEL, eindex) _PID_BASE_MENU_ITEMS(ELABEL, eindex)
#endif #endif
#define PID_MENU_ITEMS(ELABEL, eindex) \ #if ENABLED(PID_AUTOTUNE_MENU)
_PID_MENU_ITEMS(ELABEL, eindex); \ #define 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) _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 #if ENABLED(PID_PARAMS_PER_EXTRUDER) && EXTRUDERS > 1
PID_MENU_ITEMS(MSG_E1, 0); PID_MENU_ITEMS(MSG_E1, 0);