pwm period is now 200us instead of the default 20ms veml6040 config is now AF_BIT | TRIG_BIT

Dependencies:   mbed MMA8451Q USBDevice WakeUp vt100

Fork of afero_node_suntory_2017_06_15 by Orefatoi

Revision:
14:b205267fa5f6
Parent:
1:b2a9a6f2c30e
Child:
19:b45b077c88bc
diff -r c7d1ef8c57b3 -r b205267fa5f6 sensors/ToDoQ.cpp
--- a/sensors/ToDoQ.cpp	Fri Apr 28 10:11:07 2017 +0000
+++ b/sensors/ToDoQ.cpp	Tue May 16 08:58:26 2017 +0000
@@ -19,6 +19,7 @@
 
 ToDoQ::ToDoQ()
 {
+    todoQ = new USQueue<ToDo*>(NULL,USQueue<ToDo*>::QSIZE_16);
     for (int i = 0; i < TODO_QUEUE_SIZE; i++)
     {
         q[i] = NULL;
@@ -35,13 +36,21 @@
 ToDoQ::loop()
 {
     SensorsMain::getInstance()->loop();
-    for (int i = 0; i < TODO_QUEUE_SIZE; i++)
+    
+    ToDo* todoP = todoQ->deq();
+    
+    if(todoP != NULL)
     {
-        if (q[i] != NULL)
+        if(_onGetTodo(todoP)!=true)
         {
-            _onGetTodo(q[i]);
-            q[i]=NULL;
-            break;
+//            SERIAL_PRINT_DBG("ToDoQ::_onGetTodo returned false\n");
+            ++(todoP->retry_count);
+            todoQ->enq(todoP);
+        }
+        else
+        {
+            SERIAL_PRINT_DBG("ToDoQ retry count : %d\n", todoP->retry_count);
+            todoP->retry_count = 0;
         }
     }
 }
@@ -50,15 +59,7 @@
 ToDoQ::_queuePut(ToDo *todo)
 {
     SERIAL_PRINT_DBG("ToDoQ::_queuePut entered\n");
-    for (int i = 0; i < TODO_QUEUE_SIZE; i++)
-    {
-        if(q[i] == NULL)
-        {
-            SERIAL_PRINT_DBG("ToDoQ::_queuePut found empty slot\n");
-            q[i] = todo;
-            break;
-        }
-    }
+    todoQ->enq(todo);
 }
 
 void
@@ -67,4 +68,4 @@
     getInstance<ToDoQ>()->_queuePut(todo);
 }
 
-NAMESPACE_MARUSOLSENSORMANAGER_END
\ No newline at end of file
+NAMESPACE_MARUSOLSENSORMANAGER_END