Browse Source

📺 ExtUI pause state response (#22164)

vanilla_fb_2.0.x
InsanityAutomation 4 years ago
committed by Scott Lahteine
parent
commit
be13220e32
  1. 1
      Marlin/src/gcode/gcode.h
  2. 2
      Marlin/src/inc/Conditionals_post.h
  3. 15
      Marlin/src/lcd/extui/ui_api.cpp
  4. 14
      Marlin/src/lcd/extui/ui_api.h
  5. 34
      Marlin/src/lcd/marlinui.cpp
  6. 4
      Marlin/src/lcd/marlinui.h

1
Marlin/src/gcode/gcode.h

@ -424,6 +424,7 @@ public:
static uint8_t host_keepalive_interval; static uint8_t host_keepalive_interval;
static void host_keepalive(); static void host_keepalive();
static inline bool host_keepalive_is_paused() { return busy_state >= PAUSED_FOR_USER; }
#define KEEPALIVE_STATE(N) REMEMBER(_KA_, gcode.busy_state, gcode.N) #define KEEPALIVE_STATE(N) REMEMBER(_KA_, gcode.busy_state, gcode.N)
#else #else

2
Marlin/src/inc/Conditionals_post.h

@ -3167,7 +3167,7 @@
* Advanced Pause - Filament Change * Advanced Pause - Filament Change
*/ */
#if ENABLED(ADVANCED_PAUSE_FEATURE) #if ENABLED(ADVANCED_PAUSE_FEATURE)
#if HAS_LCD_MENU || BOTH(EMERGENCY_PARSER, HOST_PROMPT_SUPPORT) #if EITHER(HAS_LCD_MENU, EXTENSIBLE_UI) || BOTH(EMERGENCY_PARSER, HOST_PROMPT_SUPPORT)
#define M600_PURGE_MORE_RESUMABLE 1 #define M600_PURGE_MORE_RESUMABLE 1
#endif #endif
#ifndef FILAMENT_CHANGE_SLOW_LOAD_LENGTH #ifndef FILAMENT_CHANGE_SLOW_LOAD_LENGTH

15
Marlin/src/lcd/extui/ui_api.cpp

@ -102,6 +102,10 @@
#include "../../feature/host_actions.h" #include "../../feature/host_actions.h"
#endif #endif
#if M600_PURGE_MORE_RESUMABLE
#include "../../feature/pause.h"
#endif
namespace ExtUI { namespace ExtUI {
static struct { static struct {
uint8_t printer_killed : 1; uint8_t printer_killed : 1;
@ -381,7 +385,8 @@ namespace ExtUI {
return !thermalManager.tooColdToExtrude(extruder - E0); return !thermalManager.tooColdToExtrude(extruder - E0);
} }
GcodeSuite::MarlinBusyState getMachineBusyState() { return TERN0(HOST_KEEPALIVE_FEATURE, GcodeSuite::busy_state); } GcodeSuite::MarlinBusyState getHostKeepaliveState() { return TERN0(HOST_KEEPALIVE_FEATURE, gcode.busy_state); }
bool getHostKeepaliveIsPaused() { return TERN0(HOST_KEEPALIVE_FEATURE, gcode.host_keepalive_is_paused()); }
#if HAS_SOFTWARE_ENDSTOPS #if HAS_SOFTWARE_ENDSTOPS
bool getSoftEndstopState() { return soft_endstop._enabled; } bool getSoftEndstopState() { return soft_endstop._enabled; }
@ -1025,9 +1030,15 @@ namespace ExtUI {
TERN_(HAS_FAN, thermalManager.zero_fan_speeds()); TERN_(HAS_FAN, thermalManager.zero_fan_speeds());
} }
bool awaitingUserConfirm() { return TERN0(HAS_RESUME_CONTINUE, wait_for_user); } bool awaitingUserConfirm() {
return TERN0(HAS_RESUME_CONTINUE, wait_for_user) || getHostKeepaliveIsPaused();
}
void setUserConfirmed() { TERN_(HAS_RESUME_CONTINUE, wait_for_user = false); } void setUserConfirmed() { TERN_(HAS_RESUME_CONTINUE, wait_for_user = false); }
#if M600_PURGE_MORE_RESUMABLE
void setPauseMenuResponse(PauseMenuResponse response) { pause_menu_response = response; }
#endif
void printFile(const char *filename) { void printFile(const char *filename) {
TERN(SDSUPPORT, card.openAndPrintFile(filename), UNUSED(filename)); TERN(SDSUPPORT, card.openAndPrintFile(filename), UNUSED(filename));
} }

14
Marlin/src/lcd/extui/ui_api.h

@ -45,6 +45,9 @@
#include "../../inc/MarlinConfig.h" #include "../../inc/MarlinConfig.h"
#include "../marlinui.h" #include "../marlinui.h"
#include "../../gcode/gcode.h" #include "../../gcode/gcode.h"
#if M600_PURGE_MORE_RESUMABLE
#include "../../feature/pause.h"
#endif
namespace ExtUI { namespace ExtUI {
@ -79,7 +82,8 @@ namespace ExtUI {
void injectCommands(char * const); void injectCommands(char * const);
bool commandsInQueue(); bool commandsInQueue();
GcodeSuite::MarlinBusyState getMachineBusyState(); GcodeSuite::MarlinBusyState getHostKeepaliveState();
bool getHostKeepaliveIsPaused();
bool isHeaterIdle(const heater_t); bool isHeaterIdle(const heater_t);
bool isHeaterIdle(const extruder_t); bool isHeaterIdle(const extruder_t);
@ -228,6 +232,10 @@ namespace ExtUI {
bool awaitingUserConfirm(); bool awaitingUserConfirm();
void setUserConfirmed(); void setUserConfirmed();
#if M600_PURGE_MORE_RESUMABLE
void setPauseMenuResponse(PauseMenuResponse);
#endif
#if ENABLED(LIN_ADVANCE) #if ENABLED(LIN_ADVANCE)
float getLinearAdvance_mm_mm_s(const extruder_t); float getLinearAdvance_mm_mm_s(const extruder_t);
void setLinearAdvance_mm_mm_s(const_float_t, const extruder_t); void setLinearAdvance_mm_mm_s(const_float_t, const extruder_t);
@ -309,7 +317,7 @@ namespace ExtUI {
float getPIDValues_Ki(const extruder_t); float getPIDValues_Ki(const extruder_t);
float getPIDValues_Kd(const extruder_t); float getPIDValues_Kd(const extruder_t);
void setPIDValues(const_float_t, const_float_t , const_float_t , extruder_t); void setPIDValues(const_float_t, const_float_t , const_float_t , extruder_t);
void startPIDTune(const_float_t, extruder_t); void startPIDTune(const celsius_t, extruder_t);
#endif #endif
#if ENABLED(PIDTEMPBED) #if ENABLED(PIDTEMPBED)
@ -317,7 +325,7 @@ namespace ExtUI {
float getBedPIDValues_Ki(); float getBedPIDValues_Ki();
float getBedPIDValues_Kd(); float getBedPIDValues_Kd();
void setBedPIDValues(const_float_t, const_float_t , const_float_t); void setBedPIDValues(const_float_t, const_float_t , const_float_t);
void startBedPIDTune(const_float_t ); void startBedPIDTune(const celsius_t);
#endif #endif
/** /**

34
Marlin/src/lcd/marlinui.cpp

@ -1654,6 +1654,40 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
} }
#endif #endif
#if BOTH(EXTENSIBLE_UI, ADVANCED_PAUSE_FEATURE)
void MarlinUI::pause_show_message(
const PauseMessage message,
const PauseMode mode/*=PAUSE_MODE_SAME*/,
const uint8_t extruder/*=active_extruder*/
) {
if (mode == PAUSE_MODE_SAME)
return;
pause_mode = mode;
switch (message) {
case PAUSE_MESSAGE_PARKING: ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_PAUSE_PRINT_PARKING));
case PAUSE_MESSAGE_CHANGING: ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_FILAMENT_CHANGE_INIT));
case PAUSE_MESSAGE_UNLOAD: ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_FILAMENT_CHANGE_UNLOAD));
case PAUSE_MESSAGE_WAITING: ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_ADVANCED_PAUSE_WAITING));
case PAUSE_MESSAGE_INSERT: ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_FILAMENT_CHANGE_INSERT));
case PAUSE_MESSAGE_LOAD: ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_FILAMENT_CHANGE_LOAD));
case PAUSE_MESSAGE_PURGE:
#if ENABLED(ADVANCED_PAUSE_CONTINUOUS_PURGE)
ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_FILAMENT_CHANGE_CONT_PURGE));
#else
ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_FILAMENT_CHANGE_PURGE));
#endif
case PAUSE_MESSAGE_RESUME: ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_FILAMENT_CHANGE_RESUME));
case PAUSE_MESSAGE_HEAT: ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_FILAMENT_CHANGE_HEAT));
case PAUSE_MESSAGE_HEATING: ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_FILAMENT_CHANGE_HEATING));
case PAUSE_MESSAGE_OPTION: ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_FILAMENT_CHANGE_OPTION_HEADER));
case PAUSE_MESSAGE_STATUS:
default: break;
}
}
#endif
#if ENABLED(EEPROM_SETTINGS) #if ENABLED(EEPROM_SETTINGS)
#if HAS_LCD_MENU #if HAS_LCD_MENU

