Skip to content

Commit

Permalink
πŸ§‘β€πŸ’» ExtUI::onPlayTone optional duration
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Jan 22, 2024
1 parent dd3b5a1 commit 22fc07d
Show file tree
Hide file tree
Showing 19 changed files with 20 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Marlin/src/lcd/extui/anycubic_chiron/chiron_extui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ namespace ExtUI {
void onMediaError() { chiron.mediaEvent(AC_media_error); }
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)
::tone(BEEPER_PIN, frequency, duration);
#endif
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/extui/anycubic_i3mega/anycubic_extui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace ExtUI {
void onMediaInserted() { anycubicTFT.onSDCardStateChange(true); }
void onMediaError() { anycubicTFT.onSDCardError(); }
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));
}
void onPrintTimerStarted() { anycubicTFT.onPrintTimerStarted(); }
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/extui/anycubic_vyper/vyper_extui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ namespace ExtUI {
void onMediaError() { dgus.mediaEvent(AC_media_error); }
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)
::tone(BEEPER_PIN, frequency, duration);
#endif
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/extui/dgus/dgus_extui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ namespace ExtUI {
void onMediaError() { TERN_(HAS_MEDIA, screen.sdCardError()); }
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 onPrintTimerPaused() {}
void onPrintTimerStopped() {}
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/extui/dgus/mks/DGUSDisplayDef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include "../../../../module/planner.h"

#include "../../ui_api.h"
#include "../../../marlinui.h"
#include "../../../marlinui.h" // For material presets

#if HAS_STEALTHCHOP
#include "../../../../module/stepper/trinamic.h"
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/extui/dgus_e3s1pro/DGUSDisplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class DGUSDisplay {
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)

// Read GUI and OS version from screen
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/extui/dgus_e3s1pro/DGUSScreenHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(duration, 1, 255))
dgus.playSound((uint8_t)frequency, (uint8_t)duration);
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/extui/dgus_e3s1pro/DGUSScreenHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class DGUSScreenHandler {
static void configurationStoreWritten(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 levelingStart();
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/extui/dgus_e3s1pro/dgus_e3s1pro_extui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ namespace ExtUI {
void onMediaError() { TERN_(HAS_MEDIA, screen.sdCardError()); }
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);
}

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/extui/dgus_reloaded/DGUSDisplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class DGUSDisplay {
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)

// Read GUI and OS version from screen
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(duration, 1, 255))
dgus.playSound((uint8_t)frequency, (uint8_t)duration);
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/extui/dgus_reloaded/DGUSScreenHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class DGUSScreenHandler {
static void configurationStoreWritten(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 printTimerStarted();
static void printTimerPaused();
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/extui/dgus_reloaded/dgus_reloaded_extui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ namespace ExtUI {
void onMediaError() { TERN_(HAS_MEDIA, screen.sdCardError()); }
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);
}

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/extui/example/example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ namespace ExtUI {
void onMediaInserted() {}
void onMediaError() {}
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 onPrintTimerPaused() {}
void onPrintTimerStopped() {}
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_extui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ namespace ExtUI {
}
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) {
if (msg)
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/extui/ia_creality/ia_creality_extui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/extui/malyan/malyan_extui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ namespace ExtUI {
void onMediaInserted() {}
void onMediaError() {}
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 onUserConfirmRequired(const char * const) {}
void onHomingStart() {}
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/extui/nextion/nextion_extui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace ExtUI {
void onMediaInserted() {}
void onMediaError() {}
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 onPrintTimerPaused() {}
void onPrintTimerStopped() {}
Expand Down
3 changes: 2 additions & 1 deletion Marlin/src/lcd/extui/ui_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
****************************************************************************/

#include "../../inc/MarlinConfig.h"

#include "../marlinui.h"
#include "../../gcode/gcode.h"

Expand Down Expand Up @@ -460,7 +461,7 @@ namespace ExtUI {
void onMediaInserted();
void onMediaError();
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 onSurviveInKilled();
void onPrintTimerStarted();
Expand Down

0 comments on commit 22fc07d

Please sign in to comment.