forked from xiaozhi/xiaozhi-esp32
fix: OTA buffer overflow caused by slow SetChatMessage (#1031)
This commit is contained in:
@@ -118,9 +118,11 @@ void Application::CheckNewVersion(Ota& ota) {
|
|||||||
vTaskDelay(pdMS_TO_TICKS(1000));
|
vTaskDelay(pdMS_TO_TICKS(1000));
|
||||||
|
|
||||||
bool upgrade_success = ota.StartUpgrade([display](int progress, size_t speed) {
|
bool upgrade_success = ota.StartUpgrade([display](int progress, size_t speed) {
|
||||||
char buffer[64];
|
std::thread([display, progress, speed]() {
|
||||||
snprintf(buffer, sizeof(buffer), "%d%% %uKB/s", progress, speed / 1024);
|
char buffer[32];
|
||||||
display->SetChatMessage("system", buffer);
|
snprintf(buffer, sizeof(buffer), "%d%% %uKB/s", progress, speed / 1024);
|
||||||
|
display->SetChatMessage("system", buffer);
|
||||||
|
}).detach();
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!upgrade_success) {
|
if (!upgrade_success) {
|
||||||
|
|||||||
Reference in New Issue
Block a user