Optional HOST_STATUS_NOTIFICATIONS (#22833)

This commit is contained in:
Taylor Talkington 2022-02-08 18:36:06 -05:00 committed by Scott Lahteine
parent 973366e6aa
commit b964d2fff0
9 changed files with 55 additions and 17 deletions

View File

@ -3952,8 +3952,11 @@
*/ */
//#define HOST_ACTION_COMMANDS //#define HOST_ACTION_COMMANDS
#if ENABLED(HOST_ACTION_COMMANDS) #if ENABLED(HOST_ACTION_COMMANDS)
//#define HOST_PAUSE_M76 //#define HOST_PAUSE_M76 // Tell the host to pause in response to M76
//#define HOST_PROMPT_SUPPORT //#define HOST_PROMPT_SUPPORT // Initiate host prompts to get user feedback
#if ENABLED(HOST_PROMPT_SUPPORT)
//#define HOST_STATUS_NOTIFICATIONS // Send some status messages to the host as notifications
#endif
//#define HOST_START_MENU_ITEM // Add a menu item that tells the host to start //#define HOST_START_MENU_ITEM // Add a menu item that tells the host to start
//#define HOST_SHUTDOWN_MENU_ITEM // Add a menu item that tells the host to shut down //#define HOST_SHUTDOWN_MENU_ITEM // Add a menu item that tells the host to shut down
#endif #endif

View File

@ -22,12 +22,20 @@
#include "../gcode.h" #include "../gcode.h"
#if ENABLED(HOST_ACTION_COMMANDS)
#include "../../feature/host_actions.h"
#endif
/** /**
* M111: Set the debug level * M111: Set the debug level
*/ */
void GcodeSuite::M111() { void GcodeSuite::M111() {
if (parser.seenval('S')) marlin_debug_flags = parser.value_byte(); if (parser.seenval('S')) marlin_debug_flags = parser.value_byte();
#if EITHER(HOST_ACTION_COMMANDS, HOST_PROMPT_SUPPORT)
if (parser.seenval('H')) hostui.flag.bits = parser.value_byte();
#endif
static PGMSTR(str_debug_1, STR_DEBUG_ECHO); static PGMSTR(str_debug_1, STR_DEBUG_ECHO);
static PGMSTR(str_debug_2, STR_DEBUG_INFO); static PGMSTR(str_debug_2, STR_DEBUG_INFO);
static PGMSTR(str_debug_4, STR_DEBUG_ERRORS); static PGMSTR(str_debug_4, STR_DEBUG_ERRORS);

View File

@ -609,12 +609,6 @@
#error "LCD_SCREEN_ROT_270 is now LCD_SCREEN_ROTATE with a value of 270." #error "LCD_SCREEN_ROT_270 is now LCD_SCREEN_ROTATE with a value of 270."
#endif #endif
#if MB(DUE3DOM_MINI) && PIN_EXISTS(TEMP_2) && DISABLED(TEMP_SENSOR_BOARD)
#warning "Onboard temperature sensor for BOARD_DUE3DOM_MINI has moved from TEMP_SENSOR_2 (TEMP_2_PIN) to TEMP_SENSOR_BOARD (TEMP_BOARD_PIN)."
#elif MB(BTT_SKR_E3_TURBO) && PIN_EXISTS(TEMP_2) && DISABLED(TEMP_SENSOR_BOARD)
#warning "Onboard temperature sensor for BOARD_BTT_SKR_E3_TURBO has moved from TEMP_SENSOR_2 (TEMP_2_PIN) to TEMP_SENSOR_BOARD (TEMP_BOARD_PIN)."
#endif
constexpr float arm[] = AXIS_RELATIVE_MODES; constexpr float arm[] = AXIS_RELATIVE_MODES;
static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _LOGICAL_AXES_STR "elements."); static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _LOGICAL_AXES_STR "elements.");

View File

@ -59,6 +59,12 @@
#warning "Your Configuration provides no method to acquire user feedback!" #warning "Your Configuration provides no method to acquire user feedback!"
#endif #endif
#if MB(DUE3DOM_MINI) && PIN_EXISTS(TEMP_2) && DISABLED(TEMP_SENSOR_BOARD)
#warning "Onboard temperature sensor for BOARD_DUE3DOM_MINI has moved from TEMP_SENSOR_2 (TEMP_2_PIN) to TEMP_SENSOR_BOARD (TEMP_BOARD_PIN)."
#elif MB(BTT_SKR_E3_TURBO) && PIN_EXISTS(TEMP_2) && DISABLED(TEMP_SENSOR_BOARD)
#warning "Onboard temperature sensor for BOARD_BTT_SKR_E3_TURBO has moved from TEMP_SENSOR_2 (TEMP_2_PIN) to TEMP_SENSOR_BOARD (TEMP_BOARD_PIN)."
#endif
#ifndef NO_AUTO_ASSIGN_WARNING #ifndef NO_AUTO_ASSIGN_WARNING
#if AUTO_ASSIGNED_X2_STEPPER #if AUTO_ASSIGNED_X2_STEPPER
@ -541,6 +547,10 @@
#warning "Creality 4.2.2 boards come with a variety of stepper drivers. Check the board label and set the correct *_DRIVER_TYPE! (C=HR4988, E=A4988, A=TMC2208, B=TMC2209, H=TMC2225)." #warning "Creality 4.2.2 boards come with a variety of stepper drivers. Check the board label and set the correct *_DRIVER_TYPE! (C=HR4988, E=A4988, A=TMC2208, B=TMC2209, H=TMC2225)."
#endif #endif
#if PRINTCOUNTER_SYNC
#warning "To prevent step loss, motion will pause for PRINTCOUNTER auto-save."
#endif
#if HOMING_Z_WITH_PROBE && IS_CARTESIAN && DISABLED(Z_SAFE_HOMING) #if HOMING_Z_WITH_PROBE && IS_CARTESIAN && DISABLED(Z_SAFE_HOMING)
#error "Z_SAFE_HOMING is recommended when homing with a probe. Enable Z_SAFE_HOMING or comment out this line to continue." #error "Z_SAFE_HOMING is recommended when homing with a probe. Enable Z_SAFE_HOMING or comment out this line to continue."
#endif #endif

View File

@ -1363,7 +1363,7 @@ void MarlinUI::init() {
void MarlinUI::set_status(const char * const cstr, const bool persist) { void MarlinUI::set_status(const char * const cstr, const bool persist) {
if (alert_level) return; if (alert_level) return;
TERN_(HOST_PROMPT_SUPPORT, hostui.notify(cstr)); TERN_(HOST_STATUS_NOTIFICATIONS, hostui.notify(cstr));
// Here we have a problem. The message is encoded in UTF8, so // Here we have a problem. The message is encoded in UTF8, so
// arbitrarily cutting it will be a problem. We MUST be sure // arbitrarily cutting it will be a problem. We MUST be sure
@ -1435,7 +1435,7 @@ void MarlinUI::init() {
if (level < alert_level) return; if (level < alert_level) return;
alert_level = level; alert_level = level;
TERN_(HOST_PROMPT_SUPPORT, hostui.notify(fstr)); TERN_(HOST_STATUS_NOTIFICATIONS, hostui.notify(fstr));
// Since the message is encoded in UTF8 it must // Since the message is encoded in UTF8 it must
// only be cut on a character boundary. // only be cut on a character boundary.
@ -1473,6 +1473,9 @@ void MarlinUI::init() {
va_start(args, FTOP(fmt)); va_start(args, FTOP(fmt));
vsnprintf_P(status_message, MAX_MESSAGE_LENGTH, FTOP(fmt), args); vsnprintf_P(status_message, MAX_MESSAGE_LENGTH, FTOP(fmt), args);
va_end(args); va_end(args);
TERN_(HOST_STATUS_NOTIFICATIONS, hostui.notify(status_message));
finish_status(level > 0); finish_status(level > 0);
} }

View File

@ -43,7 +43,6 @@ Stopwatch print_job_timer; // Global Print Job Timer instance
#if PRINTCOUNTER_SYNC #if PRINTCOUNTER_SYNC
#include "../module/planner.h" #include "../module/planner.h"
#warning "To prevent step loss, motion will pause for PRINTCOUNTER auto-save."
#endif #endif
// Service intervals // Service intervals

View File

@ -80,6 +80,10 @@
#include "../lcd/e3v2/jyersui/dwin.h" #include "../lcd/e3v2/jyersui/dwin.h"
#endif #endif
#if ENABLED(HOST_PROMPT_SUPPORT)
#include "../feature/host_actions.h"
#endif
#if HAS_SERVOS #if HAS_SERVOS
#include "servo.h" #include "servo.h"
#endif #endif
@ -652,6 +656,10 @@ void MarlinSettings::postprocess() {
#define DEBUG_OUT EITHER(EEPROM_CHITCHAT, DEBUG_LEVELING_FEATURE) #define DEBUG_OUT EITHER(EEPROM_CHITCHAT, DEBUG_LEVELING_FEATURE)
#include "../core/debug_out.h" #include "../core/debug_out.h"
#if BOTH(EEPROM_CHITCHAT, HOST_PROMPT_SUPPORT)
#define HOST_EEPROM_CHITCHAT 1
#endif
#if ENABLED(EEPROM_SETTINGS) #if ENABLED(EEPROM_SETTINGS)
#define EEPROM_ASSERT(TST,ERR) do{ if (!(TST)) { SERIAL_ERROR_MSG(ERR); eeprom_error = true; } }while(0) #define EEPROM_ASSERT(TST,ERR) do{ if (!(TST)) { SERIAL_ERROR_MSG(ERR); eeprom_error = true; } }while(0)
@ -1554,7 +1562,10 @@ void MarlinSettings::postprocess() {
store_mesh(ubl.storage_slot); store_mesh(ubl.storage_slot);
#endif #endif
if (!eeprom_error) LCD_MESSAGE(MSG_SETTINGS_STORED); if (!eeprom_error) {
LCD_MESSAGE(MSG_SETTINGS_STORED);
TERN_(HOST_PROMPT_SUPPORT, hostui.notify(GET_TEXT_F(MSG_SETTINGS_STORED)));
}
TERN_(EXTENSIBLE_UI, ExtUI::onConfigurationStoreWritten(!eeprom_error)); TERN_(EXTENSIBLE_UI, ExtUI::onConfigurationStoreWritten(!eeprom_error));
@ -1578,6 +1589,7 @@ void MarlinSettings::postprocess() {
} }
DEBUG_ECHO_MSG("EEPROM version mismatch (EEPROM=", stored_ver, " Marlin=" EEPROM_VERSION ")"); DEBUG_ECHO_MSG("EEPROM version mismatch (EEPROM=", stored_ver, " Marlin=" EEPROM_VERSION ")");
TERN_(DWIN_CREALITY_LCD_ENHANCED, LCD_MESSAGE(MSG_ERR_EEPROM_VERSION)); TERN_(DWIN_CREALITY_LCD_ENHANCED, LCD_MESSAGE(MSG_ERR_EEPROM_VERSION));
TERN_(HOST_PROMPT_SUPPORT, hostui.notify(GET_TEXT_F(MSG_ERR_EEPROM_VERSION)));
IF_DISABLED(EEPROM_AUTO_INIT, ui.eeprom_alert_version()); IF_DISABLED(EEPROM_AUTO_INIT, ui.eeprom_alert_version());
eeprom_error = true; eeprom_error = true;
@ -2468,12 +2480,14 @@ void MarlinSettings::postprocess() {
eeprom_error = true; eeprom_error = true;
DEBUG_ERROR_MSG("EEPROM CRC mismatch - (stored) ", stored_crc, " != ", working_crc, " (calculated)!"); DEBUG_ERROR_MSG("EEPROM CRC mismatch - (stored) ", stored_crc, " != ", working_crc, " (calculated)!");
TERN_(DWIN_CREALITY_LCD_ENHANCED, LCD_MESSAGE(MSG_ERR_EEPROM_CRC)); TERN_(DWIN_CREALITY_LCD_ENHANCED, LCD_MESSAGE(MSG_ERR_EEPROM_CRC));
TERN_(HOST_EEPROM_CHITCHAT, hostui.notify(GET_TEXT_F(MSG_ERR_EEPROM_CRC)));
IF_DISABLED(EEPROM_AUTO_INIT, ui.eeprom_alert_crc()); IF_DISABLED(EEPROM_AUTO_INIT, ui.eeprom_alert_crc());
} }
else if (!validating) { else if (!validating) {
DEBUG_ECHO_START(); DEBUG_ECHO_START();
DEBUG_ECHO(version); DEBUG_ECHO(version);
DEBUG_ECHOLNPGM(" stored settings retrieved (", eeprom_index - (EEPROM_OFFSET), " bytes; crc ", (uint32_t)working_crc, ")"); DEBUG_ECHOLNPGM(" stored settings retrieved (", eeprom_index - (EEPROM_OFFSET), " bytes; crc ", (uint32_t)working_crc, ")");
TERN_(HOST_EEPROM_CHITCHAT, hostui.notify(F("Stored settings retrieved")));
} }
if (!validating && !eeprom_error) postprocess(); if (!validating && !eeprom_error) postprocess();
@ -2783,7 +2797,6 @@ void MarlinSettings::reset() {
#endif #endif
#endif #endif
TERN_(EXTENSIBLE_UI, ExtUI::onFactoryReset());
TERN_(DWIN_CREALITY_LCD_ENHANCED, DWIN_SetDataDefaults()); TERN_(DWIN_CREALITY_LCD_ENHANCED, DWIN_SetDataDefaults());
TERN_(DWIN_CREALITY_LCD_JYERSUI, CrealityDWIN.Reset_Settings()); TERN_(DWIN_CREALITY_LCD_JYERSUI, CrealityDWIN.Reset_Settings());
@ -3142,7 +3155,11 @@ void MarlinSettings::reset() {
postprocess(); postprocess();
DEBUG_ECHO_MSG("Hardcoded Default Settings Loaded"); FSTR_P const hdsl = F("Hardcoded Default Settings Loaded");
TERN_(HOST_EEPROM_CHITCHAT, hostui.notify(hdsl));
DEBUG_ECHO_START(); DEBUG_ECHOLNF(hdsl);
TERN_(EXTENSIBLE_UI, ExtUI::onFactoryReset());
} }
#if DISABLED(DISABLE_M503) #if DISABLED(DISABLE_M503)

View File

@ -629,6 +629,7 @@ volatile bool Temperature::raw_temps_ready = false;
SERIAL_ECHOLNPGM(STR_PID_TEMP_TOO_HIGH); SERIAL_ECHOLNPGM(STR_PID_TEMP_TOO_HIGH);
TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_TEMP_TOO_HIGH)); TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_TEMP_TOO_HIGH));
TERN_(DWIN_CREALITY_LCD_ENHANCED, DWIN_PidTuning(PID_TEMP_TOO_HIGH)); TERN_(DWIN_CREALITY_LCD_ENHANCED, DWIN_PidTuning(PID_TEMP_TOO_HIGH));
TERN_(HOST_PROMPT_SUPPORT, hostui.notify(GET_TEXT_F(MSG_PID_TEMP_TOO_HIGH)));
return; return;
} }
@ -719,6 +720,7 @@ volatile bool Temperature::raw_temps_ready = false;
SERIAL_ECHOLNPGM(STR_PID_TEMP_TOO_HIGH); SERIAL_ECHOLNPGM(STR_PID_TEMP_TOO_HIGH);
TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_TEMP_TOO_HIGH)); TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_TEMP_TOO_HIGH));
TERN_(DWIN_CREALITY_LCD_ENHANCED, DWIN_PidTuning(PID_TEMP_TOO_HIGH)); TERN_(DWIN_CREALITY_LCD_ENHANCED, DWIN_PidTuning(PID_TEMP_TOO_HIGH));
TERN_(HOST_PROMPT_SUPPORT, hostui.notify(GET_TEXT_F(MSG_PID_TEMP_TOO_HIGH)));
break; break;
} }
@ -756,12 +758,14 @@ volatile bool Temperature::raw_temps_ready = false;
TERN_(DWIN_CREALITY_LCD, DWIN_Popup_Temperature(0)); TERN_(DWIN_CREALITY_LCD, DWIN_Popup_Temperature(0));
TERN_(DWIN_CREALITY_LCD_ENHANCED, DWIN_PidTuning(PID_TUNING_TIMEOUT)); TERN_(DWIN_CREALITY_LCD_ENHANCED, DWIN_PidTuning(PID_TUNING_TIMEOUT));
TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_TUNING_TIMEOUT)); TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_TUNING_TIMEOUT));
TERN_(HOST_PROMPT_SUPPORT, hostui.notify(GET_TEXT_F(MSG_PID_TIMEOUT)));
SERIAL_ECHOLNPGM(STR_PID_TIMEOUT); SERIAL_ECHOLNPGM(STR_PID_TIMEOUT);
break; break;
} }
if (cycles > ncycles && cycles > 2) { if (cycles > ncycles && cycles > 2) {
SERIAL_ECHOLNPGM(STR_PID_AUTOTUNE_FINISHED); SERIAL_ECHOLNPGM(STR_PID_AUTOTUNE_FINISHED);
TERN_(HOST_PROMPT_SUPPORT, hostui.notify(GET_TEXT_F(MSG_PID_AUTOTUNE_DONE)));
#if EITHER(PIDTEMPBED, PIDTEMPCHAMBER) #if EITHER(PIDTEMPBED, PIDTEMPCHAMBER)
FSTR_P const estring = GHV(F("chamber"), F("bed"), FPSTR(NUL_STR)); FSTR_P const estring = GHV(F("chamber"), F("bed"), FPSTR(NUL_STR));

View File

@ -115,7 +115,7 @@ opt_set MOTHERBOARD BOARD_RAMBO \
FAN_MIN_PWM 50 FAN_KICKSTART_TIME 100 \ FAN_MIN_PWM 50 FAN_KICKSTART_TIME 100 \
XY_FREQUENCY_LIMIT 15 XY_FREQUENCY_LIMIT 15
opt_enable COREYX USE_XMAX_PLUG MIXING_EXTRUDER GRADIENT_MIX \ opt_enable COREYX USE_XMAX_PLUG MIXING_EXTRUDER GRADIENT_MIX \
BABYSTEPPING BABYSTEP_DISPLAY_TOTAL FILAMENT_LCD_DISPLAY FILAMENT_WIDTH_SENSOR \ BABYSTEPPING BABYSTEP_DISPLAY_TOTAL FILAMENT_LCD_DISPLAY \
REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER MENU_ADDAUTOSTART SDSUPPORT SDCARD_SORT_ALPHA \ REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER MENU_ADDAUTOSTART SDSUPPORT SDCARD_SORT_ALPHA \
ENDSTOP_NOISE_THRESHOLD FAN_SOFT_PWM \ ENDSTOP_NOISE_THRESHOLD FAN_SOFT_PWM \
FIX_MOUNTED_PROBE PROBING_ESTEPPERS_OFF PROBE_OFFSET_WIZARD \ FIX_MOUNTED_PROBE PROBING_ESTEPPERS_OFF PROBE_OFFSET_WIZARD \