CAN side of automated testing #4630

This commit is contained in:
rusefillc 2022-09-29 23:01:06 -04:00
parent 9122ef9317
commit 587c448688
9 changed files with 53 additions and 3 deletions

View File

@ -221,6 +221,6 @@ void setBoardDefaultConfiguration() {
engineConfiguration->injectionMode = IM_SIMULTANEOUS;//IM_BATCH;// IM_SEQUENTIAL; engineConfiguration->injectionMode = IM_SIMULTANEOUS;//IM_BATCH;// IM_SEQUENTIAL;
} }
int setBoardMetaOutputsCount() { int getBoardMetaOutputsCount() {
return efi::size(MRE_OUTPUTS); return efi::size(MRE_OUTPUTS);
} }

View File

@ -198,6 +198,6 @@ void boardPrepareForStop() {
palEnableLineEvent(PAL_LINE(GPIOD, 0), PAL_EVENT_MODE_RISING_EDGE); palEnableLineEvent(PAL_LINE(GPIOD, 0), PAL_EVENT_MODE_RISING_EDGE);
} }
int setBoardMetaOutputsCount() { int getBoardMetaOutputsCount() {
return efi::size(PROTEUS_OUTPUTS); return efi::size(PROTEUS_OUTPUTS);
} }

View File

@ -1151,4 +1151,4 @@ void setFrankenso0_1_joystick(engine_configuration_s *engineConfiguration) {
__attribute__((weak)) void setBoardDefaultConfiguration() { } __attribute__((weak)) void setBoardDefaultConfiguration() { }
__attribute__((weak)) void setBoardConfigOverrides() { } __attribute__((weak)) void setBoardConfigOverrides() { }
__attribute__((weak)) int setBoardMetaOutputsCount() { return 0; } __attribute__((weak)) int getBoardMetaOutputsCount() { return 0; }

View File

@ -97,3 +97,5 @@ extern bool isActiveConfigurationVoid;
#endif /* EFI_ACTIVE_CONFIGURATION_IN_FLASH */ #endif /* EFI_ACTIVE_CONFIGURATION_IN_FLASH */
#define isPinOrModeChanged(pin, mode) (isConfigurationChanged(pin) || isConfigurationChanged(mode)) #define isPinOrModeChanged(pin, mode) (isConfigurationChanged(pin) || isConfigurationChanged(mode))
int getBoardMetaOutputsCount();

View File

@ -0,0 +1,35 @@
#include "pch.h"
#include "can_bench_test.h"
#include "can_msg_tx.h"
#define CAN_BENCH_HEADER 0x66
#define CAN_BENCH_GET_COUNT 0
#define CAN_BENCH_GET_SET 1
#define CAN_BENCH_GET_CLEAR 2
#if EFI_CAN_SUPPORT
void processCanBenchTest(const CANRxFrame& frame) {
if (CAN_EID(frame) != CAN_ECU_HW_META) {
return;
}
if (frame.data8[0] != CAN_BENCH_HEADER) {
return;
}
uint8_t command = frame.data8[1];
if (command == CAN_BENCH_GET_COUNT) {
CanTxMessage msg(CanCategory::BENCH_TEST, CAN_ECU_HW_META + 1, 8);
msg[0] = CAN_BENCH_HEADER;
msg[1] = 0;
msg[2] = getBoardMetaOutputsCount();
} else if (command == CAN_BENCH_GET_COUNT) {
}
}
#endif // EFI_CAN_SUPPORT

View File

@ -0,0 +1,8 @@
/**
* file can_bench_test.h
*/
#pragma once
#include "can.h"
void processCanBenchTest(const CANRxFrame& frame);

View File

@ -11,6 +11,7 @@
#include "pch.h" #include "pch.h"
#include "rusefi_lua.h" #include "rusefi_lua.h"
#include "can_bench_test.h"
typedef float SCRIPT_TABLE_8x8_f32t_linear[SCRIPT_TABLE_8 * SCRIPT_TABLE_8]; typedef float SCRIPT_TABLE_8x8_f32t_linear[SCRIPT_TABLE_8 * SCRIPT_TABLE_8];
@ -208,6 +209,8 @@ void processCanRxMessage(const size_t busIndex, const CANRxFrame &frame, efitick
// todo: convert to CanListener or not? // todo: convert to CanListener or not?
processCanRxImu(frame); processCanRxImu(frame);
processCanBenchTest(frame);
processLuaCan(busIndex, frame); processLuaCan(busIndex, frame);
#if EFI_CANBUS_SLAVE #if EFI_CANBUS_SLAVE

View File

@ -50,6 +50,7 @@ CONTROLLERS_SRC_CPP = \
$(CONTROLLERS_DIR)/can/obd2.cpp \ $(CONTROLLERS_DIR)/can/obd2.cpp \
$(CONTROLLERS_DIR)/can/can_verbose.cpp \ $(CONTROLLERS_DIR)/can/can_verbose.cpp \
$(CONTROLLERS_DIR)/can/can_rx.cpp \ $(CONTROLLERS_DIR)/can/can_rx.cpp \
$(CONTROLLERS_DIR)/can/can_bench_test.cpp \
$(CONTORLLERS_DIR)/can/rusefi_wideband.cpp \ $(CONTORLLERS_DIR)/can/rusefi_wideband.cpp \
$(CONTROLLERS_DIR)/can/can_tx.cpp \ $(CONTROLLERS_DIR)/can/can_tx.cpp \
$(CONTROLLERS_DIR)/can/can_dash.cpp \ $(CONTROLLERS_DIR)/can/can_dash.cpp \

View File

@ -12,4 +12,5 @@ enum class CanCategory : uint16_t {
SERIAL = 4, SERIAL = 4,
WBO_SERVICE = 5, WBO_SERVICE = 5,
OBD = 6, OBD = 6,
BENCH_TEST = 7,
}; };