|
@@ -113,6 +113,7 @@ static void menu_action_setting_edit_callback_long5(const char* pstr, unsigned l
|
113
|
113
|
|
114
|
114
|
/** Used variables to keep track of the menu */
|
115
|
115
|
volatile uint8_t buttons;//Contains the bits of the currently pressed buttons.
|
|
116
|
+volatile uint8_t buttons_reprapworld_keypad; // to store the reprapworld_keypad shiftregister values
|
116
|
117
|
|
117
|
118
|
uint8_t currentMenuViewOffset; /* scroll offset in the current menu */
|
118
|
119
|
uint32_t blocking_enc;
|
|
@@ -687,6 +688,24 @@ menu_edit_type(float, float51, ftostr51, 10)
|
687
|
688
|
menu_edit_type(float, float52, ftostr52, 100)
|
688
|
689
|
menu_edit_type(unsigned long, long5, ftostr5, 0.01)
|
689
|
690
|
|
|
691
|
+#ifdef REPRAPWORLD_KEYPAD
|
|
692
|
+ static void reprapworld_keypad_move_y_down() {
|
|
693
|
+ encoderPosition = 1;
|
|
694
|
+ move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP;
|
|
695
|
+ lcd_move_y();
|
|
696
|
+ }
|
|
697
|
+ static void reprapworld_keypad_move_y_up() {
|
|
698
|
+ encoderPosition = -1;
|
|
699
|
+ move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP;
|
|
700
|
+ lcd_move_y();
|
|
701
|
+ }
|
|
702
|
+ static void reprapworld_keypad_move_home() {
|
|
703
|
+ //enquecommand_P((PSTR("G28"))); // move all axis home
|
|
704
|
+ // TODO gregor: move all axis home, i have currently only one axis on my prusa i3
|
|
705
|
+ enquecommand_P((PSTR("G28 Y")));
|
|
706
|
+ }
|
|
707
|
+#endif
|
|
708
|
+
|
690
|
709
|
/** End of menus **/
|
691
|
710
|
|
692
|
711
|
static void lcd_quick_feedback()
|
|
@@ -750,6 +769,13 @@ void lcd_init()
|
750
|
769
|
WRITE(BTN_EN1,HIGH);
|
751
|
770
|
WRITE(BTN_EN2,HIGH);
|
752
|
771
|
WRITE(BTN_ENC,HIGH);
|
|
772
|
+ #ifdef REPRAPWORLD_KEYPAD
|
|
773
|
+ pinMode(SHIFT_CLK,OUTPUT);
|
|
774
|
+ pinMode(SHIFT_LD,OUTPUT);
|
|
775
|
+ pinMode(SHIFT_OUT,INPUT);
|
|
776
|
+ WRITE(SHIFT_OUT,HIGH);
|
|
777
|
+ WRITE(SHIFT_LD,HIGH);
|
|
778
|
+ #endif
|
753
|
779
|
#else
|
754
|
780
|
pinMode(SHIFT_CLK,OUTPUT);
|
755
|
781
|
pinMode(SHIFT_LD,OUTPUT);
|
|
@@ -796,6 +822,17 @@ void lcd_update()
|
796
|
822
|
if (lcd_next_update_millis < millis())
|
797
|
823
|
{
|
798
|
824
|
#ifdef ULTIPANEL
|
|
825
|
+ #ifdef REPRAPWORLD_KEYPAD
|
|
826
|
+ if (REPRAPWORLD_KEYPAD_MOVE_Y_DOWN) {
|
|
827
|
+ reprapworld_keypad_move_y_down();
|
|
828
|
+ }
|
|
829
|
+ if (REPRAPWORLD_KEYPAD_MOVE_Y_UP) {
|
|
830
|
+ reprapworld_keypad_move_y_up();
|
|
831
|
+ }
|
|
832
|
+ if (REPRAPWORLD_KEYPAD_MOVE_HOME) {
|
|
833
|
+ reprapworld_keypad_move_home();
|
|
834
|
+ }
|
|
835
|
+ #endif
|
799
|
836
|
if (encoderDiff)
|
800
|
837
|
{
|
801
|
838
|
lcdDrawUpdate = 1;
|
|
@@ -876,6 +913,20 @@ void lcd_buttons_update()
|
876
|
913
|
if((blocking_enc<millis()) && (READ(BTN_ENC)==0))
|
877
|
914
|
newbutton |= EN_C;
|
878
|
915
|
buttons = newbutton;
|
|
916
|
+ #ifdef REPRAPWORLD_KEYPAD
|
|
917
|
+ // for the reprapworld_keypad
|
|
918
|
+ uint8_t newbutton_reprapworld_keypad=0;
|
|
919
|
+ WRITE(SHIFT_LD,LOW);
|
|
920
|
+ WRITE(SHIFT_LD,HIGH);
|
|
921
|
+ for(int8_t i=0;i<8;i++) {
|
|
922
|
+ newbutton_reprapworld_keypad = newbutton_reprapworld_keypad>>1;
|
|
923
|
+ if(READ(SHIFT_OUT))
|
|
924
|
+ newbutton_reprapworld_keypad|=(1<<7);
|
|
925
|
+ WRITE(SHIFT_CLK,HIGH);
|
|
926
|
+ WRITE(SHIFT_CLK,LOW);
|
|
927
|
+ }
|
|
928
|
+ buttons_reprapworld_keypad=~newbutton_reprapworld_keypad; //invert it, because a pressed switch produces a logical 0
|
|
929
|
+ #endif
|
879
|
930
|
#else //read it from the shift register
|
880
|
931
|
uint8_t newbutton=0;
|
881
|
932
|
WRITE(SHIFT_LD,LOW);
|