mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-30 22:53:59 +00:00 
			
		
		
		
	Improve OTA error messages adding return codes (#3698)
This commit is contained in:
		
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							1a524a5a50
						
					
				
				
					commit
					df6830110d
				
			| @@ -49,7 +49,7 @@ OTAResponseTypes IDFOTABackend::end() { | ||||
|   this->md5_.calculate(); | ||||
|   if (!this->md5_.equals_hex(this->expected_bin_md5_)) { | ||||
|     this->abort(); | ||||
|     return OTA_RESPONSE_ERROR_UPDATE_END; | ||||
|     return OTA_RESPONSE_ERROR_MD5_MISMATCH; | ||||
|   } | ||||
|   esp_err_t err = esp_ota_end(this->update_handle_); | ||||
|   this->update_handle_ = 0; | ||||
|   | ||||
| @@ -296,7 +296,7 @@ void OTAComponent::handle_() { | ||||
|  | ||||
|     error_code = backend->write(buf, read); | ||||
|     if (error_code != OTA_RESPONSE_OK) { | ||||
|       ESP_LOGW(TAG, "Error writing binary data to flash!"); | ||||
|       ESP_LOGW(TAG, "Error writing binary data to flash!, error_code: %d", error_code); | ||||
|       goto error;  // NOLINT(cppcoreguidelines-avoid-goto) | ||||
|     } | ||||
|     total += read; | ||||
| @@ -321,7 +321,7 @@ void OTAComponent::handle_() { | ||||
|  | ||||
|   error_code = backend->end(); | ||||
|   if (error_code != OTA_RESPONSE_OK) { | ||||
|     ESP_LOGW(TAG, "Error ending OTA!"); | ||||
|     ESP_LOGW(TAG, "Error ending OTA!, error_code: %d", error_code); | ||||
|     goto error;  // NOLINT(cppcoreguidelines-avoid-goto) | ||||
|   } | ||||
|  | ||||
|   | ||||
| @@ -32,6 +32,7 @@ enum OTAResponseTypes { | ||||
|   OTA_RESPONSE_ERROR_ESP8266_NOT_ENOUGH_SPACE = 136, | ||||
|   OTA_RESPONSE_ERROR_ESP32_NOT_ENOUGH_SPACE = 137, | ||||
|   OTA_RESPONSE_ERROR_NO_UPDATE_PARTITION = 138, | ||||
|   OTA_RESPONSE_ERROR_MD5_MISMATCH = 139, | ||||
|   OTA_RESPONSE_ERROR_UNKNOWN = 255, | ||||
| }; | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user