Make LCD preheat vars an array to reduce code size

This commit is contained in:
Scott Lahteine
2016-10-27 02:40:37 -05:00
parent 1226ae1912
commit 1a2310c494
4 changed files with 70 additions and 119 deletions

View File

@@ -43,8 +43,7 @@
#include "duration_t.h"
#endif
int preheatHotendTemp1, preheatBedTemp1, preheatFanSpeed1,
preheatHotendTemp2, preheatBedTemp2, preheatFanSpeed2;
int lcd_preheat_hotend_temp[2], lcd_preheat_bed_temp[2], lcd_preheat_fan_speed[2];
#if ENABLED(FILAMENT_LCD_DISPLAY)
millis_t previous_lcd_status_ms = 0;
@@ -887,29 +886,29 @@ void kill_screen(const char* lcd_msg) {
}
#if TEMP_SENSOR_0 != 0
void lcd_preheat_pla0() { _lcd_preheat(0, preheatHotendTemp1, preheatBedTemp1, preheatFanSpeed1); }
void lcd_preheat_abs0() { _lcd_preheat(0, preheatHotendTemp2, preheatBedTemp2, preheatFanSpeed2); }
void lcd_preheat_pla0() { _lcd_preheat(0, lcd_preheat_hotend_temp[0], lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); }
void lcd_preheat_abs0() { _lcd_preheat(0, lcd_preheat_hotend_temp[1], lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); }
#endif
#if HOTENDS > 1
void lcd_preheat_pla1() { _lcd_preheat(1, preheatHotendTemp1, preheatBedTemp1, preheatFanSpeed1); }
void lcd_preheat_abs1() { _lcd_preheat(1, preheatHotendTemp2, preheatBedTemp2, preheatFanSpeed2); }
void lcd_preheat_pla1() { _lcd_preheat(1, lcd_preheat_hotend_temp[0], lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); }
void lcd_preheat_abs1() { _lcd_preheat(1, lcd_preheat_hotend_temp[1], lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); }
#if HOTENDS > 2
void lcd_preheat_pla2() { _lcd_preheat(2, preheatHotendTemp1, preheatBedTemp1, preheatFanSpeed1); }
void lcd_preheat_abs2() { _lcd_preheat(2, preheatHotendTemp2, preheatBedTemp2, preheatFanSpeed2); }
void lcd_preheat_pla2() { _lcd_preheat(2, lcd_preheat_hotend_temp[0], lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); }
void lcd_preheat_abs2() { _lcd_preheat(2, lcd_preheat_hotend_temp[1], lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); }
#if HOTENDS > 3
void lcd_preheat_pla3() { _lcd_preheat(3, preheatHotendTemp1, preheatBedTemp1, preheatFanSpeed1); }
void lcd_preheat_abs3() { _lcd_preheat(3, preheatHotendTemp2, preheatBedTemp2, preheatFanSpeed2); }
void lcd_preheat_pla3() { _lcd_preheat(3, lcd_preheat_hotend_temp[0], lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); }
void lcd_preheat_abs3() { _lcd_preheat(3, lcd_preheat_hotend_temp[1], lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); }
#endif
#endif
void lcd_preheat_pla0123() {
#if HOTENDS > 1
thermalManager.setTargetHotend(preheatHotendTemp1, 1);
thermalManager.setTargetHotend(lcd_preheat_hotend_temp[0], 1);
#if HOTENDS > 2
thermalManager.setTargetHotend(preheatHotendTemp1, 2);
thermalManager.setTargetHotend(lcd_preheat_hotend_temp[0], 2);
#if HOTENDS > 3
thermalManager.setTargetHotend(preheatHotendTemp1, 3);
thermalManager.setTargetHotend(lcd_preheat_hotend_temp[0], 3);
#endif
#endif
#endif
@@ -917,11 +916,11 @@ void kill_screen(const char* lcd_msg) {
}
void lcd_preheat_abs0123() {
#if HOTENDS > 1
thermalManager.setTargetHotend(preheatHotendTemp2, 1);
thermalManager.setTargetHotend(lcd_preheat_hotend_temp[1], 1);
#if HOTENDS > 2
thermalManager.setTargetHotend(preheatHotendTemp2, 2);
thermalManager.setTargetHotend(lcd_preheat_hotend_temp[1], 2);
#if HOTENDS > 3
thermalManager.setTargetHotend(preheatHotendTemp2, 3);
thermalManager.setTargetHotend(lcd_preheat_hotend_temp[1], 3);
#endif
#endif
#endif
@@ -931,8 +930,8 @@ void kill_screen(const char* lcd_msg) {
#endif // HOTENDS > 1
#if TEMP_SENSOR_BED != 0
void lcd_preheat_pla_bedonly() { _lcd_preheat(0, 0, preheatBedTemp1, preheatFanSpeed1); }
void lcd_preheat_abs_bedonly() { _lcd_preheat(0, 0, preheatBedTemp2, preheatFanSpeed2); }
void lcd_preheat_pla_bedonly() { _lcd_preheat(0, 0, lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); }
void lcd_preheat_abs_bedonly() { _lcd_preheat(0, 0, lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); }
#endif
#if TEMP_SENSOR_0 != 0 && (TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_3 != 0 || TEMP_SENSOR_BED != 0)
@@ -1766,20 +1765,15 @@ void kill_screen(const char* lcd_msg) {
END_MENU();
}
/**
*
* "Temperature" > "Preheat PLA conf" submenu
*
*/
static void lcd_control_temperature_preheat_pla_settings_menu() {
static void _lcd_control_temperature_preheat_settings_menu(uint8_t material) {
START_MENU();
MENU_BACK(MSG_TEMPERATURE);
MENU_ITEM_EDIT(int3, MSG_FAN_SPEED, &preheatFanSpeed1, 0, 255);
MENU_ITEM_EDIT(int3, MSG_FAN_SPEED, &lcd_preheat_fan_speed[material], 0, 255);
#if TEMP_SENSOR_0 != 0
MENU_ITEM_EDIT(int3, MSG_NOZZLE, &preheatHotendTemp1, HEATER_0_MINTEMP, HEATER_0_MAXTEMP - 15);
MENU_ITEM_EDIT(int3, MSG_NOZZLE, &lcd_preheat_hotend_temp[material], HEATER_0_MINTEMP, HEATER_0_MAXTEMP - 15);
#endif
#if TEMP_SENSOR_BED != 0
MENU_ITEM_EDIT(int3, MSG_BED, &preheatBedTemp1, BED_MINTEMP, BED_MAXTEMP - 15);
MENU_ITEM_EDIT(int3, MSG_BED, &lcd_preheat_bed_temp[material], BED_MINTEMP, BED_MAXTEMP - 15);
#endif
#if ENABLED(EEPROM_SETTINGS)
MENU_ITEM(function, MSG_STORE_EPROM, Config_StoreSettings);
@@ -1787,26 +1781,19 @@ void kill_screen(const char* lcd_msg) {
END_MENU();
}
/**
*
* "Temperature" > "Preheat PLA conf" submenu
*
*/
static void lcd_control_temperature_preheat_pla_settings_menu() { _lcd_control_temperature_preheat_settings_menu(0); }
/**
*
* "Temperature" > "Preheat ABS conf" submenu
*
*/
static void lcd_control_temperature_preheat_abs_settings_menu() {
START_MENU();
MENU_BACK(MSG_TEMPERATURE);
MENU_ITEM_EDIT(int3, MSG_FAN_SPEED, &preheatFanSpeed2, 0, 255);
#if TEMP_SENSOR_0 != 0
MENU_ITEM_EDIT(int3, MSG_NOZZLE, &preheatHotendTemp2, HEATER_0_MINTEMP, HEATER_0_MAXTEMP - 15);
#endif
#if TEMP_SENSOR_BED != 0
MENU_ITEM_EDIT(int3, MSG_BED, &preheatBedTemp2, BED_MINTEMP, BED_MAXTEMP - 15);
#endif
#if ENABLED(EEPROM_SETTINGS)
MENU_ITEM(function, MSG_STORE_EPROM, Config_StoreSettings);
#endif
END_MENU();
}
static void lcd_control_temperature_preheat_abs_settings_menu() { _lcd_control_temperature_preheat_settings_menu(1); }
static void _reset_acceleration_rates() { planner.reset_acceleration_rates(); }
static void _planner_refresh_positioning() { planner.refresh_positioning(); }