Skip to content

Commit f4a015a

Browse files
committed
optimize display output while OTA update
1 parent 538ab99 commit f4a015a

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/main.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ void setupOTA()
327327
Serial.println("Start updating " + type);
328328

329329
display.clearDisplay();
330-
display.setTextSize(2);
330+
display.setTextSize(1);
331331
display.print("updating...");
332332

333333
display.display();
@@ -338,16 +338,19 @@ void setupOTA()
338338
isUpdating = false;
339339
})
340340
.onProgress([](unsigned int progress, unsigned int total) {
341-
Serial.printf("Progress: %u%%\r", (progress / (total / 100)));
341+
unsigned int percentValue = progress / (total / 100);
342+
343+
Serial.printf("Progress: %u%%\r", percentValue);
342344

343345
display.clearDisplay();
344346

345347
display.setCursor(0, 0);
346-
display.setTextSize(2);
348+
display.setTextSize(1);
347349
display.print("updating...");
348350

349351
display.setCursor(0, 40);
350-
display.print(progress);
352+
display.setTextSize(2);
353+
display.print(percentValue);
351354
display.print("%");
352355

353356
display.display();

0 commit comments

Comments
 (0)