Browse Source

use only one implementation for beeper feedback

pull/1/head
Christian Bohn 10 years ago
parent
commit
4c3cbc0961
  1. 12
      Marlin/dogm_lcd_implementation.h
  2. 23
      Marlin/ultralcd.cpp
  3. 26
      Marlin/ultralcd_implementation_hitachi_HD44780.h

12
Marlin/dogm_lcd_implementation.h

@ -408,16 +408,4 @@ static void _drawmenu_sd(bool isSelected, uint8_t row, const char* pstr, const c
#define lcd_implementation_drawmenu_gcode(sel, row, pstr, gcode) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ') #define lcd_implementation_drawmenu_gcode(sel, row, pstr, gcode) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ')
#define lcd_implementation_drawmenu_function(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ') #define lcd_implementation_drawmenu_function(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ')
static void lcd_implementation_quick_feedback() {
#if BEEPER > -1
SET_OUTPUT(BEEPER);
for(int8_t i=0; i<10; i++) {
WRITE(BEEPER,HIGH);
delay(3);
WRITE(BEEPER,LOW);
delay(3);
}
#endif
}
#endif //__DOGM_LCD_IMPLEMENTATION_H #endif //__DOGM_LCD_IMPLEMENTATION_H

23
Marlin/ultralcd.cpp

@ -1137,7 +1137,28 @@ menu_edit_type(unsigned long, long5, ftostr5, 0.01)
static void lcd_quick_feedback() { static void lcd_quick_feedback() {
lcdDrawUpdate = 2; lcdDrawUpdate = 2;
blocking_enc = millis() + 500; blocking_enc = millis() + 500;
lcd_implementation_quick_feedback();
#ifdef LCD_USE_I2C_BUZZER
#if defined(LCD_FEEDBACK_FREQUENCY_DURATION_MS) && defined(LCD_FEEDBACK_FREQUENCY_HZ)
lcd_buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ);
#else
lcd_buzz(1000/6, 100);
#endif
#elif defined(BEEPER) && BEEPER > -1
SET_OUTPUT(BEEPER);
#if !defined(LCD_FEEDBACK_FREQUENCY_HZ) || !defined(LCD_FEEDBACK_FREQUENCY_DURATION_MS)
#define LCD_FEEDBACK_FREQUENCY_HZ 500
#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 50
#endif
const unsigned int delay = 1000000 / LCD_FEEDBACK_FREQUENCY_HZ / 2;
int8_t i = LCD_FEEDBACK_FREQUENCY_DURATION_MS * LCD_FEEDBACK_FREQUENCY_HZ / 1000;
while (i--) {
WRITE(BEEPER,HIGH);
delayMicroseconds(delay);
WRITE(BEEPER,LOW);
delayMicroseconds(delay);
}
#endif
} }
/** Menu action functions **/ /** Menu action functions **/

26
Marlin/ultralcd_implementation_hitachi_HD44780.h

@ -709,32 +709,6 @@ static void lcd_implementation_drawmenu_sddirectory(bool sel, uint8_t row, const
#define lcd_implementation_drawmenu_gcode(sel, row, pstr, gcode) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ') #define lcd_implementation_drawmenu_gcode(sel, row, pstr, gcode) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ')
#define lcd_implementation_drawmenu_function(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ') #define lcd_implementation_drawmenu_function(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ')
static void lcd_implementation_quick_feedback()
{
#ifdef LCD_USE_I2C_BUZZER
#if defined(LCD_FEEDBACK_FREQUENCY_DURATION_MS) && defined(LCD_FEEDBACK_FREQUENCY_HZ)
lcd_buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ);
#else
lcd_buzz(1000/6, 100);
#endif
#elif defined(BEEPER) && BEEPER > -1
SET_OUTPUT(BEEPER);
#if !defined(LCD_FEEDBACK_FREQUENCY_HZ) || !defined(LCD_FEEDBACK_FREQUENCY_DURATION_MS)
const unsigned int delay = 100;
uint8_t i = 10;
#else
const unsigned int delay = 1000000 / LCD_FEEDBACK_FREQUENCY_HZ / 2;
int8_t i = LCD_FEEDBACK_FREQUENCY_DURATION_MS * LCD_FEEDBACK_FREQUENCY_HZ / 1000;
#endif
while (i--) {
WRITE(BEEPER,HIGH);
delayMicroseconds(delay);
WRITE(BEEPER,LOW);
delayMicroseconds(delay);
}
#endif
}
#ifdef LCD_HAS_STATUS_INDICATORS #ifdef LCD_HAS_STATUS_INDICATORS
static void lcd_implementation_update_indicators() static void lcd_implementation_update_indicators()
{ {

Loading…
Cancel
Save