Browse Source

Improved support for panelolu2 encoder and buzzer

I added #define for LCD_FEEDBACK_FREQUENCY_HZ and
LCD_FEEDBACK_FREQUENCY_DURATION_MS  which is used to alter the default
buzzer sound.

When selecting Panelolu2 in configuration.h:
- it automatically sets the correct ENCODER_PULSES_PER_STEP and
ENCODER_STEPS_PER_MENU_ITEM.
- if LCD_USE_I2C_BUZZER is defined it will also set the default
LCD_FEEDBACK_FREQUENCY_HZ and LCD_FEEDBACK_FREQUENCY_DURATION_MS

When selecting the sanguinololu 1284p the following is true:
- its now enables  LARGE_FLASH
- It enables the gcode M300 when the panelolu2 LCD_USE_I2C_BUZZER is
defined
Ronald 10 years ago
parent
commit
8d162e5bd7

+ 17
- 0
Marlin/Configuration.h View File

@@ -447,6 +447,8 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
447 447
 //#define ENCODER_STEPS_PER_MENU_ITEM 5 // Set according to ENCODER_PULSES_PER_STEP or your liking
448 448
 //#define ULTIMAKERCONTROLLER //as available from the ultimaker online store.
449 449
 //#define ULTIPANEL  //the ultipanel as on thingiverse
450
+//#define LCD_FEEDBACK_FREQUENCY_HZ 1000	// this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click
451
+//#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100 // the duration the buzzer plays the UI feedback sound. ie Screen Click
450 452
 
451 453
 // The MaKr3d Makr-Panel with graphic controller and SD support
452 454
 // http://reprap.org/wiki/MaKr3d_MaKrPanel
@@ -532,6 +534,21 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
532 534
   #define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD
533 535
   #define NEWPANEL
534 536
   #define ULTIPANEL
537
+  
538
+  #ifndef ENCODER_PULSES_PER_STEP
539
+	#define ENCODER_PULSES_PER_STEP 4
540
+  #endif 
541
+
542
+  #ifndef ENCODER_STEPS_PER_MENU_ITEM
543
+	#define ENCODER_STEPS_PER_MENU_ITEM 1
544
+  #endif 
545
+  
546
+  
547
+  #ifdef LCD_USE_I2C_BUZZER
548
+	#define LCD_FEEDBACK_FREQUENCY_HZ 1000
549
+	#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100
550
+  #endif
551
+  
535 552
 #endif
536 553
 
537 554
 // Panucatt VIKI LCD with status LEDs, integrated click & L/R/U/P buttons, separate encoder inputs

+ 9
- 3
Marlin/Marlin_main.cpp View File

@@ -2466,7 +2466,7 @@ void process_commands()
2466 2466
       break;
2467 2467
     #endif // NUM_SERVOS > 0
2468 2468
 
2469
-    #if LARGE_FLASH == true && ( BEEPER > 0 || defined(ULTRALCD) )
2469
+    #if (LARGE_FLASH == true && ( BEEPER > 0 || defined(ULTRALCD) || defined(LCD_USE_I2C_BUZZER)))
2470 2470
     case 300: // M300
2471 2471
     {
2472 2472
       int beepS = code_seen('S') ? code_value() : 110;
@@ -2478,7 +2478,9 @@ void process_commands()
2478 2478
           delay(beepP);
2479 2479
           noTone(BEEPER);
2480 2480
         #elif defined(ULTRALCD)
2481
-          lcd_buzz(beepS, beepP);
2481
+		  lcd_buzz(beepS, beepP);
2482
+		#elif defined(LCD_USE_I2C_BUZZER)
2483
+		  lcd_buzz(beepP, beepS);
2482 2484
         #endif
2483 2485
       }
2484 2486
       else
@@ -2736,7 +2738,11 @@ void process_commands()
2736 2738
             WRITE(BEEPER,LOW);
2737 2739
             delay(3);
2738 2740
           #else
2739
-            lcd_buzz(1000/6,100);
2741
+			#if !defined(LCD_FEEDBACK_FREQUENCY_HZ) || !defined(LCD_FEEDBACK_FREQUENCY_DURATION_MS)
2742
+              lcd_buzz(1000/6,100);
2743
+			#else
2744
+			  lcd_buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS,LCD_FEEDBACK_FREQUENCY_HZ);
2745
+			#endif
2740 2746
           #endif
2741 2747
           }
2742 2748
         }

+ 4
- 0
Marlin/pins.h View File

@@ -971,6 +971,10 @@
971 971
 #undef MOTHERBOARD
972 972
 #define MOTHERBOARD 6
973 973
 #define SANGUINOLOLU_V_1_2
974
+
975
+#if defined(__AVR_ATmega1284P__)
976
+	#define LARGE_FLASH true
977
+#endif
974 978
 #endif
975 979
 #if MOTHERBOARD == 6
976 980
 #define KNOWN_BOARD 1

+ 5
- 1
Marlin/ultralcd_implementation_hitachi_HD44780.h View File

@@ -711,7 +711,11 @@ static void lcd_implementation_drawmenu_sddirectory(uint8_t row, const char* pst
711 711
 static void lcd_implementation_quick_feedback()
712 712
 {
713 713
 #ifdef LCD_USE_I2C_BUZZER
714
-    lcd.buzz(60,1000/6);
714
+	#if !defined(LCD_FEEDBACK_FREQUENCY_HZ) || !defined(LCD_FEEDBACK_FREQUENCY_DURATION_MS)
715
+	  lcd_buzz(1000/6,100);
716
+	#else
717
+	  lcd_buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS,LCD_FEEDBACK_FREQUENCY_HZ);
718
+	#endif
715 719
 #elif defined(BEEPER) && BEEPER > -1
716 720
     SET_OUTPUT(BEEPER);
717 721
     for(int8_t i=0;i<10;i++)

Loading…
Cancel
Save