]> granicus.if.org Git - esp-idf/commitdiff
app_update: fix logic error when update ota info
authorTian Zhong Xing <tianzhongxing@espressif.com>
Mon, 20 Feb 2017 10:09:32 +0000 (18:09 +0800)
committerAngus Gratton <angus@espressif.com>
Tue, 21 Feb 2017 23:26:04 +0000 (10:26 +1100)
components/app_update/esp_ota_ops.c

index e8bfd01bc0eb21ea6be448734ca2237f6a70aef7..96e32cecfe07cfe914e4d8c44df81367a017fd81 100644 (file)
@@ -342,9 +342,9 @@ static esp_err_t esp_rewrite_ota_data(esp_partition_subtype_t subtype)
             }
 
             if (s_ota_select[0].ota_seq >= s_ota_select[1].ota_seq) {
-                return rewrite_ota_seq((SUB_TYPE_ID(subtype) + 1) % ota_app_count + i * ota_app_count, 0, find_partition);
-            } else {
                 return rewrite_ota_seq((SUB_TYPE_ID(subtype) + 1) % ota_app_count + i * ota_app_count, 1, find_partition);
+            } else {
+                return rewrite_ota_seq((SUB_TYPE_ID(subtype) + 1) % ota_app_count + i * ota_app_count, 0, find_partition);
             }
 
         } else if (ota_select_valid(&s_ota_select[0])) {