From 2a6d13f57cfbe0cb4a0e12c8e69e0e476ae49058 Mon Sep 17 00:00:00 2001 From: rusefillc <48498823+rusefillc@users.noreply.github.com> Date: Thu, 2 Feb 2023 19:38:16 -0500 Subject: [PATCH] CAN: send data for all AFR channels (#186) Co-authored-by: Andrey Gusakov --- firmware/can.cpp | 10 +++++----- firmware/can.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/firmware/can.cpp b/firmware/can.cpp index 818262d..815addc 100644 --- a/firmware/can.cpp +++ b/firmware/can.cpp @@ -21,7 +21,9 @@ void CanTxThread(void*) while(1) { - SendRusefiFormat(configuration->CanIndexOffset); + for (int ch = 0; ch < AFR_CHANNELS; ch++) { + SendRusefiFormat(ch); + } chThdSleepMilliseconds(10); } @@ -131,11 +133,9 @@ void InitCan() chThdCreateStatic(waCanRxThread, sizeof(waCanRxThread), NORMALPRIO - 4, CanRxThread, nullptr); } -void SendRusefiFormat(uint8_t idx) +void SendRusefiFormat(uint8_t ch) { - auto baseAddress = WB_DATA_BASE_ADDR + 2 * idx; - /* TODO: */ - int ch = 0; + auto baseAddress = WB_DATA_BASE_ADDR + 2 * (ch + configuration->CanIndexOffset); { CanTxTyped frame(baseAddress + 0); diff --git a/firmware/can.h b/firmware/can.h index 28e97c8..763450e 100644 --- a/firmware/can.h +++ b/firmware/can.h @@ -4,7 +4,7 @@ void InitCan(); void SendCanData(float lambda, uint16_t measuredResistance); -void SendRusefiFormat(uint8_t idx); +void SendRusefiFormat(uint8_t ch); enum class HeaterAllow { // no CAN message telling us what to do has been rx'd