🐛 Fix and improve Polargraph (#24847)
Co-Authored-By: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
committed by
Scott Lahteine
parent
b3e7d1e91e
commit
031ff2d024
@ -111,20 +111,29 @@ void HostUI::action(FSTR_P const fstr, const bool eol) {
|
||||
if (eol) SERIAL_EOL();
|
||||
}
|
||||
|
||||
void HostUI::prompt_plus(FSTR_P const ptype, FSTR_P const fstr, const char extra_char/*='\0'*/) {
|
||||
void HostUI::prompt_plus(const bool pgm, FSTR_P const ptype, const char * const str, const char extra_char/*='\0'*/) {
|
||||
prompt(ptype, false);
|
||||
PORT_REDIRECT(SerialMask::All);
|
||||
SERIAL_CHAR(' ');
|
||||
SERIAL_ECHOF(fstr);
|
||||
if (pgm)
|
||||
SERIAL_ECHOPGM_P(str);
|
||||
else
|
||||
SERIAL_ECHO(str);
|
||||
if (extra_char != '\0') SERIAL_CHAR(extra_char);
|
||||
SERIAL_EOL();
|
||||
}
|
||||
|
||||
void HostUI::prompt_begin(const PromptReason reason, FSTR_P const fstr, const char extra_char/*='\0'*/) {
|
||||
prompt_end();
|
||||
host_prompt_reason = reason;
|
||||
prompt_plus(F("begin"), fstr, extra_char);
|
||||
}
|
||||
void HostUI::prompt_button(FSTR_P const fstr) { prompt_plus(F("button"), fstr); }
|
||||
void HostUI::prompt_begin(const PromptReason reason, const char * const cstr, const char extra_char/*='\0'*/) {
|
||||
prompt_end();
|
||||
host_prompt_reason = reason;
|
||||
prompt_plus(F("begin"), cstr, extra_char);
|
||||
}
|
||||
|
||||
void HostUI::prompt_end() { prompt(F("end")); }
|
||||
void HostUI::prompt_show() { prompt(F("show")); }
|
||||
|
||||
@ -133,14 +142,26 @@ void HostUI::action(FSTR_P const fstr, const bool eol) {
|
||||
if (btn2) prompt_button(btn2);
|
||||
prompt_show();
|
||||
}
|
||||
|
||||
void HostUI::prompt_button(FSTR_P const fstr) { prompt_plus(F("button"), fstr); }
|
||||
void HostUI::prompt_button(const char * const cstr) { prompt_plus(F("button"), cstr); }
|
||||
|
||||
void HostUI::prompt_do(const PromptReason reason, FSTR_P const fstr, FSTR_P const btn1/*=nullptr*/, FSTR_P const btn2/*=nullptr*/) {
|
||||
prompt_begin(reason, fstr);
|
||||
_prompt_show(btn1, btn2);
|
||||
}
|
||||
void HostUI::prompt_do(const PromptReason reason, const char * const cstr, FSTR_P const btn1/*=nullptr*/, FSTR_P const btn2/*=nullptr*/) {
|
||||
prompt_begin(reason, cstr);
|
||||
_prompt_show(btn1, btn2);
|
||||
}
|
||||
void HostUI::prompt_do(const PromptReason reason, FSTR_P const fstr, const char extra_char, FSTR_P const btn1/*=nullptr*/, FSTR_P const btn2/*=nullptr*/) {
|
||||
prompt_begin(reason, fstr, extra_char);
|
||||
_prompt_show(btn1, btn2);
|
||||
}
|
||||
void HostUI::prompt_do(const PromptReason reason, const char * const cstr, const char extra_char, FSTR_P const btn1/*=nullptr*/, FSTR_P const btn2/*=nullptr*/) {
|
||||
prompt_begin(reason, cstr, extra_char);
|
||||
_prompt_show(btn1, btn2);
|
||||
}
|
||||
|
||||
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
||||
void HostUI::filament_load_prompt() {
|
||||
|
@ -79,7 +79,14 @@ class HostUI {
|
||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||
private:
|
||||
static void prompt(FSTR_P const ptype, const bool eol=true);
|
||||
static void prompt_plus(FSTR_P const ptype, FSTR_P const fstr, const char extra_char='\0');
|
||||
static void prompt_plus(const bool pgm, FSTR_P const ptype, const char * const str, const char extra_char='\0');
|
||||
static void prompt_plus(FSTR_P const ptype, FSTR_P const fstr, const char extra_char='\0') {
|
||||
prompt_plus(true, ptype, FTOP(fstr), extra_char);
|
||||
}
|
||||
static void prompt_plus(FSTR_P const ptype, const char * const cstr, const char extra_char='\0') {
|
||||
prompt_plus(false, ptype, cstr, extra_char);
|
||||
}
|
||||
|
||||
static void prompt_show();
|
||||
static void _prompt_show(FSTR_P const btn1, FSTR_P const btn2);
|
||||
|
||||
@ -93,10 +100,17 @@ class HostUI {
|
||||
static void notify(const char * const message);
|
||||
|
||||
static void prompt_begin(const PromptReason reason, FSTR_P const fstr, const char extra_char='\0');
|
||||
static void prompt_button(FSTR_P const fstr);
|
||||
static void prompt_begin(const PromptReason reason, const char * const cstr, const char extra_char='\0');
|
||||
static void prompt_end();
|
||||
|
||||
static void prompt_button(FSTR_P const fstr);
|
||||
static void prompt_button(const char * const cstr);
|
||||
|
||||
static void prompt_do(const PromptReason reason, FSTR_P const pstr, FSTR_P const btn1=nullptr, FSTR_P const btn2=nullptr);
|
||||
static void prompt_do(const PromptReason reason, const char * const cstr, FSTR_P const btn1=nullptr, FSTR_P const btn2=nullptr);
|
||||
static void prompt_do(const PromptReason reason, FSTR_P const pstr, const char extra_char, FSTR_P const btn1=nullptr, FSTR_P const btn2=nullptr);
|
||||
static void prompt_do(const PromptReason reason, const char * const cstr, const char extra_char, FSTR_P const btn1=nullptr, FSTR_P const btn2=nullptr);
|
||||
|
||||
static void prompt_open(const PromptReason reason, FSTR_P const pstr, FSTR_P const btn1=nullptr, FSTR_P const btn2=nullptr) {
|
||||
if (host_prompt_reason == PROMPT_NOT_DEFINED) prompt_do(reason, pstr, btn1, btn2);
|
||||
}
|
||||
|
Reference in New Issue
Block a user