fix(ota): always offer another channel's image, even from the same commit

Prod and beta are often built from one commit (e.g. after a dev->prod merge),
so a hash match does not mean the images are the same: the native base differs.
After the flash the target channel is native, so this cannot loop.
This commit is contained in:
agessaman committed 2026-10-03 15:37:49 -07:00
1 parent 33bc19722f
commit 57dfd38718
1 file changed
+3 -2
+3 -2
View File
@@ -334,13 +334,14 @@ bool ESP32Board::otaFromManifestImpl(const char* manifest_base, const char* curr
bool same_base = (own_base[0] && avail_base[0] && strcmp(own_base, avail_base) == 0);
bool have_builds = (own_build >= 0 && avail_build >= 0);
bool diff_base = (own_base[0] && avail_base[0] && !same_base);
// Build counters are per channel, so build numbers only compare within the native channel.
// Another channel's image always differs (its native base does), even from the same
// commit; build counters are per channel, so build numbers only compare natively.
bool cross_channel = (strcmp(manifest_base, OTA_MANIFEST_BASE) != 0);
int behind = 0;
bool up_to_date;
if (cross_channel) {
up_to_date = hash_equal;
up_to_date = false;
} else if (same_base && have_builds) {
behind = avail_build - own_build;
up_to_date = (behind <= 0);