Merge pull request #3176 from thinkyhead/rc_patch_3149_part_ii

Use const parameters in lcd_implementation_drawedit (etc.)
This commit is contained in:
Scott Lahteine 2016-03-19 05:18:25 -07:00
commit 7f2375ab46
25 changed files with 31 additions and 8 deletions

View file

@ -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);

View file

@ -20,6 +20,7 @@
#define MSG_AUTOSTART " Autostart"
#define MSG_DISABLE_STEPPERS "Amortar motors"
#define MSG_AUTO_HOME "Levar a l'orichen"
#define MSG_LEVEL_BED_HOMING "Homing"
#define MSG_SET_HOME_OFFSETS "Set home offsets"
#define MSG_SET_ORIGIN "Establir zero"
#define MSG_PREHEAT_PLA "Precalentar PLA"

View file

@ -20,6 +20,7 @@
#define MSG_AUTOSTART "Автостарт"
#define MSG_DISABLE_STEPPERS "Изкл. двигатели"
#define MSG_AUTO_HOME "Паркиране"
#define MSG_LEVEL_BED_HOMING "Homing"
#define MSG_SET_HOME_OFFSETS "Задай Начало"
#define MSG_SET_ORIGIN "Изходна точка"
#define MSG_PREHEAT_PLA "Подгряване PLA"

View file

@ -21,6 +21,7 @@
#define MSG_AUTOSTART "Inici automatic"
#define MSG_DISABLE_STEPPERS "Apagar motors"
#define MSG_AUTO_HOME "Home global"
#define MSG_LEVEL_BED_HOMING "Homing"
#define MSG_SET_HOME_OFFSETS "Set home offsets"
#define MSG_SET_ORIGIN "Establir origen"
#define MSG_PREHEAT_PLA "Preescalfar PLA"

View file

@ -18,6 +18,7 @@
#define MSG_AUTOSTART "\xb1\xb2\xb3\xb4"
#define MSG_DISABLE_STEPPERS "\xb5\xb6\xb7\xb8\xb9\xba"
#define MSG_AUTO_HOME "\xbb\xbc\xbd"
#define MSG_LEVEL_BED_HOMING "Homing"
#define MSG_SET_HOME_OFFSETS "\xbe\xbf\xbb\xbc\xbd\xc0\xc1"
#define MSG_SET_ORIGIN "\xbe\xbf\xbc\xbd"
#define MSG_PREHEAT_PLA "\xc3\xc4 PLA"

View file

@ -24,6 +24,7 @@
#define MSG_AUTOSTART "Autostart"
#define MSG_DISABLE_STEPPERS "Uvolnit motory"
#define MSG_AUTO_HOME "Domovska pozice"
#define MSG_LEVEL_BED_HOMING "Homing"
#define MSG_SET_HOME_OFFSETS "Nastavit ofsety"
#define MSG_SET_ORIGIN "Nastavit pocatek"
#define MSG_PREHEAT_PLA "Zahrat PLA"

View file

@ -21,6 +21,7 @@
#define MSG_AUTO_HOME "Home" // G28
#define MSG_COOLDOWN "Afkøl"
#define MSG_DISABLE_STEPPERS "Slå stepper fra"
#define MSG_LEVEL_BED_HOMING "Homing"
#define MSG_SET_HOME_OFFSETS "Sæt home offsets"
#define MSG_SET_ORIGIN "Sæt origin"
#define MSG_SWITCH_PS_ON "Slå strøm til"

View file

@ -20,6 +20,7 @@
#define MSG_AUTOSTART "Autostart"
#define MSG_DISABLE_STEPPERS "Motoren Aus" // M84
#define MSG_AUTO_HOME "Home" // G28
#define MSG_LEVEL_BED_HOMING "Homing"
#define MSG_SET_HOME_OFFSETS "Setze Home hier"
#define MSG_SET_ORIGIN "Setze Null hier" //"G92 X0 Y0 Z0" commented out in ultralcd.cpp
#define MSG_PREHEAT_PLA "Vorwärmen PLA"

View file

@ -39,6 +39,9 @@
#ifndef MSG_AUTO_HOME
#define MSG_AUTO_HOME "Auto home"
#endif
#ifndef MSG_LEVEL_BED_HOMING
#define MSG_LEVEL_BED_HOMING "Homing"
#endif
#ifndef MSG_SET_HOME_OFFSETS
#define MSG_SET_HOME_OFFSETS "Set home offsets"
#endif

View file

@ -20,6 +20,7 @@
#define MSG_AUTOSTART "Autostart"
#define MSG_DISABLE_STEPPERS "Apagar motores"
#define MSG_AUTO_HOME "Llevar al origen"
#define MSG_LEVEL_BED_HOMING "Homing"
#define MSG_SET_HOME_OFFSETS "Ajustar offsets"
#define MSG_SET_ORIGIN "Establecer cero"
#define MSG_PREHEAT_PLA "Precalentar PLA"

View file

@ -20,6 +20,7 @@
#define MSG_AUTOSTART "Auto hasiera"
#define MSG_DISABLE_STEPPERS "Itzali motoreak"
#define MSG_AUTO_HOME "Hasierara joan"
#define MSG_LEVEL_BED_HOMING "Homing"
#define MSG_SET_HOME_OFFSETS "Set home offsets"
#define MSG_SET_ORIGIN "Hasiera ipini"
#define MSG_PREHEAT_PLA "Aurreberotu PLA"

View file

@ -20,6 +20,7 @@
#define MSG_AUTOSTART "Automaatti"
#define MSG_DISABLE_STEPPERS "Vapauta moottorit"
#define MSG_AUTO_HOME "Aja referenssiin"
#define MSG_LEVEL_BED_HOMING "Homing"
#define MSG_SET_HOME_OFFSETS "Set home offsets"
#define MSG_SET_ORIGIN "Aseta origo"
#define MSG_PREHEAT_PLA "Esilämmitä PLA"

View file

@ -21,6 +21,7 @@
#define MSG_AUTOSTART "Demarrage auto"
#define MSG_DISABLE_STEPPERS "Arreter moteurs"
#define MSG_AUTO_HOME "Home auto."
#define MSG_LEVEL_BED_HOMING "Homing"
#define MSG_SET_HOME_OFFSETS "Set home offsets"
#define MSG_SET_ORIGIN "Regler origine"
#define MSG_PREHEAT_PLA "Prechauffage PLA"

View file

@ -20,6 +20,7 @@
#define MSG_AUTOSTART "Autostart"
#define MSG_DISABLE_STEPPERS "Disabilita Motori"
#define MSG_AUTO_HOME "Auto Home"
#define MSG_LEVEL_BED_HOMING "Homing"
#define MSG_SET_HOME_OFFSETS "Setta offset home"
#define MSG_SET_ORIGIN "Imposta Origine"
#define MSG_PREHEAT_PLA "Preriscalda PLA"

View file

@ -22,6 +22,7 @@
#define MSG_AUTOSTART "\xbc\xde\xc4\xde\xb3\xb6\xb2\xbc" // "Autostart"
#define MSG_DISABLE_STEPPERS "\xd3\xb0\xc0\xb0\xc3\xde\xdd\xb9\xde\xdd\x20\xb5\xcc" // "Disable steppers"
#define MSG_AUTO_HOME "\xb9\xde\xdd\xc3\xdd\xc6\xb2\xc4\xde\xb3" // "Auto home"
#define MSG_LEVEL_BED_HOMING "Homing"
#define MSG_SET_HOME_OFFSETS "\xb7\xbc\xde\xad\xdd\xb5\xcc\xbe\xaf\xc4\xbe\xaf\xc3\xb2" // "Set home offsets"
#define MSG_SET_ORIGIN "\xb7\xbc\xde\xad\xdd\xbe\xaf\xc4" // "Set origin"
#define MSG_PREHEAT_PLA "PLA \xd6\xc8\xc2" // "Preheat PLA"

View file

@ -26,6 +26,7 @@
#define MSG_AUTOSTART "ジドウカイシ" // "Autostart"
#define MSG_DISABLE_STEPPERS "モーターデンゲン オフ" // "Disable steppers"
#define MSG_AUTO_HOME "ゲンテンニイドウ" // "Auto home"
#define MSG_LEVEL_BED_HOMING "Homing"
#define MSG_SET_HOME_OFFSETS "キジュンオフセットセッテイ" // "Set home offsets"
#define MSG_SET_ORIGIN "キジュンセット" // "Set origin"
#define MSG_PREHEAT_PLA "PLA ヨネツ" // "Preheat PLA"

View file

@ -20,6 +20,7 @@
#define MSG_AUTOSTART "Autostart"
#define MSG_DISABLE_STEPPERS "Motoren uit"
#define MSG_AUTO_HOME "Auto home"
#define MSG_LEVEL_BED_HOMING "Homing"
#define MSG_SET_HOME_OFFSETS "Set home offsets"
#define MSG_SET_ORIGIN "Nulpunt instellen"
#define MSG_PREHEAT_PLA "PLA voorverwarmen"

View file

@ -20,6 +20,7 @@
#define MSG_AUTOSTART "Autostart"
#define MSG_DISABLE_STEPPERS "Wylacz silniki"
#define MSG_AUTO_HOME "Auto. poz. zerowa"
#define MSG_LEVEL_BED_HOMING "Homing"
#define MSG_SET_HOME_OFFSETS "Set home offsets"
#define MSG_SET_ORIGIN "Ustaw punkt zero"
#define MSG_PREHEAT_PLA "Rozgrzej PLA"

View file

@ -20,6 +20,7 @@
#define MSG_AUTOSTART "Autostart"
#define MSG_DISABLE_STEPPERS "Desabi. motores"
#define MSG_AUTO_HOME "Ir para origen"
#define MSG_LEVEL_BED_HOMING "Homing"
#define MSG_SET_HOME_OFFSETS "Ajustar Jogo"
#define MSG_SET_ORIGIN "Ajustar orig."
#define MSG_PREHEAT_PLA "Pre-aquecer PLA"

View file

@ -20,6 +20,7 @@
#define MSG_AUTOSTART "Autostart"
#define MSG_DISABLE_STEPPERS "Desabi. motores"
#define MSG_AUTO_HOME "Ir para origen"
#define MSG_LEVEL_BED_HOMING "Homing"
#define MSG_SET_HOME_OFFSETS "Ajustar Jogo"
#define MSG_SET_ORIGIN "Ajustar orig."
#define MSG_PREHEAT_PLA "Pre-aquecer PLA"

View file

@ -20,6 +20,7 @@
#define MSG_AUTOSTART "Autostart"
#define MSG_DISABLE_STEPPERS " Desactivar motores"
#define MSG_AUTO_HOME "Ir para origem"
#define MSG_LEVEL_BED_HOMING "Homing"
#define MSG_SET_HOME_OFFSETS "Def. desvio origem"
#define MSG_SET_ORIGIN "Definir origem"
#define MSG_PREHEAT_PLA "Pre-aquecer PLA"

View file

@ -20,6 +20,7 @@
#define MSG_AUTOSTART "Автостарт"
#define MSG_DISABLE_STEPPERS "Выкл. двигатели"
#define MSG_AUTO_HOME "Парковка"
#define MSG_LEVEL_BED_HOMING "Homing"
#define MSG_SET_HOME_OFFSETS "Запомнить парковку"
#define MSG_SET_ORIGIN "Запомнить ноль"
#define MSG_PREHEAT_PLA "Преднагрев PLA"

View file

@ -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(MSG_LEVEL_BED_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]);

View file

@ -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();

View file

@ -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(':');