diff --git a/bin/hexagram-app.c b/bin/hexagram-app.c index cca0394..a8db752 100644 --- a/bin/hexagram-app.c +++ b/bin/hexagram-app.c @@ -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);