4
Marlin/src/lcd/marlinui.h

@ -55,7 +55,7 @@
#include "../module/printcounter.h" #include "../module/printcounter.h"
#endif #endif
#if BOTH(HAS_LCD_MENU, ADVANCED_PAUSE_FEATURE) #if ENABLED(ADVANCED_PAUSE_FEATURE) && EITHER(HAS_LCD_MENU, EXTENSIBLE_UI)
#include "../feature/pause.h" #include "../feature/pause.h"
#include "../module/motion.h" // for active_extruder #include "../module/motion.h" // for active_extruder
#endif #endif
@ -544,7 +544,7 @@ public:
static inline bool use_click() { return false; } static inline bool use_click() { return false; }
#endif #endif
#if BOTH(HAS_LCD_MENU, ADVANCED_PAUSE_FEATURE) #if ENABLED(ADVANCED_PAUSE_FEATURE) && EITHER(HAS_LCD_MENU, EXTENSIBLE_UI)
static void pause_show_message(const PauseMessage message, const PauseMode mode=PAUSE_MODE_SAME, const uint8_t extruder=active_extruder); static void pause_show_message(const PauseMessage message, const PauseMode mode=PAUSE_MODE_SAME, const uint8_t extruder=active_extruder);
#else #else
static inline void _pause_show_message() {} static inline void _pause_show_message() {}

Loading…
Cancel
Save