refactoring

This commit is contained in:
rusefi 2019-11-20 01:35:08 -05:00
parent 46240980f4
commit ad7e36c228
12 changed files with 25 additions and 43 deletions

View File

@ -2,17 +2,12 @@
* @file lcd_controller.h * @file lcd_controller.h
* *
* @date Aug 14, 2014 * @date Aug 14, 2014
* @author Andrey Belomutskiy, (c) 2012-2017 * @author Andrey Belomutskiy, (c) 2012-2019
*/ */
#ifndef LCD_CONTROLLER_H_ #pragma once
#define LCD_CONTROLLER_H_
#include "engine.h"
#define MAX_LCD_WIDTH 20 #define MAX_LCD_WIDTH 20
void initLcdController(void); void initLcdController(void);
void updateHD44780lcd(void); void updateHD44780lcd(void);
#endif /* LCD_CONTROLLER_H_ */

View File

@ -19,7 +19,6 @@
* If not, see <http://www.gnu.org/licenses/>. * If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "global.h"
#include "globalaccess.h" #include "globalaccess.h"
#include "algo.h" #include "algo.h"
#include "advance_map.h" #include "advance_map.h"

View File

@ -7,7 +7,6 @@
#pragma once #pragma once
#include "global.h"
#include "globalaccess.h" #include "globalaccess.h"
#include "engine_state.h" #include "engine_state.h"
#include "rpm_calculator.h" #include "rpm_calculator.h"

View File

@ -9,10 +9,9 @@
#ifndef ENGINE_CONFIGURATION_H_ #ifndef ENGINE_CONFIGURATION_H_
#define ENGINE_CONFIGURATION_H_ #define ENGINE_CONFIGURATION_H_
#include "global.h" #include "globalaccess.h"
#include "crc.h" #include "crc.h"
#include "engine_configuration_generated_structures.h" #include "engine_configuration_generated_structures.h"
#include "globalaccess.h"
#ifndef DEFAULT_ENGINE_TYPE #ifndef DEFAULT_ENGINE_TYPE
#define DEFAULT_ENGINE_TYPE DEFAULT_FRANKENSO #define DEFAULT_ENGINE_TYPE DEFAULT_FRANKENSO

View File

@ -78,6 +78,11 @@
x.config = config; \ x.config = config; \
x.boardConfiguration = boardConfiguration; x.boardConfiguration = boardConfiguration;
#define EXPAND_Engine \
engine_configuration_s *engineConfiguration = engine->engineConfigurationPtr; \
persistent_config_s *config = engine->config; \
board_configuration_s *boardConfiguration = &engineConfiguration->bc;
#define isConfigurationChanged(x) (engineConfiguration->x != activeConfiguration.x) #define isConfigurationChanged(x) (engineConfiguration->x != activeConfiguration.x)
#endif /* CONTROLLERS_CORE_COMMON_HEADERS_H_ */ #endif /* CONTROLLERS_CORE_COMMON_HEADERS_H_ */

View File

@ -1,5 +1,5 @@
/* /*
* global_shared.h * @file global_shared.h
* *
* part of global.h which is shared between firmware and simulator * part of global.h which is shared between firmware and simulator
* See also common_headers.h * See also common_headers.h
@ -8,8 +8,7 @@
* @author Andrey Belomutskiy, (c) 2012-2019 * @author Andrey Belomutskiy, (c) 2012-2019
*/ */
#ifndef GLOBAL_SHARED_H_ #pragma once
#define GLOBAL_SHARED_H_
/** /**
* The following obscurantism is a hack to reduce stack usage, maybe even a questionable performance * The following obscurantism is a hack to reduce stack usage, maybe even a questionable performance
@ -25,6 +24,8 @@
* On the other hand, in order to have a meaningful unit test we are passing Engine * engine as a parameter * On the other hand, in order to have a meaningful unit test we are passing Engine * engine as a parameter
*/ */
#include "global.h"
#define EXTERN_CONFIG \ #define EXTERN_CONFIG \
extern engine_configuration_s *engineConfiguration; \ extern engine_configuration_s *engineConfiguration; \
extern board_configuration_s *boardConfiguration; \ extern board_configuration_s *boardConfiguration; \
@ -70,5 +71,3 @@
#define CONFIG_PARAM(x) CONFIG(x) #define CONFIG_PARAM(x) CONFIG(x)
#define PASS_CONFIG_PARAM(x) #define PASS_CONFIG_PARAM(x)
#endif /* GLOBAL_SHARED_H_ */

View File

@ -8,10 +8,9 @@
#ifndef TRIGGER_STRUCTURE_H_ #ifndef TRIGGER_STRUCTURE_H_
#define TRIGGER_STRUCTURE_H_ #define TRIGGER_STRUCTURE_H_
#include "global.h" #include "globalaccess.h"
#include "engine_configuration_generated_structures.h" #include "engine_configuration_generated_structures.h"
#include "efi_wave.h" #include "efi_wave.h"
#include "globalaccess.h"
#define FOUR_STROKE_ENGINE_CYCLE 720 #define FOUR_STROKE_ENGINE_CYCLE 720

View File

@ -9,7 +9,7 @@
#ifndef RPM_REPORTER_H_ #ifndef RPM_REPORTER_H_
#define RPM_REPORTER_H_ #define RPM_REPORTER_H_
#include "global.h" #include "globalaccess.h"
#include "scheduler.h" #include "scheduler.h"
// we use this value in case of noise on trigger input lines // we use this value in case of noise on trigger input lines

View File

@ -1,5 +1,7 @@
/* /*
* globalaccess.h * @file globalaccess.h
* @bried version of global.h with DECLARE_ENGINE_PARAMETER_SIGNATURE & PASS_ENGINE_PARAMETER_SUFFIX
*
* *
* unit_tests have a more meaningful version of this header * unit_tests have a more meaningful version of this header
* *
@ -7,9 +9,7 @@
* @author Andrey Belomutskiy, (c) 2012-2019 * @author Andrey Belomutskiy, (c) 2012-2019
*/ */
#ifndef GLOBALACCESS_H_ #pragma once
#define GLOBALACCESS_H_
#include "global_shared.h" #include "global_shared.h"
#endif /* GLOBALACCESS_H_ */

View File

@ -1,13 +1,11 @@
/* /*
* @file globalaccess.h * @file globalaccess.h
* @file See firmware/globalaccesss.h for more details.
* *
* @date Jan 28, 2019 * @date Jan 28, 2019
* @author Andrey Belomutskiy, (c) 2012-2019 * @author Andrey Belomutskiy, (c) 2012-2019
*/ */
#ifndef SIMULATOR_GLOBALACCESS_H_ #pragma once
#define SIMULATOR_GLOBALACCESS_H_
#include "global_shared.h" #include "global_shared.h"
#endif /* SIMULATOR_GLOBALACCESS_H_ */

View File

@ -7,8 +7,7 @@
* @author Andrey Belomutskiy, (c) 2012-2017 * @author Andrey Belomutskiy, (c) 2012-2017
*/ */
#ifndef GLOBAL_H_ #pragma once
#define GLOBAL_H_
#include <stdio.h> #include <stdio.h>
#include <time.h> #include <time.h>
@ -77,19 +76,9 @@ void print(const char *fmt, ...);
#define EXTERN_CONFIG #define EXTERN_CONFIG
#define DEFINE_CONFIG_PARAM(x, y) , x y #define DEFINE_CONFIG_PARAM(x, y) , x y
#define PASS_CONFIG_PARAM(x) , x #define PASS_CONFIG_PARAM(x) , x
/**
* this macro is a work-around for uint tests to get all needed pointers only
* if engine is in scope
*/
#define EXPAND_Engine \
engine_configuration_s *engineConfiguration = engine->engineConfigurationPtr; \
persistent_config_s *config = engine->config; \
board_configuration_s *boardConfiguration = &engineConfiguration->bc;
/** /**
* this macro provides references to engine from EngineTestHelper * this macro provides references to engine from EngineTestHelper
*/ */
@ -105,5 +94,3 @@ void print(const char *fmt, ...);
#define lockAnyContext() false #define lockAnyContext() false
#define unlockAnyContext() {} #define unlockAnyContext() {}
#endif /* GLOBAL_H_ */

View File

@ -7,6 +7,8 @@
#pragma once #pragma once
#include "global.h"
#define DECLARE_CONFIG_PARAMETER_SIGNATURE engine_configuration_s *engineConfiguration, persistent_config_s *config, board_configuration_s *boardConfiguration #define DECLARE_CONFIG_PARAMETER_SIGNATURE engine_configuration_s *engineConfiguration, persistent_config_s *config, board_configuration_s *boardConfiguration
#define DECLARE_CONFIG_PARAMETER_SUFFIX , DECLARE_CONFIG_PARAMETER_SIGNATURE #define DECLARE_CONFIG_PARAMETER_SUFFIX , DECLARE_CONFIG_PARAMETER_SIGNATURE
#define PASS_CONFIG_PARAMETER_SIGNATURE engineConfiguration, config, boardConfiguration #define PASS_CONFIG_PARAMETER_SIGNATURE engineConfiguration, config, boardConfiguration