Browse Source

BUZZ cleanup (#14760)

pull/1/head
Ludy 5 years ago
committed by Scott Lahteine
parent
commit
c4bb458763
  1. 4
      Marlin/src/feature/pause.cpp
  2. 2
      Marlin/src/lcd/menu/game/brickout.cpp
  3. 2
      Marlin/src/lcd/menu/game/game.h
  4. 18
      Marlin/src/lcd/menu/menu.cpp
  5. 14
      Marlin/src/lcd/menu/menu_advanced.cpp
  6. 2
      Marlin/src/lcd/menu/menu_bed_leveling.cpp
  7. 2
      Marlin/src/lcd/menu/menu_configuration.cpp
  8. 2
      Marlin/src/lcd/menu/menu_custom.cpp
  9. 4
      Marlin/src/lcd/menu/menu_service.cpp
  10. 6
      Marlin/src/lcd/ultralcd.cpp
  11. 12
      Marlin/src/lcd/ultralcd.h
  12. 2
      Marlin/src/module/temperature.cpp

4
Marlin/src/feature/pause.cpp

@ -54,7 +54,11 @@
#endif
#include "../lcd/ultralcd.h"
#if HAS_BUZZER
#include "../libs/buzzer.h"
#endif
#include "../libs/nozzle.h"
#include "pause.h"

2
Marlin/src/lcd/menu/game/brickout.cpp

@ -79,7 +79,7 @@ void BrickoutGame::game_screen() {
}
// Did the ball go below the bottom?
else if (newy > BTOF(LCD_PIXEL_HEIGHT)) {
BUZZ(500, 75);
_BUZZ(500, 75);
if (--bdat.balls_left) reset_ball(); else game_state = 0;
break; // done
}

2
Marlin/src/lcd/menu/game/game.h

@ -28,7 +28,7 @@
//#define MUTE_GAMES
#ifdef MUTE_GAMES
#if ENABLED(MUTE_GAMES) || !HAS_BUZZER
#define _BUZZ(D,F) NOOP
#else
#define _BUZZ(D,F) BUZZ(D,F)

18
Marlin/src/lcd/menu/menu.cpp

@ -31,7 +31,9 @@
#include "../../module/printcounter.h"
#include "../../gcode/queue.h"
#include "../../sd/cardreader.h"
#if HAS_BUZZER
#include "../../libs/buzzer.h"
#endif
#if ENABLED(EEPROM_SETTINGS)
#include "../../module/configuration_store.h"
@ -346,6 +348,7 @@ void scroll_screen(const uint8_t limit, const bool is_menu) {
encoderTopLine = encoderLine;
}
#if HAS_BUZZER
void MarlinUI::completion_feedback(const bool good/*=true*/) {
if (good) {
BUZZ(100, 659);
@ -353,6 +356,7 @@ void MarlinUI::completion_feedback(const bool good/*=true*/) {
}
else BUZZ(20, 440);
}
#endif
#if HAS_LINE_TO_Z
@ -433,8 +437,18 @@ void MarlinUI::completion_feedback(const bool good/*=true*/) {
#endif
#if ENABLED(EEPROM_SETTINGS)
void lcd_store_settings() { ui.completion_feedback(settings.save()); }
void lcd_load_settings() { ui.completion_feedback(settings.load()); }
void lcd_store_settings() {
const bool saved = settings.save();
#if HAS_BUZZER
ui.completion_feedback(saved);
#endif
}
void lcd_load_settings() {
const bool loaded = settings.load();
#if HAS_BUZZER
ui.completion_feedback(loaded);
#endif
}
#endif
void _lcd_draw_homing() {

14
Marlin/src/lcd/menu/menu_advanced.cpp

@ -603,7 +603,12 @@ void menu_backlash();
static void lcd_init_eeprom_confirm() {
do_select_screen(
PSTR(MSG_BUTTON_INIT), PSTR(MSG_BUTTON_CANCEL),
[]{ ui.completion_feedback(settings.init_eeprom()); },
[]{
const bool inited = settings.init_eeprom();
#if HAS_BUZZER
ui.completion_feedback(inited);
#endif
},
ui.goto_previous_screen,
PSTR(MSG_INIT_EEPROM), nullptr, PSTR("?")
);
@ -698,8 +703,11 @@ void menu_advanced_settings() {
//
// Toggle the SD Firmware Update state in EEPROM
//
const bool new_state = !settings.sd_update_status();
ui.completion_feedback(settings.set_sd_update_status(new_state));
const bool new_state = !settings.sd_update_status(),
didset = settings.set_sd_update_status(new_state);
#if HAS_BUZZER
ui.completion_feedback(didset);
#endif
ui.return_to_status();
if (new_state) LCD_MESSAGEPGM(MSG_RESET_PRINTER); else ui.reset_status();
});

2
Marlin/src/lcd/menu/menu_bed_leveling.cpp

@ -77,7 +77,9 @@
ui.synchronize(PSTR(MSG_LEVEL_BED_DONE));
#endif
ui.goto_previous_screen_no_defer();
#if HAS_BUZZER
ui.completion_feedback();
#endif
}
if (ui.should_draw()) draw_menu_item_static(LCD_HEIGHT >= 4 ? 1 : 0, PSTR(MSG_LEVEL_BED_DONE));
ui.refresh(LCDVIEW_CALL_REDRAW_NEXT);

2
Marlin/src/lcd/menu/menu_configuration.cpp

@ -56,7 +56,9 @@ void menu_advanced_settings();
static void lcd_factory_settings() {
settings.reset();
#if HAS_BUZZER
ui.completion_feedback();
#endif
}
#if ENABLED(LCD_PROGRESS_BAR_TEST)

2
Marlin/src/lcd/menu/menu_custom.cpp

@ -39,7 +39,7 @@
void _lcd_user_gcode(PGM_P const cmd) {
queue.inject_P(cmd);
#if ENABLED(USER_SCRIPT_AUDIBLE_FEEDBACK)
#if ENABLED(USER_SCRIPT_AUDIBLE_FEEDBACK) && HAS_BUZZER
ui.completion_feedback();
#endif
#if ENABLED(USER_SCRIPT_RETURN)

4
Marlin/src/lcd/menu/menu_service.cpp

@ -38,7 +38,9 @@ inline void _menu_service(const int index, PGM_P const name) {
PSTR(MSG_BUTTON_RESET), PSTR(MSG_BUTTON_CANCEL),
[]{
print_job_timer.resetServiceInterval(index);
ui.completion_feedback(true);
#if HAS_BUZZER
ui.completion_feedback();
#endif
ui.reset_status();
ui.return_to_status();
},

6
Marlin/src/lcd/ultralcd.cpp

@ -562,7 +562,7 @@ void MarlinUI::status_screen() {
if (old_frm != new_frm) {
feedrate_percentage = new_frm;
encoderPosition = 0;
#if ENABLED(BEEP_ON_FEEDRATE_CHANGE)
#if HAS_BUZZER && ENABLED(BEEP_ON_FEEDRATE_CHANGE)
static millis_t next_beep;
#ifndef GOT_MS
const millis_t ms = millis();
@ -608,8 +608,10 @@ void MarlinUI::quick_feedback(const bool clear_buttons/*=true*/) {
UNUSED(clear_buttons);
#endif
// Buzz and wait. The delay is needed for buttons to settle!
#if HAS_BUZZER
// Buzz and wait. Is the delay needed for buttons to settle?
buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ);
#endif
#if HAS_LCD_MENU
#if ENABLED(LCD_USE_I2C_BUZZER)

12
Marlin/src/lcd/ultralcd.h

@ -258,15 +258,15 @@ public:
#endif
}
#if HAS_BUZZER
static inline void buzz(const long duration, const uint16_t freq) {
#if ENABLED(LCD_USE_I2C_BUZZER)
lcd.buzz(duration, freq);
#elif PIN_EXISTS(BEEPER)
buzzer.tone(duration, freq);
#else
UNUSED(duration); UNUSED(freq);
#endif
}
#endif
// LCD implementations
static void clear_lcd();
@ -355,7 +355,9 @@ public:
#endif
static void quick_feedback(const bool clear_buttons=true);
#if HAS_BUZZER
static void completion_feedback(const bool good=true);
#endif
#if DISABLED(LIGHTWEIGHT_UI)
static void draw_status_message(const bool blink);
@ -466,7 +468,11 @@ public:
#endif
#if ENABLED(G26_MESH_VALIDATION)
static inline void chirp() { buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ); }
static inline void chirp() {
#if HAS_BUZZER
buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ);
#endif
}
#endif
#if ENABLED(AUTO_BED_LEVELING_UBL)

2
Marlin/src/module/temperature.cpp

@ -68,7 +68,7 @@
#include "tool_change.h"
#endif
#if HAS_BUZZER
#if HAS_BUZZER && PIN_EXISTS(BEEPER)
#include "../libs/buzzer.h"
#endif

Loading…
Cancel
Save