Config generator jar (#2716)
* fix test * jar * kick config * guard stuff * nmea * nmea * nmea * c++ is type safe, which is good * c++ is type safe
This commit is contained in:
parent
1245bbc48f
commit
84368cae10
|
@ -1,4 +1,4 @@
|
||||||
CONTROLLERS_ALGO_SRC = $(PROJECT_DIR)/controllers/algo/nmea.c
|
CONTROLLERS_ALGO_SRC =
|
||||||
|
|
||||||
CONTROLLERS_ALGO_SRC_CPP = $(PROJECT_DIR)/controllers/algo/advance_map.cpp \
|
CONTROLLERS_ALGO_SRC_CPP = $(PROJECT_DIR)/controllers/algo/advance_map.cpp \
|
||||||
$(PROJECT_DIR)/controllers/algo/malfunction_central.cpp \
|
$(PROJECT_DIR)/controllers/algo/malfunction_central.cpp \
|
||||||
|
@ -20,3 +20,4 @@ CONTROLLERS_ALGO_SRC_CPP = $(PROJECT_DIR)/controllers/algo/advance_map.cpp \
|
||||||
$(PROJECT_DIR)/controllers/algo/airmass/speed_density_base.cpp \
|
$(PROJECT_DIR)/controllers/algo/airmass/speed_density_base.cpp \
|
||||||
$(PROJECT_DIR)/controllers/algo/fuel/fuel_computer.cpp \
|
$(PROJECT_DIR)/controllers/algo/fuel/fuel_computer.cpp \
|
||||||
$(PROJECT_DIR)/controllers/algo/fuel/injector_model.cpp \
|
$(PROJECT_DIR)/controllers/algo/fuel/injector_model.cpp \
|
||||||
|
$(PROJECT_DIR)/controllers/algo/nmea.cpp \
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include "nmea.h"
|
#include "nmea.h"
|
||||||
|
|
||||||
static long hex2int(char *a, int len) {
|
static long hex2int(const char *a, int len) {
|
||||||
int i;
|
int i;
|
||||||
long val = 0;
|
long val = 0;
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ static long hex2int(char *a, int len) {
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int str2int(char *a, int len) {
|
static int str2int(const char *a, int len) {
|
||||||
int i = 0, k = 0;
|
int i = 0, k = 0;
|
||||||
while (i<len) {
|
while (i<len) {
|
||||||
k = (k<<3)+(k<<1)+(*a)-'0';
|
k = (k<<3)+(k<<1)+(*a)-'0';
|
||||||
|
@ -266,7 +266,7 @@ void nmea_parse_gprmc(char *nmea, loc_t *loc) {
|
||||||
nmea_message_type nmea_get_message_type(const char *message) {
|
nmea_message_type nmea_get_message_type(const char *message) {
|
||||||
int checksum = nmea_valid_checksum(message);
|
int checksum = nmea_valid_checksum(message);
|
||||||
if (checksum != _EMPTY) {
|
if (checksum != _EMPTY) {
|
||||||
return checksum;
|
return static_cast<nmea_message_type>(checksum);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strstr(message, NMEA_GPGGA_STR) != NULL) {
|
if (strstr(message, NMEA_GPGGA_STR) != NULL) {
|
||||||
|
@ -283,11 +283,11 @@ nmea_message_type nmea_get_message_type(const char *message) {
|
||||||
int nmea_valid_checksum(const char *message) {
|
int nmea_valid_checksum(const char *message) {
|
||||||
char p;
|
char p;
|
||||||
int sum = 0;
|
int sum = 0;
|
||||||
char *starPtr = strrchr(message, '*');
|
const char* starPtr = strrchr(message, '*');
|
||||||
if (!starPtr) {
|
if (!starPtr) {
|
||||||
return NMEA_CHECKSUM_ERR;
|
return NMEA_CHECKSUM_ERR;
|
||||||
}
|
}
|
||||||
char *int_message = starPtr + 1;
|
const char* int_message = starPtr + 1;
|
||||||
long checksum = hex2int(int_message, 2);
|
long checksum = hex2int(int_message, 2);
|
||||||
|
|
||||||
++message;
|
++message;
|
|
@ -6,12 +6,6 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C"
|
|
||||||
{
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
|
|
||||||
#define GPS_MAX_STRING 256
|
#define GPS_MAX_STRING 256
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
@ -48,9 +42,3 @@ int nmea_valid_checksum(const char *);
|
||||||
void nmea_parse_gpgga(char *, loc_t *);
|
void nmea_parse_gpgga(char *, loc_t *);
|
||||||
void nmea_parse_gprmc(char *, loc_t *);
|
void nmea_parse_gprmc(char *, loc_t *);
|
||||||
void gps_location(loc_t *, char *);
|
void gps_location(loc_t *, char *);
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
! The only difference here is that engine_configuration_s area does not support hot modification while tuning tables could
|
! The only difference here is that engine_configuration_s area does not support hot modification while tuning tables could
|
||||||
! be modified without burning changes
|
! be modified without burning changes
|
||||||
!
|
!
|
||||||
!
|
|
||||||
! See also ../tunerstudio/readme.txt
|
! See also ../tunerstudio/readme.txt
|
||||||
!
|
!
|
||||||
! Q: How to add new fields?
|
! Q: How to add new fields?
|
||||||
|
|
|
@ -19,9 +19,8 @@
|
||||||
* If not, see <http://www.gnu.org/licenses/>.
|
* If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "global.h"
|
|
||||||
|
|
||||||
#if !EFI_UNIT_TEST
|
#if !EFI_UNIT_TEST
|
||||||
|
#include "global.h"
|
||||||
#include "os_access.h"
|
#include "os_access.h"
|
||||||
#include "os_util.h"
|
#include "os_util.h"
|
||||||
|
|
||||||
|
|
|
@ -3,9 +3,9 @@ UTIL_DIR=$(PROJECT_DIR)/util
|
||||||
UTILSRC = \
|
UTILSRC = \
|
||||||
$(UTIL_DIR)/math/crc.c \
|
$(UTIL_DIR)/math/crc.c \
|
||||||
$(UTIL_DIR)/os_util.c \
|
$(UTIL_DIR)/os_util.c \
|
||||||
$(UTIL_DIR)/histogram.c
|
|
||||||
|
|
||||||
UTILSRC_CPP = \
|
UTILSRC_CPP = \
|
||||||
|
$(UTIL_DIR)/histogram.cpp \
|
||||||
$(UTIL_DIR)/containers/cyclic_buffer.cpp \
|
$(UTIL_DIR)/containers/cyclic_buffer.cpp \
|
||||||
$(UTIL_DIR)/containers/listener_array.cpp \
|
$(UTIL_DIR)/containers/listener_array.cpp \
|
||||||
$(UTIL_DIR)/containers/local_version_holder.cpp \
|
$(UTIL_DIR)/containers/local_version_holder.cpp \
|
||||||
|
|
Binary file not shown.
|
@ -315,7 +315,6 @@ public class ConfigFieldParserTest {
|
||||||
"\tint field[ERROR_BUFFER_SIZE];\n" +
|
"\tint field[ERROR_BUFFER_SIZE];\n" +
|
||||||
"\t/** total size 4*/\n" +
|
"\t/** total size 4*/\n" +
|
||||||
"};\n" +
|
"};\n" +
|
||||||
"\n" +
|
|
||||||
"\n", consumer.getContent().toString());
|
"\n", consumer.getContent().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue