Skip to content

Commit 743903b

Browse files
🩹 Fix Anycubic PlayTune (MarlinFirmware#25735)
Followup to MarlinFirmware#25690 Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
1 parent 02a14d3 commit 743903b

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

Marlin/src/lcd/extui/anycubic/Tunes.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@
3939

4040
namespace Anycubic {
4141

42-
void PlayTune(const uint16_t *tune, const uint8_t speed=1) {
42+
void PlayTune(const uint16_t *tune, const uint8_t speed/*=1*/) {
4343
const uint16_t wholenotelen = tune[0] / speed;
4444
for (uint8_t pos = 1; pos < MAX_TUNE_LENGTH; pos += 2) {
4545
const uint16_t freq = tune[pos];
4646
if (freq == n_END) break;
47-
BUZZ(freq, wholenotelen / tune[pos + 1]);
47+
BUZZ(wholenotelen / tune[pos + 1], freq);
4848
}
4949
}
5050

Marlin/src/lcd/extui/anycubic/Tunes.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ n_END=10000 // end of tune marker
6161

6262
namespace Anycubic {
6363

64-
void PlayTune(const uint16_t *tune, const uint8_t speed);
64+
void PlayTune(const uint16_t *tune, const uint8_t speed=1);
6565

6666
// Only uncomment the tunes you are using to save memory
6767
// This will help you write tunes!
@@ -100,7 +100,7 @@ namespace Anycubic {
100100
n_END
101101
};
102102

103-
const uint16_t Heater_Timedout[] = {
103+
const uint16_t HeaterTimeout[] = {
104104
1000,
105105
n_C6,l_T1,
106106
n_END

Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ void ChironTFT::Startup() {
104104
injectCommands(AC_cmnd_enable_leveling);
105105

106106
// Startup tunes are defined in Tunes.h
107-
PlayTune(TERN(AC_DEFAULT_STARTUP_TUNE, Anycubic_PowerOn, GB_PowerOn), 1);
107+
PlayTune(TERN(AC_DEFAULT_STARTUP_TUNE, Anycubic_PowerOn, GB_PowerOn));
108108

109109
#if ACDEBUGLEVEL
110110
SERIAL_ECHOLNPGM("AC Debug Level ", ACDEBUGLEVEL);
@@ -192,7 +192,7 @@ void ChironTFT::FilamentRunout() {
192192
// 1 Signal filament out
193193
last_error = AC_error_filament_runout;
194194
SendtoTFTLN(isPrintingFromMedia() ? AC_msg_filament_out_alert : AC_msg_filament_out_block);
195-
PlayTune(FilamentOut, 1);
195+
PlayTune(FilamentOut);
196196
}
197197

198198
void ChironTFT::ConfirmationRequest(const char * const msg) {
@@ -215,7 +215,7 @@ void ChironTFT::ConfirmationRequest(const char * const msg) {
215215
if (strcmp_P(msg, MARLIN_msg_heater_timeout) == 0) {
216216
pause_state = AC_paused_heater_timed_out;
217217
SendtoTFTLN(AC_msg_paused); // enable continue button
218-
PlayTune(BEEPER_PIN,Heater_Timedout,1);
218+
PlayTune(HeaterTimeout);
219219
}
220220
// Reheat finished, send acknowledgement
221221
else if (strcmp_P(msg, MARLIN_msg_reheat_done) == 0) {
@@ -253,7 +253,7 @@ void ChironTFT::StatusChange(const char * const msg) {
253253
}
254254
// If probing fails don't save the mesh raise the probe above the bad point
255255
if (strcmp_P(msg, MARLIN_msg_probing_failed) == 0) {
256-
PlayTune(BeepBeepBeeep, 1);
256+
PlayTune(BeepBeepBeeep);
257257
injectCommands(F("G1 Z50 F500"));
258258
SendtoTFTLN(AC_msg_probing_complete);
259259
printer_state = AC_printer_idle;
@@ -307,7 +307,7 @@ void ChironTFT::StatusChange(const char * const msg) {
307307
void ChironTFT::PowerLossRecovery() {
308308
printer_state = AC_printer_resuming_from_power_outage; // Play tune to notify user we can recover.
309309
last_error = AC_error_powerloss;
310-
PlayTune(SOS, 1);
310+
PlayTune(SOS);
311311
SERIAL_ECHOLNF(AC_msg_powerloss_recovery);
312312
}
313313

Marlin/src/lcd/extui/anycubic_vyper/dgus_tft.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ namespace Anycubic {
463463
pop_up_index = 15; // show filament lack.
464464

465465
if (READ(FIL_RUNOUT_PIN) == FIL_RUNOUT_STATE) {
466-
PlayTune(FilamentOut, 1);
466+
PlayTune(FilamentOut);
467467

468468
feedrate_back = getFeedrate_percent();
469469

@@ -505,7 +505,7 @@ namespace Anycubic {
505505
if (strcmp_P(msg, MARLIN_msg_heater_timeout) == 0) {
506506
pause_state = AC_paused_heater_timed_out;
507507
SendtoTFTLN(AC_msg_paused); // enable continue button
508-
PlayTune(Heater_Timedout, 1);
508+
PlayTune(HeaterTimeout);
509509
}
510510
// Reheat finished, send acknowledgement
511511
else if (strcmp_P(msg, MARLIN_msg_reheat_done) == 0) {
@@ -576,7 +576,7 @@ namespace Anycubic {
576576

577577
// If probing fails don't save the mesh raise the probe above the bad point
578578
if (strcmp_P(msg, MARLIN_msg_probing_failed) == 0) {
579-
PlayTune(BeepBeepBeeep, 1);
579+
PlayTune(BeepBeepBeeep);
580580
injectCommands(F("G1 Z50 F500"));
581581
ChangePageOfTFT(PAGE_CHS_ABNORMAL_LEVELING_SENSOR);
582582
SendtoTFTLN(AC_msg_probing_complete);
@@ -1070,7 +1070,7 @@ namespace Anycubic {
10701070
#else
10711071
SendTxtToTFT(recovery.info.sd_filename, TXT_OUTAGE_RECOVERY_FILE);
10721072
#endif
1073-
PlayTune(SOS, 1);
1073+
PlayTune(SOS);
10741074
}
10751075
#else
10761076
constexpr bool is_outage = false;
@@ -1081,7 +1081,7 @@ namespace Anycubic {
10811081
}
10821082
else if (control_value == 0x010000) { // startup first gif
10831083
// Startup tunes are defined in Tunes.h
1084-
PlayTune(Anycubic_PowerOn, 1); // takes 3500 ms
1084+
PlayTune(Anycubic_PowerOn); // takes 3500 ms
10851085
}
10861086
}
10871087

0 commit comments

Comments
 (0)