diff --git a/firmware/controllers/engine_controller_misc.cpp b/firmware/controllers/engine_controller_misc.cpp index 6a5d78d646..394e94b354 100644 --- a/firmware/controllers/engine_controller_misc.cpp +++ b/firmware/controllers/engine_controller_misc.cpp @@ -15,10 +15,6 @@ EXTERN_ENGINE; extern LoggingWithStorage sharedLogger; extern ButtonDebounce startStopButtonDebounce; -#if ! EFI_PROD_CODE -extern bool mockPinStates[(1 << sizeof(brain_pin_e))]; -#endif - #if ENABLE_PERF_TRACE static uint8_t nextThreadId = 0; void threadInitHook(void* vtp) { diff --git a/firmware/hw_layer/io_pins.cpp b/firmware/hw_layer/io_pins.cpp index ac503acd03..a5f95a2d5a 100644 --- a/firmware/hw_layer/io_pins.cpp +++ b/firmware/hw_layer/io_pins.cpp @@ -125,7 +125,10 @@ void efiIcuStart(const char *msg, ICUDriver *icup, const ICUConfig *config) { #endif /* HAL_USE_ICU */ #else -extern bool mockPinStates[(1 << sizeof(brain_pin_e))]; + +// This has been made global so we don't need to worry about efiReadPin having access the object +// we store it in, every time we need to use efiReadPin. +bool mockPinStates[BRAIN_PIN_COUNT]; bool efiReadPin(brain_pin_e pin) { return mockPinStates[static_cast(pin)]; diff --git a/firmware/hw_layer/io_pins.h b/firmware/hw_layer/io_pins.h index 533d5be6af..db2aeae11b 100644 --- a/firmware/hw_layer/io_pins.h +++ b/firmware/hw_layer/io_pins.h @@ -29,5 +29,10 @@ EXTERNC iomode_t getInputMode(pin_input_mode_e mode); #if HAL_USE_ICU EXTERNC void efiIcuStart(const char *msg, ICUDriver *icup, const ICUConfig *config); #endif /* HAL_USE_ICU */ + #endif /* EFI_GPIO_HARDWARE */ +#if ! EFI_PROD_CODE +#define BRAIN_PIN_COUNT (1 << 8 * sizeof(brain_pin_e)) +extern bool mockPinStates[BRAIN_PIN_COUNT]; +#endif diff --git a/unit_tests/engine_test_helper.cpp b/unit_tests/engine_test_helper.cpp index dee0d037a3..70760c718d 100644 --- a/unit_tests/engine_test_helper.cpp +++ b/unit_tests/engine_test_helper.cpp @@ -24,10 +24,6 @@ extern engine_configuration_s & activeConfiguration; extern bool printTriggerDebug; extern bool printFuelDebug; -// This has been made global so we don't need to worry about efiReadPin having access the object -// we store it in, every time we need to use efiReadPin. -bool mockPinStates[BRAIN_PIN_COUNT]; - EngineTestHelperBase::EngineTestHelperBase() { // todo: make this not a global variable, we need currentTimeProvider interface on engine timeNowUs = 0; diff --git a/unit_tests/engine_test_helper.h b/unit_tests/engine_test_helper.h index 00f9d61824..0bf755b03b 100644 --- a/unit_tests/engine_test_helper.h +++ b/unit_tests/engine_test_helper.h @@ -7,8 +7,6 @@ #pragma once -#define BRAIN_PIN_COUNT (1 << sizeof(brain_pin_e)) - #include "engine.h" #include "trigger_central.h" #include "rpm_calculator.h"