More bits when encoderPosition is cast as signed
This commit is contained in:
parent
50c3140040
commit
8198cc30b5
1 changed files with 11 additions and 11 deletions
|
@ -432,19 +432,19 @@ static void lcd_status_screen() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLED(ULTIPANEL_FEEDMULTIPLY)
|
#if ENABLED(ULTIPANEL_FEEDMULTIPLY)
|
||||||
int new_frm = feedrate_multiplier + int(encoderPosition);
|
int new_frm = feedrate_multiplier + (int32_t)encoderPosition;
|
||||||
// Dead zone at 100% feedrate
|
// Dead zone at 100% feedrate
|
||||||
if ((feedrate_multiplier < 100 && new_frm > 100) || (feedrate_multiplier > 100 && new_frm < 100)) {
|
if ((feedrate_multiplier < 100 && new_frm > 100) || (feedrate_multiplier > 100 && new_frm < 100)) {
|
||||||
feedrate_multiplier = 100;
|
feedrate_multiplier = 100;
|
||||||
encoderPosition = 0;
|
encoderPosition = 0;
|
||||||
}
|
}
|
||||||
else if (feedrate_multiplier == 100) {
|
else if (feedrate_multiplier == 100) {
|
||||||
if (int(encoderPosition) > ENCODER_FEEDRATE_DEADZONE) {
|
if ((int32_t)encoderPosition > ENCODER_FEEDRATE_DEADZONE) {
|
||||||
feedrate_multiplier += int(encoderPosition) - (ENCODER_FEEDRATE_DEADZONE);
|
feedrate_multiplier += (int32_t)encoderPosition - (ENCODER_FEEDRATE_DEADZONE);
|
||||||
encoderPosition = 0;
|
encoderPosition = 0;
|
||||||
}
|
}
|
||||||
else if (int(encoderPosition) < -ENCODER_FEEDRATE_DEADZONE) {
|
else if ((int32_t)encoderPosition < -(ENCODER_FEEDRATE_DEADZONE)) {
|
||||||
feedrate_multiplier += int(encoderPosition) + ENCODER_FEEDRATE_DEADZONE;
|
feedrate_multiplier += (int32_t)encoderPosition + ENCODER_FEEDRATE_DEADZONE;
|
||||||
encoderPosition = 0;
|
encoderPosition = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -554,7 +554,7 @@ void lcd_set_home_offsets() {
|
||||||
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) {
|
||||||
int distance = (int)encoderPosition * BABYSTEP_MULTIPLICATOR;
|
int distance = (int32_t)encoderPosition * BABYSTEP_MULTIPLICATOR;
|
||||||
encoderPosition = 0;
|
encoderPosition = 0;
|
||||||
lcdDrawUpdate = LCD_DRAW_UPDATE_CALL_REDRAW;
|
lcdDrawUpdate = LCD_DRAW_UPDATE_CALL_REDRAW;
|
||||||
#if ENABLED(COREXY) || ENABLED(COREXZ)
|
#if ENABLED(COREXY) || ENABLED(COREXZ)
|
||||||
|
@ -903,7 +903,7 @@ void lcd_cooldown() {
|
||||||
// Encoder wheel adjusts the Z position
|
// Encoder wheel adjusts the Z position
|
||||||
if (encoderPosition && movesplanned() <= 3) {
|
if (encoderPosition && movesplanned() <= 3) {
|
||||||
refresh_cmd_timeout();
|
refresh_cmd_timeout();
|
||||||
current_position[Z_AXIS] += float((int)encoderPosition) * (MBL_Z_STEP);
|
current_position[Z_AXIS] += float((int32_t)encoderPosition) * (MBL_Z_STEP);
|
||||||
if (min_software_endstops) NOLESS(current_position[Z_AXIS], Z_MIN_POS);
|
if (min_software_endstops) NOLESS(current_position[Z_AXIS], Z_MIN_POS);
|
||||||
if (max_software_endstops) NOMORE(current_position[Z_AXIS], Z_MAX_POS);
|
if (max_software_endstops) NOMORE(current_position[Z_AXIS], Z_MAX_POS);
|
||||||
encoderPosition = 0;
|
encoderPosition = 0;
|
||||||
|
@ -1126,7 +1126,7 @@ static void _lcd_move(const char* name, AxisEnum axis, float min, float max) {
|
||||||
ENCODER_DIRECTION_NORMAL();
|
ENCODER_DIRECTION_NORMAL();
|
||||||
if (encoderPosition && movesplanned() <= 3) {
|
if (encoderPosition && movesplanned() <= 3) {
|
||||||
refresh_cmd_timeout();
|
refresh_cmd_timeout();
|
||||||
current_position[axis] += float((int)encoderPosition) * move_menu_scale;
|
current_position[axis] += float((int32_t)encoderPosition) * move_menu_scale;
|
||||||
if (min_software_endstops) NOLESS(current_position[axis], min);
|
if (min_software_endstops) NOLESS(current_position[axis], min);
|
||||||
if (max_software_endstops) NOMORE(current_position[axis], max);
|
if (max_software_endstops) NOMORE(current_position[axis], max);
|
||||||
encoderPosition = 0;
|
encoderPosition = 0;
|
||||||
|
@ -1157,7 +1157,7 @@ static void lcd_move_e(
|
||||||
active_extruder = e;
|
active_extruder = e;
|
||||||
#endif
|
#endif
|
||||||
if (encoderPosition && movesplanned() <= 3) {
|
if (encoderPosition && movesplanned() <= 3) {
|
||||||
current_position[E_AXIS] += float((int)encoderPosition) * move_menu_scale;
|
current_position[E_AXIS] += float((int32_t)encoderPosition) * move_menu_scale;
|
||||||
encoderPosition = 0;
|
encoderPosition = 0;
|
||||||
line_to_current(E_AXIS);
|
line_to_current(E_AXIS);
|
||||||
lcdDrawUpdate = LCD_DRAW_UPDATE_CALL_REDRAW;
|
lcdDrawUpdate = LCD_DRAW_UPDATE_CALL_REDRAW;
|
||||||
|
@ -2345,7 +2345,7 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
|
||||||
#if ENABLED(RIGIDBOT_PANEL)
|
#if ENABLED(RIGIDBOT_PANEL)
|
||||||
if (now > next_button_update_ms) {
|
if (now > next_button_update_ms) {
|
||||||
if (BUTTON_PRESSED(UP)) {
|
if (BUTTON_PRESSED(UP)) {
|
||||||
encoderDiff = -1 * (ENCODER_STEPS_PER_MENU_ITEM);
|
encoderDiff = -(ENCODER_STEPS_PER_MENU_ITEM);
|
||||||
next_button_update_ms = now + 300;
|
next_button_update_ms = now + 300;
|
||||||
}
|
}
|
||||||
else if (BUTTON_PRESSED(DWN)) {
|
else if (BUTTON_PRESSED(DWN)) {
|
||||||
|
@ -2353,7 +2353,7 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
|
||||||
next_button_update_ms = now + 300;
|
next_button_update_ms = now + 300;
|
||||||
}
|
}
|
||||||
else if (BUTTON_PRESSED(LFT)) {
|
else if (BUTTON_PRESSED(LFT)) {
|
||||||
encoderDiff = -1 * (ENCODER_PULSES_PER_STEP);
|
encoderDiff = -(ENCODER_PULSES_PER_STEP);
|
||||||
next_button_update_ms = now + 300;
|
next_button_update_ms = now + 300;
|
||||||
}
|
}
|
||||||
else if (BUTTON_PRESSED(RT)) {
|
else if (BUTTON_PRESSED(RT)) {
|
||||||
|
|
Reference in a new issue