From a6851813f96586a0fc492129eb6f7d1b0c56e050 Mon Sep 17 00:00:00 2001 From: agessaman Date: Tue, 23 Jun 2026 14:25:06 -0700 Subject: [PATCH] fix(ota): improve display of version and hash in OTA status messages Updated the otaFromManifestImpl method to enhance the display of available and current firmware versions. The changes ensure that the short commit hash is included in the status messages, providing clearer versioning information during OTA checks. --- src/helpers/ESP32Board.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/helpers/ESP32Board.cpp b/src/helpers/ESP32Board.cpp index f698e59a..516c1422 100644 --- a/src/helpers/ESP32Board.cpp +++ b/src/helpers/ESP32Board.cpp @@ -288,8 +288,13 @@ bool ESP32Board::otaFromManifestImpl(const char* current_ver, bool dry_run, char up_to_date = hash_equal; // unknown build numbers -> fall back to hash } - const char* avail_disp = avail_version[0] ? avail_version : avail_hash; - const char* own_disp = own_version[0] ? own_version : cur_hash; + // Display strings carry the short commit hash in the same form as the asset + // filename, e.g. "v1.16.0.2 (5acfdd7)" (or just the hash if there's no version). + char avail_disp[72], own_disp[72]; + if (avail_version[0]) snprintf(avail_disp, sizeof(avail_disp), "%s (%s)", avail_version, avail_hash); + else snprintf(avail_disp, sizeof(avail_disp), "%s", avail_hash); + if (own_version[0]) snprintf(own_disp, sizeof(own_disp), "%s (%s)", own_version, cur_hash); + else snprintf(own_disp, sizeof(own_disp), "%s", cur_hash); const char* pc_note = partition_change ? " [partition change: cable flash]" : ""; // --- Report (dry run / `ota check`) -------------------------------------- @@ -312,7 +317,7 @@ bool ESP32Board::otaFromManifestImpl(const char* current_ver, bool dry_run, char return false; } if (up_to_date) { - snprintf(reply, 160, "OK: already up to date (%s)", avail_disp); + snprintf(reply, 160, "OK: already up to date: %s", avail_disp); return false; }