fixing build & taking a safer route

This commit is contained in:
rusefi 2019-08-08 22:12:51 -04:00
parent 6043c93372
commit eef4fbde9b
6 changed files with 16 additions and 18 deletions

View File

@ -319,6 +319,4 @@ void prepareOutputSignals(DECLARE_ENGINE_PARAMETER_SIGNATURE);
void validateConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE);
void doScheduleStopEngine(DECLARE_ENGINE_PARAMETER_SIGNATURE);
typedef void (*configuration_callback_t)(Engine*);
#endif /* H_ENGINE_H_ */

View File

@ -1022,7 +1022,7 @@ static void setDefaultFrankensoConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE)
boardConfiguration->is_enabled_spi_3 = true;
}
void resetConfigurationExt(Logging * logger, std::function<void(Engine *)> boardCallback, engine_type_e engineType DECLARE_ENGINE_PARAMETER_SUFFIX) {
void resetConfigurationExt(Logging * logger, configuration_callback_t boardCallback, engine_type_e engineType DECLARE_ENGINE_PARAMETER_SUFFIX) {
enginePins.reset(); // that's mostly important for functional tests
/**
* Let's apply global defaults first
@ -1032,7 +1032,7 @@ void resetConfigurationExt(Logging * logger, std::function<void(Engine *)> board
// set initial pin groups
setDefaultBasePins(PASS_CONFIG_PARAMETER_SIGNATURE);
boardCallback(engine);
boardCallback(engineConfiguration);
#if EFI_PROD_CODE
// call overrided board-specific configuration setup, if needed (for custom boards only)
@ -1291,19 +1291,17 @@ void resetConfigurationExt(Logging * logger, std::function<void(Engine *)> board
#endif /* EFI_TUNER_STUDIO */
}
void emptyCallbackWithEngine(Engine * engine) {
void emptyCallbackWithConfiguration(engine_configuration_s * engineConfiguration) {
}
void resetConfigurationExt(Logging * logger, engine_type_e engineType DECLARE_ENGINE_PARAMETER_SUFFIX) {
resetConfigurationExt(logger, &emptyCallbackWithEngine, engineType PASS_ENGINE_PARAMETER_SUFFIX);
resetConfigurationExt(logger, &emptyCallbackWithConfiguration, engineType PASS_ENGINE_PARAMETER_SUFFIX);
}
void validateConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
if (engineConfiguration->adcVcc > 5.0f || engineConfiguration->adcVcc < 1.0f) {
engineConfiguration->adcVcc = 3.0f;
}
}
void applyNonPersistentConfiguration(Logging * logger DECLARE_ENGINE_PARAMETER_SUFFIX) {

View File

@ -13,7 +13,6 @@
#include "crc.h"
#include "engine_configuration_generated_structures.h"
#include "globalaccess.h"
#include <functional>
#ifndef DEFAULT_ENGINE_TYPE
#define DEFAULT_ENGINE_TYPE DEFAULT_FRANKENSO
@ -81,8 +80,14 @@ void copyTargetAfrTable(fuel_table_t const source, afr_table_t destination);
void copyFuelTable(fuel_table_t const source, fuel_table_t destination);
void copyTimingTable(ignition_table_t const source, ignition_table_t destination);
void resetConfigurationExt(Logging * logger, std::function<void(Engine *)>, engine_type_e engineType DECLARE_ENGINE_PARAMETER_SUFFIX);
void emptyCallbackWithConfiguration(engine_configuration_s * engine);
typedef void (*configuration_callback_t)(engine_configuration_s*);
#ifdef __cplusplus
// because of 'Logging' class parameter these functions are visible only to C++ code but C code
void resetConfigurationExt(Logging * logger, configuration_callback_t boardCallback, engine_type_e engineType DECLARE_ENGINE_PARAMETER_SUFFIX);
void resetConfigurationExt(Logging * logger, engine_type_e engineType DECLARE_ENGINE_PARAMETER_SUFFIX);
void emptyCallbackWithEngine(Engine * engine);
#endif /* __cplusplus */
#endif /* ENGINE_CONFIGURATION_H_ */

View File

@ -29,7 +29,7 @@ EngineTestHelperBase::EngineTestHelperBase() {
timeNowUs = 0;
}
EngineTestHelper::EngineTestHelper(engine_type_e engineType, std::function<void(Engine *)> boardCallback) {
EngineTestHelper::EngineTestHelper(engine_type_e engineType, configuration_callback_t boardCallback) {
unitTestWarningCodeState.clear();
testMafValue = 0;
@ -79,7 +79,7 @@ EngineTestHelper::EngineTestHelper(engine_type_e engineType, std::function<void(
initMainEventListener(NULL PASS_ENGINE_PARAMETER_SUFFIX);
}
EngineTestHelper::EngineTestHelper(engine_type_e engineType) : EngineTestHelper(engineType, &emptyCallbackWithEngine) {
EngineTestHelper::EngineTestHelper(engine_type_e engineType) : EngineTestHelper(engineType, &emptyCallbackWithConfiguration) {
}
/**

View File

@ -12,7 +12,6 @@
#include "rpm_calculator.h"
#include "main_trigger_callback.h"
#include "unit_test_framework.h"
#include <functional>
class EngineTestHelperBase
{
@ -28,7 +27,7 @@ public:
class EngineTestHelper : public EngineTestHelperBase {
public:
EngineTestHelper(engine_type_e engineType);
EngineTestHelper(engine_type_e engineType, std::function<void(Engine *)>);
EngineTestHelper(engine_type_e engineType, configuration_callback_t boardCallback);
void applyTriggerShape();
void setTriggerType(trigger_type_e trigger DECLARE_ENGINE_PARAMETER_SUFFIX);
void fireRise(int delayMs);

View File

@ -7,9 +7,7 @@
#include "engine_test_helper.h"
static void boardConfigurationForIssue898(Engine * engine) {
engine_configuration_s *engineConfiguration = engine->engineConfigurationPtr;
static void boardConfigurationForIssue898(engine_configuration_s *engineConfiguration) {
setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR);
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL_60_2;
engineConfiguration->useOnlyRisingEdgeForTrigger = true;