We love to have working CAN bus stuff, actually
This commit is contained in:
parent
a5b4127b08
commit
7ec372ee48
1 changed files with 31 additions and 3 deletions
|
@ -45,9 +45,37 @@ static void cluster_update(hexagram_cluster *cluster,
|
|||
struct timeval *last) {
|
||||
struct timeval now;
|
||||
|
||||
//if (!hexagram_cluster_update(cluster, frame)) {
|
||||
// return;
|
||||
//}
|
||||
switch (frame->can_id) {
|
||||
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);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue