* CAN bench test: broadcast event counters #5436 * update libfirmware * update libfirmware * Broadcast eventcnts every 100ms * Add EFI_SHAFT_POSITION_INPUT guards
This commit is contained in:
parent
e1e8ee0929
commit
c303a8cfd9
|
@ -2,12 +2,16 @@
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "can_bench_test.h"
|
#include "can_bench_test.h"
|
||||||
#include "can_msg_tx.h"
|
#include "can_msg_tx.h"
|
||||||
|
#include "can_common.h"
|
||||||
|
|
||||||
#define CAN_BENCH_HEADER 0x66
|
#define CAN_BENCH_HEADER 0x66
|
||||||
#define CAN_BENCH_GET_COUNT 0
|
#define CAN_BENCH_GET_COUNT 0
|
||||||
#define CAN_BENCH_GET_SET 1
|
#define CAN_BENCH_GET_SET 1
|
||||||
#define CAN_BENCH_GET_CLEAR 2
|
#define CAN_BENCH_GET_CLEAR 2
|
||||||
|
|
||||||
|
#define TRUNCATE_TO_BYTE(i) ((i) & 0xff)
|
||||||
|
|
||||||
|
|
||||||
#if EFI_CAN_SUPPORT
|
#if EFI_CAN_SUPPORT
|
||||||
|
|
||||||
static void setPin(const CANRxFrame& frame, int value) {
|
static void setPin(const CANRxFrame& frame, int value) {
|
||||||
|
@ -20,6 +24,30 @@ static void setPin(const CANRxFrame& frame, int value) {
|
||||||
#endif // EFI_GPIO_HARDWARE && EFI_PROD_CODE
|
#endif // EFI_GPIO_HARDWARE && EFI_PROD_CODE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void sendEventCounters() {
|
||||||
|
#if EFI_SHAFT_POSITION_INPUT
|
||||||
|
CanTxMessage msg(CanCategory::BENCH_TEST, BENCH_TEST_EVENT_COUNTERS, 8);
|
||||||
|
|
||||||
|
int primaryFall = engine->triggerCentral.getHwEventCounter((int)SHAFT_PRIMARY_FALLING);
|
||||||
|
int primaryRise = engine->triggerCentral.getHwEventCounter((int)SHAFT_PRIMARY_RISING);
|
||||||
|
int secondaryFall = engine->triggerCentral.getHwEventCounter((int)SHAFT_SECONDARY_FALLING);
|
||||||
|
int secondaryRise = engine->triggerCentral.getHwEventCounter((int)SHAFT_SECONDARY_RISING);
|
||||||
|
|
||||||
|
msg[0] = TRUNCATE_TO_BYTE(primaryRise + primaryFall);
|
||||||
|
msg[1] = TRUNCATE_TO_BYTE(secondaryRise + secondaryFall);
|
||||||
|
|
||||||
|
for (int camIdx = 0; camIdx < 4; camIdx++) {
|
||||||
|
int vvtRise = 0, vvtFall = 0;
|
||||||
|
if (camIdx < CAM_INPUTS_COUNT) {
|
||||||
|
vvtRise = engine->triggerCentral.vvtEventRiseCounter[camIdx];
|
||||||
|
vvtFall = engine->triggerCentral.vvtEventFallCounter[camIdx];
|
||||||
|
}
|
||||||
|
|
||||||
|
msg[2 + camIdx] = TRUNCATE_TO_BYTE(vvtRise + vvtFall);
|
||||||
|
}
|
||||||
|
#endif // EFI_SHAFT_POSITION_INPUT
|
||||||
|
}
|
||||||
|
|
||||||
void processCanBenchTest(const CANRxFrame& frame) {
|
void processCanBenchTest(const CANRxFrame& frame) {
|
||||||
if (CAN_EID(frame) != CAN_ECU_HW_META) {
|
if (CAN_EID(frame) != CAN_ECU_HW_META) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -6,3 +6,4 @@
|
||||||
#include "can.h"
|
#include "can.h"
|
||||||
|
|
||||||
void processCanBenchTest(const CANRxFrame& frame);
|
void processCanBenchTest(const CANRxFrame& frame);
|
||||||
|
void sendEventCounters();
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include "can_dash.h"
|
#include "can_dash.h"
|
||||||
#include "obd2.h"
|
#include "obd2.h"
|
||||||
#include "can_sensor.h"
|
#include "can_sensor.h"
|
||||||
|
#include "can_bench_test.h"
|
||||||
#include "rusefi_wideband.h"
|
#include "rusefi_wideband.h"
|
||||||
|
|
||||||
extern CanListener* canListeners_head;
|
extern CanListener* canListeners_head;
|
||||||
|
@ -54,6 +55,10 @@ void CanWrite::PeriodicTask(efitick_t nowNt) {
|
||||||
|
|
||||||
updateDash(cycle);
|
updateDash(cycle);
|
||||||
|
|
||||||
|
if (cycle.isInterval(CI::_100ms)) {
|
||||||
|
sendEventCounters();
|
||||||
|
}
|
||||||
|
|
||||||
#if EFI_WIDEBAND_FIRMWARE_UPDATE
|
#if EFI_WIDEBAND_FIRMWARE_UPDATE
|
||||||
if (engineConfiguration->enableAemXSeries && cycle.isInterval(CI::_50ms)) {
|
if (engineConfiguration->enableAemXSeries && cycle.isInterval(CI::_50ms)) {
|
||||||
sendWidebandInfo();
|
sendWidebandInfo();
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 273697e2dec95dd4cd56ae8803370e696be90ab8
|
Subproject commit 5dcb1fef0956b8fc35a8d184f4056aa1b81e737f
|
Loading…
Reference in New Issue