Browse Source

Cleaning up, getting rid of the fake encoder count variable.

pull/1/head
Ruwan J Egoda Gamage 9 years ago
committed by Richard Wackerbarth
parent
commit
6f9e9c0e4f
  1. 24
      Marlin/ultralcd.cpp
  2. 3
      Marlin/ultralcd.h

24
Marlin/ultralcd.cpp

@ -218,9 +218,6 @@ static void lcd_status_screen();
#if ENABLED(REPRAPWORLD_KEYPAD) #if ENABLED(REPRAPWORLD_KEYPAD)
volatile uint8_t buttons_reprapworld_keypad; // to store the keypad shift register values volatile uint8_t buttons_reprapworld_keypad; // to store the keypad shift register values
#endif #endif
#if ENABLED(RIGIDBOT_PANEL)
volatile millis_t next_fake_encoder_update_ms;
#endif
#if ENABLED(LCD_HAS_SLOW_BUTTONS) #if ENABLED(LCD_HAS_SLOW_BUTTONS)
volatile uint8_t slow_buttons; // Bits of the pressed buttons. volatile uint8_t slow_buttons; // Bits of the pressed buttons.
@ -1555,7 +1552,6 @@ void lcd_init() {
pinMode(BTN_DWN,INPUT); pinMode(BTN_DWN,INPUT);
pinMode(BTN_LFT,INPUT); pinMode(BTN_LFT,INPUT);
pinMode(BTN_RT,INPUT); pinMode(BTN_RT,INPUT);
next_fake_encoder_update_ms = 0;
#endif #endif
#else // Not NEWPANEL #else // Not NEWPANEL
@ -1865,25 +1861,27 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
if (READ(BTN_EN2) == 0) newbutton |= EN_B; if (READ(BTN_EN2) == 0) newbutton |= EN_B;
#endif #endif
#if ENABLED(RIGIDBOT_PANEL) #if ENABLED(RIGIDBOT_PANEL)
if (millis() > next_fake_encoder_update_ms && READ(BTN_UP) == 0) { millis_t now = millis();
if (now > next_button_update_ms) {
if (READ(BTN_UP) == 0) {
encoderDiff = -1 * ENCODER_STEPS_PER_MENU_ITEM; encoderDiff = -1 * ENCODER_STEPS_PER_MENU_ITEM;
next_fake_encoder_update_ms = millis() + 300; next_button_update_ms = now + 300;
} }
if (millis() > next_fake_encoder_update_ms && READ(BTN_DWN) == 0) { else if (READ(BTN_DWN) == 0) {
encoderDiff = ENCODER_STEPS_PER_MENU_ITEM; encoderDiff = ENCODER_STEPS_PER_MENU_ITEM;
next_fake_encoder_update_ms = millis() + 300; next_button_update_ms = now + 300;
} }
if (millis() > next_fake_encoder_update_ms && READ(BTN_LFT) == 0) { else if (READ(BTN_LFT) == 0) {
encoderDiff = -1 * ENCODER_PULSES_PER_STEP; encoderDiff = -1 * ENCODER_PULSES_PER_STEP;
next_fake_encoder_update_ms = millis() + 300; next_button_update_ms = now + 300;
} }
if (millis() > next_fake_encoder_update_ms && READ(BTN_RT) == 0) { else if (READ(BTN_RT) == 0) {
encoderDiff = ENCODER_PULSES_PER_STEP; encoderDiff = ENCODER_PULSES_PER_STEP;
next_fake_encoder_update_ms = millis() + 300; next_button_update_ms = now + 300;
}
} }
#endif #endif
#if BTN_ENC > 0 #if BTN_ENC > 0
if (millis() > next_button_update_ms && READ(BTN_ENC) == 0) newbutton |= EN_C; if (millis() > next_button_update_ms && READ(BTN_ENC) == 0) newbutton |= EN_C;
#endif #endif

3
Marlin/ultralcd.h

@ -41,9 +41,6 @@
#if ENABLED(REPRAPWORLD_KEYPAD) #if ENABLED(REPRAPWORLD_KEYPAD)
extern volatile uint8_t buttons_reprapworld_keypad; // to store the keypad shift register values extern volatile uint8_t buttons_reprapworld_keypad; // to store the keypad shift register values
#endif #endif
#if ENABLED(RIGIDBOT_PANEL)
extern volatile millis_t next_fake_encoder_update_ms;
#endif
#else #else
FORCE_INLINE void lcd_buttons_update() {} FORCE_INLINE void lcd_buttons_update() {}
#endif #endif

Loading…
Cancel
Save