Wrangle encoder bits, LCD_CLICKED
This commit is contained in:
parent
155def24c6
commit
03fdb26cd2
|
@ -150,15 +150,6 @@
|
||||||
#define LCD_PINS_D6 27
|
#define LCD_PINS_D6 27
|
||||||
#define LCD_PINS_D7 29
|
#define LCD_PINS_D7 29
|
||||||
|
|
||||||
//bits in the shift register that carry the buttons for:
|
|
||||||
// left up center down right red
|
|
||||||
#define BL_LE 7
|
|
||||||
#define BL_UP 6
|
|
||||||
#define BL_MI 5
|
|
||||||
#define BL_DW 4
|
|
||||||
#define BL_RI 3
|
|
||||||
#define BL_ST 2
|
|
||||||
|
|
||||||
#endif // !NEWPANEL
|
#endif // !NEWPANEL
|
||||||
|
|
||||||
#endif // ULTRA_LCD
|
#endif // ULTRA_LCD
|
||||||
|
|
|
@ -58,7 +58,6 @@
|
||||||
void bootscreen();
|
void bootscreen();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#define LCD_MESSAGEPGM(x) lcd_setstatuspgm(PSTR(x))
|
#define LCD_MESSAGEPGM(x) lcd_setstatuspgm(PSTR(x))
|
||||||
#define LCD_ALERTMESSAGEPGM(x) lcd_setalertstatuspgm(PSTR(x))
|
#define LCD_ALERTMESSAGEPGM(x) lcd_setalertstatuspgm(PSTR(x))
|
||||||
|
|
||||||
|
@ -93,7 +92,20 @@
|
||||||
|
|
||||||
bool lcd_blink();
|
bool lcd_blink();
|
||||||
|
|
||||||
#if ENABLED(REPRAPWORLD_KEYPAD)
|
#if ENABLED(ULTIPANEL)
|
||||||
|
#define BLEN_A 0
|
||||||
|
#define BLEN_B 1
|
||||||
|
// Encoder click is directly connected
|
||||||
|
#if BUTTON_EXISTS(ENC)
|
||||||
|
#define BLEN_C 2
|
||||||
|
#define EN_C (_BV(BLEN_C))
|
||||||
|
#endif
|
||||||
|
#define EN_A (_BV(BLEN_A))
|
||||||
|
#define EN_B (_BV(BLEN_B))
|
||||||
|
#define EN_C (_BV(BLEN_C))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if ENABLED(REPRAPWORLD_KEYPAD) // is also ULTIPANEL and NEWPANEL
|
||||||
|
|
||||||
#define REPRAPWORLD_BTN_OFFSET 0 // bit offset into buttons for shift register values
|
#define REPRAPWORLD_BTN_OFFSET 0 // bit offset into buttons for shift register values
|
||||||
|
|
||||||
|
@ -135,36 +147,11 @@
|
||||||
EN_REPRAPWORLD_KEYPAD_LEFT) \
|
EN_REPRAPWORLD_KEYPAD_LEFT) \
|
||||||
)
|
)
|
||||||
|
|
||||||
#endif // REPRAPWORLD_KEYPAD
|
|
||||||
|
|
||||||
#if ENABLED(NEWPANEL)
|
|
||||||
|
|
||||||
#define EN_C (_BV(BLEN_C))
|
|
||||||
#define EN_B (_BV(BLEN_B))
|
|
||||||
#define EN_A (_BV(BLEN_A))
|
|
||||||
|
|
||||||
#if ENABLED(REPRAPWORLD_KEYPAD)
|
|
||||||
#define LCD_CLICKED ((buttons & EN_C) || (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_F1))
|
#define LCD_CLICKED ((buttons & EN_C) || (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_F1))
|
||||||
#else
|
#elif ENABLED(NEWPANEL)
|
||||||
#define LCD_CLICKED (buttons & EN_C)
|
#define LCD_CLICKED (buttons & EN_C)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#else //!NEWPANEL
|
|
||||||
|
|
||||||
//atomic, do not change
|
|
||||||
#define B_LE (_BV(BL_LE))
|
|
||||||
#define B_UP (_BV(BL_UP))
|
|
||||||
#define B_MI (_BV(BL_MI))
|
|
||||||
#define B_DW (_BV(BL_DW))
|
|
||||||
#define B_RI (_BV(BL_RI))
|
|
||||||
#define B_ST (_BV(BL_ST))
|
|
||||||
#define EN_B (_BV(BLEN_B))
|
|
||||||
#define EN_A (_BV(BLEN_A))
|
|
||||||
|
|
||||||
#define LCD_CLICKED ((buttons&B_MI)||(buttons&B_ST))
|
|
||||||
|
|
||||||
#endif //!NEWPANEL
|
|
||||||
|
|
||||||
#else //no LCD
|
#else //no LCD
|
||||||
FORCE_INLINE void lcd_update() {}
|
FORCE_INLINE void lcd_update() {}
|
||||||
FORCE_INLINE void lcd_init() {}
|
FORCE_INLINE void lcd_init() {}
|
||||||
|
|
|
@ -42,20 +42,9 @@
|
||||||
* Implementation of the LCD display routines for a DOGM128 graphic display.
|
* Implementation of the LCD display routines for a DOGM128 graphic display.
|
||||||
* These are common LCD 128x64 pixel graphic displays.
|
* These are common LCD 128x64 pixel graphic displays.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if ENABLED(ULTIPANEL)
|
|
||||||
#define BLEN_A 0
|
|
||||||
#define BLEN_B 1
|
|
||||||
#define BLEN_C 2
|
|
||||||
#define EN_A (_BV(BLEN_A))
|
|
||||||
#define EN_B (_BV(BLEN_B))
|
|
||||||
#define EN_C (_BV(BLEN_C))
|
|
||||||
#define LCD_CLICKED (buttons&EN_C)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "dogm_bitmaps.h"
|
|
||||||
#include "ultralcd.h"
|
#include "ultralcd.h"
|
||||||
#include "ultralcd_st7920_u8glib_rrd.h"
|
#include "ultralcd_st7920_u8glib_rrd.h"
|
||||||
|
#include "dogm_bitmaps.h"
|
||||||
#include "duration_t.h"
|
#include "duration_t.h"
|
||||||
|
|
||||||
#include <U8glib.h>
|
#include <U8glib.h>
|
||||||
|
|
|
@ -39,18 +39,6 @@ extern volatile uint8_t buttons; //an extended version of the last checked butt
|
||||||
// via a shift/i2c register.
|
// via a shift/i2c register.
|
||||||
|
|
||||||
#if ENABLED(ULTIPANEL)
|
#if ENABLED(ULTIPANEL)
|
||||||
// All UltiPanels might have an encoder - so this is always be mapped onto first two bits
|
|
||||||
#define BLEN_B 1
|
|
||||||
#define BLEN_A 0
|
|
||||||
|
|
||||||
#define EN_B (_BV(BLEN_B)) // The two encoder pins are connected through BTN_EN1 and BTN_EN2
|
|
||||||
#define EN_A (_BV(BLEN_A))
|
|
||||||
|
|
||||||
#if BUTTON_EXISTS(ENC)
|
|
||||||
// encoder click is directly connected
|
|
||||||
#define BLEN_C 2
|
|
||||||
#define EN_C (_BV(BLEN_C))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Setup other button mappings of each panel
|
// Setup other button mappings of each panel
|
||||||
|
@ -80,12 +68,7 @@ extern volatile uint8_t buttons; //an extended version of the last checked butt
|
||||||
|
|
||||||
#elif ENABLED(LCD_I2C_PANELOLU2)
|
#elif ENABLED(LCD_I2C_PANELOLU2)
|
||||||
|
|
||||||
#if BUTTON_EXISTS(ENC)
|
#if !BUTTON_EXISTS(ENC) // Use I2C if not directly connected to a pin
|
||||||
|
|
||||||
#undef LCD_CLICKED
|
|
||||||
#define LCD_CLICKED (buttons&EN_C)
|
|
||||||
|
|
||||||
#else // Read through I2C if not directly connected to a pin
|
|
||||||
|
|
||||||
#define B_I2C_BTN_OFFSET 3 // (the first three bit positions reserved for EN_A, EN_B, EN_C)
|
#define B_I2C_BTN_OFFSET 3 // (the first three bit positions reserved for EN_A, EN_B, EN_C)
|
||||||
|
|
||||||
|
@ -99,32 +82,21 @@ extern volatile uint8_t buttons; //an extended version of the last checked butt
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#elif ENABLED(REPRAPWORLD_KEYPAD)
|
#elif DISABLED(NEWPANEL) // old style ULTIPANEL
|
||||||
|
// Shift register bits correspond to buttons:
|
||||||
// REPRAPWORLD_KEYPAD defined in ultralcd.h
|
#define BL_LE 7 // Left
|
||||||
|
#define BL_UP 6 // Up
|
||||||
#elif ENABLED(NEWPANEL)
|
#define BL_MI 5 // Middle
|
||||||
#define LCD_CLICKED (buttons&EN_C)
|
#define BL_DW 4 // Down
|
||||||
|
#define BL_RI 3 // Right
|
||||||
#else // old style ULTIPANEL
|
#define BL_ST 2 // Red Button
|
||||||
//bits in the shift register that carry the buttons for:
|
|
||||||
// left up center down right red(stop)
|
|
||||||
#define BL_LE 7
|
|
||||||
#define BL_UP 6
|
|
||||||
#define BL_MI 5
|
|
||||||
#define BL_DW 4
|
|
||||||
#define BL_RI 3
|
|
||||||
#define BL_ST 2
|
|
||||||
|
|
||||||
//automatic, do not change
|
|
||||||
#define B_LE (_BV(BL_LE))
|
#define B_LE (_BV(BL_LE))
|
||||||
#define B_UP (_BV(BL_UP))
|
#define B_UP (_BV(BL_UP))
|
||||||
#define B_MI (_BV(BL_MI))
|
#define B_MI (_BV(BL_MI))
|
||||||
#define B_DW (_BV(BL_DW))
|
#define B_DW (_BV(BL_DW))
|
||||||
#define B_RI (_BV(BL_RI))
|
#define B_RI (_BV(BL_RI))
|
||||||
#define B_ST (_BV(BL_ST))
|
#define B_ST (_BV(BL_ST))
|
||||||
|
#define LCD_CLICKED ((buttons & B_MI) || (buttons & B_ST))
|
||||||
#define LCD_CLICKED (buttons&(B_MI|B_ST))
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif //ULTIPANEL
|
#endif //ULTIPANEL
|
||||||
|
|
Loading…
Reference in a new issue