Option to reverse select direction/buttons (#14693)

This commit is contained in:
Robby Candra
2019-07-31 05:42:57 +07:00
committed by Scott Lahteine
parent 27952648cf
commit 128eed6b57
121 changed files with 960 additions and 5 deletions

View File

@ -1691,6 +1691,14 @@
//
//#define REVERSE_MENU_DIRECTION
//
// This option reverses the encoder direction for Select Screen.
//
// If CLOCKWISE normally moves LEFT this makes it go RIGHT.
// If CLOCKWISE normally moves RIGHT this makes it go LEFT.
//
//#define REVERSE_SELECT_DIRECTION
//
// Individual Axis Homing
//

View File

@ -467,6 +467,7 @@ void _lcd_draw_homing() {
//
bool MarlinUI::selection; // = false
bool MarlinUI::update_selection() {
encoder_direction_select();
if (encoderPosition) {
selection = int16_t(encoderPosition) > 0;
encoderPosition = 0;

View File

@ -181,8 +181,8 @@ millis_t next_button_update_ms;
}
#endif
#if ENABLED(REVERSE_MENU_DIRECTION)
int8_t MarlinUI::encoderDirection = 1;
#if EITHER(REVERSE_MENU_DIRECTION, REVERSE_SELECT_DIRECTION)
int8_t MarlinUI::encoderDirection = ENCODERBASE;
#endif
bool MarlinUI::lcd_clicked;

View File

@ -539,15 +539,25 @@ public:
#else
#define ENCODERBASE +1
#endif
#if ENABLED(REVERSE_MENU_DIRECTION)
#if EITHER(REVERSE_MENU_DIRECTION, REVERSE_SELECT_DIRECTION)
static int8_t encoderDirection;
static inline void encoder_direction_normal() { encoderDirection = +(ENCODERBASE); }
static inline void encoder_direction_menus() { encoderDirection = -(ENCODERBASE); }
static inline void encoder_direction_normal() { encoderDirection = ENCODERBASE; }
#else
static constexpr int8_t encoderDirection = ENCODERBASE;
static inline void encoder_direction_normal() {}
#endif
#if ENABLED(REVERSE_MENU_DIRECTION)
static inline void encoder_direction_menus() { encoderDirection = -(ENCODERBASE); }
#else
static inline void encoder_direction_menus() {}
#endif
#if ENABLED(REVERSE_SELECT_DIRECTION)
static inline void encoder_direction_select() { encoderDirection = -(ENCODERBASE); }
#else
static inline void encoder_direction_select() {}
#endif
#else