Allow both encoder and ADC keypad (#13355)
This commit is contained in:
parent
31ff7da7ac
commit
10c8c034bd
|
@ -194,7 +194,8 @@
|
||||||
#define DECREMENT_(n) DEC_ ##n
|
#define DECREMENT_(n) DEC_ ##n
|
||||||
#define DECREMENT(n) DECREMENT_(n)
|
#define DECREMENT(n) DECREMENT_(n)
|
||||||
|
|
||||||
#define PIN_EXISTS(PN) (defined(PN ##_PIN) && PN ##_PIN >= 0)
|
#define PIN_EXISTS(PN) (defined(PN ##_PIN) && PN ##_PIN >= 0)
|
||||||
|
#define BUTTON_EXISTS(BN) (defined(BTN_## BN) && BTN_## BN >= 0)
|
||||||
|
|
||||||
#define MMM_TO_MMS(MM_M) ((MM_M)/60.0f)
|
#define MMM_TO_MMS(MM_M) ((MM_M)/60.0f)
|
||||||
#define MMS_TO_MMM(MM_S) ((MM_S)*60.0f)
|
#define MMS_TO_MMM(MM_S) ((MM_S)*60.0f)
|
||||||
|
|
|
@ -320,12 +320,6 @@
|
||||||
#define HAS_LCD_MENU (ENABLED(ULTIPANEL) && DISABLED(NO_LCD_MENUS))
|
#define HAS_LCD_MENU (ENABLED(ULTIPANEL) && DISABLED(NO_LCD_MENUS))
|
||||||
|
|
||||||
#define HAS_ADC_BUTTONS ENABLED(ADC_KEYPAD)
|
#define HAS_ADC_BUTTONS ENABLED(ADC_KEYPAD)
|
||||||
#define HAS_DIGITAL_BUTTONS (!HAS_ADC_BUTTONS && ENABLED(NEWPANEL))
|
|
||||||
#define HAS_SHIFT_ENCODER (!HAS_ADC_BUTTONS && (ENABLED(REPRAPWORLD_KEYPAD) || (HAS_SPI_LCD && DISABLED(NEWPANEL))))
|
|
||||||
#define HAS_ENCODER_WHEEL (!HAS_ADC_BUTTONS && ENABLED(NEWPANEL))
|
|
||||||
|
|
||||||
// I2C buttons must be read in the main thread
|
|
||||||
#define HAS_SLOW_BUTTONS (ENABLED(LCD_I2C_VIKI) || ENABLED(LCD_I2C_PANELOLU2))
|
|
||||||
|
|
||||||
#if HAS_GRAPHICAL_LCD
|
#if HAS_GRAPHICAL_LCD
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1073,15 +1073,15 @@ void MarlinUI::update() {
|
||||||
| slow_buttons
|
| slow_buttons
|
||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
|
|
||||||
#elif HAS_ADC_BUTTONS
|
#elif HAS_ADC_BUTTONS
|
||||||
|
|
||||||
buttons = 0;
|
buttons = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if HAS_ADC_BUTTONS
|
||||||
if (keypad_buttons == 0) {
|
if (keypad_buttons == 0) {
|
||||||
const uint8_t b = get_ADC_keyValue();
|
const uint8_t b = get_ADC_keyValue();
|
||||||
if (WITHIN(b, 1, 8)) keypad_buttons = _BV(b - 1);
|
if (WITHIN(b, 1, 8)) keypad_buttons = _BV(b - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAS_SHIFT_ENCODER
|
#if HAS_SHIFT_ENCODER
|
||||||
|
|
|
@ -27,8 +27,19 @@
|
||||||
#include "../libs/buzzer.h"
|
#include "../libs/buzzer.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define HAS_DIGITAL_BUTTONS (!HAS_ADC_BUTTONS && ENABLED(NEWPANEL) \
|
||||||
|
|| (BUTTON_EXISTS(EN1) && BUTTON_EXISTS(EN2)) \
|
||||||
|
|| BUTTON_EXISTS(ENC) || BUTTON_EXISTS(BACK) \
|
||||||
|
|| BUTTON_EXISTS(UP) || BUTTON_EXISTS(DWN) \
|
||||||
|
|| BUTTON_EXISTS(LFT) || BUTTON_EXISTS(RT))
|
||||||
|
|
||||||
|
#define HAS_SHIFT_ENCODER (!HAS_ADC_BUTTONS && (ENABLED(REPRAPWORLD_KEYPAD) || (HAS_SPI_LCD && DISABLED(NEWPANEL))))
|
||||||
|
#define HAS_ENCODER_WHEEL ((!HAS_ADC_BUTTONS && ENABLED(NEWPANEL)) || (BUTTON_EXISTS(EN1) && BUTTON_EXISTS(EN2)) )
|
||||||
#define HAS_ENCODER_ACTION (HAS_LCD_MENU || ENABLED(ULTIPANEL_FEEDMULTIPLY))
|
#define HAS_ENCODER_ACTION (HAS_LCD_MENU || ENABLED(ULTIPANEL_FEEDMULTIPLY))
|
||||||
|
|
||||||
|
// I2C buttons must be read in the main thread
|
||||||
|
#define HAS_SLOW_BUTTONS (ENABLED(LCD_I2C_VIKI) || ENABLED(LCD_I2C_PANELOLU2))
|
||||||
|
|
||||||
#if HAS_SPI_LCD
|
#if HAS_SPI_LCD
|
||||||
|
|
||||||
#include "../Marlin.h"
|
#include "../Marlin.h"
|
||||||
|
@ -133,7 +144,6 @@
|
||||||
#define EN_A _BV(BLEN_A)
|
#define EN_A _BV(BLEN_A)
|
||||||
#define EN_B _BV(BLEN_B)
|
#define EN_B _BV(BLEN_B)
|
||||||
|
|
||||||
#define BUTTON_EXISTS(BN) (defined(BTN_## BN) && BTN_## BN >= 0)
|
|
||||||
#define BUTTON_PRESSED(BN) !READ(BTN_## BN)
|
#define BUTTON_PRESSED(BN) !READ(BTN_## BN)
|
||||||
|
|
||||||
#if BUTTON_EXISTS(ENC)
|
#if BUTTON_EXISTS(ENC)
|
||||||
|
|
Loading…
Reference in a new issue