🎨 Apply F() to Host Actions strings
This commit is contained in:
		@@ -1352,28 +1352,28 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
 | 
			
		||||
 | 
			
		||||
  bool MarlinUI::has_status() { return (status_message[0] != '\0'); }
 | 
			
		||||
 | 
			
		||||
  void MarlinUI::set_status(const char * const message, const bool persist) {
 | 
			
		||||
  void MarlinUI::set_status(const char * const cstr, const bool persist) {
 | 
			
		||||
    if (alert_level) return;
 | 
			
		||||
 | 
			
		||||
    TERN_(HOST_PROMPT_SUPPORT, host_action_notify(message));
 | 
			
		||||
    TERN_(HOST_PROMPT_SUPPORT, host_action_notify(cstr));
 | 
			
		||||
 | 
			
		||||
    // Here we have a problem. The message is encoded in UTF8, so
 | 
			
		||||
    // arbitrarily cutting it will be a problem. We MUST be sure
 | 
			
		||||
    // that there is no cutting in the middle of a multibyte character!
 | 
			
		||||
 | 
			
		||||
    // Get a pointer to the null terminator
 | 
			
		||||
    const char* pend = message + strlen(message);
 | 
			
		||||
    const char* pend = cstr + strlen(cstr);
 | 
			
		||||
 | 
			
		||||
    //  If length of supplied UTF8 string is greater than
 | 
			
		||||
    // our buffer size, start cutting whole UTF8 chars
 | 
			
		||||
    while ((pend - message) > MAX_MESSAGE_LENGTH) {
 | 
			
		||||
    while ((pend - cstr) > MAX_MESSAGE_LENGTH) {
 | 
			
		||||
      --pend;
 | 
			
		||||
      while (!START_OF_UTF8_CHAR(*pend)) --pend;
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    // At this point, we have the proper cut point. Use it
 | 
			
		||||
    uint8_t maxLen = pend - message;
 | 
			
		||||
    strncpy(status_message, message, maxLen);
 | 
			
		||||
    uint8_t maxLen = pend - cstr;
 | 
			
		||||
    strncpy(status_message, cstr, maxLen);
 | 
			
		||||
    status_message[maxLen] = '\0';
 | 
			
		||||
 | 
			
		||||
    finish_status(persist);
 | 
			
		||||
@@ -1427,7 +1427,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(pstr));
 | 
			
		||||
    TERN_(HOST_PROMPT_SUPPORT, host_action_notify(fstr));
 | 
			
		||||
 | 
			
		||||
    // Since the message is encoded in UTF8 it must
 | 
			
		||||
    // only be cut on a character boundary.
 | 
			
		||||
@@ -1536,7 +1536,7 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
 | 
			
		||||
      host_action_cancel();
 | 
			
		||||
    #endif
 | 
			
		||||
    IF_DISABLED(SDSUPPORT, print_job_timer.stop());
 | 
			
		||||
    TERN_(HOST_PROMPT_SUPPORT, host_prompt_open(PROMPT_INFO, PSTR("UI Aborted"), DISMISS_STR));
 | 
			
		||||
    TERN_(HOST_PROMPT_SUPPORT, host_prompt_open(PROMPT_INFO, F("UI Aborted"), FPSTR(DISMISS_STR)));
 | 
			
		||||
    LCD_MESSAGE(MSG_PRINT_ABORTED);
 | 
			
		||||
    TERN_(HAS_LCD_MENU, return_to_status());
 | 
			
		||||
  }
 | 
			
		||||
@@ -1565,7 +1565,7 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
 | 
			
		||||
    #endif
 | 
			
		||||
 | 
			
		||||
    TERN_(HAS_TOUCH_SLEEP, wakeup_screen());
 | 
			
		||||
    TERN_(HOST_PROMPT_SUPPORT, host_prompt_open(PROMPT_PAUSE_RESUME, PSTR("UI Pause"), PSTR("Resume")));
 | 
			
		||||
    TERN_(HOST_PROMPT_SUPPORT, host_prompt_open(PROMPT_PAUSE_RESUME, F("UI Pause"), F("Resume")));
 | 
			
		||||
 | 
			
		||||
    LCD_MESSAGE(MSG_PRINT_PAUSED);
 | 
			
		||||
 | 
			
		||||
@@ -1642,10 +1642,10 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
 | 
			
		||||
    TERN(HOST_PROMPT_SUPPORT, host_action_notify(cstr), UNUSED(cstr));
 | 
			
		||||
  }
 | 
			
		||||
  void MarlinUI::set_status(FSTR_P const fstr, const int8_t) {
 | 
			
		||||
    TERN(HOST_PROMPT_SUPPORT, host_action_notify_P(FTOP(fstr)), UNUSED(fstr));
 | 
			
		||||
    TERN(HOST_PROMPT_SUPPORT, host_action_notify(fstr), UNUSED(fstr));
 | 
			
		||||
  }
 | 
			
		||||
  void MarlinUI::status_printf(const uint8_t, FSTR_P const fstr, ...) {
 | 
			
		||||
    TERN(HOST_PROMPT_SUPPORT, host_action_notify_P(FPSTR(fstr)), UNUSED(fstr));
 | 
			
		||||
    TERN(HOST_PROMPT_SUPPORT, host_action_notify(fstr), UNUSED(fstr));
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
#endif // !HAS_DISPLAY && !HAS_STATUS_MESSAGE
 | 
			
		||||
 
 | 
			
		||||
@@ -64,7 +64,7 @@ void _man_probe_pt(const xy_pos_t &xy) {
 | 
			
		||||
  float lcd_probe_pt(const xy_pos_t &xy) {
 | 
			
		||||
    _man_probe_pt(xy);
 | 
			
		||||
    ui.defer_status_screen();
 | 
			
		||||
    TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Delta Calibration in progress"), CONTINUE_STR));
 | 
			
		||||
    TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, F("Delta Calibration in progress"), FPSTR(CONTINUE_STR)));
 | 
			
		||||
    TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(PSTR("Delta Calibration in progress")));
 | 
			
		||||
    TERN_(HAS_RESUME_CONTINUE, wait_for_user_response());
 | 
			
		||||
    ui.goto_previous_screen_no_defer();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user