Trond Enger / d7a_1x

Fork of d7a_1x by WizziLab

Revision:
32:1e8d2d1c2946
Parent:
31:ab9bfdbc6b44
Child:
33:f9a542d3efaa
diff -r ab9bfdbc6b44 -r 1e8d2d1c2946 src/d7a_modem.cpp
--- a/src/d7a_modem.cpp	Thu Jun 02 09:24:52 2016 +0000
+++ b/src/d7a_modem.cpp	Thu Jun 16 12:10:10 2016 +0000
@@ -17,6 +17,7 @@
     DigitalInOut* reset;
     int16_t waiting_count;
     uint8_t ready_count;
+    bool booted;
 } d7a_modem_ctx_t;
 
 d7a_modem_ctx_t g_modem_ctx;
@@ -31,6 +32,7 @@
     g_modem_ctx.thread = new Thread(d7a_modem_thread, NULL, osPriorityHigh, DEFAULT_STACK_SIZE);
     g_modem_ctx.waiting_count = 0;
     g_modem_ctx.ready_count = 0;
+    g_modem_ctx.booted = false;
     
     if (reset_pin == NC)
     {
@@ -51,6 +53,7 @@
     IPRINT("MODEM Boot OK.\r\n");
     ASSERT(d7a_modem_wait_ready(2000), "MODEM READY Timeout\r\n");
     IPRINT("MODEM Ready.\r\n");
+    g_modem_ctx.booted = true;
 }
 
 void d7a_modem_reset( void )
@@ -166,7 +169,7 @@
     d7a_modem_msg(WM_CMD_NOTIFY_FILE,(uint8_t*)&nfp,sizeof(notify_file_param_t));
     WARNING(d7a_modem_wait_ready(TO_FS), "Notification Timeout on FID:%d\r\n", fid);
     
-    Thread::wait(100); // XXX: To avoid lost packets
+    //Thread::wait(100); // XXX: To avoid lost packets
     
     DPRINT("Notify %d done.\r\n", fid);
     g_modem_ctx.ressource->release();
@@ -220,6 +223,7 @@
                 }
                 else if (cmd == WM_CMD_BOOT)
                 {
+                    ASSERT(g_modem_ctx.booted == false, "Modem rebooted.\r\n");
                     DPRINT("Modem booted\r\n");
                     g_modem_ctx.boot.put(NULL);
                 }