rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Functions
can_dash_nissan.cpp File Reference

Functions

void canDashboardNissanVQ (CanCycle cycle)
 

Function Documentation

◆ canDashboardNissanVQ()

void canDashboardNissanVQ ( CanCycle  cycle)

Definition at line 53 of file can_dash_nissan.cpp.

53 {
54 static int rollingId = 0;
55
56 if (cycle.isInterval(CI::_50ms)) {
57 {
58 CanTxMessage msg(CanCategory::NBC, NISSAN_ENGINE_1_RPM_1F9_505, 8);
59 msg.setShortValueMsb(Sensor::getOrZero(SensorType::Rpm) * 8, /*offset*/ 2);
60 }
61
62 {
63 CanTxMessage msg(CanCategory::OBD, NISSAN_ENGINE_5_CLT_551_1361, 8);
64
66 msg[0] = clt + 45;
67 }
68
69
70 {
71 CanTxMessage msg(CanCategory::NBC, NISSAN_ENGINE_3_23D_573, 8);
72
73 rollingId = (rollingId + 1) % 4;
74 const uint8_t magicByte[4] = {0x03, 0x23, 0x42, 0x63};
75
76 msg[0] = magicByte[rollingId];
77 msg[1] = (int)(Sensor::getOrZero(SensorType::AcceleratorPedal) * 255 / 100);
78
79 // thank you "102 CAN Communication decoded"
80#define CAN_23D_RPM_MULT 3.15
81 int rpm315 = (int)(Sensor::getOrZero(SensorType::Rpm) / CAN_23D_RPM_MULT);
82 msg.setShortValue(rpm315, /*offset*/ 3);
83
84 msg[7] = 0x70; // todo: CLT decoding?
85 }
86 }
87}
bool isInterval(CanInterval interval)
Definition can.h:90
static float getOrZero(SensorType type)
Definition sensor.h:83
static CCM_OPTIONAL FunctionalSensor clt(SensorType::Clt, MS2NT(10))

Referenced by updateDash().

Here is the call graph for this function:
Here is the caller graph for this function:

Go to the source code of this file.