020.09 Alignment changes to json_parser; changed strtod to strtof in various places

This commit is contained in:
aldenhart
2013-10-10 12:35:22 -04:00
parent 2fd56f8aa8
commit cec71ff7b8
6 changed files with 183 additions and 205 deletions
+1 -1
View File
@@ -180,7 +180,7 @@ static stat_t _get_next_gcode_word(char **pstr, char *letter, float *value)
// get-value general case
char *end;
*value = strtod(*pstr, &end);
*value = strtof(*pstr, &end);
if(end == *pstr) { return(STAT_BAD_NUMBER_FORMAT); } // more robust test then checking for value=0;
*pstr = end;
return (STAT_OK); // pointer points to next character after the word
+176 -181
View File
File diff suppressed because it is too large Load Diff
+3 -20
View File
@@ -1,8 +1,8 @@
/*
* json_parser.h - JSON parser and JSON support
* This file is part of the TinyG2 project
* json_parser.h - JSON parser and JSON support for TinyG
* This file is part of the TinyG project
*
* Copyright (c) 2011 - 2013 Alden S. Hart Jr.
* Copyright (c) 2011 - 2013 Alden S. Hart, Jr.
*
* This file ("the software") is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License, version 2 as published by the
@@ -102,23 +102,6 @@ stat_t json_set_jv(cmdObj_t *cmd);
#endif // __TEXT_MODE
/*
// for now there is only one JSON array in use - the footer
// if you add these make sure there are no collisions w/present or past numbers
#define FOOTER_REVISION 1
#define JSON_OUTPUT_STRING_MAX (OUTPUT_BUFFER_LEN)
#define JSON_MAX_DEPTH 4
void json_parser(char_t *str);
uint16_t json_serialize(cmdObj_t *cmd, char_t *out_buf, uint16_t size);
void json_print_object(cmdObj_t *cmd);
void json_print_response(uint8_t status);
void json_print_list(stat_t status, uint8_t flags);
*/
/* unit test setup */
//#define __UNIT_TEST_JSON // uncomment to enable JSON unit tests
+1 -1
View File
@@ -114,7 +114,7 @@ static stat_t _text_parser_kernal(char_t *str, cmdObj_t *cmd)
*rd = NUL; // terminate at end of name
strncpy(cmd->token, str, CMD_TOKEN_LEN);
str = ++rd;
cmd->value = strtod(str, &rd); // rd used as end pointer
cmd->value = strtof(str, &rd); // rd used as end pointer
if (rd != str) {
cmd->objtype = TYPE_FLOAT;
}
+1 -1
View File
@@ -35,7 +35,7 @@
#include "MotatePins.h"
#define TINYG_FIRMWARE_BUILD 020.08 // Alignment changes to help.cpp
#define TINYG_FIRMWARE_BUILD 020.09 // Alignment changes to json_parser
#define TINYG_FIRMWARE_VERSION 0.8 // firmware major version
#define TINYG_HARDWARE_PLATFORM 2 // hardware platform indicator (2 = Native Arduino Due)
#define TINYG_HARDWARE_VERSION 1 // hardware platform revision number
+1 -1
View File
@@ -213,7 +213,7 @@ uint8_t read_float(char *buf, uint8_t *i, float *float_ptr)
char *start = buf + *i;
char *end;
*float_ptr = strtod(start, &end);
*float_ptr = strtof(start, &end);
if(end == start) {
return(false);
}