Skip to content

Commit

Permalink
[rtttl] Add get_gain() (esphome#7647)
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardtfn authored Oct 22, 2024
1 parent 6330177 commit 2597975
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion esphome/components/rtttl/rtttl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ inline double deg2rad(double degrees) {
return degrees * PI_ON_180;
}

void Rtttl::dump_config() { ESP_LOGCONFIG(TAG, "Rtttl"); }
void Rtttl::dump_config() {
ESP_LOGCONFIG(TAG, "Rtttl:");
ESP_LOGCONFIG(TAG, " Gain: %f", gain_);
}

void Rtttl::play(std::string rtttl) {
if (this->state_ != State::STATE_STOPPED && this->state_ != State::STATE_STOPPING) {
Expand Down
1 change: 1 addition & 0 deletions esphome/components/rtttl/rtttl.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class Rtttl : public Component {
#ifdef USE_SPEAKER
void set_speaker(speaker::Speaker *speaker) { this->speaker_ = speaker; }
#endif
float get_gain() { return gain_; }
void set_gain(float gain) {
if (gain < 0.1f)
gain = 0.1f;
Expand Down

0 comments on commit 2597975

Please sign in to comment.