From 66e22d9f5a9fe8c9a5076f67099be413c99cd9e8 Mon Sep 17 00:00:00 2001 From: InsanityAutomation <38436470+InsanityAutomation@users.noreply.github.com> Date: Fri, 7 Jun 2019 08:08:41 -0400 Subject: [PATCH] ExtUI Heated Chamber support (#14198) --- Marlin/src/lcd/extensible_ui/ui_api.cpp | 61 ++++++++++++++++--------- Marlin/src/lcd/extensible_ui/ui_api.h | 2 +- Marlin/src/lcd/ultralcd.cpp | 4 +- buildroot/share/tests/DUE-tests | 2 +- 4 files changed, 44 insertions(+), 25 deletions(-) diff --git a/Marlin/src/lcd/extensible_ui/ui_api.cpp b/Marlin/src/lcd/extensible_ui/ui_api.cpp index 0871036118..b34a4b8238 100644 --- a/Marlin/src/lcd/extensible_ui/ui_api.cpp +++ b/Marlin/src/lcd/extensible_ui/ui_api.cpp @@ -170,12 +170,17 @@ namespace ExtUI { void enableHeater(const heater_t heater) { #if HEATER_IDLE_HANDLER - #if HAS_HEATED_BED - if (heater == BED) - thermalManager.reset_bed_idle_timer(); - else - #endif - thermalManager.reset_heater_idle_timer(heater - H0); + switch (heater) { + #if HAS_HEATED_BED + case BED: + thermalManager.reset_bed_idle_timer(); + return; + #endif + #if HAS_HEATED_CHAMBER + case CHAMBER: return; // Chamber has no idle timer + #endif + default: thermalManager.reset_heater_idle_timer(heater - H0); + } #endif } @@ -188,23 +193,31 @@ namespace ExtUI { } bool isHeaterIdle(const heater_t heater) { - return (false - #if HEATER_IDLE_HANDLER - || (heater == BED ? (false - #if HAS_HEATED_BED - || thermalManager.bed_idle.timed_out - #endif - ) : thermalManager.hotend_idle[heater - H0].timed_out) - #endif - ); + #if HEATER_IDLE_HANDLER + switch (heater) { + #if HAS_HEATED_BED + case BED: return thermalManager.bed_idle.timed_out; + #endif + #if HAS_HEATED_CHAMBER + case CHAMBER: return false; // Chamber has no idle timer + #endif + default: return thermalManager.hotend_idle[heater - H0].timed_out; + } + #else + return false; + #endif } float getActualTemp_celsius(const heater_t heater) { - return heater == BED ? (0 + switch (heater) { #if HAS_HEATED_BED - + thermalManager.degBed() + case BED: return thermalManager.degBed(); + #endif + #if HAS_HEATED_CHAMBER + case CHAMBER: return thermalManager.degChamber(); #endif - ) : thermalManager.degHotend(heater - H0); + default: return thermalManager.degHotend(heater - H0); + } } float getActualTemp_celsius(const extruder_t extruder) { @@ -212,11 +225,15 @@ namespace ExtUI { } float getTargetTemp_celsius(const heater_t heater) { - return heater == BED ? (0 + switch (heater) { #if HAS_HEATED_BED - + thermalManager.degTargetBed() + case BED: return thermalManager.degTargetBed(); #endif - ) : thermalManager.degTargetHotend(heater - H0); + #if HAS_HEATED_CHAMBER + case CHAMBER: return thermalManager.degTargetChamber(); + #endif + default: return thermalManager.degTargetHotend(heater - H0); + } } float getTargetTemp_celsius(const extruder_t extruder) { @@ -839,7 +856,7 @@ namespace ExtUI { } void stopPrint() { - ui.stop_print(); + ui.abort_print(); } FileList::FileList() { refresh(); } diff --git a/Marlin/src/lcd/extensible_ui/ui_api.h b/Marlin/src/lcd/extensible_ui/ui_api.h index cce012f38f..689300b8ea 100644 --- a/Marlin/src/lcd/extensible_ui/ui_api.h +++ b/Marlin/src/lcd/extensible_ui/ui_api.h @@ -54,7 +54,7 @@ namespace ExtUI { enum axis_t : uint8_t { X, Y, Z }; enum extruder_t : uint8_t { E0, E1, E2, E3, E4, E5 }; - enum heater_t : uint8_t { H0, H1, H2, H3, H4, H5, BED }; + enum heater_t : uint8_t { H0, H1, H2, H3, H4, H5, BED, CHAMBER }; enum fan_t : uint8_t { FAN0, FAN1, FAN2, FAN3, FAN4, FAN5 }; constexpr uint8_t extruderCount = EXTRUDERS; diff --git a/Marlin/src/lcd/ultralcd.cpp b/Marlin/src/lcd/ultralcd.cpp index f0ebcefbb3..9cdcfbace6 100644 --- a/Marlin/src/lcd/ultralcd.cpp +++ b/Marlin/src/lcd/ultralcd.cpp @@ -1380,7 +1380,9 @@ void MarlinUI::update() { } void MarlinUI::pause_print() { - synchronize(PSTR(MSG_PAUSE_PRINT)); + #if HAS_LCD_MENU + synchronize(PSTR(MSG_PAUSE_PRINT)); + #endif #if ENABLED(POWER_LOSS_RECOVERY) if (recovery.enabled) recovery.save(true, false); diff --git a/buildroot/share/tests/DUE-tests b/buildroot/share/tests/DUE-tests index d13d9cc751..f793237cfb 100755 --- a/buildroot/share/tests/DUE-tests +++ b/buildroot/share/tests/DUE-tests @@ -7,7 +7,7 @@ set -e restore_configs -opt_set MOTHERBOARD BOARD_RAMPS4DUE_EFB +opt_set MOTHERBOARD BOARD_RAMPS4DUE_EFB EXTENSIBLE_UI EXTUI_EXAMPLE opt_enable S_CURVE_ACCELERATION EEPROM_SETTINGS GCODE_MACROS opt_set E0_AUTO_FAN_PIN 8 opt_set EXTRUDER_AUTO_FAN_SPEED 100