HTTP and Binary upload ota work - release

decrease logging verbosity on low level messages
merging with master branch
correcting buffer size for better OTA redirection/http header parsing
This commit is contained in:
Sebastien
2020-02-29 08:45:19 -05:00
parent d2eb9eb4aa
commit e2d77684e3

View File

@@ -144,9 +144,9 @@ static void loc_displayer_progressbar(uint8_t pct){
if(!progress_coordinates) progress_coordinates = loc_displayer_get_progress_dft(); if(!progress_coordinates) progress_coordinates = loc_displayer_get_progress_dft();
int filler_x=progress_coordinates->filler.x1+(int)((float)progress_coordinates->filler.width*(float)pct/(float)100); int filler_x=progress_coordinates->filler.x1+(int)((float)progress_coordinates->filler.width*(float)pct/(float)100);
ESP_LOGI(TAG,"Drawing %d,%d,%d,%d",progress_coordinates->border.x1,progress_coordinates->border.y1,progress_coordinates->border.x2,progress_coordinates->border.y2); ESP_LOGD(TAG,"Drawing %d,%d,%d,%d",progress_coordinates->border.x1,progress_coordinates->border.y1,progress_coordinates->border.x2,progress_coordinates->border.y2);
GDS_DrawBox(display,progress_coordinates->border.x1,progress_coordinates->border.y1,progress_coordinates->border.x2,progress_coordinates->border.y2,GDS_COLOR_WHITE,false); GDS_DrawBox(display,progress_coordinates->border.x1,progress_coordinates->border.y1,progress_coordinates->border.x2,progress_coordinates->border.y2,GDS_COLOR_WHITE,false);
ESP_LOGI(TAG,"Drawing %d,%d,%d,%d",progress_coordinates->filler.x1,progress_coordinates->filler.y1,filler_x,progress_coordinates->filler.y2); ESP_LOGD(TAG,"Drawing %d,%d,%d,%d",progress_coordinates->filler.x1,progress_coordinates->filler.y1,filler_x,progress_coordinates->filler.y2);
if(filler_x > progress_coordinates->filler.x1){ if(filler_x > progress_coordinates->filler.x1){
GDS_DrawBox(display,progress_coordinates->filler.x1,progress_coordinates->filler.y1,filler_x,progress_coordinates->filler.y2,GDS_COLOR_WHITE,true); GDS_DrawBox(display,progress_coordinates->filler.x1,progress_coordinates->filler.y1,filler_x,progress_coordinates->filler.y2,GDS_COLOR_WHITE,true);
} }
@@ -154,7 +154,7 @@ static void loc_displayer_progressbar(uint8_t pct){
// Clear the inner box // Clear the inner box
GDS_DrawBox(display,progress_coordinates->filler.x1,progress_coordinates->filler.y1,progress_coordinates->filler.x2,progress_coordinates->filler.y2,GDS_COLOR_BLACK,true); GDS_DrawBox(display,progress_coordinates->filler.x1,progress_coordinates->filler.y1,progress_coordinates->filler.x2,progress_coordinates->filler.y2,GDS_COLOR_BLACK,true);
} }
ESP_LOGI(TAG,"Updating Display"); ESP_LOGD(TAG,"Updating Display");
GDS_Update(display); GDS_Update(display);
} }
void sendMessaging(messaging_types type,const char * fmt, ...){ void sendMessaging(messaging_types type,const char * fmt, ...){
@@ -437,14 +437,14 @@ static esp_err_t _http_handle_response_code(esp_http_client_handle_t http_client
return ESP_ERR_NO_MEM; return ESP_ERR_NO_MEM;
} }
while (1) { while (1) {
ESP_LOGI(TAG, "Buffer successfully allocated. Reading data chunk. "); ESP_LOGD(TAG, "Buffer successfully allocated. Reading data chunk. ");
int data_read = esp_http_client_read(http_client, local_buff, ota_status.buffer_size); int data_read = esp_http_client_read(http_client, local_buff, ota_status.buffer_size);
if (data_read < 0) { if (data_read < 0) {
ESP_LOGE(TAG, "Error: SSL data read error"); ESP_LOGE(TAG, "Error: SSL data read error");
err= ESP_FAIL; err= ESP_FAIL;
break; break;
} else if (data_read == 0) { } else if (data_read == 0) {
ESP_LOGI(TAG, "No more data. "); ESP_LOGD(TAG, "No more data. ");
err= ESP_OK; err= ESP_OK;
break; break;
} }
@@ -459,21 +459,21 @@ static esp_err_t _http_connect(esp_http_client_handle_t http_client)
esp_err_t err = ESP_FAIL; esp_err_t err = ESP_FAIL;
int status_code, header_ret; int status_code, header_ret;
do { do {
ESP_LOGI(TAG, "connecting the http client. "); ESP_LOGD(TAG, "connecting the http client. ");
err = esp_http_client_open(http_client, 0); err = esp_http_client_open(http_client, 0);
if (err != ESP_OK) { if (err != ESP_OK) {
ESP_LOGE(TAG, "Failed to open HTTP connection: %s", esp_err_to_name(err)); ESP_LOGE(TAG, "Failed to open HTTP connection: %s", esp_err_to_name(err));
sendMessaging(MESSAGING_ERROR,"Failed to open HTTP connection: %s", esp_err_to_name(err)); sendMessaging(MESSAGING_ERROR,"Failed to open HTTP connection: %s", esp_err_to_name(err));
return err; return err;
} }
ESP_LOGI(TAG, "Fetching headers"); ESP_LOGD(TAG, "Fetching headers");
header_ret = esp_http_client_fetch_headers(http_client); header_ret = esp_http_client_fetch_headers(http_client);
if (header_ret < 0) { if (header_ret < 0) {
// Error found // Error found
sendMessaging(MESSAGING_ERROR,"Header fetch failed"); sendMessaging(MESSAGING_ERROR,"Header fetch failed");
return header_ret; return header_ret;
} }
ESP_LOGI(TAG, "HTTP Header fetch completed, found content length of %d",header_ret); ESP_LOGD(TAG, "HTTP Header fetch completed, found content length of %d",header_ret);
status_code = esp_http_client_get_status_code(http_client); status_code = esp_http_client_get_status_code(http_client);
ESP_LOGD(TAG, "HTTP status code was %d",status_code); ESP_LOGD(TAG, "HTTP status code was %d",status_code);