Skip to content

Commit

Permalink
🩹 Fix Anycubic PlayTune (MarlinFirmware#25735)
Browse files Browse the repository at this point in the history
Followup to MarlinFirmware#25690

Co-authored-by: Scott Lahteine <[email protected]>
  • Loading branch information
2 people authored and Tracy Spiva committed May 25, 2023
1 parent ae9b130 commit a18de50
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions Marlin/src/lcd/extui/anycubic/Tunes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/lcd/extui/anycubic/Tunes.h
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand Down Expand Up @@ -100,7 +100,7 @@ namespace Anycubic {
n_END
};

const uint16_t Heater_Timedout[] = {
const uint16_t HeaterTimeout[] = {
1000,
n_C6,l_T1,
n_END
Expand Down
10 changes: 5 additions & 5 deletions Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}

Expand Down
10 changes: 5 additions & 5 deletions Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand All @@ -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
}
}

Expand Down

0 comments on commit a18de50

Please sign in to comment.