Xiaofei Qiu / CommandPool
Revision:
4:014c83243d70
Parent:
3:b83fb41e2726
Child:
5:7fa548878fac
--- a/CommandPool.cpp	Sat Nov 28 02:34:45 2015 +0000
+++ b/CommandPool.cpp	Sat Nov 28 15:21:24 2015 +0000
@@ -31,9 +31,14 @@
     
 Command* CommandPool::getCommand(const char& cmdstr)
 {
-    static char cmd = cmdstr & 0x0F;
-    static int8_t is_negative = cmdstr & 0x08;
-    static int8_t sp = (cmdstr & 0xF0) >> 4;
+    static char cmd = '\0';
+    static int8_t is_negative = 0;
+    static int8_t sp = 0; (cmdstr & 0xF0) >> 4;
+    
+    cmd = cmdstr & 0x0F;
+    is_negative = (cmdstr & 0x08) >> 3;
+    sp = (cmdstr & 0xF0) >> 4;
+    
     _pool[cmd]->setSpeed(sp,is_negative);
     return _pool[cmd];
 }
\ No newline at end of file