use only one implementation for beeper feedback
This commit is contained in:
parent
80ae160c26
commit
4c3cbc0961
@ -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
|
||||||
|
@ -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 **/
|
||||||
|
@ -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…
Reference in New Issue
Block a user