Cleaning up, getting rid of the fake encoder count variable.
This commit is contained in:
parent
becbfe1065
commit
6f9e9c0e4f
@ -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
|
||||||
@ -1685,7 +1681,7 @@ void lcd_update() {
|
|||||||
int32_t encoderMovementSteps = abs(encoderDiff) / ENCODER_PULSES_PER_STEP;
|
int32_t encoderMovementSteps = abs(encoderDiff) / ENCODER_PULSES_PER_STEP;
|
||||||
|
|
||||||
if (lastEncoderMovementMillis != 0) {
|
if (lastEncoderMovementMillis != 0) {
|
||||||
// Note that the rate is always calculated between to passes through the
|
// Note that the rate is always calculated between to passes through the
|
||||||
// loop and that the abs of the encoderDiff value is tracked.
|
// loop and that the abs of the encoderDiff value is tracked.
|
||||||
float encoderStepRate = (float)(encoderMovementSteps) / ((float)(ms - lastEncoderMovementMillis)) * 1000.0;
|
float encoderStepRate = (float)(encoderMovementSteps) / ((float)(ms - lastEncoderMovementMillis)) * 1000.0;
|
||||||
|
|
||||||
@ -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();
|
||||||
encoderDiff = -1 * ENCODER_STEPS_PER_MENU_ITEM;
|
if (now > next_button_update_ms) {
|
||||||
next_fake_encoder_update_ms = millis() + 300;
|
if (READ(BTN_UP) == 0) {
|
||||||
}
|
encoderDiff = -1 * ENCODER_STEPS_PER_MENU_ITEM;
|
||||||
if (millis() > next_fake_encoder_update_ms && READ(BTN_DWN) == 0) {
|
next_button_update_ms = now + 300;
|
||||||
encoderDiff = ENCODER_STEPS_PER_MENU_ITEM;
|
}
|
||||||
next_fake_encoder_update_ms = millis() + 300;
|
else if (READ(BTN_DWN) == 0) {
|
||||||
}
|
encoderDiff = ENCODER_STEPS_PER_MENU_ITEM;
|
||||||
if (millis() > next_fake_encoder_update_ms && READ(BTN_LFT) == 0) {
|
next_button_update_ms = now + 300;
|
||||||
encoderDiff = -1 * ENCODER_PULSES_PER_STEP;
|
}
|
||||||
next_fake_encoder_update_ms = millis() + 300;
|
else if (READ(BTN_LFT) == 0) {
|
||||||
}
|
encoderDiff = -1 * ENCODER_PULSES_PER_STEP;
|
||||||
if (millis() > next_fake_encoder_update_ms && READ(BTN_RT) == 0) {
|
next_button_update_ms = now + 300;
|
||||||
encoderDiff = ENCODER_PULSES_PER_STEP;
|
}
|
||||||
next_fake_encoder_update_ms = millis() + 300;
|
else if (READ(BTN_RT) == 0) {
|
||||||
|
encoderDiff = ENCODER_PULSES_PER_STEP;
|
||||||
|
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
|
||||||
|
@ -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…
Reference in New Issue
Block a user