diff --git a/firmware/controllers/system/efi_gpio.cpp b/firmware/controllers/system/efi_gpio.cpp index 179e6bd3fa..75a098267b 100644 --- a/firmware/controllers/system/efi_gpio.cpp +++ b/firmware/controllers/system/efi_gpio.cpp @@ -508,9 +508,13 @@ void OutputPin::setValue(const char *msg, int logicValue, bool isForce) { // ScopePerf perf(PE::OutputPinSetValue); #endif // ENABLE_PERF_TRACE -#if EFI_UNIT_TEST - unitTestTurnedOnCounter++; +#if EFI_UNIT_TEST || EFI_SIMULATOR + if (currentLogicValue != logicValue) { + pinToggleCounter++; + } +#endif // EFI_UNIT_TEST || EFI_SIMULATOR +#if EFI_UNIT_TEST if (verboseMode) { efiPrintf("pin goes %d", logicValue); } @@ -587,7 +591,7 @@ void OutputPin::initPin(const char *msg, brain_pin_e brainPin) { void OutputPin::initPin(const char *msg, brain_pin_e brainPin, pin_output_mode_e outputMode, bool forceInitWithFatalError) { #if EFI_UNIT_TEST - unitTestTurnedOnCounter = 0; + pinToggleCounter = 0; #endif if (!isBrainPinValid(brainPin)) { diff --git a/firmware/controllers/system/efi_output.h b/firmware/controllers/system/efi_output.h index 34a343c95a..d26eea7fc9 100644 --- a/firmware/controllers/system/efi_output.h +++ b/firmware/controllers/system/efi_output.h @@ -65,8 +65,8 @@ public: uint8_t pin = 0; #endif /* EFI_GPIO_HARDWARE */ -#if EFI_UNIT_TEST - int unitTestTurnedOnCounter = 0; +#if EFI_UNIT_TEST || EFI_SIMULATOR + int pinToggleCounter = 0; #endif brain_pin_e brainPin = Gpio::Unassigned; diff --git a/unit_tests/tests/test_hpfp_integrated.cpp b/unit_tests/tests/test_hpfp_integrated.cpp index fcdb18131c..4824153b7d 100644 --- a/unit_tests/tests/test_hpfp_integrated.cpp +++ b/unit_tests/tests/test_hpfp_integrated.cpp @@ -34,7 +34,7 @@ TEST(HPFP, IntegratedSchedule) { /** * overall this is a pretty lame test but helps to know that the whole on/off/on dance does in fact happen for HPFP */ - ASSERT_EQ(31, enginePins.hpfpValve.unitTestTurnedOnCounter); + ASSERT_EQ(8, enginePins.hpfpValve.pinToggleCounter); }