Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: handlers.cpp
- Revision:
- 7:c268547fb6c8
- Parent:
- 6:e510aab8f2ce
- Child:
- 12:5e4cba1182ab
--- a/handlers.cpp Sat Jul 13 18:02:38 2013 +0000 +++ b/handlers.cpp Sat Jul 13 22:16:27 2013 +0000 @@ -19,7 +19,7 @@ if(line_buf[3] == LINEBUF_TOOLONG) return PARSE_LONG; //buffer too long - if(line_buf[0] == '0') + if(line_buf[0] == '0') //input is 0 { if(line_buf[1] == 255 && line_buf[2] == 255) { @@ -27,7 +27,7 @@ return PARSE_OK; } else - return PARSE_ERR; //value is zero + return PARSE_ERR; } @@ -68,7 +68,7 @@ if(line_buf[3] == LINEBUF_TOOLONG) return PARSE_LONG; - if(line_buf[0] == '0') + if(line_buf[0] == '0') //Input value is 0, both 0 and 0.0 is accpeted { if((line_buf[1] == 255 && line_buf[2] == 255) ||(line_buf[1] == '.' && line_buf[2] == '0')) { @@ -77,13 +77,15 @@ } else return PARSE_ERR; - } //zero input + } + //single digit input 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; - } //single digit input + } + //x.x format input 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; @@ -97,6 +99,4 @@ } else return PARSE_ERR; - - } \ No newline at end of file