Merge pull request #5315 from thinkyhead/rc_fixup_material_menus

Refine material heatup menu items
This commit is contained in:
Scott Lahteine 2016-11-28 01:46:51 -06:00 committed by GitHub
commit 32ee3acf86
2 changed files with 64 additions and 48 deletions

View file

@ -126,8 +126,10 @@
#define CEILING(x,y) (((x) + (y) - 1) / (y))
#define MIN3(a, b, c) min(min(a, b), c)
#define MIN4(a, b, c, d) min(min(a, b), min(c, d))
#define MAX3(a, b, c) max(max(a, b), c)
#define MAX4(a, b, c, d) max(max(max(a, b), c), d)
#define MAX4(a, b, c, d) max(max(a, b), max(c, d))
#define UNEAR_ZERO(x) ((x) < 0.000001)
#define NEAR_ZERO(x) ((x) > -0.000001 && (x) < 0.000001)

View file

@ -118,8 +118,8 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to
void lcd_move_menu();
void lcd_control_menu();
void lcd_control_temperature_menu();
void lcd_control_temperature_preheat_pla_settings_menu();
void lcd_control_temperature_preheat_abs_settings_menu();
void lcd_control_temperature_preheat_material1_settings_menu();
void lcd_control_temperature_preheat_material2_settings_menu();
void lcd_control_motion_menu();
void lcd_control_volumetric_menu();
@ -898,13 +898,15 @@ void kill_screen(const char* lcd_msg) {
}
#endif
constexpr int heater_maxtemp[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP);
/**
*
* "Prepare" submenu items
*
*/
void _lcd_preheat(int endnum, const float temph, const float tempb, const int fan) {
if (temph > 0) thermalManager.setTargetHotend(temph, endnum);
if (temph > 0) thermalManager.setTargetHotend(min(heater_maxtemp[endnum], temph), endnum);
#if TEMP_SENSOR_BED != 0
thermalManager.setTargetBed(tempb);
#else
@ -923,23 +925,23 @@ void kill_screen(const char* lcd_msg) {
}
#if TEMP_SENSOR_0 != 0
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]); }
void lcd_preheat_material1_hotend0() { _lcd_preheat(0, lcd_preheat_hotend_temp[0], lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); }
void lcd_preheat_material2_hotend0() { _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, 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]); }
void lcd_preheat_material1_hotend1() { _lcd_preheat(1, lcd_preheat_hotend_temp[0], lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); }
void lcd_preheat_material2_hotend1() { _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, 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]); }
void lcd_preheat_material1_hotend2() { _lcd_preheat(2, lcd_preheat_hotend_temp[0], lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); }
void lcd_preheat_material2_hotend2() { _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, 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]); }
void lcd_preheat_material1_hotend3() { _lcd_preheat(3, lcd_preheat_hotend_temp[0], lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); }
void lcd_preheat_material2_hotend3() { _lcd_preheat(3, lcd_preheat_hotend_temp[1], lcd_preheat_bed_temp[1], lcd_preheat_fan_speed[1]); }
#endif
#endif
void lcd_preheat_pla0123() {
void lcd_preheat_material1_hotend0123() {
#if HOTENDS > 1
thermalManager.setTargetHotend(lcd_preheat_hotend_temp[0], 1);
#if HOTENDS > 2
@ -949,9 +951,9 @@ void kill_screen(const char* lcd_msg) {
#endif
#endif
#endif
lcd_preheat_pla0();
lcd_preheat_material1_hotend0();
}
void lcd_preheat_abs0123() {
void lcd_preheat_material2_hotend0123() {
#if HOTENDS > 1
thermalManager.setTargetHotend(lcd_preheat_hotend_temp[1], 1);
#if HOTENDS > 2
@ -961,58 +963,58 @@ void kill_screen(const char* lcd_msg) {
#endif
#endif
#endif
lcd_preheat_abs0();
lcd_preheat_material2_hotend0();
}
#endif // HOTENDS > 1
#if TEMP_SENSOR_BED != 0
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]); }
void lcd_preheat_material1_bedonly() { _lcd_preheat(0, 0, lcd_preheat_bed_temp[0], lcd_preheat_fan_speed[0]); }
void lcd_preheat_material2_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)
void lcd_preheat_pla_menu() {
void lcd_preheat_material1_menu() {
START_MENU();
MENU_BACK(MSG_PREPARE);
#if HOTENDS == 1
MENU_ITEM(function, MSG_PREHEAT_1, lcd_preheat_pla0);
MENU_ITEM(function, MSG_PREHEAT_1, lcd_preheat_material1_hotend0);
#else
MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H1, lcd_preheat_pla0);
MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H2, lcd_preheat_pla1);
MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H1, lcd_preheat_material1_hotend0);
MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H2, lcd_preheat_material1_hotend1);
#if HOTENDS > 2
MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H3, lcd_preheat_pla2);
MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H3, lcd_preheat_material1_hotend2);
#if HOTENDS > 3
MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H4, lcd_preheat_pla3);
MENU_ITEM(function, MSG_PREHEAT_1_N MSG_H4, lcd_preheat_material1_hotend3);
#endif
#endif
MENU_ITEM(function, MSG_PREHEAT_1_ALL, lcd_preheat_pla0123);
MENU_ITEM(function, MSG_PREHEAT_1_ALL, lcd_preheat_material1_hotend0123);
#endif
#if TEMP_SENSOR_BED != 0
MENU_ITEM(function, MSG_PREHEAT_1_BEDONLY, lcd_preheat_pla_bedonly);
MENU_ITEM(function, MSG_PREHEAT_1_BEDONLY, lcd_preheat_material1_bedonly);
#endif
END_MENU();
}
void lcd_preheat_abs_menu() {
void lcd_preheat_material2_menu() {
START_MENU();
MENU_BACK(MSG_PREPARE);
#if HOTENDS == 1
MENU_ITEM(function, MSG_PREHEAT_2, lcd_preheat_abs0);
MENU_ITEM(function, MSG_PREHEAT_2, lcd_preheat_material2_hotend0);
#else
MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H1, lcd_preheat_abs0);
MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H2, lcd_preheat_abs1);
MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H1, lcd_preheat_material2_hotend0);
MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H2, lcd_preheat_material2_hotend1);
#if HOTENDS > 2
MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H3, lcd_preheat_abs2);
MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H3, lcd_preheat_material2_hotend2);
#if HOTENDS > 3
MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H4, lcd_preheat_abs3);
MENU_ITEM(function, MSG_PREHEAT_2_N MSG_H4, lcd_preheat_material2_hotend3);
#endif
#endif
MENU_ITEM(function, MSG_PREHEAT_2_ALL, lcd_preheat_abs0123);
MENU_ITEM(function, MSG_PREHEAT_2_ALL, lcd_preheat_material2_hotend0123);
#endif
#if TEMP_SENSOR_BED != 0
MENU_ITEM(function, MSG_PREHEAT_2_BEDONLY, lcd_preheat_abs_bedonly);
MENU_ITEM(function, MSG_PREHEAT_2_BEDONLY, lcd_preheat_material2_bedonly);
#endif
END_MENU();
}
@ -1288,11 +1290,11 @@ void kill_screen(const char* lcd_msg) {
//
#if TEMP_SENSOR_0 != 0
#if TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_3 != 0 || TEMP_SENSOR_BED != 0
MENU_ITEM(submenu, MSG_PREHEAT_1, lcd_preheat_pla_menu);
MENU_ITEM(submenu, MSG_PREHEAT_2, lcd_preheat_abs_menu);
MENU_ITEM(submenu, MSG_PREHEAT_1, lcd_preheat_material1_menu);
MENU_ITEM(submenu, MSG_PREHEAT_2, lcd_preheat_material2_menu);
#else
MENU_ITEM(function, MSG_PREHEAT_1, lcd_preheat_pla0);
MENU_ITEM(function, MSG_PREHEAT_2, lcd_preheat_abs0);
MENU_ITEM(function, MSG_PREHEAT_1, lcd_preheat_material1_hotend0);
MENU_ITEM(function, MSG_PREHEAT_2, lcd_preheat_material2_hotend0);
#endif
#endif
@ -1598,7 +1600,6 @@ void kill_screen(const char* lcd_msg) {
#if ENABLED(PIDTEMP)
int autotune_temp[HOTENDS] = ARRAY_BY_HOTENDS1(150);
const int heater_maxtemp[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP);
#endif
#if ENABLED(PIDTEMPBED)
@ -1791,23 +1792,36 @@ void kill_screen(const char* lcd_msg) {
#endif //PIDTEMP
//
// Preheat PLA conf
// Preheat Material 1 conf
//
MENU_ITEM(submenu, MSG_PREHEAT_1_SETTINGS, lcd_control_temperature_preheat_pla_settings_menu);
MENU_ITEM(submenu, MSG_PREHEAT_1_SETTINGS, lcd_control_temperature_preheat_material1_settings_menu);
//
// Preheat ABS conf
// Preheat Material 2 conf
//
MENU_ITEM(submenu, MSG_PREHEAT_2_SETTINGS, lcd_control_temperature_preheat_abs_settings_menu);
MENU_ITEM(submenu, MSG_PREHEAT_2_SETTINGS, lcd_control_temperature_preheat_material2_settings_menu);
END_MENU();
}
void _lcd_control_temperature_preheat_settings_menu(uint8_t material) {
#if HOTENDS > 3
#define MINTEMP_ALL MIN4(HEATER_0_MINTEMP, HEATER_1_MINTEMP, HEATER_2_MINTEMP, HEATER_3_MINTEMP)
#define MAXTEMP_ALL MAX4(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP, HEATER_3_MAXTEMP)
#elif HOTENDS > 2
#define MINTEMP_ALL MIN3(HEATER_0_MINTEMP, HEATER_1_MINTEMP, HEATER_2_MINTEMP)
#define MAXTEMP_ALL MAX3(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP, HEATER_2_MAXTEMP)
#elif HOTENDS > 1
#define MINTEMP_ALL min(HEATER_0_MINTEMP, HEATER_1_MINTEMP)
#define MAXTEMP_ALL max(HEATER_0_MAXTEMP, HEATER_1_MAXTEMP)
#else
#define MINTEMP_ALL HEATER_0_MINTEMP
#define MAXTEMP_ALL HEATER_0_MAXTEMP
#endif
START_MENU();
MENU_BACK(MSG_TEMPERATURE);
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, &lcd_preheat_hotend_temp[material], HEATER_0_MINTEMP, HEATER_0_MAXTEMP - 15);
MENU_ITEM_EDIT(int3, MSG_NOZZLE, &lcd_preheat_hotend_temp[material], MINTEMP_ALL, MAXTEMP_ALL - 15);
#endif
#if TEMP_SENSOR_BED != 0
MENU_ITEM_EDIT(int3, MSG_BED, &lcd_preheat_bed_temp[material], BED_MINTEMP, BED_MAXTEMP - 15);
@ -1820,17 +1834,17 @@ void kill_screen(const char* lcd_msg) {
/**
*
* "Temperature" > "Preheat PLA conf" submenu
* "Temperature" > "Preheat Material 1 conf" submenu
*
*/
void lcd_control_temperature_preheat_pla_settings_menu() { _lcd_control_temperature_preheat_settings_menu(0); }
void lcd_control_temperature_preheat_material1_settings_menu() { _lcd_control_temperature_preheat_settings_menu(0); }
/**
*
* "Temperature" > "Preheat ABS conf" submenu
* "Temperature" > "Preheat Material 2 conf" submenu
*
*/
void lcd_control_temperature_preheat_abs_settings_menu() { _lcd_control_temperature_preheat_settings_menu(1); }
void lcd_control_temperature_preheat_material2_settings_menu() { _lcd_control_temperature_preheat_settings_menu(1); }
void _reset_acceleration_rates() { planner.reset_acceleration_rates(); }
void _planner_refresh_positioning() { planner.refresh_positioning(); }