🧑💻 Add standard BUZZ types
This commit is contained in:
parent
f82b133595
commit
c49f26a7ae
@ -143,6 +143,8 @@ uint8_t MMU2::get_current_tool() {
|
||||
#define FILAMENT_PRESENT() (READ(FIL_RUNOUT1_PIN) != FIL_RUNOUT1_STATE)
|
||||
#endif
|
||||
|
||||
inline void ATTN_BUZZ(const bool two=false) { BUZZ(200, 404); if (two) { BUZZ(10, 0); BUZZ(200, 404); } }
|
||||
|
||||
void MMU2::mmu_loop() {
|
||||
|
||||
switch (state) {
|
||||
@ -525,7 +527,7 @@ static void mmu2_not_responding() {
|
||||
while (!thermalManager.wait_for_hotend(active_extruder, false)) safe_delay(100);
|
||||
load_filament_to_nozzle(index);
|
||||
#else
|
||||
BUZZ(400, 40);
|
||||
ERR_BUZZ();
|
||||
#endif
|
||||
} break;
|
||||
|
||||
@ -544,7 +546,7 @@ static void mmu2_not_responding() {
|
||||
active_extruder = 0;
|
||||
}
|
||||
#else
|
||||
BUZZ(400, 40);
|
||||
ERR_BUZZ();
|
||||
#endif
|
||||
} break;
|
||||
|
||||
@ -613,7 +615,7 @@ static void mmu2_not_responding() {
|
||||
while (!thermalManager.wait_for_hotend(active_extruder, false)) safe_delay(100);
|
||||
load_filament_to_nozzle(index);
|
||||
#else
|
||||
BUZZ(400, 40);
|
||||
ERR_BUZZ();
|
||||
#endif
|
||||
} break;
|
||||
|
||||
@ -633,7 +635,7 @@ static void mmu2_not_responding() {
|
||||
extruder = index;
|
||||
active_extruder = 0;
|
||||
#else
|
||||
BUZZ(400, 40);
|
||||
ERR_BUZZ();
|
||||
#endif
|
||||
} break;
|
||||
|
||||
@ -707,7 +709,7 @@ static void mmu2_not_responding() {
|
||||
while (!thermalManager.wait_for_hotend(active_extruder, false)) safe_delay(100);
|
||||
load_filament_to_nozzle(index);
|
||||
#else
|
||||
BUZZ(400, 40);
|
||||
ERR_BUZZ();
|
||||
#endif
|
||||
} break;
|
||||
|
||||
@ -726,7 +728,7 @@ static void mmu2_not_responding() {
|
||||
extruder = index;
|
||||
active_extruder = 0;
|
||||
#else
|
||||
BUZZ(400, 40);
|
||||
ERR_BUZZ();
|
||||
#endif
|
||||
} break;
|
||||
|
||||
@ -811,25 +813,21 @@ void MMU2::manage_response(const bool move_axes, const bool turn_off_nozzle) {
|
||||
if (turn_off_nozzle && resume_hotend_temp) {
|
||||
thermalManager.setTargetHotend(resume_hotend_temp, active_extruder);
|
||||
LCD_MESSAGE(MSG_HEATING);
|
||||
BUZZ(200, 40);
|
||||
ERR_BUZZ();
|
||||
|
||||
while (!thermalManager.wait_for_hotend(active_extruder, false)) safe_delay(1000);
|
||||
}
|
||||
|
||||
if (move_axes && all_axes_homed()) {
|
||||
LCD_MESSAGE(MSG_MMU2_RESUMING);
|
||||
BUZZ(198, 404); BUZZ(4, 0); BUZZ(198, 404);
|
||||
ATTN_BUZZ(true);
|
||||
|
||||
if (move_axes && all_axes_homed()) {
|
||||
// Move XY to starting position, then Z
|
||||
do_blocking_move_to_xy(resume_position, feedRate_t(NOZZLE_PARK_XY_FEEDRATE));
|
||||
|
||||
// Move Z_AXIS to saved position
|
||||
do_blocking_move_to_z(resume_position.z, feedRate_t(NOZZLE_PARK_Z_FEEDRATE));
|
||||
}
|
||||
else {
|
||||
BUZZ(198, 404); BUZZ(4, 0); BUZZ(198, 404);
|
||||
LCD_MESSAGE(MSG_MMU2_RESUMING);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -898,7 +896,7 @@ void MMU2::load_filament(const uint8_t index) {
|
||||
|
||||
command(MMU_CMD_L0 + index);
|
||||
manage_response(false, false);
|
||||
BUZZ(200, 404);
|
||||
ATTN_BUZZ();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -909,7 +907,7 @@ bool MMU2::load_filament_to_nozzle(const uint8_t index) {
|
||||
if (!_enabled) return false;
|
||||
|
||||
if (thermalManager.tooColdToExtrude(active_extruder)) {
|
||||
BUZZ(200, 404);
|
||||
ATTN_BUZZ();
|
||||
LCD_ALERTMESSAGE(MSG_HOTEND_TOO_COLD);
|
||||
return false;
|
||||
}
|
||||
@ -924,7 +922,7 @@ bool MMU2::load_filament_to_nozzle(const uint8_t index) {
|
||||
extruder = index;
|
||||
active_extruder = 0;
|
||||
load_to_nozzle();
|
||||
BUZZ(200, 404);
|
||||
ATTN_BUZZ();
|
||||
}
|
||||
return success;
|
||||
}
|
||||
@ -945,7 +943,7 @@ bool MMU2::eject_filament(const uint8_t index, const bool recover) {
|
||||
if (!_enabled) return false;
|
||||
|
||||
if (thermalManager.tooColdToExtrude(active_extruder)) {
|
||||
BUZZ(200, 404);
|
||||
ATTN_BUZZ();
|
||||
LCD_ALERTMESSAGE(MSG_HOTEND_TOO_COLD);
|
||||
return false;
|
||||
}
|
||||
@ -961,12 +959,11 @@ bool MMU2::eject_filament(const uint8_t index, const bool recover) {
|
||||
|
||||
if (recover) {
|
||||
LCD_MESSAGE(MSG_MMU2_EJECT_RECOVER);
|
||||
BUZZ(200, 404);
|
||||
ATTN_BUZZ();
|
||||
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_do(PROMPT_USER_CONTINUE, F("MMU2 Eject Recover"), FPSTR(CONTINUE_STR)));
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired(F("MMU2 Eject Recover")));
|
||||
TERN_(HAS_RESUME_CONTINUE, wait_for_user_response());
|
||||
BUZZ(200, 404);
|
||||
BUZZ(200, 404);
|
||||
ATTN_BUZZ(true);
|
||||
|
||||
command(MMU_CMD_R0);
|
||||
manage_response(false, false);
|
||||
@ -979,7 +976,7 @@ bool MMU2::eject_filament(const uint8_t index, const bool recover) {
|
||||
|
||||
set_runout_valid(false);
|
||||
|
||||
BUZZ(200, 404);
|
||||
ATTN_BUZZ();
|
||||
|
||||
stepper.disable_extruder();
|
||||
|
||||
@ -994,7 +991,7 @@ bool MMU2::unload() {
|
||||
if (!_enabled) return false;
|
||||
|
||||
if (thermalManager.tooColdToExtrude(active_extruder)) {
|
||||
BUZZ(200, 404);
|
||||
ATTN_BUZZ();
|
||||
LCD_ALERTMESSAGE(MSG_HOTEND_TOO_COLD);
|
||||
return false;
|
||||
}
|
||||
@ -1005,7 +1002,7 @@ bool MMU2::unload() {
|
||||
command(MMU_CMD_U0);
|
||||
manage_response(false, true);
|
||||
|
||||
BUZZ(200, 404);
|
||||
ATTN_BUZZ();
|
||||
|
||||
// no active tool
|
||||
extruder = MMU2_NO_TOOL;
|
||||
|
@ -155,8 +155,7 @@ void GcodeSuite::G29() {
|
||||
mbl_probe_index = -1;
|
||||
SERIAL_ECHOLNPGM("Mesh probing done.");
|
||||
TERN_(HAS_STATUS_MESSAGE, LCD_MESSAGE(MSG_MESH_DONE));
|
||||
BUZZ(100, 659);
|
||||
BUZZ(100, 698);
|
||||
OKAY_BUZZ();
|
||||
|
||||
home_all_axes();
|
||||
set_bed_leveling_enabled(true);
|
||||
|
@ -92,7 +92,7 @@ void GcodeSuite::M428() {
|
||||
if (!WITHIN(diff[i], -20, 20)) {
|
||||
SERIAL_ERROR_MSG(STR_ERR_M428_TOO_FAR);
|
||||
LCD_ALERTMESSAGE_F("Err: Too far!");
|
||||
BUZZ(200, 40);
|
||||
ERR_BUZZ();
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -100,8 +100,7 @@ void GcodeSuite::M428() {
|
||||
LOOP_LINEAR_AXES(i) set_home_offset((AxisEnum)i, diff[i]);
|
||||
report_current_position();
|
||||
LCD_MESSAGE(MSG_HOME_OFFSETS_APPLIED);
|
||||
BUZZ(100, 659);
|
||||
BUZZ(100, 698);
|
||||
OKAY_BUZZ();
|
||||
}
|
||||
|
||||
#endif // HAS_M206_COMMAND
|
||||
|
@ -4920,18 +4920,10 @@ void CrealityDWINClass::Screen_Update() {
|
||||
}
|
||||
|
||||
void CrealityDWINClass::AudioFeedback(const bool success/*=true*/) {
|
||||
if (success) {
|
||||
if (ui.buzzer_enabled) {
|
||||
BUZZ(100, 659);
|
||||
BUZZ( 10, 0);
|
||||
BUZZ(100, 698);
|
||||
}
|
||||
else Update_Status("Success");
|
||||
}
|
||||
else if (ui.buzzer_enabled)
|
||||
BUZZ(40, 440);
|
||||
if (ui.buzzer_enabled)
|
||||
DONE_BUZZ(success);
|
||||
else
|
||||
Update_Status("Failed");
|
||||
Update_Status(success ? "Success" : "Failed");
|
||||
}
|
||||
|
||||
void CrealityDWINClass::Save_Settings(char *buff) {
|
||||
|
@ -1285,17 +1285,7 @@ void HMI_Printing() {
|
||||
|
||||
#include "../../../libs/buzzer.h"
|
||||
|
||||
void HMI_AudioFeedback(const bool success/*=true*/) {
|
||||
#if HAS_BUZZER
|
||||
if (success) {
|
||||
BUZZ(100, 659);
|
||||
BUZZ(10, 0);
|
||||
BUZZ(100, 698);
|
||||
}
|
||||
else
|
||||
BUZZ(40, 440);
|
||||
#endif
|
||||
}
|
||||
void HMI_AudioFeedback(const bool success/*=true*/) { DONE_BUZZ(success); }
|
||||
|
||||
void Draw_Main_Area() {
|
||||
switch (checkkey) {
|
||||
|
@ -276,11 +276,7 @@ void scroll_screen(const uint8_t limit, const bool is_menu) {
|
||||
#if HAS_BUZZER
|
||||
void MarlinUI::completion_feedback(const bool good/*=true*/) {
|
||||
TERN_(HAS_TOUCH_SLEEP, wakeup_screen()); // Wake up on rotary encoder click...
|
||||
if (good) {
|
||||
BUZZ(100, 659);
|
||||
BUZZ(100, 698);
|
||||
}
|
||||
else BUZZ(20, 440);
|
||||
if (good) OKAY_BUZZ(); else ERR_BUZZ();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -127,3 +127,8 @@
|
||||
#define BUZZ(d,f) NOOP
|
||||
|
||||
#endif
|
||||
|
||||
#define ERR_BUZZ() BUZZ(400, 40);
|
||||
#define ATTN_BUZZ() do{ BUZZ(198, 404); BUZZ(4, 0); BUZZ(198, 404); }while(0)
|
||||
#define OKAY_BUZZ() do{ BUZZ(100, 659); BUZZ(10, 0); BUZZ(100, 698); }while(0)
|
||||
#define DONE_BUZZ(OK) do{ if (OK) OKAY_BUZZ(); else ERR_BUZZ(); }while(0)
|
||||
|
@ -151,7 +151,7 @@ void PrintCounter::loadStats() {
|
||||
if (data.nextService3 == 0) doBuzz = _service_warn(PSTR(" " SERVICE_NAME_3));
|
||||
#endif
|
||||
#if HAS_BUZZER && SERVICE_WARNING_BUZZES > 0
|
||||
if (doBuzz) for (int i = 0; i < SERVICE_WARNING_BUZZES; i++) BUZZ(200, 404);
|
||||
if (doBuzz) for (int i = 0; i < SERVICE_WARNING_BUZZES; i++) { BUZZ(200, 404); BUZZ(10, 0); }
|
||||
#else
|
||||
UNUSED(doBuzz);
|
||||
#endif
|
||||
|
@ -306,8 +306,7 @@ FORCE_INLINE void probe_specific_action(const bool deploy) {
|
||||
if (deploy != PROBE_TRIGGERED()) break;
|
||||
#endif
|
||||
|
||||
BUZZ(100, 659);
|
||||
BUZZ(100, 698);
|
||||
OKAY_BUZZ();
|
||||
|
||||
FSTR_P const ds_str = deploy ? GET_TEXT_F(MSG_MANUAL_DEPLOY) : GET_TEXT_F(MSG_MANUAL_STOW);
|
||||
ui.return_to_status(); // To display the new status message
|
||||
|
Loading…
Reference in New Issue
Block a user