mirror of
https://gitee.com/xiaohuolufeihua/bizhang_-obav.git
synced 2026-05-22 01:12:31 +00:00
Code style fixes, no code changes
This commit is contained in:
@@ -8,7 +8,8 @@
|
||||
|
||||
#include <drivers/sf0x/sf0x_parser.h>
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
warnx("SF0X test started");
|
||||
|
||||
int ret = 0;
|
||||
@@ -46,14 +47,14 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
int parse_ret;
|
||||
|
||||
for (int i = 0; i < strlen(lines[l]); i++)
|
||||
{
|
||||
for (int i = 0; i < strlen(lines[l]); i++) {
|
||||
parse_ret = sf0x_parser(lines[l][i], _parserbuf, &_parsebuf_index, &state, &dist_m);
|
||||
|
||||
if (parse_ret == 0) {
|
||||
printf("\nparsed: %f %s\n", dist_m, (parse_ret == 0) ? "OK" : "");
|
||||
}
|
||||
}
|
||||
|
||||
printf("%s", lines[l]);
|
||||
|
||||
}
|
||||
|
||||
@@ -69,6 +69,7 @@ int sf0x_parser(char c, char *parserbuf, unsigned *parserbuf_index, enum SF0X_PA
|
||||
*state = SF0X_PARSE_STATE1_SYNC;
|
||||
(*parserbuf_index) = 0;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case SF0X_PARSE_STATE1_SYNC:
|
||||
@@ -77,6 +78,7 @@ int sf0x_parser(char c, char *parserbuf, unsigned *parserbuf_index, enum SF0X_PA
|
||||
parserbuf[*parserbuf_index] = c;
|
||||
(*parserbuf_index)++;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case SF0X_PARSE_STATE2_GOT_DIGIT0:
|
||||
@@ -84,13 +86,16 @@ int sf0x_parser(char c, char *parserbuf, unsigned *parserbuf_index, enum SF0X_PA
|
||||
*state = SF0X_PARSE_STATE2_GOT_DIGIT0;
|
||||
parserbuf[*parserbuf_index] = c;
|
||||
(*parserbuf_index)++;
|
||||
|
||||
} else if (c == '.') {
|
||||
*state = SF0X_PARSE_STATE3_GOT_DOT;
|
||||
parserbuf[*parserbuf_index] = c;
|
||||
(*parserbuf_index)++;
|
||||
|
||||
} else {
|
||||
*state = SF0X_PARSE_STATE0_UNSYNC;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case SF0X_PARSE_STATE3_GOT_DOT:
|
||||
@@ -98,9 +103,11 @@ int sf0x_parser(char c, char *parserbuf, unsigned *parserbuf_index, enum SF0X_PA
|
||||
*state = SF0X_PARSE_STATE4_GOT_DIGIT1;
|
||||
parserbuf[*parserbuf_index] = c;
|
||||
(*parserbuf_index)++;
|
||||
|
||||
} else {
|
||||
*state = SF0X_PARSE_STATE0_UNSYNC;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case SF0X_PARSE_STATE4_GOT_DIGIT1:
|
||||
@@ -108,17 +115,21 @@ int sf0x_parser(char c, char *parserbuf, unsigned *parserbuf_index, enum SF0X_PA
|
||||
*state = SF0X_PARSE_STATE5_GOT_DIGIT2;
|
||||
parserbuf[*parserbuf_index] = c;
|
||||
(*parserbuf_index)++;
|
||||
|
||||
} else {
|
||||
*state = SF0X_PARSE_STATE0_UNSYNC;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case SF0X_PARSE_STATE5_GOT_DIGIT2:
|
||||
if (c == '\r') {
|
||||
*state = SF0X_PARSE_STATE6_GOT_CARRIAGE_RETURN;
|
||||
|
||||
} else {
|
||||
*state = SF0X_PARSE_STATE0_UNSYNC;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case SF0X_PARSE_STATE6_GOT_CARRIAGE_RETURN:
|
||||
@@ -128,9 +139,11 @@ int sf0x_parser(char c, char *parserbuf, unsigned *parserbuf_index, enum SF0X_PA
|
||||
*state = SF0X_PARSE_STATE1_SYNC;
|
||||
*parserbuf_index = 0;
|
||||
ret = 0;
|
||||
|
||||
} else {
|
||||
*state = SF0X_PARSE_STATE0_UNSYNC;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user