Make that a bit easier to read
This commit is contained in:
parent
3549fff6d6
commit
1395293091
1 changed files with 7 additions and 3 deletions
10
src/thermo.c
10
src/thermo.c
|
@ -76,12 +76,16 @@ void hexagram_thermo_draw_face(hexagram_thermo *thermo,
|
||||||
void hexagram_thermo_draw_needle(hexagram_thermo *thermo,
|
void hexagram_thermo_draw_needle(hexagram_thermo *thermo,
|
||||||
cairo_t *cr,
|
cairo_t *cr,
|
||||||
double temp) {
|
double temp) {
|
||||||
if (temp > 260) {
|
double fahrenheit = temp * (9.0 / 5.0) + 32.0;
|
||||||
temp = 260;
|
|
||||||
|
if (fahrenheit < 120) {
|
||||||
|
fahrenheit = 120;
|
||||||
|
} else if (fahrenheit > 260) {
|
||||||
|
fahrenheit = 260;
|
||||||
}
|
}
|
||||||
|
|
||||||
hexagram_gauge_draw_needle(&thermo->gauge,
|
hexagram_gauge_draw_needle(&thermo->gauge,
|
||||||
cr,
|
cr,
|
||||||
0.9,
|
0.9,
|
||||||
((temp * (9.0/5.0) + 32.0) - 120) / 140.0);
|
(fahrenheit - 120) / 140.0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue