Skip to content

Commit

Permalink
Replace ftostr62sign with ftostr62rj
Browse files Browse the repository at this point in the history
`ftostr62sign()` is used only when displaing/editing
Steps/mm. A sign is not needed - the value is always positive.
Because the number part is long there is no't much place for the values name.
With this PR the is one more char for the name possible.
  • Loading branch information
AnHardt committed Dec 12, 2016
1 parent 7c71bb2 commit cd2b74e
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Marlin/ultralcd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2475,7 +2475,7 @@ void kill_screen(const char* lcd_msg) {
menu_edit_type(float, float5, ftostr5rj, 0.01);
menu_edit_type(float, float51, ftostr51sign, 10.0);
menu_edit_type(float, float52, ftostr52sign, 100.0);
menu_edit_type(float, float62, ftostr62sign, 100.0);
menu_edit_type(float, float62, ftostr62rj, 100.0);
menu_edit_type(unsigned long, long5, ftostr5rj, 0.01);

/**
Expand Down
4 changes: 2 additions & 2 deletions Marlin/ultralcd_impl_DOGM.h
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@ static void lcd_implementation_status_screen() {
#define lcd_implementation_drawmenu_setting_edit_float5(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr5rj(*(data)))
#define lcd_implementation_drawmenu_setting_edit_float52(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr52sign(*(data)))
#define lcd_implementation_drawmenu_setting_edit_float51(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr51sign(*(data)))
#define lcd_implementation_drawmenu_setting_edit_float62(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr62sign(*(data)))
#define lcd_implementation_drawmenu_setting_edit_float62(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr62rj(*(data)))
#define lcd_implementation_drawmenu_setting_edit_long5(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr5rj(*(data)))
#define lcd_implementation_drawmenu_setting_edit_bool(sel, row, pstr, pstr2, data) lcd_implementation_drawmenu_setting_edit_generic_P(sel, row, pstr, (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF))

Expand All @@ -752,7 +752,7 @@ static void lcd_implementation_status_screen() {
#define lcd_implementation_drawmenu_setting_edit_callback_float5(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_float52(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr52sign(*(data)))
#define lcd_implementation_drawmenu_setting_edit_callback_float51(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr51sign(*(data)))
#define lcd_implementation_drawmenu_setting_edit_callback_float62(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr62sign(*(data)))
#define lcd_implementation_drawmenu_setting_edit_callback_float62(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr62rj(*(data)))
#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))

Expand Down
4 changes: 2 additions & 2 deletions Marlin/ultralcd_impl_HD44780.h
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,7 @@ static void lcd_implementation_status_screen() {
#define lcd_implementation_drawmenu_setting_edit_float5(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr5rj(*(data)))
#define lcd_implementation_drawmenu_setting_edit_float52(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr52sign(*(data)))
#define lcd_implementation_drawmenu_setting_edit_float51(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr51sign(*(data)))
#define lcd_implementation_drawmenu_setting_edit_float62(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr62sign(*(data)))
#define lcd_implementation_drawmenu_setting_edit_float62(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr62rj(*(data)))
#define lcd_implementation_drawmenu_setting_edit_long5(sel, row, pstr, pstr2, data, minValue, maxValue) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr5rj(*(data)))
#define lcd_implementation_drawmenu_setting_edit_bool(sel, row, pstr, pstr2, data) lcd_implementation_drawmenu_setting_edit_generic_P(sel, row, pstr, '>', (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF))

Expand All @@ -875,7 +875,7 @@ static void lcd_implementation_status_screen() {
#define lcd_implementation_drawmenu_setting_edit_callback_float5(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_float52(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr52sign(*(data)))
#define lcd_implementation_drawmenu_setting_edit_callback_float51(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr51sign(*(data)))
#define lcd_implementation_drawmenu_setting_edit_callback_float62(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr62sign(*(data)))
#define lcd_implementation_drawmenu_setting_edit_callback_float62(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, '>', ftostr62rj(*(data)))
#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))

Expand Down
21 changes: 10 additions & 11 deletions Marlin/utility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,18 +212,17 @@ void safe_delay(millis_t ms) {
return conv;
}

// Convert signed float to string with +1234.56 format
char* ftostr62sign(const float& x) {
// Convert unsigned float to string with 1234.56 format omitting trailing zeros
char* ftostr62rj(const float& x) {
long xx = abs(x * 100);
conv[0] = MINUSOR(xx, '+');
conv[1] = DIGIMOD(xx, 100000);
conv[2] = DIGIMOD(xx, 10000);
conv[3] = DIGIMOD(xx, 1000);
conv[4] = DIGIMOD(xx, 100);
conv[5] = '.';
conv[6] = DIGIMOD(xx, 10);
conv[7] = DIGIMOD(xx, 1);
conv[8] = '\0';
conv[0] = RJDIGIT(xx, 100000);
conv[1] = RJDIGIT(xx, 10000);
conv[2] = RJDIGIT(xx, 1000);
conv[3] = DIGIMOD(xx, 100);
conv[4] = '.';
conv[5] = DIGIMOD(xx, 10);
conv[6] = DIGIMOD(xx, 1);
conv[7] = '\0';
return conv;
}

Expand Down
4 changes: 2 additions & 2 deletions Marlin/utility.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ void safe_delay(millis_t ms);
// Convert signed float to string with +123.45 format
char* ftostr52sign(const float& x);

// Convert signed float to string with +1234.56 format
char* ftostr62sign(const float& x);
// Convert unsigned float to string with 1234.56 format omitting trailing zeros
char* ftostr62rj(const float& x);

// Convert float to rj string with 123 or -12 format
FORCE_INLINE char *ftostr3(const float& x) { return itostr3((int)x); }
Expand Down

0 comments on commit cd2b74e

Please sign in to comment.