🧑‍💻 ExtUI::onPlayTone optional duration

This commit is contained in:
Scott Lahteine 2023-06-02 15:03:02 -05:00
parent dd3b5a10a0
commit 22fc07d72b
19 changed files with 20 additions and 19 deletions

View file

@ -49,7 +49,7 @@ namespace ExtUI {
void onMediaError() { chiron.mediaEvent(AC_media_error); } void onMediaError() { chiron.mediaEvent(AC_media_error); }
void onMediaRemoved() { chiron.mediaEvent(AC_media_removed); } void onMediaRemoved() { chiron.mediaEvent(AC_media_removed); }
void onPlayTone(const uint16_t frequency, const uint16_t duration) { void onPlayTone(const uint16_t frequency, const uint16_t duration/*=0*/) {
#if ENABLED(SPEAKER) #if ENABLED(SPEAKER)
::tone(BEEPER_PIN, frequency, duration); ::tone(BEEPER_PIN, frequency, duration);
#endif #endif

View file

@ -41,7 +41,7 @@ namespace ExtUI {
void onMediaInserted() { anycubicTFT.onSDCardStateChange(true); } void onMediaInserted() { anycubicTFT.onSDCardStateChange(true); }
void onMediaError() { anycubicTFT.onSDCardError(); } void onMediaError() { anycubicTFT.onSDCardError(); }
void onMediaRemoved() { anycubicTFT.onSDCardStateChange(false); } void onMediaRemoved() { anycubicTFT.onSDCardStateChange(false); }
void onPlayTone(const uint16_t frequency, const uint16_t duration) { void onPlayTone(const uint16_t frequency, const uint16_t duration/*=0*/) {
TERN_(SPEAKER, ::tone(BEEPER_PIN, frequency, duration)); TERN_(SPEAKER, ::tone(BEEPER_PIN, frequency, duration));
} }
void onPrintTimerStarted() { anycubicTFT.onPrintTimerStarted(); } void onPrintTimerStarted() { anycubicTFT.onPrintTimerStarted(); }

View file

@ -49,7 +49,7 @@ namespace ExtUI {
void onMediaError() { dgus.mediaEvent(AC_media_error); } void onMediaError() { dgus.mediaEvent(AC_media_error); }
void onMediaRemoved() { dgus.mediaEvent(AC_media_removed); } void onMediaRemoved() { dgus.mediaEvent(AC_media_removed); }
void onPlayTone(const uint16_t frequency, const uint16_t duration) { void onPlayTone(const uint16_t frequency, const uint16_t duration/*=0*/) {
#if ENABLED(SPEAKER) #if ENABLED(SPEAKER)
::tone(BEEPER_PIN, frequency, duration); ::tone(BEEPER_PIN, frequency, duration);
#endif #endif

View file

@ -52,7 +52,7 @@ namespace ExtUI {
void onMediaError() { TERN_(HAS_MEDIA, screen.sdCardError()); } void onMediaError() { TERN_(HAS_MEDIA, screen.sdCardError()); }
void onMediaRemoved() { TERN_(HAS_MEDIA, screen.sdCardRemoved()); } void onMediaRemoved() { TERN_(HAS_MEDIA, screen.sdCardRemoved()); }
void onPlayTone(const uint16_t frequency, const uint16_t duration) {} void onPlayTone(const uint16_t frequency, const uint16_t duration/*=0*/) {}
void onPrintTimerStarted() {} void onPrintTimerStarted() {}
void onPrintTimerPaused() {} void onPrintTimerPaused() {}
void onPrintTimerStopped() {} void onPrintTimerStopped() {}

View file

@ -33,7 +33,7 @@
#include "../../../../module/planner.h" #include "../../../../module/planner.h"
#include "../../ui_api.h" #include "../../ui_api.h"
#include "../../../marlinui.h" #include "../../../marlinui.h" // For material presets
#if HAS_STEALTHCHOP #if HAS_STEALTHCHOP
#include "../../../../module/stepper/trinamic.h" #include "../../../../module/stepper/trinamic.h"

View file

@ -71,7 +71,7 @@ public:
write(addr, static_cast<const void*>(&data), sizeof(T)); write(addr, static_cast<const void*>(&data), sizeof(T));
} }
// Until now I did not need to actively read from the display. That's why there is no ReadVariable // Until now I did not need to actively read from the display. That's why there is no readVariable
// (I extensively use the auto upload of the display) // (I extensively use the auto upload of the display)
// Read GUI and OS version from screen // Read GUI and OS version from screen

View file

@ -281,7 +281,7 @@ void DGUSScreenHandler::configurationStoreRead(bool success) {
} }
} }
void DGUSScreenHandler::playTone(const uint16_t frequency, const uint16_t duration) { void DGUSScreenHandler::playTone(const uint16_t frequency, const uint16_t duration/*=0*/) {
if (WITHIN(frequency, 1, 255)) { if (WITHIN(frequency, 1, 255)) {
if (WITHIN(duration, 1, 255)) if (WITHIN(duration, 1, 255))
dgus.playSound((uint8_t)frequency, (uint8_t)duration); dgus.playSound((uint8_t)frequency, (uint8_t)duration);

View file

@ -99,7 +99,7 @@ public:
static void configurationStoreWritten(bool success); static void configurationStoreWritten(bool success);
static void configurationStoreRead(bool success); static void configurationStoreRead(bool success);
static void playTone(const uint16_t frequency, const uint16_t duration); static void playTone(const uint16_t frequency, const uint16_t duration=0);
static void angryBeeps(const uint8_t beepCount); static void angryBeeps(const uint8_t beepCount);
static void levelingStart(); static void levelingStart();

View file

@ -59,7 +59,7 @@ namespace ExtUI {
void onMediaError() { TERN_(HAS_MEDIA, screen.sdCardError()); } void onMediaError() { TERN_(HAS_MEDIA, screen.sdCardError()); }
void onMediaRemoved() { TERN_(HAS_MEDIA, screen.sdCardRemoved()); } void onMediaRemoved() { TERN_(HAS_MEDIA, screen.sdCardRemoved()); }
void onPlayTone(const uint16_t frequency, const uint16_t duration) { void onPlayTone(const uint16_t frequency, const uint16_t duration/*=0*/) {
screen.playTone(frequency, duration); screen.playTone(frequency, duration);
} }

View file

@ -74,7 +74,7 @@ public:
write(addr, static_cast<const void*>(&data), sizeof(T)); write(addr, static_cast<const void*>(&data), sizeof(T));
} }
// Until now I did not need to actively read from the display. That's why there is no ReadVariable // Until now I did not need to actively read from the display. That's why there is no readVariable
// (I extensively use the auto upload of the display) // (I extensively use the auto upload of the display)
// Read GUI and OS version from screen // Read GUI and OS version from screen

View file

@ -224,7 +224,7 @@ void DGUSScreenHandler::configurationStoreRead(bool success) {
} }
} }
void DGUSScreenHandler::playTone(const uint16_t frequency, const uint16_t duration) { void DGUSScreenHandler::playTone(const uint16_t frequency, const uint16_t duration/*=0*/) {
if (WITHIN(frequency, 1, 255)) { if (WITHIN(frequency, 1, 255)) {
if (WITHIN(duration, 1, 255)) if (WITHIN(duration, 1, 255))
dgus.playSound((uint8_t)frequency, (uint8_t)duration); dgus.playSound((uint8_t)frequency, (uint8_t)duration);

View file

@ -45,7 +45,7 @@ public:
static void configurationStoreWritten(bool success); static void configurationStoreWritten(bool success);
static void configurationStoreRead(bool success); static void configurationStoreRead(bool success);
static void playTone(const uint16_t frequency, const uint16_t duration); static void playTone(const uint16_t frequency, const uint16_t duration=0);
static void meshUpdate(const int8_t xpos, const int8_t ypos); static void meshUpdate(const int8_t xpos, const int8_t ypos);
static void printTimerStarted(); static void printTimerStarted();
static void printTimerPaused(); static void printTimerPaused();

View file

@ -54,7 +54,7 @@ namespace ExtUI {
void onMediaError() { TERN_(HAS_MEDIA, screen.sdCardError()); } void onMediaError() { TERN_(HAS_MEDIA, screen.sdCardError()); }
void onMediaRemoved() { TERN_(HAS_MEDIA, screen.sdCardRemoved()); } void onMediaRemoved() { TERN_(HAS_MEDIA, screen.sdCardRemoved()); }
void onPlayTone(const uint16_t frequency, const uint16_t duration) { void onPlayTone(const uint16_t frequency, const uint16_t duration/*=0*/) {
screen.playTone(frequency, duration); screen.playTone(frequency, duration);
} }

View file

@ -50,7 +50,7 @@ namespace ExtUI {
void onMediaInserted() {} void onMediaInserted() {}
void onMediaError() {} void onMediaError() {}
void onMediaRemoved() {} void onMediaRemoved() {}
void onPlayTone(const uint16_t frequency, const uint16_t duration) {} void onPlayTone(const uint16_t frequency, const uint16_t duration/*=0*/) {}
void onPrintTimerStarted() {} void onPrintTimerStarted() {}
void onPrintTimerPaused() {} void onPrintTimerPaused() {}
void onPrintTimerStopped() {} void onPrintTimerStopped() {}

View file

@ -108,7 +108,7 @@ namespace ExtUI {
} }
void onSettingsLoaded(const bool) {} void onSettingsLoaded(const bool) {}
void onPlayTone(const uint16_t frequency, const uint16_t duration) { sound.play_tone(frequency, duration); } void onPlayTone(const uint16_t frequency, const uint16_t duration/*=0*/) { sound.play_tone(frequency, duration); }
void onUserConfirmRequired(const char * const msg) { void onUserConfirmRequired(const char * const msg) {
if (msg) if (msg)

View file

@ -98,7 +98,7 @@ void onMediaRemoved() {
} }
} }
void onPlayTone(const uint16_t frequency, const uint16_t duration) { void onPlayTone(const uint16_t, const uint16_t/*=0*/) {
rts.sendData(StartSoundSet, SoundAddr); rts.sendData(StartSoundSet, SoundAddr);
} }

View file

@ -137,7 +137,7 @@ namespace ExtUI {
void onMediaInserted() {} void onMediaInserted() {}
void onMediaError() {} void onMediaError() {}
void onMediaRemoved() {} void onMediaRemoved() {}
void onPlayTone(const uint16_t, const uint16_t) {} void onPlayTone(const uint16_t, const uint16_t/*=0*/) {}
void onFilamentRunout(const extruder_t extruder) {} void onFilamentRunout(const extruder_t extruder) {}
void onUserConfirmRequired(const char * const) {} void onUserConfirmRequired(const char * const) {}
void onHomingStart() {} void onHomingStart() {}

View file

@ -41,7 +41,7 @@ namespace ExtUI {
void onMediaInserted() {} void onMediaInserted() {}
void onMediaError() {} void onMediaError() {}
void onMediaRemoved() {} void onMediaRemoved() {}
void onPlayTone(const uint16_t frequency, const uint16_t duration) {} void onPlayTone(const uint16_t frequency, const uint16_t duration/*=0*/) {}
void onPrintTimerStarted() {} void onPrintTimerStarted() {}
void onPrintTimerPaused() {} void onPrintTimerPaused() {}
void onPrintTimerStopped() {} void onPrintTimerStopped() {}

View file

@ -43,6 +43,7 @@
****************************************************************************/ ****************************************************************************/
#include "../../inc/MarlinConfig.h" #include "../../inc/MarlinConfig.h"
#include "../marlinui.h" #include "../marlinui.h"
#include "../../gcode/gcode.h" #include "../../gcode/gcode.h"
@ -460,7 +461,7 @@ namespace ExtUI {
void onMediaInserted(); void onMediaInserted();
void onMediaError(); void onMediaError();
void onMediaRemoved(); void onMediaRemoved();
void onPlayTone(const uint16_t frequency, const uint16_t duration); void onPlayTone(const uint16_t frequency, const uint16_t duration=0);
void onPrinterKilled(FSTR_P const error, FSTR_P const component); void onPrinterKilled(FSTR_P const error, FSTR_P const component);
void onSurviveInKilled(); void onSurviveInKilled();
void onPrintTimerStarted(); void onPrintTimerStarted();