Erick / Mbed 2 deprecated ICE_BLE_TEST

Dependencies:   NaturalTinyShell_ice libmDot-12Sept mbed-rtos mbed

Fork of ICE by Erick

Revision:
12:ea87887ca7ad
Parent:
5:5e77a1db4d45
Child:
13:c80c283f9db2
--- a/src/CommandParser/cmd.cpp	Tue Sep 06 22:09:39 2016 +0000
+++ b/src/CommandParser/cmd.cpp	Wed Sep 07 13:22:28 2016 +0000
@@ -55,7 +55,6 @@
     {"modify",              "modify a control",                                 cmd_modify          },
     {"reset",               "reset the controller",                             cmd_reset           },
     {"showControls",        "display active controls",                          cmd_ShowControls    },
-    {"stress",              "test utility to stress control creation/deletion", cmd_stress  },
     {NULL, NULL, NULL}
 };
 
@@ -64,10 +63,6 @@
 int func_cb_ntshell(const char *text);
 void func_cb_ntopt(int argc, char **argv);
 
-// stress test private functions
-static void create  ( const char *controlFile, Control_t controlType );
-static void destroy ( const char *controlFile );
-
 /**
  * Serial read function.
  */
@@ -141,7 +136,7 @@
 {
     UNUSED(argc);
     UNUSED(argv);
-    //ConfigurationHandler_DisplayThreads();
+    ConfigurationHandler_showControls();
 }
 
 void cmd_reset(int argc, char **argv)
@@ -174,8 +169,9 @@
 
 void cmd_destroy(int argc, char **argv)
 {
-    if ( argc != 2 ) {
-        printf("\r\nusage: destroy [threadName]\r\n");
+    if ( argc != 3 ) {
+        printf("\r\nusage: destroy [controlName] [controlType]\n");
+        printf("\rcontrolType-> 0=timer, 1=PID, 2=setpoint, 3=composite, 4=manual\n");
         return;
     }
 
@@ -183,6 +179,7 @@
     Message_t *msg  = MailBox.alloc();
     memset(msg, 0, sizeof(Message_t));
     msg->action  = ACTION_DESTROY;
+    msg->control = (Control_t) atoi(argv[2]);
     strncpy(msg->controlFile, argv[1], sizeof(msg->controlFile)-1);
 
     printf("%s: Sending a destroy request for control %s\r\n",
@@ -206,73 +203,5 @@
 }
 
 
-void cmd_stress(int argc, char **argv)
-{
-    UNUSED(argc), UNUSED(argv);
-    static int counter = 0;
-    const unsigned int delay = 1.0;
-
-    cmd_heap(0, 0);
-
-    // let's just run forever to see what happens
-    while ( ++ counter < 100 ) {
-        wait(delay);
-        create("TimerControl00.json", CONTROL_TIMER);
-        wait(delay);
-        create("PIDControl00.json", CONTROL_PID);
-        wait(delay);
-        create("SetpointControl00.json", CONTROL_SETPOINT);
-        wait(delay);
-        create("CompositeControl00.json", CONTROL_COMPOSITE);
-        wait(delay);
-        create("ManualControl00.json", CONTROL_MANUAL);
-        wait(delay);
-
-        cmd_heap(0, 0);
-
-        wait(2.5);
 
-        // now delete everything
-        destroy("TimerControl00.json");
-        wait(delay);
-        destroy("PIDControl00.json");
-        wait(delay);
-        destroy("SetpointControl00.json");
-        wait(delay);
-        destroy("CompositeControl00.json");
-        wait(delay);
-        destroy("ManualControl00.json");
-        wait(delay);
-        printf("\rInterval => %u\n", ++counter);
-        cmd_heap(0, 0);
-        wait(2.5);
-    }
-}
 
-static void create(const char *controlFile, Control_t controlType)
-{
-    Message_t *msg  = MailBox.alloc();
-    memset(msg, 0, sizeof(Message_t));
-    msg->action  = ACTION_CREATE;
-    msg->control = controlType;
-    strncpy(msg->controlFile, controlFile, sizeof(msg->controlFile)-1);
-
-    printf("\r%s: Sending a create request for control %s\r\n",
-           __func__, msg->controlFile);
-
-    MailBox.put(msg);
-}
-
-static void destroy(const char *controlFile)
-{
-    Message_t *msg  = MailBox.alloc();
-    memset(msg, 0, sizeof(Message_t));
-    msg->action  = ACTION_DESTROY;
-    strncpy(msg->controlFile, controlFile, sizeof(msg->controlFile)-1);
-
-    printf("\r%s: Sending a destroy request for control %s\r\n",
-           __func__, msg->controlFile);
-
-    MailBox.put(msg);
-}
-