From 3b80690a71c0a97f75efb1721fc007ef5a018c1c Mon Sep 17 00:00:00 2001 From: InsanityAutomation <38436470+InsanityAutomation@users.noreply.github.com> Date: Sat, 27 Jun 2020 23:02:28 -0400 Subject: [PATCH] ExtUI additions (#18447) Co-authored-by: Scott Lahteine --- Marlin/Configuration.h | 4 ++++ Marlin/src/lcd/extui/ui_api.cpp | 3 +++ Marlin/src/lcd/extui/ui_api.h | 3 +++ Marlin/src/libs/buzzer.cpp | 3 ++- 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 7c8222f014..04e4461db3 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -2121,6 +2121,10 @@ // //#define EXTENSIBLE_UI +#if ENABLED(EXTENSIBLE_UI) + //#define EXTUI_LOCAL_BEEPER // Enables use of local Beeper pin with external display +#endif + //============================================================================= //=============================== Graphical TFTs ============================== //============================================================================= diff --git a/Marlin/src/lcd/extui/ui_api.cpp b/Marlin/src/lcd/extui/ui_api.cpp index 65518908cb..5e1f2cfacf 100644 --- a/Marlin/src/lcd/extui/ui_api.cpp +++ b/Marlin/src/lcd/extui/ui_api.cpp @@ -590,6 +590,8 @@ namespace ExtUI { #if HAS_FILAMENT_SENSOR bool getFilamentRunoutEnabled() { return runout.enabled; } void setFilamentRunoutEnabled(const bool value) { runout.enabled = value; } + bool getFilamentRunoutState() { return runout.filament_ran_out; } + void setFilamentRunoutState(const bool value) { runout.filament_ran_out = value; } #if HAS_FILAMENT_RUNOUT_DISTANCE float getFilamentRunoutDistance_mm() { return runout.runout_distance(); } @@ -884,6 +886,7 @@ namespace ExtUI { #endif void injectCommands_P(PGM_P const gcode) { queue.inject_P(gcode); } + void injectCommands(char * const gcode) { queue.inject(gcode); } bool commandsInQueue() { return (planner.movesplanned() || queue.has_commands_queued()); } diff --git a/Marlin/src/lcd/extui/ui_api.h b/Marlin/src/lcd/extui/ui_api.h index 0f9c6ff48e..103cf6c104 100644 --- a/Marlin/src/lcd/extui/ui_api.h +++ b/Marlin/src/lcd/extui/ui_api.h @@ -74,6 +74,7 @@ namespace ExtUI { bool canMove(const axis_t); bool canMove(const extruder_t); void injectCommands_P(PGM_P const); + void injectCommands(char * const); bool commandsInQueue(); bool isHeaterIdle(const heater_t); @@ -236,6 +237,8 @@ namespace ExtUI { #if HAS_FILAMENT_SENSOR bool getFilamentRunoutEnabled(); void setFilamentRunoutEnabled(const bool); + bool getFilamentRunoutState(); + void setFilamentRunoutState(const bool); #if HAS_FILAMENT_RUNOUT_DISTANCE float getFilamentRunoutDistance_mm(); diff --git a/Marlin/src/libs/buzzer.cpp b/Marlin/src/libs/buzzer.cpp index 3b0a239178..d684dce816 100644 --- a/Marlin/src/libs/buzzer.cpp +++ b/Marlin/src/libs/buzzer.cpp @@ -66,7 +66,8 @@ void Buzzer::tick() { CRITICAL_SECTION_START(); ExtUI::onPlayTone(state.tone.frequency, state.tone.duration); CRITICAL_SECTION_END(); - #elif ENABLED(SPEAKER) + #endif + #if ENABLED(SPEAKER) && (DISABLED(EXTENSIBLE_UI) || ENABLED(EXTUI_LOCAL_BEEPER)) CRITICAL_SECTION_START(); ::tone(BEEPER_PIN, state.tone.frequency, state.tone.duration); CRITICAL_SECTION_END();