Skip to content

Commit

Permalink
https://github.com/rusefi/rusefi-hardware/issues/253
Browse files Browse the repository at this point in the history
  • Loading branch information
rusefillc authored and rusefillc committed Oct 29, 2023
1 parent 2051a41 commit bc1cc1b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
17 changes: 15 additions & 2 deletions firmware/controllers/can/can_bench_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ bool qcDirectPinControlMode = false;

#if EFI_CAN_SUPPORT

static void directWritePad(Gpio pin, int value) {
#if EFI_GPIO_HARDWARE && EFI_PROD_CODE
palWritePad(getHwPort("can_write", pin), getHwPin("can_write", pin), value);
// todo: add smart chip support support
#endif // EFI_GPIO_HARDWARE && EFI_PROD_CODE
}

static void setPin(const CANRxFrame& frame, int value) {
int outputIndex = frame.data8[2];
if (outputIndex >= getBoardMetaOutputsCount())
Expand All @@ -34,8 +41,7 @@ static void setPin(const CANRxFrame& frame, int value) {
efiSetPadModeWithoutOwnershipAcquisition("QC_SET", pin, PAL_MODE_OUTPUT_PUSHPULL);
}

palWritePad(getHwPort("can_write", pin), getHwPin("can_write", pin), value);
// todo: add smart chip support support
directWritePad(pin, value);
#endif // EFI_GPIO_HARDWARE && EFI_PROD_CODE
}

Expand Down Expand Up @@ -200,6 +206,13 @@ void processCanBenchTest(const CANRxFrame& frame) {
} else if (command == bench_test_io_control_e::CAN_QC_OUTPUT_CONTROL_CLEAR) {
qcDirectPinControlMode = true;
setPin(frame, 0);
} else if (command == bench_test_io_control_e::CAN_QC_ETB) {
qcDirectPinControlMode = true;
uint8_t dcIndex = frame.data8[2];
uint8_t direction = frame.data8[3];
const dc_io *io = &engineConfiguration->etbIo[dcIndex];
directWritePad(io->controlPin, 1);
directWritePad(io->directionPin1, direction);
} else if (command == 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
Expand Down
2 changes: 1 addition & 1 deletion firmware/libfirmware
Submodule libfirmware updated 1 files
+1 −0 can/can_common.h

0 comments on commit bc1cc1b

Please sign in to comment.