mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2024-11-23 20:18:52 +00:00
Use const parameters instead of static casting
Alternative fix to #3149
This commit is contained in:
parent
09ef955191
commit
c97c2dcaf7
@ -169,7 +169,7 @@ char lcd_print(char c) {
|
||||
}
|
||||
}
|
||||
|
||||
char lcd_print(char* str) {
|
||||
char lcd_print(const char* str) {
|
||||
char c;
|
||||
int i = 0;
|
||||
char n = 0;
|
||||
@ -508,7 +508,7 @@ static void _drawmenu_setting_edit_generic(bool isSelected, uint8_t row, const c
|
||||
#define lcd_implementation_drawmenu_setting_edit_callback_long5(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr5(*(data)))
|
||||
#define lcd_implementation_drawmenu_setting_edit_callback_bool(sel, row, pstr, pstr2, data, callback) lcd_implementation_drawmenu_setting_edit_generic_P(sel, row, pstr, (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF))
|
||||
|
||||
void lcd_implementation_drawedit(const char* pstr, char* value) {
|
||||
void lcd_implementation_drawedit(const char* pstr, const char* value) {
|
||||
uint8_t rows = 1;
|
||||
uint8_t lcd_width = LCD_WIDTH, char_width = DOG_CHAR_WIDTH;
|
||||
uint8_t vallen = lcd_strlen(value);
|
||||
|
@ -516,7 +516,7 @@ void lcd_set_home_offsets() {
|
||||
babystepsTodo[axis] += distance;
|
||||
#endif
|
||||
}
|
||||
if (lcdDrawUpdate) lcd_implementation_drawedit(msg, (char*)"");
|
||||
if (lcdDrawUpdate) lcd_implementation_drawedit(msg, PSTR(""));
|
||||
if (LCD_CLICKED) lcd_goto_previous_menu();
|
||||
}
|
||||
|
||||
@ -1715,7 +1715,7 @@ void lcd_init() {
|
||||
#endif
|
||||
}
|
||||
|
||||
int lcd_strlen(char* s) {
|
||||
int lcd_strlen(const char* s) {
|
||||
int i = 0, j = 0;
|
||||
while (s[i]) {
|
||||
if ((s[i] & 0xc0) != 0x80) j++;
|
||||
@ -2397,7 +2397,7 @@ char* ftostr52(const float& x) {
|
||||
* MBL Move to mesh starting point
|
||||
*/
|
||||
static void _lcd_level_bed_homing() {
|
||||
if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR("XYZ"), (char*)"Homing");
|
||||
if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR("XYZ"), PSTR("Homing"));
|
||||
if (axis_known_position[X_AXIS] && axis_known_position[Y_AXIS] && axis_known_position[Z_AXIS]) {
|
||||
current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
|
||||
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
||||
|
@ -5,7 +5,7 @@
|
||||
#if ENABLED(ULTRA_LCD)
|
||||
#include "buzzer.h"
|
||||
|
||||
int lcd_strlen(char* s);
|
||||
int lcd_strlen(const char* s);
|
||||
int lcd_strlen_P(const char* s);
|
||||
void lcd_update();
|
||||
void lcd_init();
|
||||
|
@ -407,7 +407,7 @@ char lcd_printPGM(const char* str) {
|
||||
return n;
|
||||
}
|
||||
|
||||
char lcd_print(char* str) {
|
||||
char lcd_print(const char* str) {
|
||||
char c, n = 0;
|
||||
unsigned char i = 0;
|
||||
while ((c = str[i++])) n += charset_mapper(c);
|
||||
@ -825,7 +825,7 @@ static void lcd_implementation_drawmenu_setting_edit_generic_P(bool sel, uint8_t
|
||||
#define lcd_implementation_drawmenu_setting_edit_callback_long5(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr5(*(data)))
|
||||
#define lcd_implementation_drawmenu_setting_edit_callback_bool(sel, row, pstr, pstr2, data, callback) lcd_implementation_drawmenu_setting_edit_generic_P(sel, row, pstr, '>', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF))
|
||||
|
||||
void lcd_implementation_drawedit(const char* pstr, char* value) {
|
||||
void lcd_implementation_drawedit(const char* pstr, const char* value) {
|
||||
lcd.setCursor(1, 1);
|
||||
lcd_printPGM(pstr);
|
||||
lcd.print(':');
|
||||
|
Loading…
Reference in New Issue
Block a user