CAN: send data for all AFR channels (#186)

Co-authored-by: Andrey Gusakov <dron0gus@gmail.com>
This commit is contained in:
rusefillc 2023-02-02 19:38:16 -05:00 committed by GitHub
parent 4730f1a2ca
commit 2a6d13f57c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View File

@ -21,7 +21,9 @@ void CanTxThread(void*)
while(1) while(1)
{ {
SendRusefiFormat(configuration->CanIndexOffset); for (int ch = 0; ch < AFR_CHANNELS; ch++) {
SendRusefiFormat(ch);
}
chThdSleepMilliseconds(10); chThdSleepMilliseconds(10);
} }
@ -131,11 +133,9 @@ void InitCan()
chThdCreateStatic(waCanRxThread, sizeof(waCanRxThread), NORMALPRIO - 4, CanRxThread, nullptr); 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; auto baseAddress = WB_DATA_BASE_ADDR + 2 * (ch + configuration->CanIndexOffset);
/* TODO: */
int ch = 0;
{ {
CanTxTyped<wbo::StandardData> frame(baseAddress + 0); CanTxTyped<wbo::StandardData> frame(baseAddress + 0);

View File

@ -4,7 +4,7 @@
void InitCan(); void InitCan();
void SendCanData(float lambda, uint16_t measuredResistance); void SendCanData(float lambda, uint16_t measuredResistance);
void SendRusefiFormat(uint8_t idx); void SendRusefiFormat(uint8_t ch);
enum class HeaterAllow { enum class HeaterAllow {
// no CAN message telling us what to do has been rx'd // no CAN message telling us what to do has been rx'd