Merge pull request #600 from xoan/Encoder_Pulses_Per_Step

add ENCODER_PULSES_PER_STEP
This commit is contained in:
ErikZalm 2013-09-14 04:56:45 -07:00
commit 6a1e980c6d

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