From 743903b96fd64ef8cbe23d84eed7de1e29b1abed Mon Sep 17 00:00:00 2001 From: Nick Date: Mon, 24 Apr 2023 01:50:39 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20Anycubic=20PlayTune=20(#25?= =?UTF-8?q?735)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Followup to #25690 Co-authored-by: Scott Lahteine --- Marlin/src/lcd/extui/anycubic/Tunes.cpp | 4 ++-- Marlin/src/lcd/extui/anycubic/Tunes.h | 4 ++-- Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.cpp | 10 +++++----- Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.cpp | 10 +++++----- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Marlin/src/lcd/extui/anycubic/Tunes.cpp b/Marlin/src/lcd/extui/anycubic/Tunes.cpp index 118f049bc1f6..d1fb888d17a2 100644 --- a/Marlin/src/lcd/extui/anycubic/Tunes.cpp +++ b/Marlin/src/lcd/extui/anycubic/Tunes.cpp @@ -39,12 +39,12 @@ namespace Anycubic { - void PlayTune(const uint16_t *tune, const uint8_t speed=1) { + void PlayTune(const uint16_t *tune, const uint8_t speed/*=1*/) { const uint16_t wholenotelen = tune[0] / speed; for (uint8_t pos = 1; pos < MAX_TUNE_LENGTH; pos += 2) { const uint16_t freq = tune[pos]; if (freq == n_END) break; - BUZZ(freq, wholenotelen / tune[pos + 1]); + BUZZ(wholenotelen / tune[pos + 1], freq); } } diff --git a/Marlin/src/lcd/extui/anycubic/Tunes.h b/Marlin/src/lcd/extui/anycubic/Tunes.h index be8bc7223c80..8b99f1f863e9 100644 --- a/Marlin/src/lcd/extui/anycubic/Tunes.h +++ b/Marlin/src/lcd/extui/anycubic/Tunes.h @@ -61,7 +61,7 @@ n_END=10000 // end of tune marker namespace Anycubic { - void PlayTune(const uint16_t *tune, const uint8_t speed); + void PlayTune(const uint16_t *tune, const uint8_t speed=1); // Only uncomment the tunes you are using to save memory // This will help you write tunes! @@ -100,7 +100,7 @@ namespace Anycubic { n_END }; - const uint16_t Heater_Timedout[] = { + const uint16_t HeaterTimeout[] = { 1000, n_C6,l_T1, n_END diff --git a/Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.cpp b/Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.cpp index 45fb73c02f44..f3bc64a02498 100644 --- a/Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.cpp +++ b/Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.cpp @@ -104,7 +104,7 @@ void ChironTFT::Startup() { injectCommands(AC_cmnd_enable_leveling); // Startup tunes are defined in Tunes.h - PlayTune(TERN(AC_DEFAULT_STARTUP_TUNE, Anycubic_PowerOn, GB_PowerOn), 1); + PlayTune(TERN(AC_DEFAULT_STARTUP_TUNE, Anycubic_PowerOn, GB_PowerOn)); #if ACDEBUGLEVEL SERIAL_ECHOLNPGM("AC Debug Level ", ACDEBUGLEVEL); @@ -192,7 +192,7 @@ void ChironTFT::FilamentRunout() { // 1 Signal filament out last_error = AC_error_filament_runout; SendtoTFTLN(isPrintingFromMedia() ? AC_msg_filament_out_alert : AC_msg_filament_out_block); - PlayTune(FilamentOut, 1); + PlayTune(FilamentOut); } void ChironTFT::ConfirmationRequest(const char * const msg) { @@ -215,7 +215,7 @@ void ChironTFT::ConfirmationRequest(const char * const msg) { if (strcmp_P(msg, MARLIN_msg_heater_timeout) == 0) { pause_state = AC_paused_heater_timed_out; SendtoTFTLN(AC_msg_paused); // enable continue button - PlayTune(BEEPER_PIN,Heater_Timedout,1); + PlayTune(HeaterTimeout); } // Reheat finished, send acknowledgement else if (strcmp_P(msg, MARLIN_msg_reheat_done) == 0) { @@ -253,7 +253,7 @@ void ChironTFT::StatusChange(const char * const msg) { } // If probing fails don't save the mesh raise the probe above the bad point if (strcmp_P(msg, MARLIN_msg_probing_failed) == 0) { - PlayTune(BeepBeepBeeep, 1); + PlayTune(BeepBeepBeeep); injectCommands(F("G1 Z50 F500")); SendtoTFTLN(AC_msg_probing_complete); printer_state = AC_printer_idle; @@ -307,7 +307,7 @@ void ChironTFT::StatusChange(const char * const msg) { void ChironTFT::PowerLossRecovery() { printer_state = AC_printer_resuming_from_power_outage; // Play tune to notify user we can recover. last_error = AC_error_powerloss; - PlayTune(SOS, 1); + PlayTune(SOS); SERIAL_ECHOLNF(AC_msg_powerloss_recovery); } diff --git a/Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.cpp b/Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.cpp index e2bc343d67fa..387557f2afec 100644 --- a/Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.cpp +++ b/Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.cpp @@ -463,7 +463,7 @@ namespace Anycubic { pop_up_index = 15; // show filament lack. if (READ(FIL_RUNOUT_PIN) == FIL_RUNOUT_STATE) { - PlayTune(FilamentOut, 1); + PlayTune(FilamentOut); feedrate_back = getFeedrate_percent(); @@ -505,7 +505,7 @@ namespace Anycubic { if (strcmp_P(msg, MARLIN_msg_heater_timeout) == 0) { pause_state = AC_paused_heater_timed_out; SendtoTFTLN(AC_msg_paused); // enable continue button - PlayTune(Heater_Timedout, 1); + PlayTune(HeaterTimeout); } // Reheat finished, send acknowledgement else if (strcmp_P(msg, MARLIN_msg_reheat_done) == 0) { @@ -576,7 +576,7 @@ namespace Anycubic { // If probing fails don't save the mesh raise the probe above the bad point if (strcmp_P(msg, MARLIN_msg_probing_failed) == 0) { - PlayTune(BeepBeepBeeep, 1); + PlayTune(BeepBeepBeeep); injectCommands(F("G1 Z50 F500")); ChangePageOfTFT(PAGE_CHS_ABNORMAL_LEVELING_SENSOR); SendtoTFTLN(AC_msg_probing_complete); @@ -1070,7 +1070,7 @@ namespace Anycubic { #else SendTxtToTFT(recovery.info.sd_filename, TXT_OUTAGE_RECOVERY_FILE); #endif - PlayTune(SOS, 1); + PlayTune(SOS); } #else constexpr bool is_outage = false; @@ -1081,7 +1081,7 @@ namespace Anycubic { } else if (control_value == 0x010000) { // startup first gif // Startup tunes are defined in Tunes.h - PlayTune(Anycubic_PowerOn, 1); // takes 3500 ms + PlayTune(Anycubic_PowerOn); // takes 3500 ms } }