-
-
Notifications
You must be signed in to change notification settings - Fork 19.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extend stack_overflow_protection for lcd_move_e and _lcd_level_bed #3126
Extend stack_overflow_protection for lcd_move_e and _lcd_level_bed #3126
Conversation
@@ -862,7 +862,8 @@ static void lcd_move_e( | |||
if (encoderPosition != 0) { | |||
current_position[E_AXIS] += float((int)encoderPosition) * move_menu_scale; | |||
encoderPosition = 0; | |||
line_to_current(E_AXIS); | |||
if (movesplanned() <= 3) | |||
line_to_current(E_AXIS); | |||
lcdDrawUpdate = 1; | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As this is, it will drop moves, and those moves will stay dropped when the LCD times out and returns to the info screen. However, it turns out there is an easy solution here to avoid dropping any moves:
if (encoderPosition != 0 && movesplanned() <= 3) {
current_position[E_AXIS] += float((int)encoderPosition) * move_menu_scale;
line_to_current(E_AXIS);
encoderPosition = 0;
lcdDrawUpdate = 1;
}
This holds onto the encoder position and doesn't reset it, so the next time this is invoked, the move will still be pending. With this change you can throw away the line_to_current
call with LCD_CLICKED
below.
@@ -2249,13 +2253,15 @@ char* ftostr52(const float& x) { | |||
if (min_software_endstops) NOLESS(current_position[Z_AXIS], Z_MIN_POS); | |||
if (max_software_endstops) NOMORE(current_position[Z_AXIS], Z_MAX_POS); | |||
encoderPosition = 0; | |||
line_to_current(Z_AXIS); | |||
if (movesplanned() <= 3) | |||
line_to_current(Z_AXIS); | |||
lcdDrawUpdate = 2; | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same idea here…
if (encoderPosition != 0 && movesplanned() <= 3) {
refresh_cmd_timeout();
current_position[Z_AXIS] += float((int)encoderPosition) * MBL_Z_STEP;
if (min_software_endstops) NOLESS(current_position[Z_AXIS], Z_MIN_POS);
if (max_software_endstops) NOMORE(current_position[Z_AXIS], Z_MAX_POS);
line_to_current(Z_AXIS);
encoderPosition = 0;
lcdDrawUpdate = 2;
}
The same technique I suggest can also be applied to the other move routines. You can amend this PR and add those also. |
08db379
to
893bc70
Compare
Extend stack_overflow_protection for lcd_move_e() and _lcd_level_bed() with a refined method of 3050.
893bc70
to
c73f1b2
Compare
Extend stack_overflow_protection for lcd_move_e and _lcd_level_bed
Extend stack_overflow_protection for lcd_move_e() and _lcd_level_bed() with
a refined method of #3050.
Simple, small, local, elegant.
Fix for one of AnatoliyKube's problems in #3054 (comment) (if i solved his language riddle correct)