Encapsulate common display code in a singleton (#12395)
* Encapsulate common LCD code in a singleton * Depend more UBL code on UBL_DEVEL_DEBUGGING - Since most users don't need the debugging on at all times, this helps reduce the default build size for UBL by over 2K, a little closer to fitting on 128K boards.
This commit is contained in:
@ -62,11 +62,11 @@ void GcodeSuite::M0_M1() {
|
||||
#if HAS_LCD_MENU
|
||||
|
||||
if (has_message)
|
||||
lcd_setstatus(args, true);
|
||||
ui.setstatus(args, true);
|
||||
else {
|
||||
LCD_MESSAGEPGM(MSG_USERWAIT);
|
||||
#if ENABLED(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0
|
||||
dontExpireStatus();
|
||||
ui.reset_progress_bar_timeout();
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -94,7 +94,7 @@ void GcodeSuite::M0_M1() {
|
||||
#endif
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
lcd_reset_status();
|
||||
ui.reset_status();
|
||||
#endif
|
||||
|
||||
wait_for_user = false;
|
||||
|
@ -28,6 +28,6 @@
|
||||
*/
|
||||
void GcodeSuite::M117() {
|
||||
|
||||
lcd_setstatus(parser.string_arg);
|
||||
ui.setstatus(parser.string_arg);
|
||||
|
||||
}
|
||||
|
@ -37,7 +37,7 @@
|
||||
*/
|
||||
void GcodeSuite::M145() {
|
||||
const uint8_t material = (uint8_t)parser.intval('S');
|
||||
if (material >= COUNT(lcd_preheat_hotend_temp)) {
|
||||
if (material >= COUNT(ui.preheat_hotend_temp)) {
|
||||
SERIAL_ERROR_START();
|
||||
SERIAL_ERRORLNPGM(MSG_ERR_MATERIAL_INDEX);
|
||||
}
|
||||
@ -45,16 +45,16 @@ void GcodeSuite::M145() {
|
||||
int v;
|
||||
if (parser.seenval('H')) {
|
||||
v = parser.value_int();
|
||||
lcd_preheat_hotend_temp[material] = constrain(v, EXTRUDE_MINTEMP, HEATER_0_MAXTEMP - 15);
|
||||
ui.preheat_hotend_temp[material] = constrain(v, EXTRUDE_MINTEMP, HEATER_0_MAXTEMP - 15);
|
||||
}
|
||||
if (parser.seenval('F')) {
|
||||
v = parser.value_int();
|
||||
lcd_preheat_fan_speed[material] = (uint8_t)constrain(v, 0, 255);
|
||||
ui.preheat_fan_speed[material] = (uint8_t)constrain(v, 0, 255);
|
||||
}
|
||||
#if TEMP_SENSOR_BED != 0
|
||||
if (parser.seenval('B')) {
|
||||
v = parser.value_int();
|
||||
lcd_preheat_bed_temp[material] = constrain(v, BED_MINTEMP, BED_MAXTEMP - 15);
|
||||
ui.preheat_bed_temp[material] = constrain(v, BED_MINTEMP, BED_MAXTEMP - 15);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -31,10 +31,8 @@
|
||||
* M250: Read and optionally set the LCD contrast
|
||||
*/
|
||||
void GcodeSuite::M250() {
|
||||
if (parser.seen('C')) set_lcd_contrast(parser.value_int());
|
||||
SERIAL_PROTOCOLPGM("lcd contrast value: ");
|
||||
SERIAL_PROTOCOL(lcd_contrast);
|
||||
SERIAL_EOL();
|
||||
if (parser.seen('C')) ui.set_contrast(parser.value_int());
|
||||
SERIAL_PROTOCOLLNPAIR("LCD Contrast: ", ui.contrast);
|
||||
}
|
||||
|
||||
#endif // HAS_LCD_CONTRAST
|
||||
|
@ -38,10 +38,8 @@
|
||||
* This has no effect during an SD print job
|
||||
*/
|
||||
void GcodeSuite::M73() {
|
||||
if (!IS_SD_PRINTING() && parser.seen('P')) {
|
||||
progress_bar_percent = parser.value_byte();
|
||||
NOMORE(progress_bar_percent, 100);
|
||||
}
|
||||
if (parser.seen('P') && !IS_SD_PRINTING())
|
||||
ui.set_progress(parser.value_byte());
|
||||
}
|
||||
|
||||
#endif // ULTRA_LCD && LCD_SET_PROGRESS_MANUALLY
|
||||
|
Reference in New Issue
Block a user