diff --git a/firmware/config/boards/hellen/hellen121nissan/board_configuration.cpp b/firmware/config/boards/hellen/hellen121nissan/board_configuration.cpp index 2b04d7e9d1..c3e6e21006 100644 --- a/firmware/config/boards/hellen/hellen121nissan/board_configuration.cpp +++ b/firmware/config/boards/hellen/hellen121nissan/board_configuration.cpp @@ -143,6 +143,7 @@ void setBoardDefaultConfiguration(void) { engineConfiguration->isSdCardEnabled = true; CONFIG(enableSoftwareKnock) = true; + CONFIG(canNbcType) = CAN_BUS_NISSAN_VQ; engineConfiguration->canTxPin = GPIOD_1; engineConfiguration->canRxPin = GPIOD_0; diff --git a/firmware/controllers/can/can_dash.cpp b/firmware/controllers/can/can_dash.cpp index 6382f3834b..e79e3b83b0 100644 --- a/firmware/controllers/can/can_dash.cpp +++ b/firmware/controllers/can/can_dash.cpp @@ -299,7 +299,14 @@ void canDashboardW202(CanCycle cycle) { void canDashboardNissanVQ(CanCycle cycle) { if (cycle.isInterval(CI::_50ms)) { + { + CanTxMessage msg(NISSAN_RPM_CLT, 8); + msg[4] = ((int)(GET_RPM() / 4)) & 0xFF; + msg[5] = ((int)(GET_RPM() / 4)) >> 8; + + msg[7] = 0x70; // todo: CLT decoding? + } } } diff --git a/firmware/controllers/trigger/trigger_decoder.cpp b/firmware/controllers/trigger/trigger_decoder.cpp index fd5f364e20..6becce38ec 100644 --- a/firmware/controllers/trigger/trigger_decoder.cpp +++ b/firmware/controllers/trigger/trigger_decoder.cpp @@ -362,6 +362,12 @@ void TriggerCentral::validateCamVvtCounters() { } } +void TriggerState::syncSymmetricalCrank(int mod, int remainder) { + while (getTotalRevolutionCounter() % mod != remainder) { + incrementTotalEventCounter(); + } +} + void TriggerState::incrementTotalEventCounter() { totalRevolutionCounter++; } diff --git a/firmware/controllers/trigger/trigger_decoder.h b/firmware/controllers/trigger/trigger_decoder.h index fb9de5448a..9853512fec 100644 --- a/firmware/controllers/trigger/trigger_decoder.h +++ b/firmware/controllers/trigger/trigger_decoder.h @@ -91,6 +91,7 @@ public: */ bool isEvenRevolution() const; void incrementTotalEventCounter(); + void syncSymmetricalCrank(int mod, int remainder); efitime_t getTotalEventCounter() const; void decodeTriggerEvent(