parent
f31178f868
commit
5408259f51
|
@ -196,14 +196,15 @@ bool GCodeQueue::process_injected_command() {
|
|||
* Never call this from a G-code handler!
|
||||
*/
|
||||
void GCodeQueue::enqueue_one_now(const char * const cmd) { while (!enqueue_one(cmd)) idle(); }
|
||||
void GCodeQueue::enqueue_one_now(FSTR_P const fcmd) { while (!enqueue_one(fcmd)) idle(); }
|
||||
|
||||
/**
|
||||
* Attempt to enqueue a single G-code command
|
||||
* and return 'true' if successful.
|
||||
*/
|
||||
bool GCodeQueue::enqueue_one(FSTR_P const fgcode) {
|
||||
bool GCodeQueue::enqueue_one(FSTR_P const fcmd) {
|
||||
size_t i = 0;
|
||||
PGM_P p = FTOP(fgcode);
|
||||
PGM_P p = FTOP(fcmd);
|
||||
char c;
|
||||
while ((c = pgm_read_byte(&p[i])) && c != '\n') i++;
|
||||
char cmd[i + 1];
|
||||
|
|
|
@ -141,12 +141,13 @@ public:
|
|||
* Enqueue and return only when commands are actually enqueued
|
||||
*/
|
||||
static void enqueue_one_now(const char * const cmd);
|
||||
static void enqueue_one_now(FSTR_P const fcmd);
|
||||
|
||||
/**
|
||||
* Attempt to enqueue a single G-code command
|
||||
* and return 'true' if successful.
|
||||
*/
|
||||
static bool enqueue_one(FSTR_P const fgcode);
|
||||
static bool enqueue_one(FSTR_P const fcmd);
|
||||
|
||||
/**
|
||||
* Enqueue with Serial Echo
|
||||
|
|
|
@ -176,9 +176,13 @@ void DWIN_Frame_AreaMove(uint8_t mode, uint8_t dir, uint16_t dis,
|
|||
void DWIN_Draw_String(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t x, uint16_t y, const char * const string, uint16_t rlimit=0xFFFF);
|
||||
|
||||
inline void DWIN_Draw_String(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t x, uint16_t y, FSTR_P const ftitle) {
|
||||
char ctitle[strlen_P(FTOP(ftitle)) + 1];
|
||||
strcpy_P(ctitle, FTOP(ftitle));
|
||||
DWIN_Draw_String(bShow, size, color, bColor, x, y, ctitle);
|
||||
#ifdef __AVR__
|
||||
char ctitle[strlen_P(FTOP(ftitle)) + 1];
|
||||
strcpy_P(ctitle, FTOP(ftitle));
|
||||
DWIN_Draw_String(bShow, size, color, bColor, x, y, ctitle);
|
||||
#else
|
||||
DWIN_Draw_String(bShow, size, color, bColor, x, y, FTOP(ftitle));
|
||||
#endif
|
||||
}
|
||||
|
||||
// Draw a positive integer
|
||||
|
|
|
@ -4307,9 +4307,13 @@ void DWIN_StatusChanged(const char * const cstr/*=nullptr*/) {
|
|||
}
|
||||
|
||||
void DWIN_StatusChanged(FSTR_P const fstr) {
|
||||
char str[strlen_P(FTOP(fstr)) + 1];
|
||||
strcpy_P(str, FTOP(fstr));
|
||||
DWIN_StatusChanged(str);
|
||||
#ifdef __AVR__
|
||||
char str[strlen_P(FTOP(fstr)) + 1];
|
||||
strcpy_P(str, FTOP(fstr));
|
||||
DWIN_StatusChanged(str);
|
||||
#else
|
||||
DWIN_StatusChanged(FTOP(fstr));
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // DWIN_CREALITY_LCD
|
||||
|
|
|
@ -274,7 +274,7 @@ void MarlinUI::draw_status_message(const bool blink) {
|
|||
|
||||
dwin_font.solid = false;
|
||||
dwin_font.fg = Color_White;
|
||||
dwin_string.set("E");
|
||||
dwin_string.set('E');
|
||||
dwin_string.add('1' + extruder);
|
||||
dwin_string.add(' ');
|
||||
dwin_string.add(i16tostr3rj(thermalManager.degHotend(extruder)));
|
||||
|
@ -282,7 +282,7 @@ void MarlinUI::draw_status_message(const bool blink) {
|
|||
if (get_blink() || !thermalManager.heater_idle[thermalManager.idle_index_for_id(extruder)].timed_out)
|
||||
dwin_string.add(i16tostr3rj(thermalManager.degTargetHotend(extruder)));
|
||||
else
|
||||
dwin_string.add(PSTR(" "));
|
||||
dwin_string.add(F(" "));
|
||||
|
||||
lcd_moveto(LCD_WIDTH - dwin_string.length, row);
|
||||
lcd_put_dwin_string();
|
||||
|
@ -540,11 +540,11 @@ void MarlinUI::draw_status_message(const bool blink) {
|
|||
lcd_put_u8str(ftostr52(lpos.y));
|
||||
|
||||
// Print plot position
|
||||
dwin_string.set("(");
|
||||
dwin_string.set('(');
|
||||
dwin_string.add(i8tostr3rj(x_plot));
|
||||
dwin_string.add(",");
|
||||
dwin_string.add(',');
|
||||
dwin_string.add(i8tostr3rj(y_plot));
|
||||
dwin_string.add(")");
|
||||
dwin_string.add(')');
|
||||
lcd_moveto(
|
||||
TERN(DWIN_MARLINUI_LANDSCAPE, ((x_offset + x_map_pixels) / MENU_FONT_WIDTH) + 2, LCD_WIDTH - dwin_string.length),
|
||||
TERN(DWIN_MARLINUI_LANDSCAPE, LCD_HEIGHT - 2, ((y_offset + y_map_pixels) / MENU_LINE_HEIGHT) + 1)
|
||||
|
@ -556,7 +556,7 @@ void MarlinUI::draw_status_message(const bool blink) {
|
|||
if (!isnan(bedlevel.z_values[x_plot][y_plot]))
|
||||
dwin_string.add(ftostr43sign(bedlevel.z_values[x_plot][y_plot]));
|
||||
else
|
||||
dwin_string.add(PSTR(" -----"));
|
||||
dwin_string.add(F(" -----"));
|
||||
lcd_moveto(
|
||||
TERN(DWIN_MARLINUI_LANDSCAPE, ((x_offset + x_map_pixels) / MENU_FONT_WIDTH) + 2, LCD_WIDTH - dwin_string.length),
|
||||
TERN(DWIN_MARLINUI_LANDSCAPE, LCD_HEIGHT - 1, ((y_offset + y_map_pixels) / MENU_LINE_HEIGHT) + 2)
|
||||
|
|
|
@ -88,7 +88,7 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const
|
|||
|
||||
// For E_TOTAL there may be some characters to cover up
|
||||
if (BOTH(DWIN_MARLINUI_PORTRAIT, LCD_SHOW_E_TOTAL) && axis == X_AXIS)
|
||||
dwin_string.add(" ");
|
||||
dwin_string.add(F(" "));
|
||||
|
||||
DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, x, y + 32, S(dwin_string.string()));
|
||||
|
||||
|
@ -117,7 +117,7 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const
|
|||
|
||||
// For E_TOTAL there may be some characters to cover up
|
||||
if (ENABLED(LCD_SHOW_E_TOTAL) && (!ui.did_first_redraw || ui.old_is_printing != print_job_timer.isRunning()) && axis == X_AXIS)
|
||||
dwin_string.add(" ");
|
||||
dwin_string.add(F(" "));
|
||||
|
||||
DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, x + 32, y + 4, S(dwin_string.string()));
|
||||
|
||||
|
@ -133,7 +133,7 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const
|
|||
|
||||
if (!ui.did_first_redraw) {
|
||||
// Extra spaces to erase previous value
|
||||
dwin_string.set("E ");
|
||||
dwin_string.set(F("E "));
|
||||
DWIN_Draw_String(true, font16x32, Color_IconBlue, Color_Bg_Black, x + (4 * 14 / 2) - 7, y + 2, S(dwin_string.string()));
|
||||
}
|
||||
|
||||
|
@ -146,7 +146,7 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const
|
|||
#else // !DWIN_MARLINUI_PORTRAIT
|
||||
|
||||
if (!ui.did_first_redraw || ui.old_is_printing != print_job_timer.isRunning()) {
|
||||
dwin_string.set("E ");
|
||||
dwin_string.set(F("E "));
|
||||
DWIN_Draw_String(true, font16x32, Color_IconBlue, Color_Bg_Black, x, y, S(dwin_string.string()));
|
||||
}
|
||||
|
||||
|
@ -176,7 +176,7 @@ FORCE_INLINE void _draw_fan_status(const uint16_t x, const uint16_t y) {
|
|||
else {
|
||||
DWIN_ICON_AnimationControl(0x0000); // disable all icon animations (this is the only one)
|
||||
DWIN_ICON_Show(ICON, ICON_Fan0, x + fanx, y);
|
||||
dwin_string.set(PSTR(" "));
|
||||
dwin_string.set(F(" "));
|
||||
DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, x, y + STATUS_FAN_HEIGHT, S(dwin_string.string()));
|
||||
}
|
||||
}
|
||||
|
@ -289,7 +289,7 @@ FORCE_INLINE void _draw_feedrate_status(const char *value, uint16_t x, uint16_t
|
|||
}
|
||||
|
||||
dwin_string.set(value);
|
||||
dwin_string.add(PSTR("%"));
|
||||
dwin_string.add('%');
|
||||
DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, x + 14, y, S(dwin_string.string()));
|
||||
}
|
||||
|
||||
|
@ -396,7 +396,7 @@ void MarlinUI::draw_status_screen() {
|
|||
// landscape mode shows both elapsed and remaining (if SHOW_REMAINING_TIME)
|
||||
time = print_job_timer.duration();
|
||||
time.toDigital(buffer);
|
||||
dwin_string.set(" ");
|
||||
dwin_string.set(' ');
|
||||
dwin_string.add(buffer);
|
||||
DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, 230, 170, S(dwin_string.string()));
|
||||
|
||||
|
@ -405,7 +405,7 @@ void MarlinUI::draw_status_screen() {
|
|||
time = get_remaining_time();
|
||||
DWIN_Draw_String(true, font14x28, Color_IconBlue, Color_Bg_Black, 336, 170, S(" R "));
|
||||
if (print_job_timer.isPaused() && blink)
|
||||
dwin_string.set(" ");
|
||||
dwin_string.set(F(" "));
|
||||
else {
|
||||
time.toDigital(buffer);
|
||||
dwin_string.set(buffer);
|
||||
|
@ -413,7 +413,7 @@ void MarlinUI::draw_status_screen() {
|
|||
DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, 378, 170, S(dwin_string.string()));
|
||||
}
|
||||
else if (!ui.did_first_redraw || ui.old_is_printing != print_job_timer.isRunning()) {
|
||||
dwin_string.set(" ");
|
||||
dwin_string.set(F(" "));
|
||||
DWIN_Draw_String(true, font14x28, Color_IconBlue, Color_Bg_Black, 336, 170, S(dwin_string.string()));
|
||||
}
|
||||
#endif
|
||||
|
@ -449,7 +449,7 @@ void MarlinUI::draw_status_screen() {
|
|||
|
||||
#if ENABLED(SHOW_SD_PERCENT)
|
||||
dwin_string.set(TERN(PRINT_PROGRESS_SHOW_DECIMALS, permyriadtostr4(progress), ui8tostr3rj(progress / (PROGRESS_SCALE))));
|
||||
dwin_string.add(PSTR("%"));
|
||||
dwin_string.add('%');
|
||||
DWIN_Draw_String(
|
||||
false, font16x32, Percent_Color, Color_Bg_Black,
|
||||
pb_left + (pb_width - dwin_string.length * 16) / 2,
|
||||
|
|
|
@ -474,13 +474,8 @@ void DGUSScreenHandler::HandleManualExtrude(DGUS_VP_Variable &var, void *val_ptr
|
|||
|
||||
void DGUSScreenHandler::HandleMotorLockUnlock(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
DEBUG_ECHOLNPGM("HandleMotorLockUnlock");
|
||||
|
||||
char buf[4];
|
||||
const int16_t lock = swap16(*(uint16_t*)val_ptr);
|
||||
strcpy_P(buf, lock ? PSTR("M18") : PSTR("M17"));
|
||||
|
||||
//DEBUG_ECHOPGM(" ", buf);
|
||||
queue.enqueue_one_now(buf);
|
||||
queue.enqueue_one_now(lock ? F("M18") : F("M17"));
|
||||
}
|
||||
|
||||
void DGUSScreenHandler::HandleSettings(DGUS_VP_Variable &var, void *val_ptr) {
|
||||
|
@ -552,23 +547,23 @@ void DGUSScreenHandler::HandleStepPerMMExtruderChanged(DGUS_VP_Variable &var, vo
|
|||
#if HAS_HOTEND
|
||||
case VP_PID_AUTOTUNE_E0: // Autotune Extruder 0
|
||||
sprintf_P(buf, PSTR("M303 E%d C5 S210 U1"), ExtUI::extruder_t::E0);
|
||||
queue.enqueue_one_now(buf);
|
||||
break;
|
||||
#endif
|
||||
#if HAS_MULTI_HOTEND
|
||||
case VP_PID_AUTOTUNE_E1:
|
||||
sprintf_P(buf, PSTR("M303 E%d C5 S210 U1"), ExtUI::extruder_t::E1);
|
||||
queue.enqueue_one_now(buf);
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
#if ENABLED(PIDTEMPBED)
|
||||
case VP_PID_AUTOTUNE_BED:
|
||||
strcpy_P(buf, PSTR("M303 E-1 C5 S70 U1"));
|
||||
queue.enqueue_one_now(F("M303 E-1 C5 S70 U1"));
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (buf[0]) queue.enqueue_one_now(buf);
|
||||
|
||||
#if ENABLED(DGUS_UI_WAITING)
|
||||
sendinfoscreen(F("PID is autotuning"), F("please wait"), NUL_STR, NUL_STR, true, true, true, true);
|
||||
GotoScreen(DGUSLCD_SCREEN_WAITING);
|
||||
|
|
|
@ -32,12 +32,12 @@ using namespace Theme;
|
|||
#define GRID_COLS 2
|
||||
#define GRID_ROWS 9
|
||||
|
||||
void BioPrintingDialogBox::draw_status_message(draw_mode_t what, const char *message) {
|
||||
void BioPrintingDialogBox::draw_status_message(draw_mode_t what, const char *cmsg) {
|
||||
if (what & BACKGROUND) {
|
||||
CommandProcessor cmd;
|
||||
cmd.cmd(COLOR_RGB(bg_text_enabled))
|
||||
.tag(0);
|
||||
draw_text_box(cmd, BTN_POS(1,2), BTN_SIZE(2,2), message, OPT_CENTER, font_large);
|
||||
draw_text_box(cmd, BTN_POS(1,2), BTN_SIZE(2,2), cmsg, OPT_CENTER, font_large);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -105,26 +105,30 @@ bool BioPrintingDialogBox::onTouchEnd(uint8_t tag) {
|
|||
return true;
|
||||
}
|
||||
|
||||
void BioPrintingDialogBox::setStatusMessage(FSTR_P message) {
|
||||
char buff[strlen_P(FTOP(message)) + 1];
|
||||
strcpy_P(buff, FTOP(message));
|
||||
setStatusMessage(buff);
|
||||
void BioPrintingDialogBox::setStatusMessage(FSTR_P fmsg) {
|
||||
#ifdef __AVR__
|
||||
char buff[strlen_P(FTOP(fmsg)) + 1];
|
||||
strcpy_P(buff, FTOP(fmsg));
|
||||
setStatusMessage(buff);
|
||||
#else
|
||||
setStatusMessage(FTOP(fmsg));
|
||||
#endif
|
||||
}
|
||||
|
||||
void BioPrintingDialogBox::setStatusMessage(const char *message) {
|
||||
void BioPrintingDialogBox::setStatusMessage(const char *cmsg) {
|
||||
CommandProcessor cmd;
|
||||
cmd.cmd(CMD_DLSTART)
|
||||
.cmd(CLEAR_COLOR_RGB(bg_color))
|
||||
.cmd(CLEAR(true,true,true));
|
||||
|
||||
draw_status_message(BACKGROUND, message);
|
||||
draw_status_message(BACKGROUND, cmsg);
|
||||
draw_progress(BACKGROUND);
|
||||
draw_time_remaining(BACKGROUND);
|
||||
draw_interaction_buttons(BACKGROUND);
|
||||
storeBackground();
|
||||
|
||||
#if ENABLED(TOUCH_UI_DEBUG)
|
||||
SERIAL_ECHO_MSG("New status message: ", message);
|
||||
SERIAL_ECHO_MSG("New status message: ", cmsg);
|
||||
#endif
|
||||
|
||||
if (AT_SCREEN(BioPrintingDialogBox))
|
||||
|
|
|
@ -122,7 +122,7 @@ void StatusScreen::draw_temperature(draw_mode_t what) {
|
|||
|
||||
ui.bounds(POLY(bed_temp), x, y, h, v);
|
||||
cmd.text(x, y, h, v, str);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -354,8 +354,8 @@ bool StatusScreen::onTouchHeld(uint8_t tag) {
|
|||
return false;
|
||||
}
|
||||
|
||||
void StatusScreen::setStatusMessage(FSTR_P pstr) {
|
||||
BioPrintingDialogBox::setStatusMessage(pstr);
|
||||
void StatusScreen::setStatusMessage(FSTR_P fstr) {
|
||||
BioPrintingDialogBox::setStatusMessage(fstr);
|
||||
}
|
||||
|
||||
void StatusScreen::setStatusMessage(const char * const str) {
|
||||
|
|
|
@ -136,9 +136,13 @@ namespace FTDI {
|
|||
}
|
||||
|
||||
void draw_text_box(CommandProcessor& cmd, int x, int y, int w, int h, FSTR_P fstr, uint16_t options, uint8_t font) {
|
||||
char str[strlen_P(FTOP(fstr)) + 1];
|
||||
strcpy_P(str, FTOP(fstr));
|
||||
draw_text_box(cmd, x, y, w, h, (const char*) str, options, font);
|
||||
#ifdef __AVR__
|
||||
char str[strlen_P(FTOP(fstr)) + 1];
|
||||
strcpy_P(str, FTOP(fstr));
|
||||
draw_text_box(cmd, x, y, w, h, (const char*) str, options, font);
|
||||
#else
|
||||
draw_text_box(cmd, x, y, w, h, FTOP(fstr), options, font);
|
||||
#endif
|
||||
}
|
||||
} // namespace FTDI
|
||||
|
||||
|
|
|
@ -192,9 +192,13 @@
|
|||
}
|
||||
|
||||
uint16_t FTDI::get_utf8_text_width(FSTR_P fstr, font_size_t fs) {
|
||||
char str[strlen_P(FTOP(fstr)) + 1];
|
||||
strcpy_P(str, FTOP(fstr));
|
||||
return get_utf8_text_width(str, fs);
|
||||
#ifdef __AVR__
|
||||
char str[strlen_P(FTOP(fstr)) + 1];
|
||||
strcpy_P(str, FTOP(fstr));
|
||||
return get_utf8_text_width(str, fs);
|
||||
#else
|
||||
return get_utf8_text_width(FTOP(fstr), fs);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -32,7 +32,7 @@ using namespace Theme;
|
|||
#define GRID_ROWS 8
|
||||
|
||||
template<typename T>
|
||||
void DialogBoxBaseClass::drawMessage(T message, int16_t font) {
|
||||
void DialogBoxBaseClass::drawMessage(T message, const int16_t font) {
|
||||
CommandProcessor cmd;
|
||||
cmd.cmd(CMD_DLSTART)
|
||||
.cmd(CLEAR_COLOR_RGB(bg_color))
|
||||
|
@ -43,8 +43,7 @@ void DialogBoxBaseClass::drawMessage(T message, int16_t font) {
|
|||
cmd.colors(normal_btn);
|
||||
}
|
||||
|
||||
template void DialogBoxBaseClass::drawMessage(const char *, int16_t font);
|
||||
template void DialogBoxBaseClass::drawMessage(FSTR_P, int16_t font);
|
||||
template void DialogBoxBaseClass::drawMessage(PGM_P const, const int16_t);
|
||||
|
||||
void DialogBoxBaseClass::drawYesNoButtons(uint8_t default_btn) {
|
||||
CommandProcessor cmd;
|
||||
|
|
|
@ -27,12 +27,15 @@
|
|||
|
||||
class DialogBoxBaseClass : public BaseScreen {
|
||||
protected:
|
||||
template<typename T> static void drawMessage(T, int16_t font = 0);
|
||||
template<typename T> static void drawMessage(T, const int16_t font=0);
|
||||
static void drawMessage(FSTR_P const fstr, const int16_t font=0) { drawMessage(FTOP(fstr), font); }
|
||||
|
||||
template<typename T> static void drawButton(T);
|
||||
static void drawYesNoButtons(uint8_t default_btn = 0);
|
||||
static void drawOkayButton();
|
||||
|
||||
static void onRedraw(draw_mode_t) {};
|
||||
static void onRedraw(draw_mode_t) {}
|
||||
|
||||
public:
|
||||
static bool onTouchEnd(uint8_t tag);
|
||||
static void onIdle();
|
||||
|
|
|
@ -332,10 +332,14 @@ void StatusScreen::draw_status_message(draw_mode_t what, const char *message) {
|
|||
}
|
||||
}
|
||||
|
||||
void StatusScreen::setStatusMessage(FSTR_P message) {
|
||||
char buff[strlen_P(FTOP(message)) + 1];
|
||||
strcpy_P(buff, FTOP(message));
|
||||
setStatusMessage((const char *) buff);
|
||||
void StatusScreen::setStatusMessage(FSTR_P fmsg) {
|
||||
#ifdef __AVR__
|
||||
char buff[strlen_P(FTOP(fmsg)) + 1];
|
||||
strcpy_P(buff, FTOP(fmsg));
|
||||
setStatusMessage((const char *)buff);
|
||||
#else
|
||||
setStatusMessage(FTOP(fmsg));
|
||||
#endif
|
||||
}
|
||||
|
||||
void StatusScreen::setStatusMessage(const char *message) {
|
||||
|
|
|
@ -711,12 +711,16 @@ void disp_assets_update() {
|
|||
}
|
||||
|
||||
void disp_assets_update_progress(FSTR_P const fmsg) {
|
||||
static constexpr int buflen = 30;
|
||||
char buf[buflen];
|
||||
memset(buf, ' ', buflen);
|
||||
strncpy_P(buf, FTOP(fmsg), buflen - 1);
|
||||
buf[buflen - 1] = '\0';
|
||||
disp_string(100, 165, buf, 0xFFFF, 0x0000);
|
||||
#ifdef __AVR__
|
||||
static constexpr int buflen = 30;
|
||||
char buf[buflen];
|
||||
memset(buf, ' ', buflen);
|
||||
strncpy_P(buf, FTOP(fmsg), buflen - 1);
|
||||
buf[buflen - 1] = '\0';
|
||||
disp_string(100, 165, buf, 0xFFFF, 0x0000);
|
||||
#else
|
||||
disp_string(100, 165, FTOP(fmsg), 0xFFFF, 0x0000);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if BOTH(MKS_TEST, SDSUPPORT)
|
||||
|
|
|
@ -1082,15 +1082,23 @@ namespace ExtUI {
|
|||
|
||||
// Simplest approach is to make an SRAM copy
|
||||
void onUserConfirmRequired(FSTR_P const fstr) {
|
||||
char msg[strlen_P(FTOP(fstr)) + 1];
|
||||
strcpy_P(msg, FTOP(fstr));
|
||||
onUserConfirmRequired(msg);
|
||||
#ifdef __AVR__
|
||||
char msg[strlen_P(FTOP(fstr)) + 1];
|
||||
strcpy_P(msg, FTOP(fstr));
|
||||
onUserConfirmRequired(msg);
|
||||
#else
|
||||
onUserConfirmRequired(FTOP(fstr));
|
||||
#endif
|
||||
}
|
||||
|
||||
void onStatusChanged(FSTR_P const fstr) {
|
||||
char msg[strlen_P(FTOP(fstr)) + 1];
|
||||
strcpy_P(msg, FTOP(fstr));
|
||||
onStatusChanged(msg);
|
||||
#ifdef __AVR__
|
||||
char msg[strlen_P(FTOP(fstr)) + 1];
|
||||
strcpy_P(msg, FTOP(fstr));
|
||||
onStatusChanged(msg);
|
||||
#else
|
||||
onStatusChanged(FTOP(fstr));
|
||||
#endif
|
||||
}
|
||||
|
||||
FileList::FileList() { refresh(); }
|
||||
|
|
|
@ -113,11 +113,15 @@ class MenuItem_confirm : public MenuItemBase {
|
|||
static void select_screen(
|
||||
FSTR_P const yes, FSTR_P const no,
|
||||
selectFunc_t yesFunc, selectFunc_t noFunc,
|
||||
FSTR_P const pref, FSTR_P const string, FSTR_P const suff=nullptr
|
||||
FSTR_P const pref, FSTR_P const fstr, FSTR_P const suff=nullptr
|
||||
) {
|
||||
char str[strlen_P(FTOP(string)) + 1];
|
||||
strcpy_P(str, FTOP(string));
|
||||
select_screen(yes, no, yesFunc, noFunc, pref, str, suff);
|
||||
#ifdef __AVR__
|
||||
char str[strlen_P(FTOP(fstr)) + 1];
|
||||
strcpy_P(str, FTOP(fstr));
|
||||
select_screen(yes, no, yesFunc, noFunc, pref, str, suff);
|
||||
#else
|
||||
select_screen(yes, no, yesFunc, noFunc, pref, FTOP(fstr), suff);
|
||||
#endif
|
||||
}
|
||||
// Shortcut for prompt with "NO"/ "YES" labels
|
||||
FORCE_INLINE static void confirm_screen(selectFunc_t yesFunc, selectFunc_t noFunc, FSTR_P const pref, const char * const string=nullptr, FSTR_P const suff=nullptr) {
|
||||
|
|
|
@ -271,19 +271,25 @@ void MarlinUI::draw_status_screen() {
|
|||
else {
|
||||
tft.add_text(200, 3, COLOR_AXIS_HOMED , "X");
|
||||
const bool nhx = axis_should_home(X_AXIS);
|
||||
tft_string.set(blink && nhx ? "?" : ftostr4sign(LOGICAL_X_POSITION(current_position.x)));
|
||||
if (blink && nhx)
|
||||
tft_string.set('?');
|
||||
else
|
||||
tft_string.set(ftostr4sign(LOGICAL_X_POSITION(current_position.x)));
|
||||
tft.add_text(300 - tft_string.width(), 3, nhx ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
|
||||
|
||||
tft.add_text(500, 3, COLOR_AXIS_HOMED , "Y");
|
||||
const bool nhy = axis_should_home(Y_AXIS);
|
||||
tft_string.set(blink && nhy ? "?" : ftostr4sign(LOGICAL_Y_POSITION(current_position.y)));
|
||||
if (blink && nhy)
|
||||
tft_string.set('?');
|
||||
else
|
||||
tft_string.set(ftostr4sign(LOGICAL_Y_POSITION(current_position.y)));
|
||||
tft.add_text(600 - tft_string.width(), 3, nhy ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
|
||||
}
|
||||
tft.add_text(800, 3, COLOR_AXIS_HOMED , "Z");
|
||||
uint16_t offset = 32;
|
||||
const bool nhz = axis_should_home(Z_AXIS);
|
||||
if (blink && nhz)
|
||||
tft_string.set("?");
|
||||
tft_string.set('?');
|
||||
else {
|
||||
const float z = LOGICAL_Z_POSITION(current_position.z);
|
||||
tft_string.set(ftostr52sp((int16_t)z));
|
||||
|
@ -479,7 +485,7 @@ void MenuItem_confirm::draw_select_screen(FSTR_P const yes, FSTR_P const no, con
|
|||
tft_string.add(' ');
|
||||
tft_string.add(i16tostr3rj(thermalManager.wholeDegHotend(extruder)));
|
||||
tft_string.add(LCD_STR_DEGREE);
|
||||
tft_string.add(" / ");
|
||||
tft_string.add(F(" / "));
|
||||
tft_string.add(i16tostr3rj(thermalManager.degTargetHotend(extruder)));
|
||||
tft_string.add(LCD_STR_DEGREE);
|
||||
tft_string.trim();
|
||||
|
@ -607,19 +613,19 @@ static void quick_feedback() {
|
|||
#define CUR_STEP_VALUE_WIDTH 104
|
||||
static void drawCurStepValue() {
|
||||
tft_string.set(ftostr52sp(motionAxisState.currentStepSize));
|
||||
tft_string.add("mm");
|
||||
tft_string.add(F("mm"));
|
||||
tft.canvas(motionAxisState.stepValuePos.x, motionAxisState.stepValuePos.y, CUR_STEP_VALUE_WIDTH, BTN_HEIGHT);
|
||||
tft.set_background(COLOR_BACKGROUND);
|
||||
tft.add_text(tft_string.center(CUR_STEP_VALUE_WIDTH), 0, COLOR_AXIS_HOMED, tft_string);
|
||||
}
|
||||
|
||||
static void drawCurZSelection() {
|
||||
tft_string.set("Z");
|
||||
tft_string.set('Z');
|
||||
tft.canvas(motionAxisState.zTypePos.x, motionAxisState.zTypePos.y, tft_string.width(), 34);
|
||||
tft.set_background(COLOR_BACKGROUND);
|
||||
tft.add_text(0, 0, Z_BTN_COLOR, tft_string);
|
||||
tft.queue.sync();
|
||||
tft_string.set("Offset");
|
||||
tft_string.set(F("Offset"));
|
||||
tft.canvas(motionAxisState.zTypePos.x, motionAxisState.zTypePos.y + 34, tft_string.width(), 34);
|
||||
tft.set_background(COLOR_BACKGROUND);
|
||||
if (motionAxisState.z_selection == Z_SELECTION_Z_PROBE) {
|
||||
|
@ -630,17 +636,19 @@ static void drawCurZSelection() {
|
|||
static void drawCurESelection() {
|
||||
tft.canvas(motionAxisState.eNamePos.x, motionAxisState.eNamePos.y, BTN_WIDTH, BTN_HEIGHT);
|
||||
tft.set_background(COLOR_BACKGROUND);
|
||||
tft_string.set("E");
|
||||
tft_string.set('E');
|
||||
tft.add_text(0, 0, E_BTN_COLOR , tft_string);
|
||||
tft.add_text(tft_string.width(), 0, E_BTN_COLOR, ui8tostr3rj(motionAxisState.e_selection));
|
||||
}
|
||||
|
||||
static void drawMessage(const char *msg) {
|
||||
static void drawMessage(PGM_P const msg) {
|
||||
tft.canvas(X_MARGIN, TFT_HEIGHT - Y_MARGIN - 34, TFT_HEIGHT / 2, 34);
|
||||
tft.set_background(COLOR_BACKGROUND);
|
||||
tft.add_text(0, 0, COLOR_YELLOW, msg);
|
||||
}
|
||||
|
||||
static void drawMessage(FSTR_P const fmsg) { drawMessage(FTOP(fmsg)); }
|
||||
|
||||
static void drawAxisValue(const AxisEnum axis) {
|
||||
const float value = (
|
||||
TERN_(HAS_BED_PROBE, axis == Z_AXIS && motionAxisState.z_selection == Z_SELECTION_Z_PROBE ? probe.offset.z :)
|
||||
|
@ -666,7 +674,7 @@ static void moveAxis(const AxisEnum axis, const int8_t direction) {
|
|||
|
||||
#if ENABLED(PREVENT_COLD_EXTRUSION)
|
||||
if (axis == E_AXIS && thermalManager.tooColdToExtrude(motionAxisState.e_selection)) {
|
||||
drawMessage("Too cold");
|
||||
drawMessage(F("Too cold"));
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -282,7 +282,7 @@ void MarlinUI::draw_status_screen() {
|
|||
const bool nhz = axis_should_home(Z_AXIS);
|
||||
uint16_t offset = 25;
|
||||
if (blink && nhz)
|
||||
tft_string.set("?");
|
||||
tft_string.set('?');
|
||||
else {
|
||||
const float z = LOGICAL_Z_POSITION(current_position.z);
|
||||
tft_string.set(ftostr52sp((int16_t)z));
|
||||
|
@ -461,7 +461,7 @@ void MenuItem_confirm::draw_select_screen(FSTR_P const yes, FSTR_P const no, con
|
|||
tft_string.add(' ');
|
||||
tft_string.add(i16tostr3rj(thermalManager.wholeDegHotend(extruder)));
|
||||
tft_string.add(LCD_STR_DEGREE);
|
||||
tft_string.add(" / ");
|
||||
tft_string.add(F(" / "));
|
||||
tft_string.add(i16tostr3rj(thermalManager.degTargetHotend(extruder)));
|
||||
tft_string.add(LCD_STR_DEGREE);
|
||||
tft_string.trim();
|
||||
|
@ -593,19 +593,19 @@ static void drawCurStepValue() {
|
|||
tft.set_background(COLOR_BACKGROUND);
|
||||
tft.add_text(CUR_STEP_VALUE_WIDTH - tft_string.width(), 0, COLOR_AXIS_HOMED, tft_string);
|
||||
tft.queue.sync();
|
||||
tft_string.set("mm");
|
||||
tft_string.set(F("mm"));
|
||||
tft.canvas(motionAxisState.stepValuePos.x, motionAxisState.stepValuePos.y + 20, CUR_STEP_VALUE_WIDTH, 20);
|
||||
tft.set_background(COLOR_BACKGROUND);
|
||||
tft.add_text(CUR_STEP_VALUE_WIDTH - tft_string.width(), 0, COLOR_AXIS_HOMED, tft_string);
|
||||
}
|
||||
|
||||
static void drawCurZSelection() {
|
||||
tft_string.set("Z");
|
||||
tft_string.set('Z');
|
||||
tft.canvas(motionAxisState.zTypePos.x, motionAxisState.zTypePos.y, tft_string.width(), 20);
|
||||
tft.set_background(COLOR_BACKGROUND);
|
||||
tft.add_text(0, 0, Z_BTN_COLOR, tft_string);
|
||||
tft.queue.sync();
|
||||
tft_string.set("Offset");
|
||||
tft_string.set(F("Offset"));
|
||||
tft.canvas(motionAxisState.zTypePos.x, motionAxisState.zTypePos.y + 34, tft_string.width(), 20);
|
||||
tft.set_background(COLOR_BACKGROUND);
|
||||
if (motionAxisState.z_selection == Z_SELECTION_Z_PROBE) {
|
||||
|
@ -616,7 +616,7 @@ static void drawCurZSelection() {
|
|||
static void drawCurESelection() {
|
||||
tft.canvas(motionAxisState.eNamePos.x, motionAxisState.eNamePos.y, BTN_WIDTH, BTN_HEIGHT);
|
||||
tft.set_background(COLOR_BACKGROUND);
|
||||
tft_string.set("E");
|
||||
tft_string.set('E');
|
||||
tft.add_text(0, 0, E_BTN_COLOR , tft_string);
|
||||
tft.add_text(tft_string.width(), 0, E_BTN_COLOR, ui8tostr3rj(motionAxisState.e_selection));
|
||||
}
|
||||
|
@ -627,6 +627,8 @@ static void drawMessage(PGM_P const msg) {
|
|||
tft.add_text(0, 0, COLOR_YELLOW, msg);
|
||||
}
|
||||
|
||||
static void drawMessage(FSTR_P const fmsg) { drawMessage(FTOP(fmsg)); }
|
||||
|
||||
static void drawAxisValue(const AxisEnum axis) {
|
||||
const float value = (
|
||||
TERN_(HAS_BED_PROBE, axis == Z_AXIS && motionAxisState.z_selection == Z_SELECTION_Z_PROBE ? probe.offset.z :)
|
||||
|
@ -652,7 +654,7 @@ static void moveAxis(const AxisEnum axis, const int8_t direction) {
|
|||
|
||||
#if ENABLED(PREVENT_COLD_EXTRUSION)
|
||||
if (axis == E_AXIS && thermalManager.tooColdToExtrude(motionAxisState.e_selection)) {
|
||||
drawMessage(PSTR("Too cold"));
|
||||
drawMessage(F("Too cold"));
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
@ -679,18 +681,18 @@ static void moveAxis(const AxisEnum axis, const int8_t direction) {
|
|||
drawAxisValue(axis);
|
||||
}
|
||||
else {
|
||||
drawMessage(GET_TEXT(MSG_LCD_SOFT_ENDSTOPS));
|
||||
drawMessage(GET_TEXT_F(MSG_LCD_SOFT_ENDSTOPS));
|
||||
}
|
||||
#elif HAS_BED_PROBE
|
||||
// only change probe.offset.z
|
||||
probe.offset.z += diff;
|
||||
if (direction < 0 && current_position[axis] < Z_PROBE_OFFSET_RANGE_MIN) {
|
||||
current_position[axis] = Z_PROBE_OFFSET_RANGE_MIN;
|
||||
drawMessage(GET_TEXT(MSG_LCD_SOFT_ENDSTOPS));
|
||||
drawMessage(GET_TEXT_F(MSG_LCD_SOFT_ENDSTOPS));
|
||||
}
|
||||
else if (direction > 0 && current_position[axis] > Z_PROBE_OFFSET_RANGE_MAX) {
|
||||
current_position[axis] = Z_PROBE_OFFSET_RANGE_MAX;
|
||||
drawMessage(GET_TEXT(MSG_LCD_SOFT_ENDSTOPS));
|
||||
drawMessage(GET_TEXT_F(MSG_LCD_SOFT_ENDSTOPS));
|
||||
}
|
||||
else {
|
||||
drawMessage(NUL_STR); // clear the error
|
||||
|
@ -752,7 +754,7 @@ static void z_minus() { moveAxis(Z_AXIS, -1); }
|
|||
|
||||
static void do_home() {
|
||||
quick_feedback();
|
||||
drawMessage(GET_TEXT(MSG_LEVEL_BED_HOMING));
|
||||
drawMessage(GET_TEXT_F(MSG_LEVEL_BED_HOMING));
|
||||
queue.inject_P(G28_STR);
|
||||
// Disable touch until home is done
|
||||
TERN_(HAS_TFT_XPT2046, touch.disable());
|
||||
|
|
|
@ -283,7 +283,7 @@ void MarlinUI::draw_status_screen() {
|
|||
uint16_t offset = 32;
|
||||
const bool nhz = axis_should_home(Z_AXIS);
|
||||
if (blink && nhz)
|
||||
tft_string.set("?");
|
||||
tft_string.set('?');
|
||||
else {
|
||||
const float z = LOGICAL_Z_POSITION(current_position.z);
|
||||
tft_string.set(ftostr52sp((int16_t)z));
|
||||
|
@ -466,7 +466,7 @@ void MenuItem_confirm::draw_select_screen(FSTR_P const yes, FSTR_P const no, con
|
|||
tft_string.add(' ');
|
||||
tft_string.add(i16tostr3rj(thermalManager.wholeDegHotend(extruder)));
|
||||
tft_string.add(LCD_STR_DEGREE);
|
||||
tft_string.add(" / ");
|
||||
tft_string.add(F(" / "));
|
||||
tft_string.add(i16tostr3rj(thermalManager.degTargetHotend(extruder)));
|
||||
tft_string.add(LCD_STR_DEGREE);
|
||||
tft_string.trim();
|
||||
|
@ -594,19 +594,19 @@ static void quick_feedback() {
|
|||
#define CUR_STEP_VALUE_WIDTH 104
|
||||
static void drawCurStepValue() {
|
||||
tft_string.set(ftostr52sp(motionAxisState.currentStepSize));
|
||||
tft_string.add("mm");
|
||||
tft_string.add(F("mm"));
|
||||
tft.canvas(motionAxisState.stepValuePos.x, motionAxisState.stepValuePos.y, CUR_STEP_VALUE_WIDTH, BTN_HEIGHT);
|
||||
tft.set_background(COLOR_BACKGROUND);
|
||||
tft.add_text(tft_string.center(CUR_STEP_VALUE_WIDTH), 0, COLOR_AXIS_HOMED, tft_string);
|
||||
}
|
||||
|
||||
static void drawCurZSelection() {
|
||||
tft_string.set("Z");
|
||||
tft_string.set('Z');
|
||||
tft.canvas(motionAxisState.zTypePos.x, motionAxisState.zTypePos.y, tft_string.width(), 34);
|
||||
tft.set_background(COLOR_BACKGROUND);
|
||||
tft.add_text(0, 0, Z_BTN_COLOR, tft_string);
|
||||
tft.queue.sync();
|
||||
tft_string.set("Offset");
|
||||
tft_string.set(F("Offset"));
|
||||
tft.canvas(motionAxisState.zTypePos.x, motionAxisState.zTypePos.y + 34, tft_string.width(), 34);
|
||||
tft.set_background(COLOR_BACKGROUND);
|
||||
if (motionAxisState.z_selection == Z_SELECTION_Z_PROBE) {
|
||||
|
@ -617,7 +617,7 @@ static void drawCurZSelection() {
|
|||
static void drawCurESelection() {
|
||||
tft.canvas(motionAxisState.eNamePos.x, motionAxisState.eNamePos.y, BTN_WIDTH, BTN_HEIGHT);
|
||||
tft.set_background(COLOR_BACKGROUND);
|
||||
tft_string.set("E");
|
||||
tft_string.set('E');
|
||||
tft.add_text(0, 0, E_BTN_COLOR , tft_string);
|
||||
tft.add_text(tft_string.width(), 0, E_BTN_COLOR, ui8tostr3rj(motionAxisState.e_selection));
|
||||
}
|
||||
|
@ -628,6 +628,8 @@ static void drawMessage(PGM_P const msg) {
|
|||
tft.add_text(0, 0, COLOR_YELLOW, msg);
|
||||
}
|
||||
|
||||
static void drawMessage(FSTR_P const fmsg) { drawMessage(FTOP(fmsg)); }
|
||||
|
||||
static void drawAxisValue(const AxisEnum axis) {
|
||||
const float value = (
|
||||
TERN_(HAS_BED_PROBE, axis == Z_AXIS && motionAxisState.z_selection == Z_SELECTION_Z_PROBE ? probe.offset.z :)
|
||||
|
@ -653,7 +655,7 @@ static void moveAxis(const AxisEnum axis, const int8_t direction) {
|
|||
|
||||
#if ENABLED(PREVENT_COLD_EXTRUSION)
|
||||
if (axis == E_AXIS && thermalManager.tooColdToExtrude(motionAxisState.e_selection)) {
|
||||
drawMessage(PSTR("Too cold"));
|
||||
drawMessage(F("Too cold"));
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
@ -680,18 +682,18 @@ static void moveAxis(const AxisEnum axis, const int8_t direction) {
|
|||
drawAxisValue(axis);
|
||||
}
|
||||
else {
|
||||
drawMessage(GET_TEXT(MSG_LCD_SOFT_ENDSTOPS));
|
||||
drawMessage(GET_TEXT_F(MSG_LCD_SOFT_ENDSTOPS));
|
||||
}
|
||||
#elif HAS_BED_PROBE
|
||||
// only change probe.offset.z
|
||||
probe.offset.z += diff;
|
||||
if (direction < 0 && current_position[axis] < Z_PROBE_OFFSET_RANGE_MIN) {
|
||||
current_position[axis] = Z_PROBE_OFFSET_RANGE_MIN;
|
||||
drawMessage(GET_TEXT(MSG_LCD_SOFT_ENDSTOPS));
|
||||
drawMessage(GET_TEXT_F(MSG_LCD_SOFT_ENDSTOPS));
|
||||
}
|
||||
else if (direction > 0 && current_position[axis] > Z_PROBE_OFFSET_RANGE_MAX) {
|
||||
current_position[axis] = Z_PROBE_OFFSET_RANGE_MAX;
|
||||
drawMessage(GET_TEXT(MSG_LCD_SOFT_ENDSTOPS));
|
||||
drawMessage(GET_TEXT_F(MSG_LCD_SOFT_ENDSTOPS));
|
||||
}
|
||||
else {
|
||||
drawMessage(NUL_STR); // clear the error
|
||||
|
@ -753,7 +755,7 @@ static void z_minus() { moveAxis(Z_AXIS, -1); }
|
|||
|
||||
static void do_home() {
|
||||
quick_feedback();
|
||||
drawMessage(GET_TEXT(MSG_LEVEL_BED_HOMING));
|
||||
drawMessage(GET_TEXT_F(MSG_LEVEL_BED_HOMING));
|
||||
queue.inject_P(G28_STR);
|
||||
// Disable touch until home is done
|
||||
TERN_(HAS_TFT_XPT2046, touch.disable());
|
||||
|
|
Loading…
Reference in a new issue