mirror of
https://github.com/esphome/esphome.git
synced 2026-02-21 08:55:36 -07:00
Merge branch 'rtttl_substr' into integration
This commit is contained in:
@@ -35,7 +35,9 @@ void Rtttl::dump_config() {
|
||||
|
||||
void Rtttl::play(std::string rtttl) {
|
||||
if (this->state_ != State::STATE_STOPPED && this->state_ != State::STATE_STOPPING) {
|
||||
ESP_LOGW(TAG, "Already playing: %.*s", (int) this->rtttl_.find(':'), this->rtttl_.c_str());
|
||||
size_t pos = this->rtttl_.find(':');
|
||||
size_t len = (pos != std::string::npos) ? pos : this->rtttl_.length();
|
||||
ESP_LOGW(TAG, "Already playing: %.*s", (int) len, this->rtttl_.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user