Use PGM_P for PSTR pointers (#11977)

This commit is contained in:
Scott Lahteine
2018-09-30 23:44:33 -05:00
committed by GitHub
parent 4d5566a6b7
commit 11ac75edcb
39 changed files with 166 additions and 165 deletions

View File

@ -75,18 +75,18 @@ void ST7920_Lite_Status_Screen::write_str(const char *str, uint8_t len) {
while (*str && len--) write_byte(*str++);
}
void ST7920_Lite_Status_Screen::write_str_P(const char * const str) {
const char *p_str = (const char *)str;
void ST7920_Lite_Status_Screen::write_str_P(PGM_P const str) {
PGM_P p_str = (PGM_P)str;
while (char c = pgm_read_byte_near(p_str++)) write_byte(c);
}
void ST7920_Lite_Status_Screen::write_str(progmem_str str) {
write_str_P((const char*)str);
write_str_P((PGM_P)str);
}
void ST7920_Lite_Status_Screen::write_number(const int16_t value, const uint8_t digits/*=3*/) {
char str[7];
const char *fmt;
PGM_P fmt;
switch (digits) {
case 6: fmt = PSTR("%6d"); break;
case 5: fmt = PSTR("%5d"); break;

View File

@ -48,7 +48,7 @@ class ST7920_Lite_Status_Screen {
static void write_str(const char *str);
static void write_str(const char *str, const uint8_t len);
static void write_str_P(const char * const str);
static void write_str_P(PGM_P const str);
static void write_str(progmem_str str);
static void write_number(const int16_t value, const uint8_t digits=3);

View File

@ -177,7 +177,7 @@ uint8_t utf8_strlen(const char *pstart) {
return utf8_strlen_cb(pstart, read_byte_ram);
}
uint8_t utf8_strlen_P(const char *pstart) {
uint8_t utf8_strlen_P(PGM_P pstart) {
return utf8_strlen_cb(pstart, read_byte_rom);
}

View File

@ -44,6 +44,6 @@ uint8_t* get_utf8_value_cb(uint8_t *pstart, read_byte_cb_t cb_read_byte, wchar_t
/* Returns lenght of string in CHARACTERS, NOT BYTES */
uint8_t utf8_strlen(const char *pstart);
uint8_t utf8_strlen_P(const char *pstart);
uint8_t utf8_strlen_P(PGM_P pstart);
#endif // _FONT_UTILS_H

View File

@ -45,11 +45,11 @@ int lcd_put_u8str_max(const char * utf8_str, pixel_len_t max_length);
*
* Draw a ROM UTF-8 string
*/
int lcd_put_u8str_max_P(const char * utf8_str_P, pixel_len_t max_length);
int lcd_put_u8str_max_P(PGM_P utf8_str_P, pixel_len_t max_length);
void lcd_moveto(int col, int row);
inline int lcd_put_u8str_P(const char *str) { return lcd_put_u8str_max_P(str, PIXEL_LEN_NOLIMIT); }
inline int lcd_put_u8str_P(PGM_P str) { return lcd_put_u8str_max_P(str, PIXEL_LEN_NOLIMIT); }
inline int lcd_put_u8str(const char* str) { return lcd_put_u8str_max(str, PIXEL_LEN_NOLIMIT); }

View File

@ -1036,7 +1036,7 @@ int lcd_put_u8str_max(const char * utf8_str, pixel_len_t max_length) {
return lcd_put_u8str_max_cb(utf8_str, read_byte_ram, max_length);
}
int lcd_put_u8str_max_P(const char * utf8_str_P, pixel_len_t max_length) {
int lcd_put_u8str_max_P(PGM_P utf8_str_P, pixel_len_t max_length) {
return lcd_put_u8str_max_cb(utf8_str_P, read_byte_rom, max_length);
}

View File

@ -54,7 +54,7 @@ int lcd_put_u8str_max(const char * utf8_str, pixel_len_t max_length) {
return ret;
}
int lcd_put_u8str_max_P(const char * utf8_str_P, pixel_len_t max_length) {
int lcd_put_u8str_max_P(PGM_P utf8_str_P, pixel_len_t max_length) {
unsigned int x = pu8g->getPrintCol(),
y = pu8g->getPrintRow(),
ret = uxg_DrawUtf8StrP(pu8g->getU8g(), x, y, utf8_str_P, max_length);

View File

@ -81,7 +81,7 @@ int inbound_count;
bool last_printing_status = false;
// Everything written needs the high bit set.
void write_to_lcd_P(const char * const message) {
void write_to_lcd_P(PGM_P const message) {
char encoded_message[MAX_CURLY_COMMAND];
uint8_t message_length = MIN(strlen_P(message), sizeof(encoded_message));
@ -481,7 +481,7 @@ void lcd_init() {
/**
* Set an alert.
*/
void lcd_setalertstatusPGM(const char* message) {
void lcd_setalertstatusPGM(PGM_P message) {
char message_buffer[MAX_CURLY_COMMAND];
sprintf_P(message_buffer, PSTR("{E:%s}"), message);
write_to_lcd(message_buffer);

View File

@ -233,7 +233,7 @@ unsigned int uxg_DrawUtf8Str(u8g_t *pu8g, unsigned int x, unsigned int y, const
*
* Draw a ROM UTF-8 string at the specified position
*/
unsigned int uxg_DrawUtf8StrP(u8g_t *pu8g, unsigned int x, unsigned int y, const char *utf8_msg, pixel_len_t max_width) {
unsigned int uxg_DrawUtf8StrP(u8g_t *pu8g, unsigned int x, unsigned int y, PGM_P utf8_msg, pixel_len_t max_width) {
struct _uxg_drawu8_data_t data;
font_group_t *group = &g_fontgroup_root;
const font_t *fnt_default = uxg_GetFont(pu8g);
@ -302,7 +302,7 @@ int uxg_GetUtf8StrPixelWidth(u8g_t *pu8g, const char *utf8_msg) {
*
* Get the screen pixel width of a ROM UTF-8 string
*/
int uxg_GetUtf8StrPixelWidthP(u8g_t *pu8g, const char *utf8_msg) {
int uxg_GetUtf8StrPixelWidthP(u8g_t *pu8g, PGM_P utf8_msg) {
struct _uxg_drawu8_data_t data;
font_group_t *group = &g_fontgroup_root;
const font_t *fnt_default = uxg_GetFont(pu8g);

View File

@ -30,10 +30,10 @@ int uxg_SetUtf8Fonts (const uxg_fontinfo_t * fntinfo, int number); // fntinfo is
unsigned int uxg_DrawWchar (u8g_t *pu8g, unsigned int x, unsigned int y, wchar_t ch, pixel_len_t max_length);
unsigned int uxg_DrawUtf8Str (u8g_t *pu8g, unsigned int x, unsigned int y, const char *utf8_msg, pixel_len_t max_length);
unsigned int uxg_DrawUtf8StrP (u8g_t *pu8g, unsigned int x, unsigned int y, const char *utf8_msg, pixel_len_t max_length);
unsigned int uxg_DrawUtf8StrP (u8g_t *pu8g, unsigned int x, unsigned int y, PGM_P utf8_msg, pixel_len_t max_length);
int uxg_GetUtf8StrPixelWidth(u8g_t *pu8g, const char *utf8_msg);
int uxg_GetUtf8StrPixelWidthP(u8g_t *pu8g, const char *utf8_msg);
int uxg_GetUtf8StrPixelWidthP(u8g_t *pu8g, PGM_P utf8_msg);
#define uxg_GetFont(puxg) ((puxg)->font)

View File

@ -125,15 +125,15 @@ uint16_t max_display_update_time = 0;
#if ENABLED(ULTIPANEL)
#define DEFINE_LCD_IMPLEMENTATION_DRAWMENU_SETTING_EDIT_TYPE(_type, _name, _strFunc) \
inline void lcd_implementation_drawmenu_setting_edit_ ## _name (const bool sel, const uint8_t row, const char* pstr, const char* pstr2, _type * const data, ...) { \
inline void lcd_implementation_drawmenu_setting_edit_ ## _name (const bool sel, const uint8_t row, PGM_P pstr, PGM_P pstr2, _type * const data, ...) { \
UNUSED(pstr2); \
DRAWMENU_SETTING_EDIT_GENERIC(_strFunc(*(data))); \
} \
inline void lcd_implementation_drawmenu_setting_edit_callback_ ## _name (const bool sel, const uint8_t row, const char* pstr, const char* pstr2, _type * const data, ...) { \
inline void lcd_implementation_drawmenu_setting_edit_callback_ ## _name (const bool sel, const uint8_t row, PGM_P pstr, PGM_P pstr2, _type * const data, ...) { \
UNUSED(pstr2); \
DRAWMENU_SETTING_EDIT_GENERIC(_strFunc(*(data))); \
} \
inline void lcd_implementation_drawmenu_setting_edit_accessor_ ## _name (const bool sel, const uint8_t row, const char* pstr, const char* pstr2, _type (*pget)(), void (*pset)(_type), ...) { \
inline void lcd_implementation_drawmenu_setting_edit_accessor_ ## _name (const bool sel, const uint8_t row, PGM_P pstr, PGM_P pstr2, _type (*pget)(), void (*pset)(_type), ...) { \
UNUSED(pstr2); UNUSED(pset); \
DRAWMENU_SETTING_EDIT_GENERIC(_strFunc(pget())); \
} \
@ -254,16 +254,16 @@ uint16_t max_display_update_time = 0;
#define menu_action_back(dummy) _menu_action_back()
void _menu_action_back();
void menu_action_submenu(screenFunc_t data);
void menu_action_gcode(const char* pgcode);
void menu_action_gcode(PGM_P pgcode);
void menu_action_function(menuAction_t data);
#define DECLARE_MENU_EDIT_TYPE(_type, _name) \
bool _menu_edit_ ## _name(); \
void menu_edit_ ## _name(); \
void menu_edit_callback_ ## _name(); \
void _menu_action_setting_edit_ ## _name(const char * const pstr, _type* const ptr, const _type minValue, const _type maxValue); \
void menu_action_setting_edit_ ## _name(const char * const pstr, _type * const ptr, const _type minValue, const _type maxValue); \
void menu_action_setting_edit_callback_ ## _name(const char * const pstr, _type * const ptr, const _type minValue, const _type maxValue, const screenFunc_t callback=NULL, const bool live=false); \
void _menu_action_setting_edit_ ## _name(PGM_P const pstr, _type* const ptr, const _type minValue, const _type maxValue); \
void menu_action_setting_edit_ ## _name(PGM_P const pstr, _type * const ptr, const _type minValue, const _type maxValue); \
void menu_action_setting_edit_callback_ ## _name(PGM_P const pstr, _type * const ptr, const _type minValue, const _type maxValue, const screenFunc_t callback=NULL, const bool live=false); \
typedef void _name##_void
DECLARE_MENU_EDIT_TYPE(int16_t, int3);
@ -277,8 +277,8 @@ uint16_t max_display_update_time = 0;
DECLARE_MENU_EDIT_TYPE(float, float62);
DECLARE_MENU_EDIT_TYPE(uint32_t, long5);
void menu_action_setting_edit_bool(const char* pstr, bool* ptr);
void menu_action_setting_edit_callback_bool(const char* pstr, bool* ptr, screenFunc_t callbackFunc);
void menu_action_setting_edit_bool(PGM_P pstr, bool* ptr);
void menu_action_setting_edit_callback_bool(PGM_P pstr, bool* ptr, screenFunc_t callbackFunc);
#if ENABLED(SDSUPPORT)
void lcd_sdcard_menu();
@ -466,7 +466,7 @@ uint16_t max_display_update_time = 0;
bool screen_changed, defer_return_to_status;
// Value Editing
const char *editLabel;
PGM_P editLabel;
void *editValue;
int32_t minEditValue, maxEditValue;
screenFunc_t callbackFunc;
@ -570,7 +570,7 @@ uint16_t max_display_update_time = 0;
* Show "Moving..." till moves are done, then revert to previous display.
*/
static const char moving[] PROGMEM = MSG_MOVING;
static const char *sync_message = moving;
static PGM_P sync_message = moving;
//
// Display the synchronize screen until moves are
@ -591,7 +591,7 @@ uint16_t max_display_update_time = 0;
// Display the synchronize screen with a custom message
// ** This blocks the command queue! **
void lcd_synchronize(const char * const msg=NULL) {
void lcd_synchronize(PGM_P const msg=NULL) {
sync_message = msg ? msg : moving;
_lcd_synchronize();
}
@ -772,7 +772,7 @@ void lcd_reset_status() {
static const char paused[] PROGMEM = MSG_PRINT_PAUSED;
static const char printing[] PROGMEM = MSG_PRINTING;
static const char welcome[] PROGMEM = WELCOME_MSG;
const char *msg;
PGM_P msg;
if (print_job_timer.isPaused())
msg = paused;
#if ENABLED(SDSUPPORT)
@ -792,7 +792,7 @@ void lcd_reset_status() {
* draw the kill screen
*
*/
void kill_screen(const char* lcd_msg) {
void kill_screen(PGM_P lcd_msg) {
lcd_init();
lcd_setalertstatusPGM(lcd_msg);
lcd_kill_screen();
@ -1080,7 +1080,7 @@ void lcd_quick_feedback(const bool clear_buttons) {
#define _DONE_SCRIPT ""
#endif
void _lcd_user_gcode(const char * const cmd) {
void _lcd_user_gcode(PGM_P const cmd) {
enqueue_and_echo_commands_P(cmd);
#if ENABLED(USER_SCRIPT_AUDIBLE_FEEDBACK)
lcd_completion_feedback();
@ -1288,7 +1288,7 @@ void lcd_quick_feedback(const bool clear_buttons) {
#if ENABLED(BABYSTEPPING)
void _lcd_babystep(const AxisEnum axis, const char* msg) {
void _lcd_babystep(const AxisEnum axis, PGM_P msg) {
if (use_click()) { return lcd_goto_previous_menu_no_defer(); }
ENCODER_DIRECTION_NORMAL();
if (encoderPosition) {
@ -1373,7 +1373,7 @@ void lcd_quick_feedback(const bool clear_buttons) {
// separate value that doesn't lose precision.
static int16_t ubl_encoderPosition = 0;
static void _lcd_mesh_fine_tune(const char* msg) {
static void _lcd_mesh_fine_tune(PGM_P msg) {
defer_return_to_status = true;
if (ubl.encoder_diff) {
ubl_encoderPosition = (ubl.encoder_diff > 0) ? 1 : -1;
@ -1937,7 +1937,7 @@ void lcd_quick_feedback(const bool clear_buttons) {
no_reentry = false;
}
void lcd_enqueue_commands_P(const char * const cmd) {
void lcd_enqueue_commands_P(PGM_P const cmd) {
no_reentry = true;
enqueue_and_echo_commands_now_P(cmd);
no_reentry = false;
@ -3030,7 +3030,7 @@ void lcd_quick_feedback(const bool clear_buttons) {
*
*/
void _lcd_move_xyz(const char* name, AxisEnum axis) {
void _lcd_move_xyz(PGM_P name, AxisEnum axis) {
if (use_click()) { return lcd_goto_previous_menu_no_defer(); }
ENCODER_DIRECTION_NORMAL();
if (encoderPosition && !processing_manual_move) {
@ -4508,7 +4508,7 @@ void lcd_quick_feedback(const bool clear_buttons) {
static AdvancedPauseMode _change_filament_temp_mode;
static int8_t _change_filament_temp_extruder;
static const char* _change_filament_temp_command() {
static PGM_P _change_filament_temp_command() {
switch (_change_filament_temp_mode) {
case ADVANCED_PAUSE_MODE_LOAD_FILAMENT:
return PSTR("M701 T%d");
@ -4531,7 +4531,7 @@ void lcd_quick_feedback(const bool clear_buttons) {
void _lcd_change_filament_temp_2_menu() { _change_filament_temp(PREHEAT_2_TEMP_HOTEND); }
void _lcd_change_filament_temp_custom_menu() { _change_filament_temp(thermalManager.target_temperature[_change_filament_temp_extruder]); }
static const char* change_filament_header(const AdvancedPauseMode mode) {
static PGM_P change_filament_header(const AdvancedPauseMode mode) {
switch (mode) {
case ADVANCED_PAUSE_MODE_LOAD_FILAMENT:
return PSTR(MSG_FILAMENTLOAD);
@ -4779,7 +4779,7 @@ void lcd_quick_feedback(const bool clear_buttons) {
static AdvancedPauseMode advanced_pause_mode = ADVANCED_PAUSE_MODE_PAUSE_PRINT;
static uint8_t hotend_status_extruder = 0;
static const char* advanced_pause_header() {
static PGM_P advanced_pause_header() {
switch (advanced_pause_mode) {
case ADVANCED_PAUSE_MODE_LOAD_FILAMENT:
return PSTR(MSG_FILAMENT_CHANGE_HEADER_LOAD);
@ -5061,9 +5061,9 @@ void lcd_quick_feedback(const bool clear_buttons) {
* bool _menu_edit_int3();
* void menu_edit_int3(); // edit int16_t (interactively)
* void menu_edit_callback_int3(); // edit int16_t (interactively) with callback on completion
* void _menu_action_setting_edit_int3(const char * const pstr, int16_t * const ptr, const int16_t minValue, const int16_t maxValue);
* void menu_action_setting_edit_int3(const char * const pstr, int16_t * const ptr, const int16_t minValue, const int16_t maxValue);
* void menu_action_setting_edit_callback_int3(const char * const pstr, int16_t * const ptr, const int16_t minValue, const int16_t maxValue, const screenFunc_t callback, const bool live); // edit int16_t with callback
* void _menu_action_setting_edit_int3(PGM_P const pstr, int16_t * const ptr, const int16_t minValue, const int16_t maxValue);
* void menu_action_setting_edit_int3(PGM_P const pstr, int16_t * const ptr, const int16_t minValue, const int16_t maxValue);
* void menu_action_setting_edit_callback_int3(PGM_P const pstr, int16_t * const ptr, const int16_t minValue, const int16_t maxValue, const screenFunc_t callback, const bool live); // edit int16_t with callback
*
* You can then use one of the menu macros to present the edit interface:
* MENU_ITEM_EDIT(int3, MSG_SPEED, &feedrate_percentage, 10, 999)
@ -5090,7 +5090,7 @@ void lcd_quick_feedback(const bool clear_buttons) {
return use_click(); \
} \
void menu_edit_ ## _name() { _menu_edit_ ## _name(); } \
void _menu_action_setting_edit_ ## _name(const char * const pstr, _type* const ptr, const _type minValue, const _type maxValue) { \
void _menu_action_setting_edit_ ## _name(PGM_P const pstr, _type* const ptr, const _type minValue, const _type maxValue) { \
lcd_save_previous_screen(); \
lcd_refresh(); \
\
@ -5100,13 +5100,13 @@ void lcd_quick_feedback(const bool clear_buttons) {
maxEditValue = maxValue * _scale - minEditValue; \
encoderPosition = (*ptr) * _scale - minEditValue; \
} \
void menu_action_setting_edit_callback_ ## _name(const char * const pstr, _type * const ptr, const _type minValue, const _type maxValue, const screenFunc_t callback, const bool live) { \
void menu_action_setting_edit_callback_ ## _name(PGM_P const pstr, _type * const ptr, const _type minValue, const _type maxValue, const screenFunc_t callback, const bool live) { \
_menu_action_setting_edit_ ## _name(pstr, ptr, minValue, maxValue); \
currentScreen = menu_edit_ ## _name; \
callbackFunc = callback; \
liveEdit = live; \
} \
FORCE_INLINE void menu_action_setting_edit_ ## _name(const char * const pstr, _type * const ptr, const _type minValue, const _type maxValue) { \
FORCE_INLINE void menu_action_setting_edit_ ## _name(PGM_P const pstr, _type * const ptr, const _type minValue, const _type maxValue) { \
menu_action_setting_edit_callback_ ## _name(pstr, ptr, minValue, maxValue); \
} \
typedef void _name##_void
@ -5219,7 +5219,7 @@ void lcd_quick_feedback(const bool clear_buttons) {
*/
void _menu_action_back() { lcd_goto_previous_menu(); }
void menu_action_submenu(screenFunc_t func) { lcd_save_previous_screen(); lcd_goto_screen(func); }
void menu_action_gcode(const char* pgcode) { enqueue_and_echo_commands_P(pgcode); }
void menu_action_gcode(PGM_P pgcode) { enqueue_and_echo_commands_P(pgcode); }
void menu_action_function(screenFunc_t func) { (*func)(); }
#if ENABLED(SDSUPPORT)
@ -5246,8 +5246,8 @@ void lcd_quick_feedback(const bool clear_buttons) {
#endif // SDSUPPORT
void menu_action_setting_edit_bool(const char* pstr, bool* ptr) { UNUSED(pstr); *ptr ^= true; lcd_refresh(); }
void menu_action_setting_edit_callback_bool(const char* pstr, bool* ptr, screenFunc_t callback) {
void menu_action_setting_edit_bool(PGM_P pstr, bool* ptr) { UNUSED(pstr); *ptr ^= true; lcd_refresh(); }
void menu_action_setting_edit_callback_bool(PGM_P pstr, bool* ptr, screenFunc_t callback) {
menu_action_setting_edit_bool(pstr, ptr);
(*callback)();
}
@ -5694,7 +5694,7 @@ void lcd_setstatus(const char * const message, const bool persist) {
lcd_finishstatus(persist);
}
void lcd_setstatusPGM(const char * const message, int8_t level) {
void lcd_setstatusPGM(PGM_P const message, int8_t level) {
if (level < 0) level = lcd_status_message_level = 0;
if (level < lcd_status_message_level) return;
lcd_status_message_level = level;
@ -5704,7 +5704,7 @@ void lcd_setstatusPGM(const char * const message, int8_t level) {
// that there is no cutting in the middle of a multibyte character!
// Get a pointer to the null terminator
const char* pend = message + strlen_P(message);
PGM_P pend = message + strlen_P(message);
// If length of supplied UTF8 string is greater than
// our buffer size, start cutting whole UTF8 chars
@ -5721,7 +5721,7 @@ void lcd_setstatusPGM(const char * const message, int8_t level) {
lcd_finishstatus(level > 0);
}
void lcd_status_printf_P(const uint8_t level, const char * const fmt, ...) {
void lcd_status_printf_P(const uint8_t level, PGM_P const fmt, ...) {
if (level < lcd_status_message_level) return;
lcd_status_message_level = level;
va_list args;
@ -5731,7 +5731,7 @@ void lcd_status_printf_P(const uint8_t level, const char * const fmt, ...) {
lcd_finishstatus(level > 0);
}
void lcd_setalertstatusPGM(const char * const message) {
void lcd_setalertstatusPGM(PGM_P const message) {
lcd_setstatusPGM(message, 1);
#if ENABLED(ULTIPANEL)
lcd_return_to_status();

View File

@ -29,12 +29,12 @@
void lcd_init();
bool lcd_detected();
void lcd_update();
void lcd_setalertstatusPGM(const char* message);
void lcd_setalertstatusPGM(PGM_P message);
#else
inline void lcd_init() {}
inline bool lcd_detected() { return true; }
inline void lcd_update() {}
inline void lcd_setalertstatusPGM(const char* message) { UNUSED(message); }
inline void lcd_setalertstatusPGM(PGM_P message) { UNUSED(message); }
#endif
#if ENABLED(ULTRA_LCD)
@ -49,13 +49,13 @@
void lcd_return_to_status();
bool lcd_hasstatus();
void lcd_setstatus(const char* message, const bool persist=false);
void lcd_setstatusPGM(const char* message, const int8_t level=0);
void lcd_setalertstatusPGM(const char* message);
void lcd_setstatusPGM(PGM_P message, const int8_t level=0);
void lcd_setalertstatusPGM(PGM_P message);
void lcd_reset_alert_level();
void lcd_reset_status();
void lcd_status_printf_P(const uint8_t level, const char * const fmt, ...);
void lcd_status_printf_P(const uint8_t level, PGM_P const fmt, ...);
void lcd_kill_screen();
void kill_screen(const char* lcd_msg);
void kill_screen(PGM_P lcd_msg);
extern uint8_t lcdDrawUpdate;
inline void lcd_refresh() { lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; }
@ -206,8 +206,8 @@
inline void lcd_refresh() {}
inline bool lcd_hasstatus() { return false; }
inline void lcd_setstatus(const char* const message, const bool persist=false) { UNUSED(message); UNUSED(persist); }
inline void lcd_setstatusPGM(const char* const message, const int8_t level=0) { UNUSED(message); UNUSED(level); }
inline void lcd_status_printf_P(const uint8_t level, const char * const fmt, ...) { UNUSED(level); UNUSED(fmt); }
inline void lcd_setstatusPGM(PGM_P const message, const int8_t level=0) { UNUSED(message); UNUSED(level); }
inline void lcd_status_printf_P(const uint8_t level, PGM_P const fmt, ...) { UNUSED(level); UNUSED(fmt); }
inline void lcd_reset_alert_level() {}
inline void lcd_reset_status() {}

View File

@ -408,7 +408,7 @@ void lcd_implementation_clear() { } // Automatically cleared by Picture Loop
}
// Draw a static line of text in the same idiom as a menu item
static void lcd_implementation_drawmenu_static(const uint8_t row, const char* pstr, const bool center=true, const bool invert=false, const char* valstr=NULL) {
static void lcd_implementation_drawmenu_static(const uint8_t row, PGM_P pstr, const bool center=true, const bool invert=false, const char* valstr=NULL) {
if (lcd_implementation_mark_as_selected(row, invert)) {
@ -428,7 +428,7 @@ void lcd_implementation_clear() { } // Automatically cleared by Picture Loop
}
// Draw a generic menu item
static void lcd_implementation_drawmenu_generic(const bool isSelected, const uint8_t row, const char* pstr, const char pre_char, const char post_char) {
static void lcd_implementation_drawmenu_generic(const bool isSelected, const uint8_t row, PGM_P pstr, const char pre_char, const char post_char) {
UNUSED(pre_char);
if (lcd_implementation_mark_as_selected(row, isSelected)) {
@ -449,7 +449,7 @@ void lcd_implementation_clear() { } // Automatically cleared by Picture Loop
#define lcd_implementation_drawmenu_function(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ')
// Draw a menu item with an editable value
static void _drawmenu_setting_edit_generic(const bool isSelected, const uint8_t row, const char* pstr, const char* const data, const bool pgm) {
static void _drawmenu_setting_edit_generic(const bool isSelected, const uint8_t row, PGM_P pstr, const char* const data, const bool pgm) {
if (lcd_implementation_mark_as_selected(row, isSelected)) {
const uint8_t vallen = (pgm ? utf8_strlen_P(data) : utf8_strlen((char*)data));
uint8_t n = LCD_WIDTH - (START_COL) - 2 - vallen;
@ -469,7 +469,7 @@ void lcd_implementation_clear() { } // Automatically cleared by Picture Loop
#define DRAWMENU_SETTING_EDIT_GENERIC(_src) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, _src)
#define DRAW_BOOL_SETTING(sel, row, pstr, data) lcd_implementation_drawmenu_setting_edit_generic_P(sel, row, pstr, (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF))
void lcd_implementation_drawedit(const char* const pstr, const char* const value=NULL) {
void lcd_implementation_drawedit(PGM_P const pstr, const char* const value=NULL) {
const uint8_t labellen = utf8_strlen_P(pstr),
vallen = utf8_strlen(value);
@ -521,7 +521,7 @@ void lcd_implementation_clear() { } // Automatically cleared by Picture Loop
#if ENABLED(SDSUPPORT)
static void _drawmenu_sd(const bool isSelected, const uint8_t row, const char* const pstr, CardReader &theCard, const bool isDir) {
static void _drawmenu_sd(const bool isSelected, const uint8_t row, PGM_P const pstr, CardReader &theCard, const bool isDir) {
UNUSED(pstr);
lcd_implementation_mark_as_selected(row, isSelected);

View File

@ -347,7 +347,7 @@ void lcd_implementation_clear() { lcd.clear(); }
}
// Scroll the PSTR 'text' in a 'len' wide field for 'time' milliseconds at position col,line
void lcd_scroll(const uint8_t col, const uint8_t line, const char* const text, const uint8_t len, const int16_t time) {
void lcd_scroll(const uint8_t col, const uint8_t line, PGM_P const text, const uint8_t len, const int16_t time) {
uint8_t slen = utf8_strlen_P(text);
if (slen < len) {
// Fits into,
@ -360,7 +360,7 @@ void lcd_implementation_clear() { lcd.clear(); }
safe_delay(time);
}
else {
const char* p = text;
PGM_P p = text;
int dly = time / MAX(slen, 1);
for (uint8_t i = 0; i <= slen; i++) {
@ -387,7 +387,7 @@ void lcd_implementation_clear() { lcd.clear(); }
}
}
static void logo_lines(const char* const extra) {
static void logo_lines(PGM_P const extra) {
int16_t indent = (LCD_WIDTH - 8 - utf8_strlen_P(extra)) / 2;
lcd_moveto(indent, 0); lcd_put_wchar('\x00'); lcd_put_u8str_P(PSTR( "------" )); lcd_put_wchar('\x01');
lcd_moveto(indent, 1); lcd_put_u8str_P(PSTR("|Marlin|")); lcd_put_u8str_P(extra);
@ -867,7 +867,7 @@ static void lcd_implementation_status_screen() {
#endif // ADVANCED_PAUSE_FEATURE
static void lcd_implementation_drawmenu_static(const uint8_t row, const char* pstr, const bool center=true, const bool invert=false, const char *valstr=NULL) {
static void lcd_implementation_drawmenu_static(const uint8_t row, PGM_P pstr, const bool center=true, const bool invert=false, const char *valstr=NULL) {
UNUSED(invert);
int8_t n = LCD_WIDTH;
lcd_moveto(0, row);
@ -880,7 +880,7 @@ static void lcd_implementation_status_screen() {
for (; n > 0; --n) lcd_put_wchar(' ');
}
static void lcd_implementation_drawmenu_generic(const bool sel, const uint8_t row, const char* pstr, const char pre_char, const char post_char) {
static void lcd_implementation_drawmenu_generic(const bool sel, const uint8_t row, PGM_P pstr, const char pre_char, const char post_char) {
uint8_t n = LCD_WIDTH - 2;
lcd_moveto(0, row);
lcd_put_wchar(sel ? pre_char : ' ');
@ -889,7 +889,7 @@ static void lcd_implementation_status_screen() {
lcd_put_wchar(post_char);
}
static void lcd_implementation_drawmenu_setting_edit_generic(const bool sel, const uint8_t row, const char* pstr, const char pre_char, const char* const data) {
static void lcd_implementation_drawmenu_setting_edit_generic(const bool sel, const uint8_t row, PGM_P pstr, const char pre_char, const char* const data) {
uint8_t n = LCD_WIDTH - 2 - utf8_strlen(data);
lcd_moveto(0, row);
lcd_put_wchar(sel ? pre_char : ' ');
@ -898,7 +898,7 @@ static void lcd_implementation_status_screen() {
while (n--) lcd_put_wchar(' ');
lcd_put_u8str(data);
}
static void lcd_implementation_drawmenu_setting_edit_generic_P(const bool sel, const uint8_t row, const char* pstr, const char pre_char, const char* const data) {
static void lcd_implementation_drawmenu_setting_edit_generic_P(const bool sel, const uint8_t row, PGM_P pstr, const char pre_char, const char* const data) {
uint8_t n = LCD_WIDTH - 2 - utf8_strlen_P(data);
lcd_moveto(0, row);
lcd_put_wchar(sel ? pre_char : ' ');
@ -911,7 +911,7 @@ static void lcd_implementation_status_screen() {
#define DRAWMENU_SETTING_EDIT_GENERIC(_src) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', _src)
#define DRAW_BOOL_SETTING(sel, row, pstr, data) lcd_implementation_drawmenu_setting_edit_generic_P(sel, row, pstr, '>', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF))
void lcd_implementation_drawedit(const char* pstr, const char* const value=NULL) {
void lcd_implementation_drawedit(PGM_P pstr, const char* const value=NULL) {
lcd_moveto(1, 1);
lcd_put_u8str_P(pstr);
if (value != NULL) {
@ -926,7 +926,7 @@ static void lcd_implementation_status_screen() {
#if ENABLED(SDSUPPORT)
static void lcd_implementation_drawmenu_sd(const bool sel, const uint8_t row, const char* const pstr, CardReader &theCard, const uint8_t concat, const char post_char) {
static void lcd_implementation_drawmenu_sd(const bool sel, const uint8_t row, PGM_P const pstr, CardReader &theCard, const uint8_t concat, const char post_char) {
UNUSED(pstr);
lcd_moveto(0, row);
lcd_put_wchar(sel ? '>' : ' ');
@ -960,11 +960,11 @@ static void lcd_implementation_status_screen() {
lcd_put_wchar(post_char);
}
static void lcd_implementation_drawmenu_sdfile(const bool sel, const uint8_t row, const char* pstr, CardReader &theCard) {
static void lcd_implementation_drawmenu_sdfile(const bool sel, const uint8_t row, PGM_P pstr, CardReader &theCard) {
lcd_implementation_drawmenu_sd(sel, row, pstr, theCard, 2, ' ');
}
static void lcd_implementation_drawmenu_sddirectory(const bool sel, const uint8_t row, const char* pstr, CardReader &theCard) {
static void lcd_implementation_drawmenu_sddirectory(const bool sel, const uint8_t row, PGM_P pstr, CardReader &theCard) {
lcd_implementation_drawmenu_sd(sel, row, pstr, theCard, 2, LCD_STR_FOLDER[0]);
}