瀏覽代碼

add ENCODER_PULSES_PER_STEP

Xoan Sampaiño 12 年之前
父節點
當前提交
bf7007d02f
共有 1 個檔案被更改,包括 3 行新增2 行删除
  1. 3
    2
      Marlin/ultralcd.cpp

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

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

Loading…
取消
儲存