The Big Refactoring of 2019: folder structure #723

This commit is contained in:
rusefi 2019-03-31 16:33:16 -04:00
parent 892a423b60
commit 56d026b8e2
10 changed files with 28 additions and 25 deletions

View File

@ -271,7 +271,6 @@ INCDIR = $(CHIBIOS)/os/license \
config \ config \
ext \ ext \
ext_algo \ ext_algo \
util \
console_util \ console_util \
console \ console \
$(PROJECT_DIR)/console/binary \ $(PROJECT_DIR)/console/binary \
@ -285,6 +284,7 @@ INCDIR = $(CHIBIOS)/os/license \
hw_layer/mass_storage \ hw_layer/mass_storage \
hw_layer/$(CPU_HWLAYER) \ hw_layer/$(CPU_HWLAYER) \
$(HW_LAYER_DRIVERS_INC) \ $(HW_LAYER_DRIVERS_INC) \
$(UTIL_INC) \
development \ development \
development/hw_layer \ development/hw_layer \
development/test \ development/test \

View File

@ -7,19 +7,18 @@
#include "biquad.h" #include "biquad.h"
EXTERN_ENGINE;
Biquad::Biquad() { Biquad::Biquad() {
a0 = a1 = a2 = b1 = b2 = 0; a0 = a1 = a2 = b1 = b2 = 0;
z1 = z2 = 0; z1 = z2 = 0;
} }
void Biquad::initValue(float input DECLARE_ENGINE_PARAMETER_SUFFIX) { // todo: decouple from engine and just use bi_quard_s
a0 = engineConfiguration->biQuad.a0; void Biquad::initValue(float input, bi_quard_s *settings) {
a1 = engineConfiguration->biQuad.a1; a0 = settings->a0;
a2 = engineConfiguration->biQuad.a2; a1 = settings->a1;
b1 = engineConfiguration->biQuad.b1; a2 = settings->a2;
b2 = engineConfiguration->biQuad.b2; b1 = settings->b1;
b2 = settings->b2;
z1 = input * (1 - a0); z1 = input * (1 - a0);
z2 = input * (1 - a0 - a1 + b1); z2 = input * (1 - a0 - a1 + b1);

View File

@ -8,12 +8,14 @@
#ifndef CONTROLLERS_MATH_BIQUAD_H_ #ifndef CONTROLLERS_MATH_BIQUAD_H_
#define CONTROLLERS_MATH_BIQUAD_H_ #define CONTROLLERS_MATH_BIQUAD_H_
#include "engine.h" // todo: narrow this dependency further? only 'bi_quard_s' is needed, should it be extracted / moved to a smaller header?
// todo: do we need to make code generation smarted and produce a larger number of smaller headers instead of one monster header?
#include "engine_configuration.h"
class Biquad { class Biquad {
public: public:
Biquad(); Biquad();
void initValue(float input DECLARE_ENGINE_PARAMETER_SUFFIX); void initValue(float input, bi_quard_s *settings);
float getValue(float input); float getValue(float input);
float a0, a1, a2, b1, b2; float a0, a1, a2, b1, b2;

View File

@ -6,10 +6,6 @@
*/ */
#include "data_buffer.h" #include "data_buffer.h"
#include "global.h"
#if EFI_PROD_CODE
//#include "eficonsole.h"
#endif /* EFI_PROD_CODE */
int dbIsFull(data_buffer_s *db) { int dbIsFull(data_buffer_s *db) {
return db->size == DB_MAX_SIZE; return db->size == DB_MAX_SIZE;

3
firmware/util/readme.md Normal file
View File

@ -0,0 +1,3 @@
In this folder we have all the tiny utility stuff.
Ideally, code from this folder should not depend on code from any other folder.

View File

@ -1,3 +0,0 @@
In this folder we have all the tiny utility stuff.
Ideally, code from this fould should not depend on code from any other folder.

View File

@ -1,10 +1,11 @@
UTIL_DIR=$(PROJECT_DIR)/util
UTILSRC = $(PROJECT_DIR)/util/crc.c \ UTILSRC = $(UTIL_DIR)/crc.c \
$(PROJECT_DIR)/util/data_buffer.c \ $(UTIL_DIR)/containers/data_buffer.c \
$(PROJECT_DIR)/util/rfiutil.c \ $(UTIL_DIR)/rfiutil.c \
$(PROJECT_DIR)/util/histogram.c $(UTIL_DIR)/histogram.c
UTILSRC_CPP = $(PROJECT_DIR)/util/cyclic_buffer.cpp \ UTILSRC_CPP = $(UTIL_DIR)/cyclic_buffer.cpp \
$(PROJECT_DIR)/util/datalogging.cpp \ $(PROJECT_DIR)/util/datalogging.cpp \
$(PROJECT_DIR)/util/loggingcentral.cpp \ $(PROJECT_DIR)/util/loggingcentral.cpp \
$(PROJECT_DIR)/util/listener_array.cpp \ $(PROJECT_DIR)/util/listener_array.cpp \
@ -14,3 +15,8 @@ UTILSRC_CPP = $(PROJECT_DIR)/util/cyclic_buffer.cpp \
$(PROJECT_DIR)/util/efilib.cpp \ $(PROJECT_DIR)/util/efilib.cpp \
$(PROJECT_DIR)/util/efilib2.cpp \ $(PROJECT_DIR)/util/efilib2.cpp \
$(PROJECT_DIR)/util/LocalVersionHolder.cpp $(PROJECT_DIR)/util/LocalVersionHolder.cpp
UTIL_INC = \
$(UTIL_DIR) \
$(UTIL_DIR)/containers \

View File

@ -170,7 +170,7 @@ INCDIR = . \
$(HALINC) \ $(HALINC) \
$(PLATFORMINC) \ $(PLATFORMINC) \
$(BOARDINC) \ $(BOARDINC) \
$(PROJECT_DIR)/util \ $(UTIL_INC) \
$(PROJECT_DIR)/console \ $(PROJECT_DIR)/console \
$(PROJECT_DIR)/console/binary \ $(PROJECT_DIR)/console/binary \
$(PROJECT_DIR)/console/fl_binary \ $(PROJECT_DIR)/console/fl_binary \

View File

@ -143,7 +143,7 @@ ASMSRC = $(PORTASM)
INCDIR = . \ INCDIR = . \
$(PROJECT_DIR)/util \ $(UTIL_INC) \
$(PROJECT_DIR)/config/engines \ $(PROJECT_DIR)/config/engines \
$(PROJECT_DIR)/controllers \ $(PROJECT_DIR)/controllers \
$(PROJECT_DIR)/controllers/sensors \ $(PROJECT_DIR)/controllers/sensors \