Helper library to use modem_ref driver.

Dependencies:   WizziCom WizziDebug ram_fs modem_ref

Dependents:   D7A_Localisation D7A_1x_demo_send_file_data_and_forget D7A_1x_demo_CodeUpgradeProtocol D7A_1x_demo_LoRaWAN ... more

Revision:
49:035512e64fdd
Parent:
48:beb06c0bdb1e
Child:
58:f7105abdceed
--- a/modem_ref_helper.cpp	Tue Oct 30 14:25:24 2018 +0000
+++ b/modem_ref_helper.cpp	Mon Nov 26 16:42:56 2018 +0000
@@ -237,12 +237,16 @@
     modem_write_file_root(FID_HOST_REV, (void*)data, 0, HAL_U32_BYTE_SWAP(header->alloc), root_key, id);
     g_modem_ready.wait();
     
+    // Error when writing to the file
     if (ALP_ERR_NONE != g_err)
     {
-        // Error when writing to the file
-        // Delete old file
-        modem_delete_file(FID_HOST_REV, id);
-        g_modem_ready.wait();
+        // File exists
+        if (ALP_ERR_FILE_NOT_FOUND != g_err)
+        {
+            // Delete old file
+            modem_delete_file_root(FID_HOST_REV, root_key, id);
+            g_modem_ready.wait();
+        }
         
         // Recreate file
         modem_create_file(FID_HOST_REV, header, id);
@@ -324,7 +328,9 @@
         .lqual      = NULL,
         .ldown      = NULL,
         .reset      = NULL,
-        .boot       = my_startup_boot
+        .boot       = my_startup_boot,
+        .busy       = NULL,
+        .itf_busy   = NULL,
     };
     
     // Open modem Com port