fix: OTA buffer overflow caused by slow SetChatMessage (#1031)

This commit is contained in:
Xiaoxia
2025-08-06 01:16:52 +08:00
committed by GitHub
parent da228f2582
commit 363073658a

View File

@@ -118,9 +118,11 @@ void Application::CheckNewVersion(Ota& ota) {
vTaskDelay(pdMS_TO_TICKS(1000));
bool upgrade_success = ota.StartUpgrade([display](int progress, size_t speed) {
char buffer[64];
std::thread([display, progress, speed]() {
char buffer[32];
snprintf(buffer, sizeof(buffer), "%d%% %uKB/s", progress, speed / 1024);
display->SetChatMessage("system", buffer);
}).detach();
});
if (!upgrade_success) {