yuhang zhu / Mbed 2 deprecated ADAM_menu

Dependencies:   mbed

Revision:
20:2a5e9d9aadbf
Parent:
12:5e4cba1182ab
Child:
21:4d6b26eecdac
--- a/handlers.cpp	Thu Jul 18 00:59:38 2013 +0000
+++ b/handlers.cpp	Fri Jul 19 21:25:24 2013 +0000
@@ -73,24 +73,30 @@
     if(line_buf[3] == LINEBUF_TOOLONG)
         return PARSE_LONG;
 
-    if(line_buf[0] == '0') //Input value is 0, both 0 and 0.0 is accpeted
+    /*if(line_buf[0] == '0') //Input value is 0, or 0.0, or 0.5
     {
-        if((line_buf[1] == 255 && line_buf[2] == 255) ||(line_buf[1] == '.' && line_buf[2] == '0'))
+        if((line_buf[1] == 255 && line_buf[2] == 255) ||(line_buf[1] == '.' && line_buf[2] == '0'))  //Input is 0 or 0.0
         {
             *adam_amp = 0;
             return PARSE_OK;
         }
+        else if(line_buf[1] == '.' && line_buf[2] == '5')    //Input is 0.5
+        {
+            *adam_amp = 1;
+            return PARSE_OK;
+        }
         else
             return PARSE_ERR;
-    }  
-    //single digit input 
+    } 
+    */ 
+    //single digit input single digit is 0,1,2,3,4,5,6,7
     if(line_buf[0]>='0' && line_buf[0]<='7' && line_buf[1] == 255 && line_buf[2] == 255)
     {
         temp = (line_buf[0] - '0')*10;
         *adam_amp = temp/5;
         return PARSE_OK;
     }  
-    //x.x format input
+    //x.x format input eg. 0.0 0.5 1.5 1.0 to 7.0 7.5
     else if(line_buf[0]>='0' && line_buf[0]<='7' && line_buf[2]>='0'&& line_buf[2]<='9' && line_buf[1] == '.')
     {
         temp = (line_buf[0] - '0')*10;