Add EXTUi Click function
This commit is contained in:
@@ -47,6 +47,7 @@
|
||||
|
||||
#include "../marlinui.h"
|
||||
#include "../../gcode/queue.h"
|
||||
#include "../../gcode/gcode.h"
|
||||
#include "../../module/motion.h"
|
||||
#include "../../module/planner.h"
|
||||
#include "../../module/probe.h"
|
||||
@@ -385,6 +386,8 @@ namespace ExtUI {
|
||||
return !thermalManager.tooColdToExtrude(extruder - E0);
|
||||
}
|
||||
|
||||
GcodeSuite::MarlinBusyState getMachineState() { return TERN0(HOST_KEEPALIVE_FEATURE, GcodeSuite::busy_state); }
|
||||
|
||||
#if HAS_SOFTWARE_ENDSTOPS
|
||||
bool getSoftEndstopState() { return soft_endstop._enabled; }
|
||||
void setSoftEndstopState(const bool value) { soft_endstop._enabled = value; }
|
||||
@@ -889,6 +892,12 @@ namespace ExtUI {
|
||||
|
||||
#endif // HAS_LEVELING
|
||||
|
||||
bool ui_cancel_operation;
|
||||
void ui_setUICancelOperation(const bool state) {
|
||||
ui_cancel_operation = state;
|
||||
}
|
||||
bool get_isUICanceled() { return ui_cancel_operation; }
|
||||
|
||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||
void setHostResponse(const uint8_t response) { host_response_handler(response); }
|
||||
#endif
|
||||
@@ -1018,6 +1027,10 @@ namespace ExtUI {
|
||||
|
||||
void setUserConfirmed() { TERN_(HAS_RESUME_CONTINUE, wait_for_user = false); }
|
||||
|
||||
bool isWaitingOnUser() {
|
||||
return TERN(HAS_RESUME_CONTINUE, wait_for_user, false);
|
||||
}
|
||||
|
||||
void printFile(const char *filename) {
|
||||
TERN(SDSUPPORT, card.openAndPrintFile(filename), UNUSED(filename));
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#include "../marlinui.h"
|
||||
#include "../../gcode/gcode.h"
|
||||
|
||||
namespace ExtUI {
|
||||
|
||||
@@ -78,6 +79,8 @@ namespace ExtUI {
|
||||
void injectCommands(char * const);
|
||||
bool commandsInQueue();
|
||||
|
||||
GcodeSuite::MarlinBusyState getMachineState();
|
||||
|
||||
bool isHeaterIdle(const heater_t);
|
||||
bool isHeaterIdle(const extruder_t);
|
||||
void enableHeater(const heater_t);
|
||||
@@ -125,6 +128,7 @@ namespace ExtUI {
|
||||
float getAxisMaxAcceleration_mm_s2(const extruder_t);
|
||||
feedRate_t getMinFeedrate_mm_s();
|
||||
feedRate_t getMinTravelFeedrate_mm_s();
|
||||
feedRate_t getFeedrate_mm_s();
|
||||
float getPrintingAcceleration_mm_s2();
|
||||
float getRetractAcceleration_mm_s2();
|
||||
float getTravelAcceleration_mm_s2();
|
||||
@@ -186,6 +190,9 @@ namespace ExtUI {
|
||||
void setHostResponse(const uint8_t);
|
||||
#endif
|
||||
|
||||
void ui_setUICancelOperation(const bool);
|
||||
bool get_isUICanceled();
|
||||
|
||||
#if ENABLED(PRINTCOUNTER)
|
||||
char* getFailedPrints_str(char buffer[21]);
|
||||
char* getTotalPrints_str(char buffer[21]);
|
||||
@@ -215,7 +222,7 @@ namespace ExtUI {
|
||||
void setTravelAcceleration_mm_s2(const_float_t );
|
||||
void setFeedrate_percent(const_float_t );
|
||||
void setFlow_percent(const int16_t, const extruder_t);
|
||||
bool awaitingUserConfirm();
|
||||
bool isWaitingOnUser();
|
||||
void setUserConfirmed();
|
||||
|
||||
#if ENABLED(LIN_ADVANCE)
|
||||
|
||||
@@ -1458,6 +1458,12 @@ void MarlinUI::update() {
|
||||
TERN_(DWIN_CREALITY_LCD, DWIN_StatusChanged(status_message));
|
||||
}
|
||||
|
||||
bool MarlinUI::use_click() {
|
||||
const bool click = ExtUI::get_isUICanceled();
|
||||
ExtUI::ui_setUICancelOperation(false);
|
||||
return click;
|
||||
}
|
||||
|
||||
#if ENABLED(STATUS_MESSAGE_SCROLLING)
|
||||
|
||||
void MarlinUI::advance_status_scroll() {
|
||||
|
||||
@@ -531,6 +531,9 @@ public:
|
||||
static constexpr bool on_status_screen() { return true; }
|
||||
FORCE_INLINE static void run_current_screen() { status_screen(); }
|
||||
|
||||
#elif ENABLED(EXTENSIBLE_UI)
|
||||
static bool lcd_clicked;
|
||||
static bool use_click();
|
||||
#endif
|
||||
|
||||
#if BOTH(HAS_LCD_MENU, ADVANCED_PAUSE_FEATURE)
|
||||
|
||||
@@ -3548,7 +3548,9 @@ void Temperature::isr() {
|
||||
#if G26_CLICK_CAN_CANCEL
|
||||
if (click_to_cancel && ui.use_click()) {
|
||||
wait_for_heatup = false;
|
||||
ui.quick_feedback();
|
||||
#if HAS_LCD_MENU
|
||||
ui.quick_feedback();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -3682,7 +3684,9 @@ void Temperature::isr() {
|
||||
#if G26_CLICK_CAN_CANCEL
|
||||
if (click_to_cancel && ui.use_click()) {
|
||||
wait_for_heatup = false;
|
||||
ui.quick_feedback();
|
||||
#if HAS_LCD_MENU
|
||||
ui.quick_feedback();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -3701,11 +3705,11 @@ void Temperature::isr() {
|
||||
return false;
|
||||
}
|
||||
|
||||
void Temperature::wait_for_bed_heating() {
|
||||
if (isHeatingBed()) {
|
||||
void Temperature::wait_for_bed_heating(const bool no_wait_for_cooling/*=true*/) {
|
||||
if (isHeatingBed() || !no_wait_for_cooling ) {
|
||||
SERIAL_ECHOLNPGM("Wait for bed heating...");
|
||||
LCD_MESSAGEPGM(MSG_BED_HEATING);
|
||||
wait_for_bed();
|
||||
wait_for_bed(no_wait_for_cooling);
|
||||
ui.reset_status();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ enum ADCSensorState : char {
|
||||
#define unscalePID_d(d) ( float(d) * PID_dT )
|
||||
#endif
|
||||
|
||||
#if BOTH(HAS_LCD_MENU, G26_MESH_VALIDATION)
|
||||
#if EITHER(HAS_LCD_MENU, EXTENSIBLE_UI) && ENABLED(G26_MESH_VALIDATION)
|
||||
#define G26_CLICK_CAN_CANCEL 1
|
||||
#endif
|
||||
|
||||
@@ -722,7 +722,7 @@ class Temperature {
|
||||
OPTARG(G26_CLICK_CAN_CANCEL, const bool click_to_cancel=false)
|
||||
);
|
||||
|
||||
static void wait_for_bed_heating();
|
||||
static void wait_for_bed_heating(const bool no_wait_for_cooling=true);
|
||||
|
||||
static inline bool degBedNear(const celsius_t temp) {
|
||||
return ABS(wholeDegBed() - temp) < (TEMP_BED_HYSTERESIS);
|
||||
|
||||
Reference in New Issue
Block a user