add ENCODER_PULSES_PER_STEP

master
Xoan Sampaiño 11 years ago
parent 59e36f1d27
commit bf7007d02f

@ -88,6 +88,7 @@ static void menu_action_setting_edit_callback_long5(const char* pstr, unsigned l
#if !defined(LCD_I2C_VIKI) #if !defined(LCD_I2C_VIKI)
#define ENCODER_STEPS_PER_MENU_ITEM 5 #define ENCODER_STEPS_PER_MENU_ITEM 5
#define ENCODER_PULSES_PER_STEP 1
#else #else
#define ENCODER_STEPS_PER_MENU_ITEM 2 // VIKI LCD rotary encoder uses a different number of steps per rotation #define ENCODER_STEPS_PER_MENU_ITEM 2 // VIKI LCD rotary encoder uses a different number of steps per rotation
#endif #endif
@ -984,10 +985,10 @@ void lcd_update()
reprapworld_keypad_move_home(); reprapworld_keypad_move_home();
} }
#endif #endif
if (encoderDiff) if (abs(encoderDiff) >= ENCODER_PULSES_PER_STEP)
{ {
lcdDrawUpdate = 1; lcdDrawUpdate = 1;
encoderPosition += encoderDiff; encoderPosition += encoderDiff / ENCODER_PULSES_PER_STEP;
encoderDiff = 0; encoderDiff = 0;
timeoutToStatus = millis() + LCD_TIMEOUT_TO_STATUS; timeoutToStatus = millis() + LCD_TIMEOUT_TO_STATUS;
} }

Loading…
Cancel
Save