add ENCODER_PULSES_PER_STEP

This commit is contained in:
Xoan Sampaiño 2013-09-13 04:12:51 +02:00
parent 59e36f1d27
commit bf7007d02f

View File

@ -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;
} }