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;
|
||||
}
|
||||
|
||||
while (true) {
|
||||
switch (this->ota_state_) {
|
||||
case OTAState::MAGIC_READ: {
|
||||
// Try to read remaining magic bytes (5 total)
|
||||
@@ -175,7 +174,7 @@ void ESPHomeOTAComponent::handle_handshake_() {
|
||||
|
||||
// Magic bytes valid, move to next state
|
||||
this->transition_ota_state_(OTAState::MAGIC_ACK);
|
||||
continue;
|
||||
[[fallthrough]];
|
||||
}
|
||||
|
||||
case OTAState::MAGIC_ACK: {
|
||||
@@ -193,7 +192,7 @@ void ESPHomeOTAComponent::handle_handshake_() {
|
||||
// All bytes sent, create backend and move to next state
|
||||
this->backend_ = ota::make_ota_backend();
|
||||
this->transition_ota_state_(OTAState::FEATURE_READ);
|
||||
continue;
|
||||
[[fallthrough]];
|
||||
}
|
||||
|
||||
case OTAState::FEATURE_READ: {
|
||||
@@ -205,7 +204,7 @@ void ESPHomeOTAComponent::handle_handshake_() {
|
||||
this->ota_features_ = this->handshake_buf_[0];
|
||||
ESP_LOGV(TAG, "Features: 0x%02X", this->ota_features_);
|
||||
this->transition_ota_state_(OTAState::FEATURE_ACK);
|
||||
continue;
|
||||
[[fallthrough]];
|
||||
}
|
||||
|
||||
case OTAState::FEATURE_ACK: {
|
||||
@@ -224,7 +223,7 @@ void ESPHomeOTAComponent::handle_handshake_() {
|
||||
|
||||
// Handshake complete, move to data phase
|
||||
this->transition_ota_state_(OTAState::DATA);
|
||||
continue;
|
||||
[[fallthrough]];
|
||||
}
|
||||
|
||||
case OTAState::DATA:
|
||||
@@ -236,7 +235,6 @@ void ESPHomeOTAComponent::handle_handshake_() {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ESPHomeOTAComponent::handle_data_() {
|
||||
/// Handle the OTA data transfer and update process.
|
||||
|
Reference in New Issue
Block a user