diff --git a/Marlin/src/gcode/config/M200-M205.cpp b/Marlin/src/gcode/config/M200-M205.cpp index f806fd19d1..08a2b1560b 100644 --- a/Marlin/src/gcode/config/M200-M205.cpp +++ b/Marlin/src/gcode/config/M200-M205.cpp @@ -61,7 +61,7 @@ void GcodeSuite::M201() { LOOP_XYZE(i) { if (parser.seen(axis_codes[i])) { - const uint8_t a = (i == E_AXIS ? E_AXIS_N(target_extruder) : i); + const uint8_t a = (i == uint8_t(E_AXIS) ? E_AXIS_N(target_extruder) : i); planner.settings.max_acceleration_mm_per_s2[a] = parser.value_axis_units((AxisEnum)a); } } diff --git a/Marlin/src/lcd/HD44780/lcdprint_hd44780.cpp b/Marlin/src/lcd/HD44780/lcdprint_hd44780.cpp index 38e06ec96a..f888dc48e1 100644 --- a/Marlin/src/lcd/HD44780/lcdprint_hd44780.cpp +++ b/Marlin/src/lcd/HD44780/lcdprint_hd44780.cpp @@ -866,11 +866,11 @@ static const hd44780_charmap_t g_hd44780_charmap_common[] PROGMEM = { }; /* return v1 - v2 */ -static int hd44780_charmap_compare(hd44780_charmap_t * v1, hd44780_charmap_t * v2) { +static int hd44780_charmap_compare(const hd44780_charmap_t * const v1, const hd44780_charmap_t * const v2) { return (v1->uchar < v2->uchar) ? -1 : (v1->uchar > v2->uchar) ? 1 : 0; } -static int pf_bsearch_cb_comp_hd4map_pgm(void *userdata, size_t idx, void * data_pin) { +static int pf_bsearch_cb_comp_hd4map_pgm(void *userdata, const size_t idx, const void * const data_pin) { hd44780_charmap_t localval; hd44780_charmap_t *p_hd44780_charmap = (hd44780_charmap_t *)userdata; memcpy_P(&localval, p_hd44780_charmap + idx, sizeof(localval)); @@ -883,7 +883,7 @@ void lcd_put_int(const int i) { lcd.print(i); } // return < 0 on error // return the advanced cols -int lcd_put_wchar_max(wchar_t c, pixel_len_t max_length) { +int lcd_put_wchar_max(const wchar_t c, pixel_len_t max_length) { // find the HD44780 internal ROM first int ret; @@ -938,7 +938,7 @@ int lcd_put_wchar_max(wchar_t c, pixel_len_t max_length) { * * Draw a UTF-8 string */ -static int lcd_put_u8str_max_cb(const char * utf8_str, uint8_t (*cb_read_byte)(uint8_t * str), pixel_len_t max_length) { +static int lcd_put_u8str_max_cb(const char * const utf8_str, uint8_t (*cb_read_byte)(uint8_t * str), pixel_len_t max_length) { pixel_len_t ret = 0; uint8_t *p = (uint8_t *)utf8_str; while (ret < max_length) { @@ -950,17 +950,17 @@ static int lcd_put_u8str_max_cb(const char * utf8_str, uint8_t (*cb_read_byte)(u return (int)ret; } -int lcd_put_u8str_max(const char * utf8_str, pixel_len_t max_length) { +int lcd_put_u8str_max(const char * const 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(PGM_P utf8_str_P, pixel_len_t max_length) { +int lcd_put_u8str_max_P(PGM_P const utf8_str_P, pixel_len_t max_length) { return lcd_put_u8str_max_cb(utf8_str_P, read_byte_rom, max_length); } #if ENABLED(DEBUG_LCDPRINT) - int test_hd44780_charmap(hd44780_charmap_t *data, size_t size, char *name, char flg_show_contents) { + int test_hd44780_charmap(hd44780_charmap_t *data, const size_t size, const char * const name, const bool flg_show_contents) { int ret; size_t idx = 0; hd44780_charmap_t preval = {0, 0, 0}; diff --git a/Marlin/src/lcd/dogm/lcdprint_u8g.cpp b/Marlin/src/lcd/dogm/lcdprint_u8g.cpp index d46eb85903..78804f3a9a 100644 --- a/Marlin/src/lcd/dogm/lcdprint_u8g.cpp +++ b/Marlin/src/lcd/dogm/lcdprint_u8g.cpp @@ -28,7 +28,7 @@ void lcd_put_int(const int i) { u8g.print(i); } // return < 0 on error // return the advanced pixels -int lcd_put_wchar_max(wchar_t c, pixel_len_t max_length) { +int lcd_put_wchar_max(const wchar_t c, pixel_len_t max_length) { if (c < 256) { u8g.print((char)c); return u8g_GetFontBBXWidth(u8g.getU8g()); @@ -41,7 +41,7 @@ int lcd_put_wchar_max(wchar_t c, pixel_len_t max_length) { return ret; } -int lcd_put_u8str_max(const char * utf8_str, pixel_len_t max_length) { +int lcd_put_u8str_max(const char * const utf8_str, pixel_len_t max_length) { unsigned int x = u8g.getPrintCol(), y = u8g.getPrintRow(), ret = uxg_DrawUtf8Str(u8g.getU8g(), x, y, utf8_str, max_length); @@ -49,7 +49,7 @@ int lcd_put_u8str_max(const char * utf8_str, pixel_len_t max_length) { return ret; } -int lcd_put_u8str_max_P(PGM_P utf8_str_P, pixel_len_t max_length) { +int lcd_put_u8str_max_P(PGM_P const utf8_str_P, pixel_len_t max_length) { unsigned int x = u8g.getPrintCol(), y = u8g.getPrintRow(), ret = uxg_DrawUtf8StrP(u8g.getU8g(), x, y, utf8_str_P, max_length); diff --git a/Marlin/src/lcd/dogm/u8g_fontutf8.cpp b/Marlin/src/lcd/dogm/u8g_fontutf8.cpp index 890cd4217c..80422e9341 100644 --- a/Marlin/src/lcd/dogm/u8g_fontutf8.cpp +++ b/Marlin/src/lcd/dogm/u8g_fontutf8.cpp @@ -42,7 +42,7 @@ static int fontinfo_compare(uxg_fontinfo_t * v1, uxg_fontinfo_t * v2) { } /*"data_list[idx] - *data_pin"*/ -static int pf_bsearch_cb_comp_fntifo_pgm (void *userdata, size_t idx, void *data_pin) { +static int pf_bsearch_cb_comp_fntifo_pgm(void *userdata, const size_t idx, void *data_pin) { uxg_fontinfo_t *fntinfo = (uxg_fontinfo_t*)userdata; uxg_fontinfo_t localval; memcpy_P(&localval, fntinfo + idx, sizeof(localval)); @@ -103,7 +103,7 @@ static void fontgroup_drawwchar(font_group_t *group, const font_t *fnt_default, * * Get the screen pixel width of a ROM UTF-8 string */ -static void fontgroup_drawstring(font_group_t *group, const font_t *fnt_default, const char *utf8_msg, read_byte_cb_t cb_read_byte, void * userdata, fontgroup_cb_draw_t cb_draw_ram) { +static void fontgroup_drawstring(font_group_t *group, const font_t *fnt_default, const char * const utf8_msg, read_byte_cb_t cb_read_byte, void * userdata, fontgroup_cb_draw_t cb_draw_ram) { uint8_t *p = (uint8_t*)utf8_msg; for (;;) { wchar_t val = 0; @@ -196,7 +196,7 @@ unsigned int uxg_DrawWchar(u8g_t *pu8g, unsigned int x, unsigned int y, wchar_t * * Draw a UTF-8 string at the specified position */ -unsigned int uxg_DrawUtf8Str(u8g_t *pu8g, unsigned int x, unsigned int y, const char *utf8_msg, pixel_len_t max_width) { +unsigned int uxg_DrawUtf8Str(u8g_t *pu8g, unsigned int x, unsigned int y, const char * const 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); @@ -230,7 +230,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, PGM_P utf8_msg, pixel_len_t max_width) { +unsigned int uxg_DrawUtf8StrP(u8g_t *pu8g, unsigned int x, unsigned int y, PGM_P const 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); @@ -273,7 +273,7 @@ static int fontgroup_cb_draw_u8gstrlen(void *userdata, const font_t *fnt_current * * Get the screen pixel width of a UTF-8 string */ -int uxg_GetUtf8StrPixelWidth(u8g_t *pu8g, const char *utf8_msg) { +int uxg_GetUtf8StrPixelWidth(u8g_t *pu8g, const char * const utf8_msg) { struct _uxg_drawu8_data_t data; font_group_t *group = &g_fontgroup_root; const font_t *fnt_default = uxg_GetFont(pu8g); @@ -299,7 +299,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, PGM_P utf8_msg) { +int uxg_GetUtf8StrPixelWidthP(u8g_t *pu8g, PGM_P const utf8_msg) { struct _uxg_drawu8_data_t data; font_group_t *group = &g_fontgroup_root; const font_t *fnt_default = uxg_GetFont(pu8g); diff --git a/Marlin/src/lcd/dogm/u8g_fontutf8.h b/Marlin/src/lcd/dogm/u8g_fontutf8.h index 34e365cf95..3e7de24b75 100644 --- a/Marlin/src/lcd/dogm/u8g_fontutf8.h +++ b/Marlin/src/lcd/dogm/u8g_fontutf8.h @@ -28,10 +28,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, PGM_P utf8_msg, pixel_len_t max_length); +unsigned int uxg_DrawUtf8Str(u8g_t *pu8g, unsigned int x, unsigned int y, const char * const utf8_msg, pixel_len_t max_length); +unsigned int uxg_DrawUtf8StrP(u8g_t *pu8g, unsigned int x, unsigned int y, PGM_P const utf8_msg, pixel_len_t max_length); -int uxg_GetUtf8StrPixelWidth(u8g_t *pu8g, const char *utf8_msg); -int uxg_GetUtf8StrPixelWidthP(u8g_t *pu8g, PGM_P utf8_msg); +int uxg_GetUtf8StrPixelWidth(u8g_t *pu8g, const char * const utf8_msg); +int uxg_GetUtf8StrPixelWidthP(u8g_t *pu8g, PGM_P const utf8_msg); #define uxg_GetFont(puxg) ((puxg)->font) diff --git a/Marlin/src/lcd/lcdprint.h b/Marlin/src/lcd/lcdprint.h index 59cd546855..594e159b6e 100644 --- a/Marlin/src/lcd/lcdprint.h +++ b/Marlin/src/lcd/lcdprint.h @@ -22,7 +22,7 @@ int lcd_glyph_height(void); -int lcd_put_wchar_max(wchar_t c, pixel_len_t max_length); +int lcd_put_wchar_max(const wchar_t c, pixel_len_t max_length); /** * @brief Draw a UTF-8 string @@ -34,7 +34,7 @@ int lcd_put_wchar_max(wchar_t c, pixel_len_t max_length); * * Draw a UTF-8 string */ -int lcd_put_u8str_max(const char * utf8_str, pixel_len_t max_length); +int lcd_put_u8str_max(const char * const utf8_str, pixel_len_t max_length); /** * @brief Draw a ROM UTF-8 string @@ -46,14 +46,14 @@ 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(PGM_P utf8_str_P, pixel_len_t max_length); +int lcd_put_u8str_max_P(PGM_P const utf8_str_P, pixel_len_t max_length); void lcd_moveto(const uint8_t col, const uint8_t row); void lcd_put_int(const int i); -inline int lcd_put_u8str_P(PGM_P str) { return lcd_put_u8str_max_P(str, PIXEL_LEN_NOLIMIT); } +inline int lcd_put_u8str_P(PGM_P const 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); } +inline int lcd_put_u8str(const char * const str) { return lcd_put_u8str_max(str, PIXEL_LEN_NOLIMIT); } inline int lcd_put_wchar(const wchar_t c) { return lcd_put_wchar_max(c, PIXEL_LEN_NOLIMIT); } diff --git a/Marlin/src/lcd/ultralcd.cpp b/Marlin/src/lcd/ultralcd.cpp index 8cecbd9182..8d11dabaec 100644 --- a/Marlin/src/lcd/ultralcd.cpp +++ b/Marlin/src/lcd/ultralcd.cpp @@ -130,7 +130,7 @@ millis_t next_button_update_ms; uint8_t MarlinUI::filename_scroll_pos, MarlinUI::filename_scroll_max; #endif - const char * const MarlinUI::scrolled_filename(CardReader &theCard, const uint8_t maxlen, uint8_t hash, const bool doScroll) { + const char * MarlinUI::scrolled_filename(CardReader &theCard, const uint8_t maxlen, uint8_t hash, const bool doScroll) { const char *outstr = theCard.longest_filename(); if (theCard.longFilename[0]) { #if ENABLED(SCROLL_LONG_FILENAMES) diff --git a/Marlin/src/lcd/ultralcd.h b/Marlin/src/lcd/ultralcd.h index 9465dc6161..61524a082b 100644 --- a/Marlin/src/lcd/ultralcd.h +++ b/Marlin/src/lcd/ultralcd.h @@ -380,7 +380,7 @@ public: #if ENABLED(SCROLL_LONG_FILENAMES) static uint8_t filename_scroll_pos, filename_scroll_max; #endif - static const char * const scrolled_filename(CardReader &theCard, const uint8_t maxlen, uint8_t hash, const bool doScroll); + static const char * scrolled_filename(CardReader &theCard, const uint8_t maxlen, uint8_t hash, const bool doScroll); #endif #if IS_KINEMATIC