Add CAN support for gear, ambient temperature

This commit is contained in:
XANTRONIX Development 2024-01-28 22:41:52 +00:00
parent 9836905566
commit b89ff5b4a7

View file

@ -67,6 +67,26 @@ static void cluster_update(hexagram_cluster *cluster,
break; break;
} }
case 0x420: {
double temp = ((double)frame->data[1] - 100) / 2.0;
cluster->temp.value = temp;
break;
}
case 0x540: {
int value = ((frame->data[7] & 0xf0) >> 4) - 2;
if ((frame->data[7] & 0xc) == 0xc) {
cluster->tacho.gear = value;
} else {
cluster->tacho.gear = HEXAGRAM_TRANS_GEAR_D;
}
break;
}
case 0x5a0: { case 0x5a0: {
double rps = 0.001 * (float)(frame->data[1] | (frame->data[2] << 8)), double rps = 0.001 * (float)(frame->data[1] | (frame->data[2] << 8)),
kph = (2.00152 * rps * 3600) / 1000.0; kph = (2.00152 * rps * 3600) / 1000.0;