mirror of
https://github.com/esphome/esphome.git
synced 2024-12-23 14:04:53 +01:00
Dontr try stop if not actually started (#4814)
This commit is contained in:
parent
625126df68
commit
65cda10884
2 changed files with 8 additions and 0 deletions
|
@ -89,6 +89,10 @@ void I2SAudioMicrophone::start_() {
|
||||||
void I2SAudioMicrophone::stop() {
|
void I2SAudioMicrophone::stop() {
|
||||||
if (this->state_ == microphone::STATE_STOPPED || this->is_failed())
|
if (this->state_ == microphone::STATE_STOPPED || this->is_failed())
|
||||||
return;
|
return;
|
||||||
|
if (this->state_ == microphone::STATE_STARTING) {
|
||||||
|
this->state_ = microphone::STATE_STOPPED;
|
||||||
|
return;
|
||||||
|
}
|
||||||
this->state_ = microphone::STATE_STOPPING;
|
this->state_ = microphone::STATE_STOPPING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -136,6 +136,10 @@ void I2SAudioSpeaker::player_task(void *params) {
|
||||||
void I2SAudioSpeaker::stop() {
|
void I2SAudioSpeaker::stop() {
|
||||||
if (this->state_ == speaker::STATE_STOPPED)
|
if (this->state_ == speaker::STATE_STOPPED)
|
||||||
return;
|
return;
|
||||||
|
if (this->state_ == speaker::STATE_STARTING) {
|
||||||
|
this->state_ = speaker::STATE_STOPPED;
|
||||||
|
return;
|
||||||
|
}
|
||||||
this->state_ = speaker::STATE_STOPPING;
|
this->state_ = speaker::STATE_STOPPING;
|
||||||
DataEvent data;
|
DataEvent data;
|
||||||
data.stop = true;
|
data.stop = true;
|
||||||
|
|
Loading…
Reference in a new issue