enableExtendedCanBroadcast

This commit is contained in:
rusefillc 2024-01-19 19:04:48 -05:00
parent 6dbf84ced0
commit 459a6d6dc6
5 changed files with 26 additions and 24 deletions

View File

@ -65,7 +65,7 @@ static void setPin(const CANRxFrame& frame, int value) {
#endif // EFI_GPIO_HARDWARE && EFI_PROD_CODE
}
void sendEventCounters() {
void sendQcBenchEventCounters() {
#if EFI_SHAFT_POSITION_INPUT
CanTxMessage msg(CanCategory::BENCH_TEST, (int)bench_test_packet_ids_e::EVENT_COUNTERS, 8, /*bus*/0, /*isExtended*/true);
@ -92,7 +92,7 @@ void sendEventCounters() {
#endif // EFI_SHAFT_POSITION_INPUT
}
void sendButtonCounters() {
void sendQcBenchButtonCounters() {
CanTxMessage msg(CanCategory::BENCH_TEST, (int)bench_test_packet_ids_e::BUTTON_COUNTERS, 8, /*bus*/0, /*isExtended*/true);
msg[0] = TRUNCATE_TO_BYTE(engine->brakePedalSwitchedState.getCounter());
msg[1] = TRUNCATE_TO_BYTE(engine->clutchUpSwitchedState.getCounter());
@ -100,14 +100,14 @@ void sendButtonCounters() {
// todo: start button
}
void sendAuxDigitalCounters() {
void sendQcBenchAuxDigitalCounters() {
CanTxMessage msg(CanCategory::BENCH_TEST, (int)bench_test_packet_ids_e::BUTTON_COUNTERS, 8, /*bus*/0, /*isExtended*/true);
for (int i =0;i<LUA_DIGITAL_INPUT_COUNT;i++) {
msg[i] = TRUNCATE_TO_BYTE(engine->luaDigitalInputState[i].state.getCounter());
}
}
void sendRawAnalogValues() {
void sendQcBenchRawAnalogValues() {
const float values_1[] = {
Sensor::getRaw(SensorType::Tps1Primary),
Sensor::getRaw(SensorType::Tps1Secondary),
@ -159,7 +159,7 @@ static void sendOutBoardMeta() {
#endif // EFI_PROD_CODE
}
void sendBoardStatus() {
void sendQcBenchBoardStatus() {
#if EFI_PROD_CODE
CanTxMessage msg(CanCategory::BENCH_TEST, (int)bench_test_packet_ids_e::BOARD_STATUS, 8, /*bus*/0, /*isExtended*/true);
@ -218,7 +218,7 @@ static void resetPinStats(bench_mode_e benchModePinIdx) {
#endif // EFI_SIMULATOR
}
void processCanBenchTest(const CANRxFrame& frame) {
void processCanQcBenchTest(const CANRxFrame& frame) {
if (CAN_EID(frame) != (int)bench_test_packet_ids_e::IO_CONTROL) {
return;
}
@ -261,7 +261,7 @@ void processCanBenchTest(const CANRxFrame& frame) {
}
#endif // EFI_CAN_SUPPORT
void initQcControls() {
void initQcBenchControls() {
addConsoleActionII("qc_etb", [](int index, int direction) {
qcSetEtbState(index, direction);
});

View File

@ -5,10 +5,10 @@
#pragma once
#include "can.h"
void processCanBenchTest(const CANRxFrame& frame);
void sendEventCounters();
void sendButtonCounters();
void sendAuxDigitalCounters();
void sendRawAnalogValues();
void sendBoardStatus();
void initQcControls();
void processCanQcBenchTest(const CANRxFrame& frame);
void sendQcBenchEventCounters();
void sendQcBenchButtonCounters();
void sendQcBenchAuxDigitalCounters();
void sendQcBenchRawAnalogValues();
void sendQcBenchBoardStatus();
void initQcBenchControls();

View File

@ -182,7 +182,7 @@ void processCanRxMessage(const size_t busIndex, const CANRxFrame &frame, efitick
processCanRxImu(frame);
}
processCanBenchTest(frame);
processCanQcBenchTest(frame);
processLuaCan(busIndex, frame);

View File

@ -55,15 +55,17 @@ void CanWrite::PeriodicTask(efitick_t nowNt) {
updateDash(cycle);
if (cycle.isInterval(CI::_100ms)) {
sendEventCounters();
sendRawAnalogValues();
}
if (engineConfiguration->enableExtendedCanBroadcast) {
if (cycle.isInterval(CI::_100ms)) {
sendQcBenchEventCounters();
sendQcBenchRawAnalogValues();
}
if (cycle.isInterval(CI::_250ms)) {
sendBoardStatus();
sendButtonCounters();
sendAuxDigitalCounters();
if (cycle.isInterval(CI::_250ms)) {
sendQcBenchBoardStatus();
sendQcBenchButtonCounters();
sendQcBenchAuxDigitalCounters();
}
}
#if EFI_WIDEBAND_FIRMWARE_UPDATE

View File

@ -670,7 +670,7 @@ void commonEarlyInit() {
*/
initHardware();
initQcControls();
initQcBenchControls();
#if EFI_FILE_LOGGING
initMmcCard();