Skip to content

Commit

Permalink
Clean up fwupdate.
Browse files Browse the repository at this point in the history
  • Loading branch information
bertrik committed Dec 23, 2024
1 parent de53d78 commit 74ef4a0
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions fwupdate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ static String _update_path;
static String _update_page;

static unsigned long update_started = 0;
static size_t estimated_size;
static size_t progress = 0;
static int last_chunk = 0;

#define printf Serial.printf
Expand All @@ -38,10 +36,7 @@ static void handleRequest(AsyncWebServerRequest *request)
static void handleUpload(AsyncWebServerRequest *request, const String &filename, size_t index, uint8_t *data, size_t len, bool final)
{
if (index == 0) {
estimated_size = ESP.getSketchSize();
progress= 0;
last_chunk = 0;
printf("begin, free heap=%u, current sketch=%u: ", ESP.getFreeHeap(), ESP.getSketchSize());
uint32_t maxSketchSpace = (ESP.getFreeSketchSpace() - 0x1000) & 0xFFFFF000;
update_started = millis();
if (!Update.begin(maxSketchSpace, U_FLASH)) {
Expand All @@ -60,7 +55,6 @@ static void handleUpload(AsyncWebServerRequest *request, const String &filename,

if (final) {
Update.end(true);
request->redirect(_update_path);
}
}

Expand Down

0 comments on commit 74ef4a0

Please sign in to comment.