From e7d63f887e400cff5ea14540c295755c43736509 Mon Sep 17 00:00:00 2001 From: andreika-git Date: Sun, 8 Oct 2023 22:14:42 +0300 Subject: [PATCH] call handleBenchCategory() via CAN --- firmware/controllers/bench_test.cpp | 2 +- firmware/controllers/bench_test.h | 1 + firmware/controllers/can/can_bench_test.cpp | 12 ++++++++---- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/firmware/controllers/bench_test.cpp b/firmware/controllers/bench_test.cpp index 61db9ae54c..ed735be84d 100644 --- a/firmware/controllers/bench_test.cpp +++ b/firmware/controllers/bench_test.cpp @@ -308,7 +308,7 @@ private: static BenchController instance; -static void handleBenchCategory(uint16_t index) { +void handleBenchCategory(uint16_t index) { switch(index) { case BENCH_VVT0_VALVE: vvtValveBench(0); diff --git a/firmware/controllers/bench_test.h b/firmware/controllers/bench_test.h index 808a3953dd..8e336bc854 100644 --- a/firmware/controllers/bench_test.h +++ b/firmware/controllers/bench_test.h @@ -24,3 +24,4 @@ void milBench(); void starterRelayBench(); void executeTSCommand(uint16_t subsystem, uint16_t index); +void handleBenchCategory(uint16_t index); diff --git a/firmware/controllers/can/can_bench_test.cpp b/firmware/controllers/can/can_bench_test.cpp index 8b51b62be9..6d6be52bb7 100644 --- a/firmware/controllers/can/can_bench_test.cpp +++ b/firmware/controllers/can/can_bench_test.cpp @@ -1,5 +1,6 @@ #include "pch.h" +#include "bench_test.h" #include "board_id.h" #include "can_bench_test.h" #include "can_msg_tx.h" @@ -148,19 +149,22 @@ void processCanBenchTest(const CANRxFrame& frame) { } qcDirectPinControlMode = true; uint8_t command = frame.data8[1]; - if (command == CAN_BENCH_GET_COUNT) { + if (command == (uint8_t)bench_test_io_control_e::CAN_BENCH_GET_COUNT) { sendOutBoardMeta(); - } else if (command == CAN_BENCH_GET_SET) { + } else if (command == (uint8_t)bench_test_io_control_e::CAN_BENCH_GET_SET) { setPin(frame, 1); - } else if (command == CAN_BENCH_GET_CLEAR) { + } else if (command == (uint8_t)bench_test_io_control_e::CAN_BENCH_GET_CLEAR) { setPin(frame, 0); - } else if (command == CAN_BENCH_SET_ENGINE_TYPE) { + } else if (command == (uint8_t)bench_test_io_control_e::CAN_BENCH_SET_ENGINE_TYPE) { int eType = frame.data8[2]; // todo: fix firmware for 'false' to be possible - i.e. more of properties should be applied on the fly setEngineType(eType, true); #if EFI_PROD_CODE scheduleReboot(); #endif // EFI_PROD_CODE + } else if (command == (uint8_t)bench_test_io_control_e::CAN_BENCH_EXECUTE_BENCH_TEST) { + int benchCommandIdx = frame.data8[2]; + handleBenchCategory(benchCommandIdx); } }