🎨 Format, use status macros

This commit is contained in:
Scott Lahteine
2022-03-25 17:09:55 -05:00
committed by Scott Lahteine
parent 5632ad65f5
commit 9324132a40
11 changed files with 29 additions and 31 deletions

View File

@ -2304,7 +2304,7 @@ TERN(HAS_ONESTEP_LEVELING, float, void) Tram(uint8_t point) {
inLev = true;
zval = probe.probe_at_point(xpos, ypos, PROBE_PT_STOW);
if (isnan(zval))
ui.set_status(F("Position Not Reachable, check offsets"));
LCD_MESSAGE_F("Position Not Reachable, check offsets");
else {
sprintf_P(cmd, PSTR("X:%s, Y:%s, Z:%s"),
dtostrf(xpos, 1, 1, str_1),
@ -2336,7 +2336,7 @@ void TramC () { Tram(4); }
void Trammingwizard() {
bed_mesh_t zval = {0};
if (HMI_data.FullManualTramming) {
ui.set_status(F("Disable manual tramming"));
LCD_MESSAGE_F("Disable manual tramming");
return;
}
zval[0][0] = Tram(0);

View File

@ -593,7 +593,7 @@ void MarlinUI::init() {
// share the same line on the display.
//
#if DISABLED(PROGRESS_MSG_ONCE) || (PROGRESS_MSG_EXPIRE > 0)
#if DISABLED(PROGRESS_MSG_ONCE) || PROGRESS_MSG_EXPIRE > 0
#define GOT_MS
const millis_t ms = millis();
#endif
@ -1420,6 +1420,7 @@ void MarlinUI::init() {
#if SERVICE_INTERVAL_3 > 0
static PGMSTR(service3, "> " SERVICE_NAME_3 "!");
#endif
FSTR_P msg;
if (printingIsPaused())
msg = GET_TEXT_F(MSG_PRINT_PAUSED);
@ -1450,13 +1451,18 @@ void MarlinUI::init() {
set_status(msg, -1);
}
/**
* Set Status with a fixed string and alert level.
* @param fstr A constant F-string to set as the status.
* @param level Alert level. Negative to ignore and reset the level. Non-zero never expires.
*/
void MarlinUI::set_status(FSTR_P const fstr, int8_t level) {
PGM_P const pstr = FTOP(fstr);
// Alerts block lower priority messages
if (level < 0) level = alert_level = 0;
if (level < alert_level) return;
alert_level = level;
TERN_(HOST_STATUS_NOTIFICATIONS, hostui.notify(fstr));
PGM_P const pstr = FTOP(fstr);
// Since the message is encoded in UTF8 it must
// only be cut on a character boundary.
@ -1476,6 +1482,8 @@ void MarlinUI::init() {
strncpy_P(status_message, pstr, maxLen);
status_message[maxLen] = '\0';
TERN_(HOST_STATUS_NOTIFICATIONS, hostui.notify(fstr));
finish_status(level > 0);
}

View File

@ -39,10 +39,6 @@
#define HAS_ENCODER_ACTION 1
#endif
#if HAS_STATUS_MESSAGE
#define START_OF_UTF8_CHAR(C) (((C) & 0xC0u) != 0x80U)
#endif
#if E_MANUAL > 1
#define MULTI_E_MANUAL 1
#endif