Make LCD preheat vars an array to reduce code size
This commit is contained in:
@@ -5519,46 +5519,26 @@ inline void gcode_M140() {
|
||||
*/
|
||||
inline void gcode_M145() {
|
||||
int8_t material = code_seen('S') ? (int8_t)code_value_int() : 0;
|
||||
if (material < 0 || material > 1) {
|
||||
if (material < 0 || material >= COUNT(lcd_preheat_hotend_temp)) {
|
||||
SERIAL_ERROR_START;
|
||||
SERIAL_ERRORLNPGM(MSG_ERR_MATERIAL_INDEX);
|
||||
}
|
||||
else {
|
||||
int v;
|
||||
switch (material) {
|
||||
case 0:
|
||||
if (code_seen('H')) {
|
||||
v = code_value_int();
|
||||
preheatHotendTemp1 = constrain(v, EXTRUDE_MINTEMP, HEATER_0_MAXTEMP - 15);
|
||||
}
|
||||
if (code_seen('F')) {
|
||||
v = code_value_int();
|
||||
preheatFanSpeed1 = constrain(v, 0, 255);
|
||||
}
|
||||
#if TEMP_SENSOR_BED != 0
|
||||
if (code_seen('B')) {
|
||||
v = code_value_int();
|
||||
preheatBedTemp1 = constrain(v, BED_MINTEMP, BED_MAXTEMP - 15);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case 1:
|
||||
if (code_seen('H')) {
|
||||
v = code_value_int();
|
||||
preheatHotendTemp2 = constrain(v, EXTRUDE_MINTEMP, HEATER_0_MAXTEMP - 15);
|
||||
}
|
||||
if (code_seen('F')) {
|
||||
v = code_value_int();
|
||||
preheatFanSpeed2 = constrain(v, 0, 255);
|
||||
}
|
||||
#if TEMP_SENSOR_BED != 0
|
||||
if (code_seen('B')) {
|
||||
v = code_value_int();
|
||||
preheatBedTemp2 = constrain(v, BED_MINTEMP, BED_MAXTEMP - 15);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
if (code_seen('H')) {
|
||||
v = code_value_int();
|
||||
lcd_preheat_hotend_temp[material] = constrain(v, EXTRUDE_MINTEMP, HEATER_0_MAXTEMP - 15);
|
||||
}
|
||||
if (code_seen('F')) {
|
||||
v = code_value_int();
|
||||
lcd_preheat_fan_speed[material] = constrain(v, 0, 255);
|
||||
}
|
||||
#if TEMP_SENSOR_BED != 0
|
||||
if (code_seen('B')) {
|
||||
v = code_value_int();
|
||||
lcd_preheat_bed_temp[material] = constrain(v, BED_MINTEMP, BED_MAXTEMP - 15);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user