Apply const to LCD arguments and locals

This commit is contained in:
Scott Lahteine
2016-11-24 00:54:21 -06:00
parent b1abd7edef
commit 71842b6a17
5 changed files with 56 additions and 56 deletions

View File

@ -195,7 +195,7 @@ extern volatile uint8_t buttons; //an extended version of the last checked butt
static void lcd_set_custom_characters(
#if ENABLED(LCD_PROGRESS_BAR)
bool info_screen_charset = true
const bool info_screen_charset = true
#endif
) {
static byte bedTemp[8] = {
@ -341,7 +341,7 @@ static void lcd_set_custom_characters(
static void lcd_implementation_init(
#if ENABLED(LCD_PROGRESS_BAR)
bool info_screen_charset = true
const bool info_screen_charset = true
#endif
) {
@ -385,7 +385,7 @@ void lcd_printPGM(const char *str) {
for (; char c = pgm_read_byte(str); ++str) charset_mapper(c);
}
void lcd_print(const char* str) {
void lcd_print(const char* const str) {
for (uint8_t i = 0; char c = str[i]; ++i) charset_mapper(c);
}
@ -393,14 +393,14 @@ void lcd_print(char c) { charset_mapper(c); }
#if ENABLED(SHOW_BOOTSCREEN)
void lcd_erase_line(int line) {
void lcd_erase_line(const int line) {
lcd.setCursor(0, line);
for (int i = 0; i < LCD_WIDTH; i++)
for (uint8_t i = LCD_WIDTH + 1; --i;)
lcd_print(' ');
}
// Scroll the PSTR 'text' in a 'len' wide field for 'time' milliseconds at position col,line
void lcd_scroll(int col, int line, const char* text, int len, int time) {
void lcd_scroll(const int col, const int line, const char* const text, const int len, const int time) {
char tmp[LCD_WIDTH + 1] = {0};
int n = max(lcd_strlen_P(text) - len, 0);
for (int i = 0; i <= n; i++) {
@ -411,7 +411,7 @@ void lcd_print(char c) { charset_mapper(c); }
}
}
static void logo_lines(const char *extra) {
static void logo_lines(const char* const extra) {
int indent = (LCD_WIDTH - 8 - lcd_strlen_P(extra)) / 2;
lcd.setCursor(indent, 0); lcd.print('\x00'); lcd_printPGM(PSTR( "------" )); lcd.print('\x01');
lcd.setCursor(indent, 1); lcd_printPGM(PSTR("|Marlin|")); lcd_printPGM(extra);
@ -552,7 +552,7 @@ void lcd_kill_screen() {
lcd_printPGM(PSTR(MSG_PLEASE_RESET));
}
FORCE_INLINE void _draw_axis_label(AxisEnum axis, const char *pstr, bool blink) {
FORCE_INLINE void _draw_axis_label(const AxisEnum axis, const char* const pstr, const bool blink) {
if (blink)
lcd_printPGM(pstr);
else {
@ -794,7 +794,7 @@ static void lcd_implementation_status_screen() {
#if ENABLED(LCD_INFO_MENU) || ENABLED(FILAMENT_CHANGE_FEATURE)
static void lcd_implementation_drawmenu_static(uint8_t row, const char* pstr, bool center=true, bool invert=false, const char *valstr=NULL) {
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) {
UNUSED(invert);
char c;
int8_t n = LCD_WIDTH;
@ -816,7 +816,7 @@ static void lcd_implementation_status_screen() {
#endif // LCD_INFO_MENU || FILAMENT_CHANGE_FEATURE
static void lcd_implementation_drawmenu_generic(bool sel, uint8_t row, const char* pstr, char pre_char, char post_char) {
static void lcd_implementation_drawmenu_generic(const bool sel, const uint8_t row, const char* pstr, const char pre_char, const char post_char) {
char c;
uint8_t n = LCD_WIDTH - 2;
lcd.setCursor(0, row);
@ -829,7 +829,7 @@ static void lcd_implementation_status_screen() {
lcd.print(post_char);
}
static void lcd_implementation_drawmenu_setting_edit_generic(bool sel, uint8_t row, const char* pstr, char pre_char, char* data) {
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) {
char c;
uint8_t n = LCD_WIDTH - 2 - lcd_strlen(data);
lcd.setCursor(0, row);
@ -842,7 +842,7 @@ static void lcd_implementation_status_screen() {
while (n--) lcd.print(' ');
lcd_print(data);
}
static void lcd_implementation_drawmenu_setting_edit_generic_P(bool sel, uint8_t row, const char* pstr, char pre_char, const char* 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) {
char c;
uint8_t n = LCD_WIDTH - 2 - lcd_strlen_P(data);
lcd.setCursor(0, row);
@ -879,7 +879,7 @@ static void lcd_implementation_status_screen() {
#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, '>', ftostr5rj(*(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, const char* value=NULL) {
void lcd_implementation_drawedit(const char* pstr, const char* const value=NULL) {
lcd.setCursor(1, 1);
lcd_printPGM(pstr);
if (value != NULL) {
@ -891,7 +891,7 @@ static void lcd_implementation_status_screen() {
#if ENABLED(SDSUPPORT)
static void lcd_implementation_drawmenu_sd(bool sel, uint8_t row, const char* pstr, const char* filename, char* longFilename, uint8_t concat, char post_char) {
static void lcd_implementation_drawmenu_sd(const bool sel, const uint8_t row, const char* const pstr, const char* filename, char* const longFilename, const uint8_t concat, const char post_char) {
UNUSED(pstr);
char c;
uint8_t n = LCD_WIDTH - concat;
@ -909,11 +909,11 @@ static void lcd_implementation_status_screen() {
lcd.print(post_char);
}
static void lcd_implementation_drawmenu_sdfile(bool sel, uint8_t row, const char* pstr, const char* filename, char* longFilename) {
static void lcd_implementation_drawmenu_sdfile(const bool sel, const uint8_t row, const char* pstr, const char* filename, char* const longFilename) {
lcd_implementation_drawmenu_sd(sel, row, pstr, filename, longFilename, 2, ' ');
}
static void lcd_implementation_drawmenu_sddirectory(bool sel, uint8_t row, const char* pstr, const char* filename, char* longFilename) {
static void lcd_implementation_drawmenu_sddirectory(const bool sel, const uint8_t row, const char* pstr, const char* filename, char* const longFilename) {
lcd_implementation_drawmenu_sd(sel, row, pstr, filename, longFilename, 2, LCD_STR_FOLDER[0]);
}