mirror of
https://github.com/esphome/esphome.git
synced 2025-09-28 16:12:24 +01:00
optimize
This commit is contained in:
@@ -153,7 +153,6 @@ void ESPHomeOTAComponent::handle_handshake_() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (true) {
|
|
||||||
switch (this->ota_state_) {
|
switch (this->ota_state_) {
|
||||||
case OTAState::MAGIC_READ: {
|
case OTAState::MAGIC_READ: {
|
||||||
// Try to read remaining magic bytes (5 total)
|
// Try to read remaining magic bytes (5 total)
|
||||||
@@ -175,7 +174,7 @@ void ESPHomeOTAComponent::handle_handshake_() {
|
|||||||
|
|
||||||
// Magic bytes valid, move to next state
|
// Magic bytes valid, move to next state
|
||||||
this->transition_ota_state_(OTAState::MAGIC_ACK);
|
this->transition_ota_state_(OTAState::MAGIC_ACK);
|
||||||
continue;
|
[[fallthrough]];
|
||||||
}
|
}
|
||||||
|
|
||||||
case OTAState::MAGIC_ACK: {
|
case OTAState::MAGIC_ACK: {
|
||||||
@@ -193,7 +192,7 @@ void ESPHomeOTAComponent::handle_handshake_() {
|
|||||||
// All bytes sent, create backend and move to next state
|
// All bytes sent, create backend and move to next state
|
||||||
this->backend_ = ota::make_ota_backend();
|
this->backend_ = ota::make_ota_backend();
|
||||||
this->transition_ota_state_(OTAState::FEATURE_READ);
|
this->transition_ota_state_(OTAState::FEATURE_READ);
|
||||||
continue;
|
[[fallthrough]];
|
||||||
}
|
}
|
||||||
|
|
||||||
case OTAState::FEATURE_READ: {
|
case OTAState::FEATURE_READ: {
|
||||||
@@ -205,7 +204,7 @@ void ESPHomeOTAComponent::handle_handshake_() {
|
|||||||
this->ota_features_ = this->handshake_buf_[0];
|
this->ota_features_ = this->handshake_buf_[0];
|
||||||
ESP_LOGV(TAG, "Features: 0x%02X", this->ota_features_);
|
ESP_LOGV(TAG, "Features: 0x%02X", this->ota_features_);
|
||||||
this->transition_ota_state_(OTAState::FEATURE_ACK);
|
this->transition_ota_state_(OTAState::FEATURE_ACK);
|
||||||
continue;
|
[[fallthrough]];
|
||||||
}
|
}
|
||||||
|
|
||||||
case OTAState::FEATURE_ACK: {
|
case OTAState::FEATURE_ACK: {
|
||||||
@@ -224,7 +223,7 @@ void ESPHomeOTAComponent::handle_handshake_() {
|
|||||||
|
|
||||||
// Handshake complete, move to data phase
|
// Handshake complete, move to data phase
|
||||||
this->transition_ota_state_(OTAState::DATA);
|
this->transition_ota_state_(OTAState::DATA);
|
||||||
continue;
|
[[fallthrough]];
|
||||||
}
|
}
|
||||||
|
|
||||||
case OTAState::DATA:
|
case OTAState::DATA:
|
||||||
@@ -235,7 +234,6 @@ void ESPHomeOTAComponent::handle_handshake_() {
|
|||||||
// This shouldn't happen
|
// This shouldn't happen
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ESPHomeOTAComponent::handle_data_() {
|
void ESPHomeOTAComponent::handle_data_() {
|
||||||
|
Reference in New Issue
Block a user