Dumb stuff

This commit is contained in:
XANTRONIX 2019-06-14 01:11:08 -05:00
parent 2871fd974a
commit e513fc1083
4 changed files with 10 additions and 5 deletions

View file

@ -5,6 +5,8 @@
#include <hexagram/gauge.h> #include <hexagram/gauge.h>
#define HEXAGRAM_SPEEDO_MAX_KPH 289.682
typedef struct _hexagram_speedo { typedef struct _hexagram_speedo {
hexagram_gauge gauge; hexagram_gauge gauge;
} hexagram_speedo; } hexagram_speedo;

View file

@ -126,7 +126,7 @@ void hexagram_cluster_draw_fg(hexagram_cluster *cluster,
cluster->state.rpm); cluster->state.rpm);
hexagram_speedo_draw_needle(&cluster->speedo, cr, hexagram_speedo_draw_needle(&cluster->speedo, cr,
(2.00152 * cluster->state.rps * 3600) / 1000.0); cluster->state.rps);
hexagram_thermo_draw_needle(&cluster->thermo, cr, hexagram_thermo_draw_needle(&cluster->thermo, cr,
cluster->state.temp); cluster->state.temp);

View file

@ -66,7 +66,7 @@ void hexagram_gauge_draw_needle(hexagram_gauge *gauge,
/* /*
* Draw the gauge pivot * Draw the gauge pivot
*/ */
cairo_set_source_rgb(cr, 0.1, 0.1, 0.1); cairo_set_source_rgb(cr, 0.4, 0.4, 0.4);
cairo_arc(cr, cairo_arc(cr,
gauge->x, gauge->x,
@ -78,7 +78,8 @@ void hexagram_gauge_draw_needle(hexagram_gauge *gauge,
cairo_stroke(cr); cairo_stroke(cr);
/* /*
* Draw the needle above the pivot */ * Draw the needle above the pivot
*/
cairo_move_to(cr, gauge->x, gauge->y); cairo_move_to(cr, gauge->x, gauge->y);
cairo_set_source_rgb(cr, 0, 0.25, 1.0); cairo_set_source_rgb(cr, 0, 0.25, 1.0);

View file

@ -60,7 +60,9 @@ void hexagram_speedo_draw_face(hexagram_speedo *speedo,
void hexagram_speedo_draw_needle(hexagram_speedo *speedo, void hexagram_speedo_draw_needle(hexagram_speedo *speedo,
cairo_t *cr, cairo_t *cr,
double kph) { double rps) {
double kph = (2.00152 * rps * 3600) / 1000.0;
if (kph < 0) { if (kph < 0) {
kph = 0; kph = 0;
} else if (kph > 290) { } else if (kph > 290) {
@ -70,5 +72,5 @@ void hexagram_speedo_draw_needle(hexagram_speedo *speedo,
hexagram_gauge_draw_needle(&speedo->gauge, hexagram_gauge_draw_needle(&speedo->gauge,
cr, cr,
0.8, 0.8,
kph / 289.682); kph / HEXAGRAM_SPEEDO_MAX_KPH);
} }