Show steps done in the babystep display

This commit is contained in:
Scott Lahteine 2016-04-18 20:39:15 -07:00
parent 09c6323b68
commit 4f04bf7fe8
2 changed files with 15 additions and 8 deletions

View File

@ -550,6 +550,8 @@ void lcd_set_home_offsets() {
#if ENABLED(BABYSTEPPING) #if ENABLED(BABYSTEPPING)
int babysteps_done = 0;
static void _lcd_babystep(const int axis, const char* msg) { static void _lcd_babystep(const int axis, const char* msg) {
ENCODER_DIRECTION_NORMAL(); ENCODER_DIRECTION_NORMAL();
if (encoderPosition) { if (encoderPosition) {
@ -580,16 +582,21 @@ void lcd_set_home_offsets() {
#else #else
babystepsTodo[axis] += distance; babystepsTodo[axis] += distance;
#endif #endif
babysteps_done += distance;
} }
if (lcdDrawUpdate) lcd_implementation_drawedit(msg, NULL); if (lcdDrawUpdate) lcd_implementation_drawedit(msg, itostr3sign(babysteps_done));
if (LCD_CLICKED) lcd_goto_previous_menu(true); if (LCD_CLICKED) lcd_goto_previous_menu(true);
} }
#if ENABLED(BABYSTEP_XY) #if ENABLED(BABYSTEP_XY)
static void lcd_babystep_x() { _lcd_babystep(X_AXIS, PSTR(MSG_BABYSTEPPING_X)); } static void _lcd_babystep_x() { _lcd_babystep(X_AXIS, PSTR(MSG_BABYSTEPPING_X)); }
static void lcd_babystep_y() { _lcd_babystep(Y_AXIS, PSTR(MSG_BABYSTEPPING_Y)); } static void _lcd_babystep_y() { _lcd_babystep(Y_AXIS, PSTR(MSG_BABYSTEPPING_Y)); }
static void lcd_babystep_x() { babysteps_done = 0; lcd_goto_menu(_lcd_babystep_x); }
static void lcd_babystep_y() { babysteps_done = 0; lcd_goto_menu(_lcd_babystep_y); }
#endif #endif
static void lcd_babystep_z() { _lcd_babystep(Z_AXIS, PSTR(MSG_BABYSTEPPING_Z)); } static void _lcd_babystep_z() { _lcd_babystep(Z_AXIS, PSTR(MSG_BABYSTEPPING_Z)); }
static void lcd_babystep_z() { babysteps_done = 0; lcd_goto_menu(_lcd_babystep_z); }
#endif //BABYSTEPPING #endif //BABYSTEPPING
@ -2573,8 +2580,8 @@ char* ftostr32sp(const float& x) {
return conv; return conv;
} }
// Convert signed int to lj string with +012.0 / -012.0 format // Convert signed int to lj string with +012 / -012 format
char* itostr31(const int& x) { char* itostr3sign(const int& x) {
int xx; int xx;
if (x >= 0) { if (x >= 0) {
conv[0] = '+'; conv[0] = '+';

View File

@ -162,7 +162,7 @@
#endif //ULTRA_LCD #endif //ULTRA_LCD
char* itostr2(const uint8_t& x); char* itostr2(const uint8_t& x);
char* itostr31(const int& x); char* itostr3sign(const int& x);
char* itostr3(const int& x); char* itostr3(const int& x);
char* itostr3left(const int& x); char* itostr3left(const int& x);
char* itostr4(const int& x); char* itostr4(const int& x);