Browse Source

changes:

- changed the variables from keypad to reprapworld_keypad
- added a missing ifdef check
gregor 11 years ago
parent
commit
2739c26c4f
4 changed files with 58 additions and 57 deletions
  1. 4
    4
      Marlin/Configuration.h
  2. 9
    9
      Marlin/pins.h
  3. 29
    28
      Marlin/ultralcd.cpp
  4. 16
    16
      Marlin/ultralcd.h

+ 4
- 4
Marlin/Configuration.h View File

@@ -338,10 +338,10 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
338 338
 // ==> REMEMBER TO INSTALL U8glib to your ARDUINO library folder: http://code.google.com/p/u8glib/wiki/u8glib
339 339
 //#define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER
340 340
 
341
-// The RepRapWorld Keypad v1.1
341
+// The RepRapWorld REPRAPWORLD_KEYPAD v1.1
342 342
 // http://reprapworld.com/?products_details&products_id=202&cPath=1591_1626
343
-//#define KEYPAD
344
-//#define KEYPAD_MOVE_STEP 10.0 // how much should be moved when a key is pressed, eg 10.0 means 10mm per click
343
+//#define REPRAPWORLD_KEYPAD
344
+//#define REPRAPWORLD_KEYPAD_MOVE_STEP 10.0 // how much should be moved when a key is pressed, eg 10.0 means 10mm per click
345 345
 
346 346
 //automatic expansion
347 347
 #if defined (REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER)
@@ -355,7 +355,7 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
355 355
  #define NEWPANEL
356 356
 #endif 
357 357
 
358
-#if defined(KEYPAD)
358
+#if defined(REPRAPWORLD_KEYPAD)
359 359
   #define NEWPANEL
360 360
   #define ULTIPANEL
361 361
 #endif

+ 9
- 9
Marlin/pins.h View File

@@ -416,7 +416,7 @@
416 416
       #define BEEPER 33	 // Beeper on AUX-4
417 417
 
418 418
       //buttons are directly attached using AUX-2
419
-      #ifdef KEYPAD
419
+      #ifdef REPRAPWORLD_KEYPAD
420 420
         #define BTN_EN1 64 // encoder
421 421
         #define BTN_EN2 59 // encoder
422 422
         #define BTN_ENC 63 // enter button
@@ -424,14 +424,14 @@
424 424
         #define SHIFT_CLK 44 // shift register
425 425
         #define SHIFT_LD 42 // shift register
426 426
         // define register bit values, don't change it
427
-        #define BLEN_KEYPAD_F3 0
428
-        #define BLEN_KEYPAD_F2 1
429
-        #define BLEN_KEYPAD_F1 2
430
-        #define BLEN_KEYPAD_UP 3
431
-        #define BLEN_KEYPAD_RIGHT 4
432
-        #define BLEN_KEYPAD_MIDDLE 5
433
-        #define BLEN_KEYPAD_DOWN 6
434
-        #define BLEN_KEYPAD_LEFT 7
427
+        #define BLEN_REPRAPWORLD_KEYPAD_F3 0
428
+        #define BLEN_REPRAPWORLD_KEYPAD_F2 1
429
+        #define BLEN_REPRAPWORLD_KEYPAD_F1 2
430
+        #define BLEN_REPRAPWORLD_KEYPAD_UP 3
431
+        #define BLEN_REPRAPWORLD_KEYPAD_RIGHT 4
432
+        #define BLEN_REPRAPWORLD_KEYPAD_MIDDLE 5
433
+        #define BLEN_REPRAPWORLD_KEYPAD_DOWN 6
434
+        #define BLEN_REPRAPWORLD_KEYPAD_LEFT 7
435 435
 	  #else
436 436
         #define BTN_EN1 37
437 437
         #define BTN_EN2 35

+ 29
- 28
Marlin/ultralcd.cpp View File

@@ -113,7 +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_keypad; // to store the keypad shiftregister values
116
+volatile uint8_t buttons_reprapworld_keypad; // to store the reprapworld_keypad shiftregister values
117 117
 
118 118
 uint8_t currentMenuViewOffset;              /* scroll offset in the current menu */
119 119
 uint32_t blocking_enc;
@@ -688,19 +688,18 @@ menu_edit_type(float, float51, ftostr51, 10)
688 688
 menu_edit_type(float, float52, ftostr52, 100)
689 689
 menu_edit_type(unsigned long, long5, ftostr5, 0.01)
690 690
 
691
-#ifdef KEYPAD
692
-	static void keypad_move_y_down() {
693
-	SERIAL_ECHO("keypad_move_y_down");
691
+#ifdef REPRAPWORLD_KEYPAD
692
+	static void reprapworld_keypad_move_y_down() {
694 693
         encoderPosition = 1;
695
-        move_menu_scale = KEYPAD_MOVE_STEP;
694
+        move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP;
696 695
 		lcd_move_y();
697 696
 	}
698
-	static void keypad_move_y_up() {
697
+	static void reprapworld_keypad_move_y_up() {
699 698
 		encoderPosition = -1;
700
-		move_menu_scale = KEYPAD_MOVE_STEP;
699
+		move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP;
701 700
     	lcd_move_y();
702 701
 	}
703
-	static void keypad_move_home() {
702
+	static void reprapworld_keypad_move_home() {
704 703
 		//enquecommand_P((PSTR("G28"))); // move all axis home
705 704
 		// TODO gregor: move all axis home, i have currently only one axis on my prusa i3
706 705
 		enquecommand_P((PSTR("G28 Y")));
@@ -770,7 +769,7 @@ void lcd_init()
770 769
     WRITE(BTN_EN1,HIGH);
771 770
     WRITE(BTN_EN2,HIGH);
772 771
     WRITE(BTN_ENC,HIGH);
773
-    #ifdef KEYPAD
772
+    #ifdef REPRAPWORLD_KEYPAD
774 773
       pinMode(SHIFT_CLK,OUTPUT);
775 774
       pinMode(SHIFT_LD,OUTPUT);
776 775
       pinMode(SHIFT_OUT,INPUT);
@@ -823,15 +822,15 @@ void lcd_update()
823 822
     if (lcd_next_update_millis < millis())
824 823
     {
825 824
 #ifdef ULTIPANEL
826
-		#ifdef KEYPAD
827
-        	if (KEYPAD_MOVE_Y_DOWN) {
828
-        		keypad_move_y_down();
825
+		#ifdef REPRAPWORLD_KEYPAD
826
+        	if (REPRAPWORLD_KEYPAD_MOVE_Y_DOWN) {
827
+        		reprapworld_keypad_move_y_down();
829 828
         	}
830
-        	if (KEYPAD_MOVE_Y_UP) {
831
-        		keypad_move_y_up();
829
+        	if (REPRAPWORLD_KEYPAD_MOVE_Y_UP) {
830
+        		reprapworld_keypad_move_y_up();
832 831
         	}
833
-        	if (KEYPAD_MOVE_HOME) {
834
-        		keypad_move_home();
832
+        	if (REPRAPWORLD_KEYPAD_MOVE_HOME) {
833
+        		reprapworld_keypad_move_home();
835 834
         	}
836 835
 		#endif
837 836
         if (encoderDiff)
@@ -914,18 +913,20 @@ void lcd_buttons_update()
914 913
     if((blocking_enc<millis()) && (READ(BTN_ENC)==0))
915 914
         newbutton |= EN_C;
916 915
     buttons = newbutton;
917
-    // for the keypad
918
-    uint8_t newbutton_keypad=0;
919
-    WRITE(SHIFT_LD,LOW);
920
-    WRITE(SHIFT_LD,HIGH);
921
-    for(int8_t i=0;i<8;i++) {
922
-        newbutton_keypad = newbutton_keypad>>1;
923
-        if(READ(SHIFT_OUT))
924
-            newbutton_keypad|=(1<<7);
925
-        WRITE(SHIFT_CLK,HIGH);
926
-        WRITE(SHIFT_CLK,LOW);
927
-    }
928
-    buttons_keypad=~newbutton_keypad; //invert it, because a pressed switch produces a logical 0
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
929 930
 #else   //read it from the shift register
930 931
     uint8_t newbutton=0;
931 932
     WRITE(SHIFT_LD,LOW);

+ 16
- 16
Marlin/ultralcd.h View File

@@ -23,8 +23,8 @@
23 23
   #ifdef ULTIPANEL
24 24
   void lcd_buttons_update();
25 25
   extern volatile uint8_t buttons;  //the last checked buttons in a bit array.
26
-  #ifdef KEYPAD
27
-    extern volatile uint8_t buttons_keypad; // to store the keypad shiftregister values
26
+  #ifdef REPRAPWORLD_KEYPAD
27
+    extern volatile uint8_t buttons_reprapworld_keypad; // to store the keypad shiftregister values
28 28
   #endif
29 29
   #else
30 30
   FORCE_INLINE void lcd_buttons_update() {}
@@ -44,21 +44,21 @@
44 44
     #define EN_A (1<<BLEN_A)
45 45
 
46 46
     #define LCD_CLICKED (buttons&EN_C)
47
-    #ifdef KEYPAD
48
-  	  #define EN_KEYPAD_F3 (1<<BLEN_KEYPAD_F3)
49
-  	  #define EN_KEYPAD_F2 (1<<BLEN_KEYPAD_F2)
50
-  	  #define EN_KEYPAD_F1 (1<<BLEN_KEYPAD_F1)
51
-  	  #define EN_KEYPAD_UP (1<<BLEN_KEYPAD_UP)
52
-  	  #define EN_KEYPAD_RIGHT (1<<BLEN_KEYPAD_RIGHT)
53
-  	  #define EN_KEYPAD_MIDDLE (1<<BLEN_KEYPAD_MIDDLE)
54
-  	  #define EN_KEYPAD_DOWN (1<<BLEN_KEYPAD_DOWN)
55
-  	  #define EN_KEYPAD_LEFT (1<<BLEN_KEYPAD_LEFT)
47
+    #ifdef REPRAPWORLD_KEYPAD
48
+  	  #define EN_REPRAPWORLD_KEYPAD_F3 (1<<BLEN_REPRAPWORLD_KEYPAD_F3)
49
+  	  #define EN_REPRAPWORLD_KEYPAD_F2 (1<<BLEN_REPRAPWORLD_KEYPAD_F2)
50
+  	  #define EN_REPRAPWORLD_KEYPAD_F1 (1<<BLEN_REPRAPWORLD_KEYPAD_F1)
51
+  	  #define EN_REPRAPWORLD_KEYPAD_UP (1<<BLEN_REPRAPWORLD_KEYPAD_UP)
52
+  	  #define EN_REPRAPWORLD_KEYPAD_RIGHT (1<<BLEN_REPRAPWORLD_KEYPAD_RIGHT)
53
+  	  #define EN_REPRAPWORLD_KEYPAD_MIDDLE (1<<BLEN_REPRAPWORLD_KEYPAD_MIDDLE)
54
+  	  #define EN_REPRAPWORLD_KEYPAD_DOWN (1<<BLEN_REPRAPWORLD_KEYPAD_DOWN)
55
+  	  #define EN_REPRAPWORLD_KEYPAD_LEFT (1<<BLEN_REPRAPWORLD_KEYPAD_LEFT)
56 56
 
57
-  	  #define LCD_CLICKED ((buttons&EN_C) || (buttons_keypad&EN_KEYPAD_F1))
58
-  	  #define KEYPAD_MOVE_Y_DOWN (buttons_keypad&EN_KEYPAD_DOWN)
59
-  	  #define KEYPAD_MOVE_Y_UP (buttons_keypad&EN_KEYPAD_UP)
60
-  	  #define KEYPAD_MOVE_HOME (buttons_keypad&EN_KEYPAD_MIDDLE)
61
-    #endif //KEYPAD
57
+  	  #define LCD_CLICKED ((buttons&EN_C) || (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_F1))
58
+  	  #define REPRAPWORLD_KEYPAD_MOVE_Y_DOWN (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_DOWN)
59
+  	  #define REPRAPWORLD_KEYPAD_MOVE_Y_UP (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_UP)
60
+  	  #define REPRAPWORLD_KEYPAD_MOVE_HOME (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_MIDDLE)
61
+    #endif //REPRAPWORLD_KEYPAD
62 62
   #else
63 63
     //atomatic, do not change
64 64
     #define B_LE (1<<BL_LE)

Loading…
Cancel
Save