From c4c3855739ae28bfc955fa114d463dba776bfe7b Mon Sep 17 00:00:00 2001 From: rusefillc Date: Wed, 28 Jul 2021 17:18:44 -0400 Subject: [PATCH] genesis coupe --- firmware/controllers/can/can_dash.cpp | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/firmware/controllers/can/can_dash.cpp b/firmware/controllers/can/can_dash.cpp index 2d12fc2883..d0aba6a344 100644 --- a/firmware/controllers/can/can_dash.cpp +++ b/firmware/controllers/can/can_dash.cpp @@ -66,6 +66,9 @@ static time_msecs_t mph_timer; static time_msecs_t mph_ctr; +#define GENESIS_COUPLE_RPM_316 0x316 +#define GENESIS_COUPLE_COOLANT_329 0x329 + #define NISSAN_RPM_1F9 0x1F9 // Nissan z33 350Z and else // 0x23d = 573 @@ -96,6 +99,7 @@ void canDashboardW202(CanCycle cycle); void canDashboardBMWE90(CanCycle cycle); void canDashboardVagMqb(CanCycle cycle); void canDashboardNissanVQ(CanCycle cycle); +void canDashboardGenesisCoupe(CanCycle cycle); void updateDash(CanCycle cycle) { @@ -125,6 +129,9 @@ void updateDash(CanCycle cycle) { case CAN_BUS_NISSAN_VQ: canDashboardNissanVQ(cycle); break; + case CAN_BUS_GENESIS_COUPE: + canDashboardGenesisCoupe(cycle); + break; default: break; } @@ -305,6 +312,22 @@ void canDashboardW202(CanCycle cycle) { static int rollingId = 0; +void canDashboardGenesisCoupe(CanCycle cycle) { + if (cycle.isInterval(CI::_50ms)) { + { + CanTxMessage msg(GENESIS_COUPLE_RPM_316, 8); + int rpm8 = GET_RPM() * 4; + msg[3] = rpm8 >> 8; + msg[4] = rpm8 & 0xFF; + } + { + CanTxMessage msg(GENESIS_COUPLE_COOLANT_329, 8); + int clt = Sensor::get(SensorType::Clt).value_or(0) * 2; + msg[1] = clt; + } + } +} + void canDashboardNissanVQ(CanCycle cycle) { if (cycle.isInterval(CI::_50ms)) { { @@ -318,7 +341,7 @@ void canDashboardNissanVQ(CanCycle cycle) { { CanTxMessage msg(NISSAN_CLT_551, 8); - int clt = 40; // todo read sensor + int clt = Sensor::get(SensorType::Clt).value_or(0); msg[0] = clt + 45; }