Intant Fuel Consuption an All Renault

We hack ID instant Fuel Consuplton in car Renault / Nissan

Now we calculate this code - every 3 seconds

private void receive(byte[] data) throws IOException {
// spn.append("receive " + data.length + " bytes\n");
for (int i = 0; i < data.length; i += 16) {
int id = data[i + 4] + data[i + 5] * 256;
// if (MainActivity.FiltrNumber != 0 || MainActivity.FiltrNumber == id) {
if (data[i + 4] == 0x6a && data[i + 5] == 0x06) {
// SpannableStringBuilder spn = new SpannableStringBuilder();
// spn.append(HexDump.dumpHexString(data)).append("\n");
MainActivity.Consumption = data[i + 11];
NewTime = System.currentTimeMillis();
long deltaTime = NewTime - OldTime;
if (deltaTime > 2500) {
int delta = MainActivity.Consumption - MainActivity.Consumption_old;
if (delta < 0)
delta += 256;
float con = delta / 10f * (1000f / deltaTime) * 3600f / 1000f;
String s;
if (MainActivity.speed > 15.0f) {
con = con * (100f / MainActivity.speed);
s = "cons = " + String.format ("%.3f", con) + "L/100km" + "\n";
}
else {
s = "cons = " + String.format ("%.3f", con) + "L/hour" + "\n";
}
// spn.append(s);
receiveText.append(s);
MainActivity.Consumption_old = MainActivity.Consumption;
OldTime = NewTime;

// try {
// s += "\n";
// MainActivity.fOut.write(s.getBytes());
// } catch (IOException e) {
// e.printStackTrace();
// }
}
}
else if (id == 535) { //speed
MainActivity.speed = (data[i + 11]*255*255 + data[i+ 12]*255 + data[i + 13])/39500f;
}
/*
if (MainActivity.FiltrNumber == 0 || MainActivity.FiltrNumber == id) {
if (MainActivity.RecordFlag) {
try {
MainActivity.fOut.write(data, 0, data.length);
} catch (IOException e) {
e.printStackTrace();
}
}
}
*/
}
}

can ID 66A offset=“3” we accumulate the value difference every for example three seconds -

please add this function in XML as ENUM

regards
Slava

I think its easiest that you accumulate the value in your custom code and send that value over to RealDash.

Ok we made it, now easy made as you write. Thanks. Other can see our code