We love to have working CAN bus stuff, actually

This commit is contained in:
XANTRONIX Development 2024-01-28 16:27:54 +00:00
parent a5b4127b08
commit 7ec372ee48

View file

@ -45,9 +45,37 @@ static void cluster_update(hexagram_cluster *cluster,
struct timeval *last) { struct timeval *last) {
struct timeval now; struct timeval now;
//if (!hexagram_cluster_update(cluster, frame)) { switch (frame->can_id) {
// return; case 0x280: {
//} double rpm = 0.25 * (float)(frame->data[2] | frame->data[3] << 8);
cluster->tacho.dial.value = rpm;
cluster->shift_indicator.rpm = rpm;
break;
}
case 0x288: {
cluster->thermo.dial.value = 0.75 * (float)(frame->data[1] - 48);
break;
}
case 0x320: {
cluster->fuel.dial.value = frame->data[2] & 0xf;
break;
}
case 0x5a0: {
double rps = 0.001 * (float)(frame->data[1] | (frame->data[2] << 8)),
kph = (2.00152 * rps * 3600) / 1000.0;
cluster->speedo.dial.value = kph;
break;
}
}
gettimeofday(&now, NULL); gettimeofday(&now, NULL);