zephyr: Rely on img_mgmt_find_best_area_id to select update partition

The img_mgmt_find_best_area_id is supposed to figure out the best, which
also means possible, partition for software update.
Unfortunately in the code in many places the direct reference the to
FLASH_AREA_ID(image_1) is used, which may cause image_1 being
overwritten, even if other partition would be selected as the "best".

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
diff --git a/cmd/img_mgmt/port/zephyr/src/zephyr_img_mgmt.c b/cmd/img_mgmt/port/zephyr/src/zephyr_img_mgmt.c
index d6169b8..ef72c1e 100644
--- a/cmd/img_mgmt/port/zephyr/src/zephyr_img_mgmt.c
+++ b/cmd/img_mgmt/port/zephyr/src/zephyr_img_mgmt.c
@@ -194,14 +194,16 @@
     bool empty;
     int rc;
 
-    rc = zephyr_img_mgmt_flash_check_empty(FLASH_AREA_ID(image_1),
-                                           &empty);
+    /* Select non-active slot */
+    const int best_id = img_mgmt_find_best_area_id();
+
+    rc = zephyr_img_mgmt_flash_check_empty(best_id, &empty);
     if (rc != 0) {
         return MGMT_ERR_EUNKNOWN;
     }
 
     if (!empty) {
-        rc = boot_erase_img_bank(FLASH_AREA_ID(image_1));
+        rc = boot_erase_img_bank(best_id);
         if (rc != 0) {
             return MGMT_ERR_EUNKNOWN;
         }
@@ -328,7 +330,7 @@
         goto end;
     }
 
-    rc = flash_area_open(FLASH_AREA_ID(image_1), &fa);
+    rc = flash_area_open(img_mgmt_find_best_area_id(), &fa);
     if (rc != 0) {
         LOG_ERR("Can't bind to the flash area (err %d)", rc);
         rc = MGMT_ERR_EUNKNOWN;