浏览代码

add ENCODER_PULSES_PER_STEP

Xoan Sampaiño 11 年前
父节点
当前提交
bf7007d02f
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 3
    2
      Marlin/ultralcd.cpp

+ 3
- 2
Marlin/ultralcd.cpp 查看文件

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

正在加载...
取消
保存