Use new config parser for calibration
This commit is contained in:
@@ -71,6 +71,7 @@ static int parse_value(struct config_parser_entry *entry, char *value_start_tok
|
||||
if (endptr == value_start_token)
|
||||
return -1;
|
||||
entry->type = CONFIG_PARSER_TYPE_FLOAT;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (value_start_token[0] != '-') {
|
||||
@@ -81,6 +82,7 @@ static int parse_value(struct config_parser_entry *entry, char *value_start_tok
|
||||
return -1;
|
||||
}
|
||||
entry->type = CONFIG_PARSER_TYPE_UINT;
|
||||
goto exit;
|
||||
} else {
|
||||
/* Try parsing as int */
|
||||
entry->value.int_val = strtod(value_start_token, &endptr);
|
||||
@@ -90,6 +92,7 @@ static int parse_value(struct config_parser_entry *entry, char *value_start_tok
|
||||
entry->type = CONFIG_PARSER_TYPE_INT;
|
||||
}
|
||||
|
||||
exit:
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -128,7 +131,7 @@ enum config_parser_ret config_parser_get_line(config_parser_handle_t handle, str
|
||||
}
|
||||
break;
|
||||
case 2: /* VALUE */
|
||||
if (!parse_value(entry, token))
|
||||
if (parse_value(entry, token))
|
||||
return CONFIG_PARSER_LINE_MALFORM;
|
||||
break;
|
||||
default:
|
||||
@@ -136,7 +139,7 @@ enum config_parser_ret config_parser_get_line(config_parser_handle_t handle, str
|
||||
}
|
||||
|
||||
token_round++;
|
||||
strtok(NULL, token_delim);
|
||||
token = strtok(NULL, token_delim);
|
||||
}
|
||||
|
||||
return CONFIG_PARSER_OK;
|
||||
|
Reference in New Issue
Block a user