mirror of
https://github.com/esphome/esphome.git
synced 2024-12-22 13:34:54 +01:00
[rtttl] Add get_gain()
(#7647)
This commit is contained in:
parent
6330177d24
commit
2597975ae0
2 changed files with 5 additions and 1 deletions
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue