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
*
* @date Aug 14, 2014
* @author Andrey Belomutskiy, (c) 2012-2017
* @author Andrey Belomutskiy, (c) 2012-2019
*/
#ifndef LCD_CONTROLLER_H_
#define LCD_CONTROLLER_H_
#include "engine.h"
#pragma once
#define MAX_LCD_WIDTH 20
void initLcdController(void);
void updateHD44780lcd(void);
#endif /* LCD_CONTROLLER_H_ */

View File

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

View File

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

View File

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

View File

@ -65,19 +65,24 @@
#define DISPLAY_SENSOR(x) {}
#define DISPLAY_IF(x) x
#define DECLARE_ENGINE_PTR \
#define DECLARE_ENGINE_PTR \
Engine *engine = nullptr; \
engine_configuration_s *engineConfiguration = nullptr; \
persistent_config_s *config = nullptr; \
board_configuration_s *boardConfiguration = nullptr;
#define INJECT_ENGINE_REFERENCE(x) \
#define INJECT_ENGINE_REFERENCE(x) \
x.engine = engine; \
x.engineConfiguration = engineConfiguration; \
x.config = config; \
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)
#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
* See also common_headers.h
@ -8,8 +8,7 @@
* @author Andrey Belomutskiy, (c) 2012-2019
*/
#ifndef GLOBAL_SHARED_H_
#define GLOBAL_SHARED_H_
#pragma once
/**
* 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
*/
#include "global.h"
#define EXTERN_CONFIG \
extern engine_configuration_s *engineConfiguration; \
extern board_configuration_s *boardConfiguration; \
@ -70,5 +71,3 @@
#define CONFIG_PARAM(x) CONFIG(x)
#define PASS_CONFIG_PARAM(x)
#endif /* GLOBAL_SHARED_H_ */

View File

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

View File

@ -9,7 +9,7 @@
#ifndef RPM_REPORTER_H_
#define RPM_REPORTER_H_
#include "global.h"
#include "globalaccess.h"
#include "scheduler.h"
// 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
*
@ -7,9 +9,7 @@
* @author Andrey Belomutskiy, (c) 2012-2019
*/
#ifndef GLOBALACCESS_H_
#define GLOBALACCESS_H_
#pragma once
#include "global_shared.h"
#endif /* GLOBALACCESS_H_ */

View File

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

View File

@ -7,8 +7,7 @@
* @author Andrey Belomutskiy, (c) 2012-2017
*/
#ifndef GLOBAL_H_
#define GLOBAL_H_
#pragma once
#include <stdio.h>
#include <time.h>
@ -77,19 +76,9 @@ void print(const char *fmt, ...);
#define EXTERN_CONFIG
#define DEFINE_CONFIG_PARAM(x, y) , x y
#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
*/
@ -105,5 +94,3 @@ void print(const char *fmt, ...);
#define lockAnyContext() false
#define unlockAnyContext() {}
#endif /* GLOBAL_H_ */

View File

@ -7,6 +7,8 @@
#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_SUFFIX , DECLARE_CONFIG_PARAMETER_SIGNATURE
#define PASS_CONFIG_PARAMETER_SIGNATURE engineConfiguration, config, boardConfiguration