Skip to content

Commit

Permalink
Log in the OTAupdater changed from ESP_LOGI to BSC_LOGI
Browse files Browse the repository at this point in the history
  • Loading branch information
shining-man committed Feb 20, 2024
1 parent e7aa085 commit 71fe0e7
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/OTAupdater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include <Arduino.h>
#include <Update.h>
#include "log.h"
#include "defines.h"

static const char *TAG = "OTA";

Expand Down Expand Up @@ -198,38 +199,38 @@ void OTAupdater::setHttpRoutes(WebServer *server, const char *path, bool enUpdat

if(upload.status == UPLOAD_FILE_START)
{
ESP_LOGI(TAG,"Firmware update initiated: %s",upload.filename.c_str());
BSC_LOGI(TAG,"Firmware update initiated: %s",upload.filename.c_str());
uint32_t sketchSize = (ESP.getFreeSketchSpace()-0x1000) & 0xFFFFF000;

if(!Update.begin(sketchSize))
{
ESP_LOGI(TAG,"Firmware update:", Update.errorString());
BSC_LOGI(TAG,"Firmware update:", Update.errorString());
}
}
else if(upload.status == UPLOAD_FILE_WRITE)
{
if(Update.write(upload.buf, upload.currentSize) != upload.currentSize) // if error
{
ESP_LOGI(TAG,"Firmware update:", Update.errorString());
BSC_LOGI(TAG,"Firmware update:", Update.errorString());
}

// Print info all 100k
static uint32_t nextInfoSize = CHUNK_SIZE;
if(upload.totalSize >= nextInfoSize)
{
ESP_LOGI(TAG,"%d k ",nextInfoSize/1024);
BSC_LOGI(TAG,"%d k ",nextInfoSize/1024);
nextInfoSize += CHUNK_SIZE;
}
}
else if(upload.status == UPLOAD_FILE_END)
{
if(Update.end(true))
{
ESP_LOGI(TAG,"Firmware update successful: %u bytes;\nRebooting...", upload.totalSize);
BSC_LOGI(TAG,"Firmware update successful: %u bytes;\nRebooting...", upload.totalSize);
}
else
{
ESP_LOGI(TAG,"Firmware update:", Update.errorString());
BSC_LOGI(TAG,"Firmware update:", Update.errorString());
}
}
});
Expand Down

0 comments on commit 71fe0e7

Please sign in to comment.