Embed client working with Cell network.

Dependencies:   C027Interface

Fork of U_Blox_DeviceConnector by Sarah Marsh

Revision:
49:10f84adec19e
Parent:
44:2b472e66a942
Child:
64:bb80622ae5e6
--- a/main.cpp	Tue Dec 20 14:45:09 2016 +0000
+++ b/main.cpp	Wed Dec 21 10:00:11 2016 +0000
@@ -208,22 +208,23 @@
     Thread blinky_thread;
     BlinkArgs *blink_args;
     void do_blink() {
-        // blink the LED
-        red_led = !red_led;
-        // up the position, if we reached the end of the vector
-        if (blink_args->position >= blink_args->blink_pattern.size()) {
-            // send delayed response after blink is done
-            M2MObjectInstance* inst = led_object->object_instance();
-            M2MResource* led_res = inst->resource("5850");
-            led_res->send_delayed_post_response();
-            red_led = 1;
-            status_ticker.attach_us(blinky, 250000);
-            return;
+        for (;;) {
+            // blink the LED
+            red_led = !red_led;
+            // up the position, if we reached the end of the vector
+            if (blink_args->position >= blink_args->blink_pattern.size()) {
+                // send delayed response after blink is done
+                M2MObjectInstance* inst = led_object->object_instance();
+                M2MResource* led_res = inst->resource("5850");
+                led_res->send_delayed_post_response();
+                red_led = 1;
+                status_ticker.attach_us(blinky, 250000);
+                return;
+            }
+            // Wait requested time, then continue prosessing the blink pattern from next position.
+            Thread::wait(blink_args->blink_pattern.at(blink_args->position));
+            blink_args->position++;
         }
-        // Invoke same function after `delay_ms` (upping position)
-        Thread::wait(blink_args->blink_pattern.at(blink_args->position));
-        blink_args->position++;
-        do_blink();
     }
 };