🎨 Updated string macros
This commit is contained in:
@ -416,7 +416,7 @@ bool UIFlashStorage::is_present = false;
|
||||
/* Writes a media file from the SD card/USB flash drive into a slot on the SPI Flash. Media
|
||||
* files must be written sequentially following by a chip erase and it is not possible to
|
||||
* overwrite files. */
|
||||
UIFlashStorage::error_t UIFlashStorage::write_media_file(progmem_str filename, uint8_t slot) {
|
||||
UIFlashStorage::error_t UIFlashStorage::write_media_file(FSTR_P filename, uint8_t slot) {
|
||||
#if ENABLED(SDSUPPORT)
|
||||
uint32_t addr;
|
||||
uint8_t buff[write_page_size];
|
||||
@ -543,7 +543,7 @@ bool UIFlashStorage::is_present = false;
|
||||
void UIFlashStorage::write_config_data(const void *, size_t) {}
|
||||
bool UIFlashStorage::verify_config_data(const void *, size_t) {return false;}
|
||||
bool UIFlashStorage::read_config_data(void *, size_t ) {return false;}
|
||||
UIFlashStorage::error_t UIFlashStorage::write_media_file(progmem_str, uint8_t) {return FILE_NOT_FOUND;}
|
||||
UIFlashStorage::error_t UIFlashStorage::write_media_file(FSTR_P, uint8_t) {return FILE_NOT_FOUND;}
|
||||
void UIFlashStorage::format_flash() {}
|
||||
|
||||
bool UIFlashStorage::BootMediaReader::isAvailable(uint32_t) {return false;}
|
||||
|
@ -88,7 +88,7 @@ class UIFlashStorage : private SPIFlash {
|
||||
static void write_config_data (const void *data, size_t size);
|
||||
static bool verify_config_data (const void *data, size_t size);
|
||||
static bool read_config_data (void *data, size_t size);
|
||||
static error_t write_media_file (progmem_str filename, uint8_t slot = 0);
|
||||
static error_t write_media_file (FSTR_P filename, uint8_t slot = 0);
|
||||
|
||||
class BootMediaReader;
|
||||
};
|
||||
|
@ -105,7 +105,7 @@ bool BioPrintingDialogBox::onTouchEnd(uint8_t tag) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void BioPrintingDialogBox::setStatusMessage(progmem_str message) {
|
||||
void BioPrintingDialogBox::setStatusMessage(FSTR_P message) {
|
||||
char buff[strlen_P((const char*)message)+1];
|
||||
strcpy_P(buff, (const char*) message);
|
||||
setStatusMessage(buff);
|
||||
|
@ -37,7 +37,7 @@ class BioPrintingDialogBox : public BaseScreen, public CachedScreen<PRINTING_SCR
|
||||
static void show();
|
||||
|
||||
static void setStatusMessage(const char *);
|
||||
static void setStatusMessage(progmem_str);
|
||||
static void setStatusMessage(FSTR_P);
|
||||
|
||||
static void onIdle();
|
||||
static bool onTouchEnd(uint8_t tag);
|
||||
|
@ -354,7 +354,7 @@ bool StatusScreen::onTouchHeld(uint8_t tag) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void StatusScreen::setStatusMessage(progmem_str pstr) {
|
||||
void StatusScreen::setStatusMessage(FSTR_P pstr) {
|
||||
BioPrintingDialogBox::setStatusMessage(pstr);
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ class StatusScreen : public BaseScreen, public CachedScreen<STATUS_SCREEN_CACHE>
|
||||
static void unlockMotors();
|
||||
|
||||
static void setStatusMessage(const char *);
|
||||
static void setStatusMessage(progmem_str);
|
||||
static void setStatusMessage(FSTR_P);
|
||||
|
||||
static void onRedraw(draw_mode_t);
|
||||
|
||||
|
@ -81,7 +81,7 @@ void PreheatTimerScreen::draw_interaction_buttons(draw_mode_t what) {
|
||||
}
|
||||
}
|
||||
|
||||
void PreheatTimerScreen::draw_adjuster(draw_mode_t what, uint8_t tag, progmem_str label, float value, int16_t x, int16_t y, int16_t w, int16_t h) {
|
||||
void PreheatTimerScreen::draw_adjuster(draw_mode_t what, uint8_t tag, FSTR_P label, float value, int16_t x, int16_t y, int16_t w, int16_t h) {
|
||||
#define SUB_COLS 9
|
||||
#define SUB_ROWS 2
|
||||
|
||||
|
@ -35,7 +35,7 @@ class PreheatTimerScreen : public BaseScreen, public CachedScreen<PREHEAT_TIMER_
|
||||
static void draw_message(draw_mode_t);
|
||||
static void draw_time_remaining(draw_mode_t);
|
||||
static void draw_interaction_buttons(draw_mode_t);
|
||||
static void draw_adjuster(draw_mode_t, uint8_t tag, progmem_str label, float value, int16_t x, int16_t y, int16_t w, int16_t h);
|
||||
static void draw_adjuster(draw_mode_t, uint8_t tag, FSTR_P label, float value, int16_t x, int16_t y, int16_t w, int16_t h);
|
||||
public:
|
||||
static void onRedraw(draw_mode_t);
|
||||
|
||||
|
@ -279,7 +279,7 @@ bool StatusScreen::onTouchHeld(uint8_t tag) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void StatusScreen::setStatusMessage(progmem_str) {
|
||||
void StatusScreen::setStatusMessage(FSTR_P) {
|
||||
}
|
||||
|
||||
void StatusScreen::setStatusMessage(const char * const) {
|
||||
|
@ -44,7 +44,7 @@ class StatusScreen : public BaseScreen, public CachedScreen<STATUS_SCREEN_CACHE>
|
||||
static void unlockMotors();
|
||||
|
||||
static void setStatusMessage(const char *);
|
||||
static void setStatusMessage(progmem_str);
|
||||
static void setStatusMessage(FSTR_P);
|
||||
|
||||
static void onRedraw(draw_mode_t);
|
||||
|
||||
|
@ -49,5 +49,5 @@
|
||||
#endif
|
||||
|
||||
class __FlashStringHelper;
|
||||
typedef const __FlashStringHelper *progmem_str;
|
||||
typedef const __FlashStringHelper *FSTR_P;
|
||||
extern const char G28_STR[];
|
||||
|
@ -71,7 +71,7 @@ namespace ExtUI {
|
||||
}
|
||||
|
||||
void onStatusChanged(const char *lcd_msg) { StatusScreen::setStatusMessage(lcd_msg); }
|
||||
void onStatusChanged(progmem_str lcd_msg) { StatusScreen::setStatusMessage(lcd_msg); }
|
||||
void onStatusChanged(FSTR_P lcd_msg) { StatusScreen::setStatusMessage(lcd_msg); }
|
||||
|
||||
void onPrintTimerStarted() {
|
||||
InterfaceSoundsScreen::playEventSound(InterfaceSoundsScreen::PRINTING_STARTED);
|
||||
|
@ -66,7 +66,7 @@ uint16_t CLCD::FontMetrics::get_text_width(const char *str, size_t n) const {
|
||||
return width;
|
||||
}
|
||||
|
||||
uint16_t CLCD::FontMetrics::get_text_width(progmem_str str, size_t n) const {
|
||||
uint16_t CLCD::FontMetrics::get_text_width(FSTR_P str, size_t n) const {
|
||||
uint16_t width = 0;
|
||||
const uint8_t *p = (const uint8_t *) str;
|
||||
for (;;) {
|
||||
@ -162,7 +162,7 @@ void CLCD::mem_write_bulk(uint32_t reg_address, const void *data, uint16_t len,
|
||||
}
|
||||
|
||||
// Write 3-Byte Address, Multiple Bytes, plus padding bytes, from PROGMEM
|
||||
void CLCD::mem_write_bulk(uint32_t reg_address, progmem_str str, uint16_t len, uint8_t padding) {
|
||||
void CLCD::mem_write_bulk(uint32_t reg_address, FSTR_P str, uint16_t len, uint8_t padding) {
|
||||
spi_ftdi_select();
|
||||
spi_write_addr(reg_address);
|
||||
spi_write_bulk<pgm_write>(str, len, padding);
|
||||
@ -178,7 +178,7 @@ void CLCD::mem_write_pgm(uint32_t reg_address, const void *data, uint16_t len, u
|
||||
}
|
||||
|
||||
// Write 3-Byte Address, Multiple Bytes, plus padding bytes, from PROGMEM, reversing bytes (suitable for loading XBM images)
|
||||
void CLCD::mem_write_xbm(uint32_t reg_address, progmem_str data, uint16_t len, uint8_t padding) {
|
||||
void CLCD::mem_write_xbm(uint32_t reg_address, FSTR_P data, uint16_t len, uint8_t padding) {
|
||||
spi_ftdi_select();
|
||||
spi_write_addr(reg_address);
|
||||
spi_write_bulk<xbm_write>(data, len, padding);
|
||||
@ -1048,7 +1048,7 @@ template <class T> bool CLCD::CommandFifo::write(T data, uint16_t len) {
|
||||
#endif // ... FTDI_API_LEVEL != 800
|
||||
|
||||
template bool CLCD::CommandFifo::write(const void*, uint16_t);
|
||||
template bool CLCD::CommandFifo::write(progmem_str, uint16_t);
|
||||
template bool CLCD::CommandFifo::write(FSTR_P, uint16_t);
|
||||
|
||||
// CO_PROCESSOR COMMANDS
|
||||
|
||||
@ -1071,7 +1071,7 @@ void CLCD::CommandFifo::str(const char * data) {
|
||||
write(data, strlen(data)+1);
|
||||
}
|
||||
|
||||
void CLCD::CommandFifo::str(progmem_str data) {
|
||||
void CLCD::CommandFifo::str(FSTR_P data) {
|
||||
write(data, strlen_P((const char*)data)+1);
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
typedef const __FlashStringHelper *progmem_str;
|
||||
typedef const __FlashStringHelper *FSTR_P;
|
||||
|
||||
class UIStorage;
|
||||
|
||||
@ -118,8 +118,8 @@ class CLCD {
|
||||
static void mem_write_fill (uint32_t reg_address, uint8_t w_data, uint16_t len);
|
||||
static void mem_write_bulk (uint32_t reg_address, const void *data, uint16_t len, uint8_t padding = 0);
|
||||
static void mem_write_pgm (uint32_t reg_address, const void *data, uint16_t len, uint8_t padding = 0);
|
||||
static void mem_write_bulk (uint32_t reg_address, progmem_str str, uint16_t len, uint8_t padding = 0);
|
||||
static void mem_write_xbm (uint32_t reg_address, progmem_str str, uint16_t len, uint8_t padding = 0);
|
||||
static void mem_write_bulk (uint32_t reg_address, FSTR_P str, uint16_t len, uint8_t padding = 0);
|
||||
static void mem_write_xbm (uint32_t reg_address, FSTR_P str, uint16_t len, uint8_t padding = 0);
|
||||
|
||||
public:
|
||||
class CommandFifo;
|
||||
@ -168,7 +168,7 @@ class CLCD::FontMetrics {
|
||||
|
||||
// Returns width of string, up to a maximum of n characters.
|
||||
uint16_t get_text_width(const char *str, size_t n = SIZE_MAX) const;
|
||||
uint16_t get_text_width(progmem_str str, size_t n = SIZE_MAX) const;
|
||||
uint16_t get_text_width(FSTR_P str, size_t n = SIZE_MAX) const;
|
||||
};
|
||||
|
||||
/******************* FT800/810 Graphic Commands *********************************/
|
||||
@ -250,7 +250,7 @@ class CLCD::CommandFifo {
|
||||
// Sends the string portion of text, button, toggle and keys.
|
||||
void str (const char * data, size_t maxlen);
|
||||
void str (const char * data);
|
||||
void str (progmem_str data);
|
||||
void str (FSTR_P data);
|
||||
|
||||
void memzero (uint32_t ptr, uint32_t size);
|
||||
void memset (uint32_t ptr, uint32_t value, uint32_t size);
|
||||
|
@ -30,7 +30,7 @@
|
||||
#define DEC_POS SUB_POS(8,1), SUB_SIZE(2,1)
|
||||
|
||||
namespace FTDI {
|
||||
void draw_adjuster_value(CommandProcessor& cmd, int16_t x, int16_t y, int16_t w, int16_t h, float value, progmem_str units, int8_t width, uint8_t precision) {
|
||||
void draw_adjuster_value(CommandProcessor& cmd, int16_t x, int16_t y, int16_t w, int16_t h, float value, FSTR_P units, int8_t width, uint8_t precision) {
|
||||
char str[width + precision + 10 + (units ? strlen_P((const char*) units) : 0)];
|
||||
if (isnan(value))
|
||||
strcpy_P(str, PSTR("-"));
|
||||
@ -45,7 +45,7 @@ namespace FTDI {
|
||||
cmd.tag(0).text(VAL_POS, str);
|
||||
}
|
||||
|
||||
void draw_adjuster(CommandProcessor& cmd, int16_t x, int16_t y, int16_t w, int16_t h, uint8_t tag, float value, progmem_str units, int8_t width, uint8_t precision, draw_mode_t what) {
|
||||
void draw_adjuster(CommandProcessor& cmd, int16_t x, int16_t y, int16_t w, int16_t h, uint8_t tag, float value, FSTR_P units, int8_t width, uint8_t precision, draw_mode_t what) {
|
||||
if (what & BACKGROUND)
|
||||
cmd.tag(0).button(VAL_POS, F(""), FTDI::OPT_FLAT);
|
||||
|
||||
|
@ -25,7 +25,7 @@ namespace FTDI {
|
||||
void draw_adjuster_value(
|
||||
CommandProcessor& cmd,
|
||||
int16_t x, int16_t y, int16_t w, int16_t h,
|
||||
float value, progmem_str units = nullptr,
|
||||
float value, FSTR_P units = nullptr,
|
||||
int8_t width = 5, uint8_t precision = 1
|
||||
);
|
||||
|
||||
@ -33,7 +33,7 @@ namespace FTDI {
|
||||
CommandProcessor& cmd,
|
||||
int16_t x, int16_t y, int16_t w, int16_t h,
|
||||
uint8_t tag,
|
||||
float value, progmem_str units = nullptr,
|
||||
float value, FSTR_P units = nullptr,
|
||||
int8_t width = 5, uint8_t precision = 1,
|
||||
draw_mode_t what = BOTH
|
||||
);
|
||||
|
@ -241,7 +241,7 @@ class CommandProcessor : public CLCD::CommandFifo {
|
||||
return *this;
|
||||
}
|
||||
|
||||
CommandProcessor& toggle2(int16_t x, int16_t y, int16_t w, int16_t h, progmem_str no, progmem_str yes, bool state, uint16_t options = FTDI::OPT_3D) {
|
||||
CommandProcessor& toggle2(int16_t x, int16_t y, int16_t w, int16_t h, FSTR_P no, FSTR_P yes, bool state, uint16_t options = FTDI::OPT_3D) {
|
||||
char text[strlen_P((const char *)no) + strlen_P((const char *)yes) + 2];
|
||||
strcpy_P(text, (const char *)no);
|
||||
strcat(text, "\xFF");
|
||||
|
@ -135,7 +135,7 @@ namespace FTDI {
|
||||
}
|
||||
}
|
||||
|
||||
void draw_text_box(CommandProcessor& cmd, int x, int y, int w, int h, progmem_str pstr, uint16_t options, uint8_t font) {
|
||||
void draw_text_box(CommandProcessor& cmd, int x, int y, int w, int h, FSTR_P pstr, uint16_t options, uint8_t font) {
|
||||
char str[strlen_P((const char*)pstr) + 1];
|
||||
strcpy_P(str, (const char*)pstr);
|
||||
draw_text_box(cmd, x, y, w, h, (const char*) str, options, font);
|
||||
|
@ -27,6 +27,6 @@
|
||||
namespace FTDI {
|
||||
constexpr uint16_t OPT_BOTTOMY = 0x1000; // Non-standard
|
||||
|
||||
void draw_text_box(class CommandProcessor& cmd, int x, int y, int w, int h, progmem_str str, uint16_t options = 0, uint8_t font = 31);
|
||||
void draw_text_box(class CommandProcessor& cmd, int x, int y, int w, int h, FSTR_P str, uint16_t options = 0, uint8_t font = 31);
|
||||
void draw_text_box(class CommandProcessor& cmd, int x, int y, int w, int h, const char *str, uint16_t options = 0, uint8_t font = 31);
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ namespace FTDI {
|
||||
_draw_text_with_ellipsis(cmd, x, y, w, h, tmp, options, font);
|
||||
}
|
||||
|
||||
void draw_text_with_ellipsis(CommandProcessor& cmd, int x, int y, int w, int h, progmem_str pstr, uint16_t options, uint8_t font) {
|
||||
void draw_text_with_ellipsis(CommandProcessor& cmd, int x, int y, int w, int h, FSTR_P pstr, uint16_t options, uint8_t font) {
|
||||
char tmp[strlen_P((const char*)pstr) + 3];
|
||||
strcpy_P(tmp, (const char*)pstr);
|
||||
_draw_text_with_ellipsis(cmd, x, y, w, h, tmp, options, font);
|
||||
|
@ -26,6 +26,6 @@
|
||||
* showing ellipsis if it does not fit.
|
||||
*/
|
||||
namespace FTDI {
|
||||
void draw_text_with_ellipsis(class CommandProcessor& cmd, int x, int y, int w, int h, progmem_str str, uint16_t options = 0, uint8_t font = 31);
|
||||
void draw_text_with_ellipsis(class CommandProcessor& cmd, int x, int y, int w, int h, FSTR_P str, uint16_t options = 0, uint8_t font = 31);
|
||||
void draw_text_with_ellipsis(class CommandProcessor& cmd, int x, int y, int w, int h, const char *str, uint16_t options = 0, uint8_t font = 31);
|
||||
}
|
||||
|
@ -44,7 +44,7 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
bool FTDI::has_utf8_chars(progmem_str _str) {
|
||||
bool FTDI::has_utf8_chars(FSTR_P _str) {
|
||||
const char *str = (const char *) _str;
|
||||
for (;;) {
|
||||
const char c = pgm_read_byte(str++);
|
||||
@ -191,7 +191,7 @@
|
||||
return render_utf8_text(nullptr, 0, 0, str, fs, maxlen);
|
||||
}
|
||||
|
||||
uint16_t FTDI::get_utf8_text_width(progmem_str pstr, font_size_t fs) {
|
||||
uint16_t FTDI::get_utf8_text_width(FSTR_P pstr, font_size_t fs) {
|
||||
char str[strlen_P((const char*)pstr) + 1];
|
||||
strcpy_P(str, (const char*)pstr);
|
||||
return get_utf8_text_width(str, fs);
|
||||
@ -234,7 +234,7 @@
|
||||
cmd.cmd(RESTORE_CONTEXT());
|
||||
}
|
||||
|
||||
void FTDI::draw_utf8_text(CommandProcessor& cmd, int x, int y, progmem_str pstr, font_size_t fs, uint16_t options) {
|
||||
void FTDI::draw_utf8_text(CommandProcessor& cmd, int x, int y, FSTR_P pstr, font_size_t fs, uint16_t options) {
|
||||
char str[strlen_P((const char*)pstr) + 1];
|
||||
strcpy_P(str, (const char*)pstr);
|
||||
draw_utf8_text(cmd, x, y, (const char*) str, fs, options);
|
||||
|
@ -40,7 +40,7 @@ namespace FTDI {
|
||||
|
||||
/* Returns true if the string has UTF8 string characters */
|
||||
|
||||
bool has_utf8_chars(progmem_str str);
|
||||
bool has_utf8_chars(FSTR_P str);
|
||||
bool has_utf8_chars(const char *str);
|
||||
|
||||
/* Returns the next character in a UTF8 string and increments the
|
||||
@ -66,10 +66,10 @@ namespace FTDI {
|
||||
void load_utf8_bitmaps(CommandProcessor& cmd);
|
||||
|
||||
uint16_t get_utf8_char_width(utf8_char_t, font_size_t);
|
||||
uint16_t get_utf8_text_width(progmem_str, font_size_t);
|
||||
uint16_t get_utf8_text_width(FSTR_P, font_size_t);
|
||||
uint16_t get_utf8_text_width(const char *, font_size_t, size_t maxlen=SIZE_MAX);
|
||||
|
||||
void draw_utf8_text(CommandProcessor&, int x, int y, progmem_str, font_size_t, uint16_t options = 0);
|
||||
void draw_utf8_text(CommandProcessor&, int x, int y, FSTR_P, font_size_t, uint16_t options = 0);
|
||||
void draw_utf8_text(CommandProcessor&, int x, int y, const char *, font_size_t, uint16_t options = 0, size_t maxlen=SIZE_MAX);
|
||||
|
||||
// Similar to CLCD::FontMetrics, but can be used with UTF8 encoded strings.
|
||||
|
@ -83,7 +83,7 @@ void AboutScreen::onRedraw(draw_mode_t) {
|
||||
#ifdef TOUCH_UI_VERSION
|
||||
F(TOUCH_UI_VERSION)
|
||||
#else
|
||||
progmem_str(getFirmwareName_str())
|
||||
FPSTR(getFirmwareName_str())
|
||||
#endif
|
||||
, OPT_CENTER, font_medium);
|
||||
cmd.tag(0);
|
||||
|
@ -64,8 +64,8 @@ void AlertDialogBox::hide() {
|
||||
}
|
||||
|
||||
template void AlertDialogBox::show(const char *);
|
||||
template void AlertDialogBox::show(progmem_str);
|
||||
template void AlertDialogBox::show(FSTR_P);
|
||||
template void AlertDialogBox::showError(const char *);
|
||||
template void AlertDialogBox::showError(progmem_str);
|
||||
template void AlertDialogBox::showError(FSTR_P);
|
||||
|
||||
#endif // FTDI_ALERT_DIALOG_BOX
|
||||
|
@ -109,7 +109,7 @@ void BaseNumericAdjustmentScreen::widgets_t::_button_style(CommandProcessor &cmd
|
||||
* Speed optimization for drawing buttons. Draw all unpressed buttons in the
|
||||
* background layer and draw only the pressed button in the foreground layer.
|
||||
*/
|
||||
void BaseNumericAdjustmentScreen::widgets_t::_button(CommandProcessor &cmd, uint8_t tag, int16_t x, int16_t y, int16_t w, int16_t h, progmem_str text, bool enabled, bool highlight) {
|
||||
void BaseNumericAdjustmentScreen::widgets_t::_button(CommandProcessor &cmd, uint8_t tag, int16_t x, int16_t y, int16_t w, int16_t h, FSTR_P text, bool enabled, bool highlight) {
|
||||
if (_what & BACKGROUND) enabled = true;
|
||||
if ((_what & BACKGROUND) || buttonIsPressed(tag) || highlight || !enabled) {
|
||||
_button_style(cmd, (!enabled) ? BTN_DISABLED : (highlight ? BTN_ACTION : BTN_NORMAL));
|
||||
@ -125,7 +125,7 @@ BaseNumericAdjustmentScreen::widgets_t &BaseNumericAdjustmentScreen::widgets_t::
|
||||
return *this;
|
||||
}
|
||||
|
||||
void BaseNumericAdjustmentScreen::widgets_t::heading(progmem_str label) {
|
||||
void BaseNumericAdjustmentScreen::widgets_t::heading(FSTR_P label) {
|
||||
if (_what & BACKGROUND) {
|
||||
CommandProcessor cmd;
|
||||
_button_style(cmd, TEXT_LABEL);
|
||||
@ -176,13 +176,13 @@ void BaseNumericAdjustmentScreen::widgets_t::_draw_increment_btn(CommandProcesso
|
||||
|
||||
switch (pos) {
|
||||
#if ENABLED(TOUCH_UI_PORTRAIT)
|
||||
case 0: _button(cmd, tag, BTN_POS(5,_line), BTN_SIZE(2,1), progmem_str(label), true, highlight); break;
|
||||
case 1: _button(cmd, tag, BTN_POS(7,_line), BTN_SIZE(2,1), progmem_str(label), true, highlight); break;
|
||||
case 2: _button(cmd, tag, BTN_POS(9,_line), BTN_SIZE(2,1), progmem_str(label), true, highlight); break;
|
||||
case 0: _button(cmd, tag, BTN_POS(5,_line), BTN_SIZE(2,1), FPSTR(label), true, highlight); break;
|
||||
case 1: _button(cmd, tag, BTN_POS(7,_line), BTN_SIZE(2,1), FPSTR(label), true, highlight); break;
|
||||
case 2: _button(cmd, tag, BTN_POS(9,_line), BTN_SIZE(2,1), FPSTR(label), true, highlight); break;
|
||||
#else
|
||||
case 0: _button(cmd, tag, BTN_POS(15,2), BTN_SIZE(4,1), progmem_str(label), true, highlight); break;
|
||||
case 1: _button(cmd, tag, BTN_POS(15,3), BTN_SIZE(4,1), progmem_str(label), true, highlight); break;
|
||||
case 2: _button(cmd, tag, BTN_POS(15,4), BTN_SIZE(4,1), progmem_str(label), true, highlight); break;
|
||||
case 0: _button(cmd, tag, BTN_POS(15,2), BTN_SIZE(4,1), FPSTR(label), true, highlight); break;
|
||||
case 1: _button(cmd, tag, BTN_POS(15,3), BTN_SIZE(4,1), FPSTR(label), true, highlight); break;
|
||||
case 2: _button(cmd, tag, BTN_POS(15,4), BTN_SIZE(4,1), FPSTR(label), true, highlight); break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -213,7 +213,7 @@ void BaseNumericAdjustmentScreen::widgets_t::increments() {
|
||||
#endif
|
||||
}
|
||||
|
||||
void BaseNumericAdjustmentScreen::widgets_t::adjuster_sram_val(uint8_t tag, progmem_str label, const char *value, bool is_enabled) {
|
||||
void BaseNumericAdjustmentScreen::widgets_t::adjuster_sram_val(uint8_t tag, FSTR_P label, const char *value, bool is_enabled) {
|
||||
CommandProcessor cmd;
|
||||
|
||||
if (_what & BACKGROUND) {
|
||||
@ -239,7 +239,7 @@ void BaseNumericAdjustmentScreen::widgets_t::adjuster_sram_val(uint8_t tag, prog
|
||||
_line++;
|
||||
}
|
||||
|
||||
void BaseNumericAdjustmentScreen::widgets_t::adjuster(uint8_t tag, progmem_str label, const char *value, bool is_enabled) {
|
||||
void BaseNumericAdjustmentScreen::widgets_t::adjuster(uint8_t tag, FSTR_P label, const char *value, bool is_enabled) {
|
||||
if (_what & BACKGROUND) {
|
||||
adjuster_sram_val(tag, label, nullptr);
|
||||
}
|
||||
@ -251,7 +251,7 @@ void BaseNumericAdjustmentScreen::widgets_t::adjuster(uint8_t tag, progmem_str l
|
||||
}
|
||||
}
|
||||
|
||||
void BaseNumericAdjustmentScreen::widgets_t::adjuster(uint8_t tag, progmem_str label, float value, bool is_enabled) {
|
||||
void BaseNumericAdjustmentScreen::widgets_t::adjuster(uint8_t tag, FSTR_P label, float value, bool is_enabled) {
|
||||
if (_what & BACKGROUND) {
|
||||
adjuster_sram_val(tag, label, nullptr);
|
||||
}
|
||||
@ -265,7 +265,7 @@ void BaseNumericAdjustmentScreen::widgets_t::adjuster(uint8_t tag, progmem_str l
|
||||
}
|
||||
}
|
||||
|
||||
void BaseNumericAdjustmentScreen::widgets_t::button(uint8_t tag, progmem_str label, bool is_enabled) {
|
||||
void BaseNumericAdjustmentScreen::widgets_t::button(uint8_t tag, FSTR_P label, bool is_enabled) {
|
||||
CommandProcessor cmd;
|
||||
cmd.font(LAYOUT_FONT);
|
||||
_button(cmd, tag, BTN_POS(5,_line), BTN_SIZE(9,1), label, is_enabled);
|
||||
@ -273,7 +273,7 @@ void BaseNumericAdjustmentScreen::widgets_t::button(uint8_t tag, progmem_str lab
|
||||
_line++;
|
||||
}
|
||||
|
||||
void BaseNumericAdjustmentScreen::widgets_t::text_field(uint8_t tag, progmem_str label, const char *value, bool is_enabled) {
|
||||
void BaseNumericAdjustmentScreen::widgets_t::text_field(uint8_t tag, FSTR_P label, const char *value, bool is_enabled) {
|
||||
CommandProcessor cmd;
|
||||
|
||||
if (_what & BACKGROUND) {
|
||||
@ -295,7 +295,7 @@ void BaseNumericAdjustmentScreen::widgets_t::text_field(uint8_t tag, progmem_str
|
||||
_line++;
|
||||
}
|
||||
|
||||
void BaseNumericAdjustmentScreen::widgets_t::two_buttons(uint8_t tag1, progmem_str label1, uint8_t tag2, progmem_str label2, bool is_enabled) {
|
||||
void BaseNumericAdjustmentScreen::widgets_t::two_buttons(uint8_t tag1, FSTR_P label1, uint8_t tag2, FSTR_P label2, bool is_enabled) {
|
||||
CommandProcessor cmd;
|
||||
cmd.font(LAYOUT_FONT);
|
||||
_button(cmd, tag1, BTN_POS(5,_line), BTN_SIZE(4.5,1), label1, is_enabled);
|
||||
@ -304,7 +304,7 @@ void BaseNumericAdjustmentScreen::widgets_t::two_buttons(uint8_t tag1, progmem_s
|
||||
_line++;
|
||||
}
|
||||
|
||||
void BaseNumericAdjustmentScreen::widgets_t::toggle(uint8_t tag, progmem_str label, bool value, bool is_enabled) {
|
||||
void BaseNumericAdjustmentScreen::widgets_t::toggle(uint8_t tag, FSTR_P label, bool value, bool is_enabled) {
|
||||
CommandProcessor cmd;
|
||||
|
||||
if (_what & BACKGROUND) {
|
||||
|
@ -44,7 +44,7 @@ class BaseNumericAdjustmentScreen : public BaseScreen {
|
||||
uint8_t _line;
|
||||
uint32_t _color;
|
||||
uint8_t _decimals;
|
||||
progmem_str _units;
|
||||
FSTR_P _units;
|
||||
enum style_t {
|
||||
BTN_NORMAL,
|
||||
BTN_ACTION,
|
||||
@ -56,25 +56,25 @@ class BaseNumericAdjustmentScreen : public BaseScreen {
|
||||
|
||||
protected:
|
||||
void _draw_increment_btn(CommandProcessor &, uint8_t line, const uint8_t tag);
|
||||
void _button(CommandProcessor &, uint8_t tag, int16_t x, int16_t y, int16_t w, int16_t h, progmem_str, bool enabled = true, bool highlight = false);
|
||||
void _button(CommandProcessor &, uint8_t tag, int16_t x, int16_t y, int16_t w, int16_t h, FSTR_P, bool enabled = true, bool highlight = false);
|
||||
void _button_style(CommandProcessor &cmd, style_t style);
|
||||
public:
|
||||
widgets_t(draw_mode_t);
|
||||
|
||||
widgets_t &color(uint32_t color) {_color = color; return *this;}
|
||||
widgets_t &units(progmem_str units) {_units = units; return *this;}
|
||||
widgets_t &units(FSTR_P units) {_units = units; return *this;}
|
||||
widgets_t &draw_mode(draw_mode_t what) {_what = what; return *this;}
|
||||
widgets_t &precision(uint8_t decimals, precision_default_t = DEFAULT_HIGHEST);
|
||||
|
||||
void heading (progmem_str label);
|
||||
void adjuster_sram_val (uint8_t tag, progmem_str label, const char *value, bool is_enabled = true);
|
||||
void adjuster (uint8_t tag, progmem_str label, const char *value, bool is_enabled = true);
|
||||
void adjuster (uint8_t tag, progmem_str label, float value=0, bool is_enabled = true);
|
||||
void button (uint8_t tag, progmem_str label, bool is_enabled = true);
|
||||
void text_field (uint8_t tag, progmem_str label, const char *value, bool is_enabled = true);
|
||||
void two_buttons (uint8_t tag1, progmem_str label1,
|
||||
uint8_t tag2, progmem_str label2, bool is_enabled = true);
|
||||
void toggle (uint8_t tag, progmem_str label, bool value, bool is_enabled = true);
|
||||
void heading (FSTR_P label);
|
||||
void adjuster_sram_val (uint8_t tag, FSTR_P label, const char *value, bool is_enabled = true);
|
||||
void adjuster (uint8_t tag, FSTR_P label, const char *value, bool is_enabled = true);
|
||||
void adjuster (uint8_t tag, FSTR_P label, float value=0, bool is_enabled = true);
|
||||
void button (uint8_t tag, FSTR_P label, bool is_enabled = true);
|
||||
void text_field (uint8_t tag, FSTR_P label, const char *value, bool is_enabled = true);
|
||||
void two_buttons (uint8_t tag1, FSTR_P label1,
|
||||
uint8_t tag2, FSTR_P label2, bool is_enabled = true);
|
||||
void toggle (uint8_t tag, FSTR_P label, bool value, bool is_enabled = true);
|
||||
void home_buttons (uint8_t tag);
|
||||
void increments ();
|
||||
};
|
||||
|
@ -25,7 +25,7 @@
|
||||
#define FTDI_BED_MESH_VIEW_SCREEN_CLASS BedMeshViewScreen
|
||||
|
||||
struct BedMeshViewScreenData {
|
||||
progmem_str message;
|
||||
FSTR_P message;
|
||||
uint8_t count;
|
||||
xy_uint8_t highlight;
|
||||
};
|
||||
|
@ -44,7 +44,7 @@ void DialogBoxBaseClass::drawMessage(T message, int16_t font) {
|
||||
}
|
||||
|
||||
template void DialogBoxBaseClass::drawMessage(const char *, int16_t font);
|
||||
template void DialogBoxBaseClass::drawMessage(progmem_str, int16_t font);
|
||||
template void DialogBoxBaseClass::drawMessage(FSTR_P, int16_t font);
|
||||
|
||||
void DialogBoxBaseClass::drawYesNoButtons(uint8_t default_btn) {
|
||||
CommandProcessor cmd;
|
||||
@ -67,7 +67,7 @@ void DialogBoxBaseClass::drawButton(T label) {
|
||||
}
|
||||
|
||||
template void DialogBoxBaseClass::drawButton(const char *);
|
||||
template void DialogBoxBaseClass::drawButton(progmem_str);
|
||||
template void DialogBoxBaseClass::drawButton(FSTR_P);
|
||||
|
||||
bool DialogBoxBaseClass::onTouchEnd(uint8_t tag) {
|
||||
switch (tag) {
|
||||
|
@ -39,7 +39,7 @@ void FilamentRunoutScreen::onRedraw(draw_mode_t what) {
|
||||
w.units(GET_TEXT_F(MSG_UNITS_MM));
|
||||
w.precision(0);
|
||||
w.color(e_axis);
|
||||
w.adjuster( 10, progmem_str(NUL_STR), getFilamentRunoutDistance_mm(), getFilamentRunoutEnabled());
|
||||
w.adjuster( 10, FPSTR(NUL_STR), getFilamentRunoutDistance_mm(), getFilamentRunoutEnabled());
|
||||
w.increments();
|
||||
#endif
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ void LockScreen::onRedraw(draw_mode_t what) {
|
||||
#define MARGIN_T 3
|
||||
#define MARGIN_B 3
|
||||
|
||||
progmem_str message;
|
||||
FSTR_P message;
|
||||
switch (message_style()) {
|
||||
case 'w':
|
||||
message = GET_TEXT_F(MSG_PASSCODE_REJECTED);
|
||||
|
@ -60,7 +60,7 @@ void SpinnerDialogBox::onRefresh() {
|
||||
void SpinnerDialogBox::onRedraw(draw_mode_t) {
|
||||
}
|
||||
|
||||
void SpinnerDialogBox::show(progmem_str message) {
|
||||
void SpinnerDialogBox::show(FSTR_P message) {
|
||||
CommandProcessor cmd;
|
||||
if (AT_SCREEN(SpinnerDialogBox)) cmd.stop().execute();
|
||||
cmd.cmd(CMD_DLSTART)
|
||||
@ -86,13 +86,13 @@ void SpinnerDialogBox::hide() {
|
||||
GOTO_PREVIOUS();
|
||||
}
|
||||
|
||||
void SpinnerDialogBox::enqueueAndWait(progmem_str message, progmem_str commands) {
|
||||
void SpinnerDialogBox::enqueueAndWait(FSTR_P message, FSTR_P commands) {
|
||||
show(message);
|
||||
ExtUI::injectCommands_P((const char*)commands);
|
||||
mydata.auto_hide = true;
|
||||
}
|
||||
|
||||
void SpinnerDialogBox::enqueueAndWait(progmem_str message, char *commands) {
|
||||
void SpinnerDialogBox::enqueueAndWait(FSTR_P message, char *commands) {
|
||||
show(message);
|
||||
ExtUI::injectCommands(commands);
|
||||
mydata.auto_hide = true;
|
||||
|
@ -37,12 +37,12 @@ class SpinnerDialogBox : public UIScreen {
|
||||
static void onRefresh();
|
||||
static void onIdle();
|
||||
|
||||
static void show(progmem_str);
|
||||
static void show(FSTR_P);
|
||||
static void hide();
|
||||
|
||||
template<typename T>
|
||||
static void enqueueAndWait(T commands) {enqueueAndWait(GET_TEXT_F(MSG_PLEASE_WAIT), commands);}
|
||||
|
||||
static void enqueueAndWait(progmem_str message, char *commands);
|
||||
static void enqueueAndWait(progmem_str message, progmem_str commands);
|
||||
static void enqueueAndWait(FSTR_P message, char *commands);
|
||||
static void enqueueAndWait(FSTR_P message, FSTR_P commands);
|
||||
};
|
||||
|
@ -344,7 +344,7 @@ void StatusScreen::draw_status_message(draw_mode_t what, const char *message) {
|
||||
#undef GRID_COLS
|
||||
}
|
||||
|
||||
void StatusScreen::setStatusMessage(progmem_str message) {
|
||||
void StatusScreen::setStatusMessage(FSTR_P message) {
|
||||
char buff[strlen_P((const char * const)message)+1];
|
||||
strcpy_P(buff, (const char * const) message);
|
||||
setStatusMessage((const char *) buff);
|
||||
|
@ -36,7 +36,7 @@ class StatusScreen : public BaseScreen, public CachedScreen<STATUS_SCREEN_CACHE,
|
||||
public:
|
||||
static void loadBitmaps();
|
||||
static void setStatusMessage(const char *);
|
||||
static void setStatusMessage(progmem_str);
|
||||
static void setStatusMessage(FSTR_P);
|
||||
static void onRedraw(draw_mode_t);
|
||||
static void onStartup();
|
||||
static void onEntry();
|
||||
|
@ -59,7 +59,7 @@ void StressTestScreen::onRedraw(draw_mode_t) {
|
||||
.cmd(CLEAR(true,true,true))
|
||||
.cmd(COLOR_RGB(bg_text_enabled))
|
||||
.font(font_medium)
|
||||
.text(BTN_POS(1,1), BTN_SIZE(4,1), progmem_str(mydata.message));
|
||||
.text(BTN_POS(1,1), BTN_SIZE(4,1), FPSTR(mydata.message));
|
||||
|
||||
drawDots(BTN_POS(1,3), BTN_SIZE(4,4));
|
||||
|
||||
|
Reference in New Issue
Block a user