From 0eef3f80fd4b1dd13db90819bd510f881f126117 Mon Sep 17 00:00:00 2001 From: XANTRONIX Development Date: Tue, 28 May 2019 01:09:44 -0500 Subject: [PATCH] *Strong Bad and The Cheat walk away* --- examples/cluster.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/examples/cluster.c b/examples/cluster.c index eb0d59b..5dd1aef 100644 --- a/examples/cluster.c +++ b/examples/cluster.c @@ -200,19 +200,21 @@ static void update_gauge_cluster(cairo_t *cr, double y, double width, double height) { - static double rpm = 0; - - if (frame->can_id == 0x280) { - rpm = 0.25 * (double)(frame->data[2] | (frame->data[3] << 8)); - } else { - return; - } + switch (frame->can_id) { + case 0x280: { + static double rpm = 0; - draw_tachometer_needle(cr, - x + width * 0.2, - y + height * 0.5, - height * 0.4, - rpm); + rpm = 0.25 * (double)(frame->data[2] | (frame->data[3] << 8)); + + draw_tachometer_needle(cr, + x + width * 0.2, + y + height * 0.5, + height * 0.4, + rpm); + + break; + } + } } int main(int argc, char **argv) { @@ -273,7 +275,7 @@ int main(int argc, char **argv) { hexagram_window_refresh_bg(window); break; - + case ButtonPress: case KeyPress: break;