From bf7007d02fe02fa1d78ab50cbc68a3debf6bcfa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xoan=20Sampai=C3=B1o?= Date: Fri, 13 Sep 2013 04:12:51 +0200 Subject: [PATCH] add ENCODER_PULSES_PER_STEP --- Marlin/ultralcd.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 229e23e92..425687893 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -88,6 +88,7 @@ static void menu_action_setting_edit_callback_long5(const char* pstr, unsigned l #if !defined(LCD_I2C_VIKI) #define ENCODER_STEPS_PER_MENU_ITEM 5 + #define ENCODER_PULSES_PER_STEP 1 #else #define ENCODER_STEPS_PER_MENU_ITEM 2 // VIKI LCD rotary encoder uses a different number of steps per rotation #endif @@ -984,10 +985,10 @@ void lcd_update() reprapworld_keypad_move_home(); } #endif - if (encoderDiff) + if (abs(encoderDiff) >= ENCODER_PULSES_PER_STEP) { lcdDrawUpdate = 1; - encoderPosition += encoderDiff; + encoderPosition += encoderDiff / ENCODER_PULSES_PER_STEP; encoderDiff = 0; timeoutToStatus = millis() + LCD_TIMEOUT_TO_STATUS; }