🩹 Fix Anycubic PlayTune (#25735)
Followup to #25690 Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
parent
02a14d31b2
commit
743903b96f
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue