瀏覽代碼

reusing millis()

Ruwan J Egoda Gamage 9 年之前
父節點
當前提交
a64bcd53e9
共有 1 個檔案被更改,包括 4 行新增3 行删除
  1. 4
    3
      Marlin/ultralcd.cpp

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

1860
       #if BTN_EN2 > 0
1860
       #if BTN_EN2 > 0
1861
         if (READ(BTN_EN2) == 0) newbutton |= EN_B;
1861
         if (READ(BTN_EN2) == 0) newbutton |= EN_B;
1862
       #endif
1862
       #endif
1863
-      #if ENABLED(RIGIDBOT_PANEL)
1863
+      #if ENABLED(RIGIDBOT_PANEL) || BTN_ENC > 0
1864
         millis_t now = millis();
1864
         millis_t now = millis();
1865
+      #endif
1866
+      #if ENABLED(RIGIDBOT_PANEL)
1865
         if (now > next_button_update_ms) {
1867
         if (now > next_button_update_ms) {
1866
           if (READ(BTN_UP) == 0) {
1868
           if (READ(BTN_UP) == 0) {
1867
             encoderDiff = -1 * ENCODER_STEPS_PER_MENU_ITEM;
1869
             encoderDiff = -1 * ENCODER_STEPS_PER_MENU_ITEM;
1881
           }
1883
           }
1882
         }
1884
         }
1883
       #endif
1885
       #endif
1884
-
1885
       #if BTN_ENC > 0
1886
       #if BTN_ENC > 0
1886
-        if (millis() > next_button_update_ms && READ(BTN_ENC) == 0) newbutton |= EN_C;
1887
+        if (now > next_button_update_ms && READ(BTN_ENC) == 0) newbutton |= EN_C;
1887
       #endif
1888
       #endif
1888
       buttons = newbutton;
1889
       buttons = newbutton;
1889
       #if ENABLED(LCD_HAS_SLOW_BUTTONS)
1890
       #if ENABLED(LCD_HAS_SLOW_BUTTONS)

Loading…
取消
儲存