|
@@ -37,33 +37,33 @@
|
37
|
37
|
#include "runout.h"
|
38
|
38
|
#endif
|
39
|
39
|
|
40
|
|
-void host_action(PGM_P const pstr, const bool eol) {
|
|
40
|
+void host_action(FSTR_P const fstr, const bool eol) {
|
41
|
41
|
PORT_REDIRECT(SerialMask::All);
|
42
|
42
|
SERIAL_ECHOPGM("//action:");
|
43
|
|
- SERIAL_ECHOPGM_P(pstr);
|
|
43
|
+ SERIAL_ECHOF(fstr);
|
44
|
44
|
if (eol) SERIAL_EOL();
|
45
|
45
|
}
|
46
|
46
|
|
47
|
47
|
#ifdef ACTION_ON_KILL
|
48
|
|
- void host_action_kill() { host_action(PSTR(ACTION_ON_KILL)); }
|
|
48
|
+ void host_action_kill() { host_action(F(ACTION_ON_KILL)); }
|
49
|
49
|
#endif
|
50
|
50
|
#ifdef ACTION_ON_PAUSE
|
51
|
|
- void host_action_pause(const bool eol/*=true*/) { host_action(PSTR(ACTION_ON_PAUSE), eol); }
|
|
51
|
+ void host_action_pause(const bool eol/*=true*/) { host_action(F(ACTION_ON_PAUSE), eol); }
|
52
|
52
|
#endif
|
53
|
53
|
#ifdef ACTION_ON_PAUSED
|
54
|
|
- void host_action_paused(const bool eol/*=true*/) { host_action(PSTR(ACTION_ON_PAUSED), eol); }
|
|
54
|
+ void host_action_paused(const bool eol/*=true*/) { host_action(F(ACTION_ON_PAUSED), eol); }
|
55
|
55
|
#endif
|
56
|
56
|
#ifdef ACTION_ON_RESUME
|
57
|
|
- void host_action_resume() { host_action(PSTR(ACTION_ON_RESUME)); }
|
|
57
|
+ void host_action_resume() { host_action(F(ACTION_ON_RESUME)); }
|
58
|
58
|
#endif
|
59
|
59
|
#ifdef ACTION_ON_RESUMED
|
60
|
|
- void host_action_resumed() { host_action(PSTR(ACTION_ON_RESUMED)); }
|
|
60
|
+ void host_action_resumed() { host_action(F(ACTION_ON_RESUMED)); }
|
61
|
61
|
#endif
|
62
|
62
|
#ifdef ACTION_ON_CANCEL
|
63
|
|
- void host_action_cancel() { host_action(PSTR(ACTION_ON_CANCEL)); }
|
|
63
|
+ void host_action_cancel() { host_action(F(ACTION_ON_CANCEL)); }
|
64
|
64
|
#endif
|
65
|
65
|
#ifdef ACTION_ON_START
|
66
|
|
- void host_action_start() { host_action(PSTR(ACTION_ON_START)); }
|
|
66
|
+ void host_action_start() { host_action(F(ACTION_ON_START)); }
|
67
|
67
|
#endif
|
68
|
68
|
|
69
|
69
|
#if ENABLED(HOST_PROMPT_SUPPORT)
|
|
@@ -77,60 +77,60 @@ void host_action(PGM_P const pstr, const bool eol) {
|
77
|
77
|
|
78
|
78
|
PromptReason host_prompt_reason = PROMPT_NOT_DEFINED;
|
79
|
79
|
|
80
|
|
- void host_action_notify(const char * const message) {
|
|
80
|
+ void host_action_notify(const char * const cstr) {
|
81
|
81
|
PORT_REDIRECT(SerialMask::All);
|
82
|
|
- host_action(PSTR("notification "), false);
|
83
|
|
- SERIAL_ECHOLN(message);
|
|
82
|
+ host_action(F("notification "), false);
|
|
83
|
+ SERIAL_ECHOLN(cstr);
|
84
|
84
|
}
|
85
|
85
|
|
86
|
|
- void host_action_notify_P(PGM_P const message) {
|
|
86
|
+ void host_action_notify(FSTR_P const fstr) {
|
87
|
87
|
PORT_REDIRECT(SerialMask::All);
|
88
|
|
- host_action(PSTR("notification "), false);
|
89
|
|
- SERIAL_ECHOLNPGM_P(message);
|
|
88
|
+ host_action(F("notification "), false);
|
|
89
|
+ SERIAL_ECHOLNF(fstr);
|
90
|
90
|
}
|
91
|
91
|
|
92
|
|
- void host_action_prompt(PGM_P const ptype, const bool eol=true) {
|
|
92
|
+ void host_action_prompt(FSTR_P const ptype, const bool eol=true) {
|
93
|
93
|
PORT_REDIRECT(SerialMask::All);
|
94
|
|
- host_action(PSTR("prompt_"), false);
|
95
|
|
- SERIAL_ECHOPGM_P(ptype);
|
|
94
|
+ host_action(F("prompt_"), false);
|
|
95
|
+ SERIAL_ECHOF(ptype);
|
96
|
96
|
if (eol) SERIAL_EOL();
|
97
|
97
|
}
|
98
|
98
|
|
99
|
|
- void host_action_prompt_plus(PGM_P const ptype, PGM_P const pstr, const char extra_char='\0') {
|
|
99
|
+ void host_action_prompt_plus(FSTR_P const ptype, FSTR_P const fstr, const char extra_char='\0') {
|
100
|
100
|
host_action_prompt(ptype, false);
|
101
|
101
|
PORT_REDIRECT(SerialMask::All);
|
102
|
102
|
SERIAL_CHAR(' ');
|
103
|
|
- SERIAL_ECHOPGM_P(pstr);
|
|
103
|
+ SERIAL_ECHOF(fstr);
|
104
|
104
|
if (extra_char != '\0') SERIAL_CHAR(extra_char);
|
105
|
105
|
SERIAL_EOL();
|
106
|
106
|
}
|
107
|
|
- void host_action_prompt_begin(const PromptReason reason, PGM_P const pstr, const char extra_char/*='\0'*/) {
|
|
107
|
+ void host_action_prompt_begin(const PromptReason reason, FSTR_P const fstr, const char extra_char/*='\0'*/) {
|
108
|
108
|
host_action_prompt_end();
|
109
|
109
|
host_prompt_reason = reason;
|
110
|
|
- host_action_prompt_plus(PSTR("begin"), pstr, extra_char);
|
|
110
|
+ host_action_prompt_plus(F("begin"), fstr, extra_char);
|
111
|
111
|
}
|
112
|
|
- void host_action_prompt_button(PGM_P const pstr) { host_action_prompt_plus(PSTR("button"), pstr); }
|
113
|
|
- void host_action_prompt_end() { host_action_prompt(PSTR("end")); }
|
114
|
|
- void host_action_prompt_show() { host_action_prompt(PSTR("show")); }
|
|
112
|
+ void host_action_prompt_button(FSTR_P const fstr) { host_action_prompt_plus(F("button"), fstr); }
|
|
113
|
+ void host_action_prompt_end() { host_action_prompt(F("end")); }
|
|
114
|
+ void host_action_prompt_show() { host_action_prompt(F("show")); }
|
115
|
115
|
|
116
|
|
- void _host_prompt_show(PGM_P const btn1/*=nullptr*/, PGM_P const btn2/*=nullptr*/) {
|
|
116
|
+ void _host_prompt_show(FSTR_P const btn1/*=nullptr*/, FSTR_P const btn2/*=nullptr*/) {
|
117
|
117
|
if (btn1) host_action_prompt_button(btn1);
|
118
|
118
|
if (btn2) host_action_prompt_button(btn2);
|
119
|
119
|
host_action_prompt_show();
|
120
|
120
|
}
|
121
|
|
- void host_prompt_do(const PromptReason reason, PGM_P const pstr, PGM_P const btn1/*=nullptr*/, PGM_P const btn2/*=nullptr*/) {
|
122
|
|
- host_action_prompt_begin(reason, pstr);
|
|
121
|
+ void host_prompt_do(const PromptReason reason, FSTR_P const fstr, FSTR_P const btn1/*=nullptr*/, FSTR_P const btn2/*=nullptr*/) {
|
|
122
|
+ host_action_prompt_begin(reason, fstr);
|
123
|
123
|
_host_prompt_show(btn1, btn2);
|
124
|
124
|
}
|
125
|
|
- void host_prompt_do(const PromptReason reason, PGM_P const pstr, const char extra_char, PGM_P const btn1/*=nullptr*/, PGM_P const btn2/*=nullptr*/) {
|
126
|
|
- host_action_prompt_begin(reason, pstr, extra_char);
|
|
125
|
+ void host_prompt_do(const PromptReason reason, FSTR_P const fstr, const char extra_char, FSTR_P const btn1/*=nullptr*/, FSTR_P const btn2/*=nullptr*/) {
|
|
126
|
+ host_action_prompt_begin(reason, fstr, extra_char);
|
127
|
127
|
_host_prompt_show(btn1, btn2);
|
128
|
128
|
}
|
129
|
129
|
|
130
|
130
|
void filament_load_host_prompt() {
|
131
|
131
|
const bool disable_to_continue = TERN0(HAS_FILAMENT_SENSOR, runout.filament_ran_out);
|
132
|
|
- host_prompt_do(PROMPT_FILAMENT_RUNOUT, PSTR("Paused"), PSTR("PurgeMore"),
|
133
|
|
- disable_to_continue ? PSTR("DisableRunout") : CONTINUE_STR
|
|
132
|
+ host_prompt_do(PROMPT_FILAMENT_RUNOUT, F("Paused"), F("PurgeMore"),
|
|
133
|
+ disable_to_continue ? F("DisableRunout") : FPSTR(CONTINUE_STR)
|
134
|
134
|
);
|
135
|
135
|
}
|
136
|
136
|
|