Remove a bunch of macros from engine_ptr.h (#3562)

This commit is contained in:
Scott Smith 2021-11-16 23:01:39 -08:00 committed by GitHub
parent a29933d7f8
commit 8dbdeb7773
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 40 deletions

View File

@ -23,32 +23,13 @@ struct engine_configuration_s;
struct persistent_config_s;
#if EFI_UNIT_TEST
#define CONFIG(x) engineConfiguration->x
#define ENGINE(x) engine->x
#ifdef __cplusplus
#define EXTERN_ENGINE extern engine_configuration_s & activeConfiguration
struct EnginePtr {
void inject() {
}
};
#endif // def __cplusplus
#define EXPAND_Engine
#define CONFIG(x) engineConfiguration->x
#define ENGINE(x) engine->x
#else // EFI_UNIT_TEST
// These are the non-unit-test (AKA real firmware) noop versions
#ifdef __cplusplus
#define ENGINE(x) ___engine.x
struct EnginePtr {
void inject() { }
};
#endif // def __cplusplus
/**
* this macro allows the compiled to figure out the complete static address, that's a performance
* optimization which is hopefully useful at least for anything trigger-related
@ -58,6 +39,4 @@ struct persistent_config_s;
* access in unit tests
*/
#define CONFIG(x) persistentState.persistentConfiguration.engineConfiguration.x
#define EXPAND_Engine
#endif // EFI_UNIT_TEST

View File

@ -62,23 +62,6 @@ void chDbgAssert(int c, char *msg, void *arg);
#define CCM_OPTIONAL
/**
* this macro provides references to engine from EngineTestHelper
*/
#define EXPAND_EngineTestHelper \
#define WITH_ENGINE_TEST_HELPER_SENS(x, sensorvals) \
EngineTestHelper eth(x, sensorvals); \
EXPAND_EngineTestHelper;
#define WITH_ENGINE_TEST_HELPER(x) \
EngineTestHelper eth(x, std::unordered_map<SensorType, float>{}); \
EXPAND_EngineTestHelper;
#define WITH_ENGINE_TEST_HELPER_BOARD_CALLBACK(x, callback) \
EngineTestHelper eth(x, callback, std::unordered_map<SensorType, float>{}); \
EXPAND_EngineTestHelper;
#ifdef __cplusplus
namespace chibios_rt {
// Noop for unit tests - this does real lock in FW/sim