diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 6e44f009edad..a68778c170ea 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -3837,6 +3837,9 @@ #if ENABLED(HOST_ACTION_COMMANDS) //#define HOST_PAUSE_M76 //#define HOST_PROMPT_SUPPORT + #if ENABLED(HOST_PROMPT_SUPPORT) + //#define HOST_STATUS_NOTIFICATIONS + #endif //#define HOST_START_MENU_ITEM // Add a menu item that tells the host to start #endif diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index 2a6a3208894f..a2065f596e08 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -1348,7 +1348,7 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP; void MarlinUI::set_status(const char * const message, const bool persist) { if (alert_level) return; - TERN_(HOST_PROMPT_SUPPORT, host_action_notify(message)); + TERN_(HOST_STATUS_NOTIFICATIONS, host_action_notify(message)); // Here we have a problem. The message is encoded in UTF8, so // arbitrarily cutting it will be a problem. We MUST be sure @@ -1419,7 +1419,7 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP; if (level < alert_level) return; alert_level = level; - TERN_(HOST_PROMPT_SUPPORT, host_action_notify_P(message)); + TERN_(HOST_STATUS_NOTIFICATIONS, host_action_notify_P(message)); // Since the message is encoded in UTF8 it must // only be cut on a character boundary. @@ -1457,6 +1457,9 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP; va_start(args, fmt); vsnprintf_P(status_message, MAX_MESSAGE_LENGTH, fmt, args); va_end(args); + + TERN_(HOST_STATUS_NOTIFICATIONS, host_action_notify(status_message)); + finish_status(level > 0); } diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index d8d9f2027689..37025dc835ce 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -77,6 +77,10 @@ #include "../lcd/e3v2/jyersui/dwin.h" #endif +#if ENABLED(HOST_PROMPT_SUPPORT) + #include "../feature/host_actions.h" +#endif + #if HAS_SERVOS #include "servo.h" #endif @@ -1471,7 +1475,10 @@ void MarlinSettings::postprocess() { store_mesh(ubl.storage_slot); #endif - if (!eeprom_error) LCD_MESSAGEPGM(MSG_SETTINGS_STORED); + if (!eeprom_error) { + LCD_MESSAGEPGM(MSG_SETTINGS_STORED); + TERN_(HOST_PROMPT_SUPPORT, host_action_notify_P(GET_TEXT(MSG_SETTINGS_STORED))); + } TERN_(EXTENSIBLE_UI, ExtUI::onConfigurationStoreWritten(!eeprom_error)); @@ -1498,6 +1505,7 @@ void MarlinSettings::postprocess() { } DEBUG_ECHO_MSG("EEPROM version mismatch (EEPROM=", stored_ver, " Marlin=" EEPROM_VERSION ")"); TERN_(DWIN_CREALITY_LCD_ENHANCED, ui.set_status(GET_TEXT(MSG_ERR_EEPROM_VERSION))); + TERN_(HOST_PROMPT_SUPPORT, host_action_notify_P(GET_TEXT(MSG_ERR_EEPROM_VERSION))); IF_DISABLED(EEPROM_AUTO_INIT, ui.eeprom_alert_version()); eeprom_error = true; @@ -2363,12 +2371,14 @@ void MarlinSettings::postprocess() { eeprom_error = true; DEBUG_ERROR_MSG("EEPROM CRC mismatch - (stored) ", stored_crc, " != ", working_crc, " (calculated)!"); TERN_(DWIN_CREALITY_LCD_ENHANCED, ui.set_status(GET_TEXT(MSG_ERR_EEPROM_CRC))); + TERN_(HOST_PROMPT_SUPPORT, host_action_notify_P(GET_TEXT(MSG_ERR_EEPROM_CRC))); IF_DISABLED(EEPROM_AUTO_INIT, ui.eeprom_alert_crc()); } else if (!validating) { DEBUG_ECHO_START(); DEBUG_ECHO(version); DEBUG_ECHOLNPGM(" stored settings retrieved (", eeprom_index - (EEPROM_OFFSET), " bytes; crc ", (uint32_t)working_crc, ")"); + TERN_(HOST_PROMPT_SUPPORT, host_action_notify("Stored settings retrieved")); } if (!validating && !eeprom_error) postprocess(); @@ -3028,6 +3038,7 @@ void MarlinSettings::reset() { postprocess(); DEBUG_ECHO_MSG("Hardcoded Default Settings Loaded"); + TERN_(HOST_PROMPT_SUPPORT, host_action_notify("Hardcoded Default Settings Loaded")); TERN_(EXTENSIBLE_UI, ExtUI::onFactoryReset()); } diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 6be98e90d4e8..dde996938d8f 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -615,6 +615,7 @@ volatile bool Temperature::raw_temps_ready = false; SERIAL_ECHOLNPGM(STR_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_(HOST_PROMPT_SUPPORT, host_action_notify(STR_PID_TEMP_TOO_HIGH)); return; } @@ -710,6 +711,7 @@ volatile bool Temperature::raw_temps_ready = false; SERIAL_ECHOLNPGM(STR_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_(HOST_PROMPT_SUPPORT, host_action_notify(STR_PID_TEMP_TOO_HIGH)); break; } @@ -747,12 +749,14 @@ volatile bool Temperature::raw_temps_ready = false; TERN_(DWIN_CREALITY_LCD, DWIN_Popup_Temperature(0)); TERN_(DWIN_CREALITY_LCD_ENHANCED, DWIN_PidTuning(PID_TUNING_TIMEOUT)); TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_TUNING_TIMEOUT)); + TERN_(HOST_PROMPT_SUPPORT, host_action_notify(STR_PID_TIMEOUT)); SERIAL_ECHOLNPGM(STR_PID_TIMEOUT); break; } if (cycles > ncycles && cycles > 2) { SERIAL_ECHOLNPGM(STR_PID_AUTOTUNE_FINISHED); + TERN_(HOST_PROMPT_SUPPORT, host_action_notify("PID Autotune Finished!")); // TODO: New str value? #if EITHER(PIDTEMPBED, PIDTEMPCHAMBER) PGM_P const estring = GHV(PSTR("chamber"), PSTR("bed"), NUL_STR);