layout and adjustements
This commit is contained in:
parent
be10b800bf
commit
e474653363
14
src/main.c
14
src/main.c
@ -182,14 +182,14 @@ void win_bar(WINDOW *lwin, int data, int data_max, int use_color, int color) {
|
||||
int color_high(float data, float ldata, float hdata) {
|
||||
int percent = (int)((100.0f * (data - ldata)) / (hdata - ldata) + 0.5f);
|
||||
if (percent >= 90) return 1;
|
||||
else if (percent >= 70) return 2;
|
||||
else if (percent >= 75) return 2;
|
||||
else return 3;
|
||||
}
|
||||
|
||||
short color_low(float data, float ldata, float hdata) {
|
||||
int percent = 100 - (int)((100.0f * (data - ldata)) / (hdata - ldata) + 0.5f);
|
||||
if (percent >= 90) return 1;
|
||||
else if (percent >= 70) return 2;
|
||||
else if (percent >= 75) return 2;
|
||||
else return 3;
|
||||
}
|
||||
|
||||
@ -257,11 +257,11 @@ int main(int argc, char **argv) {
|
||||
|
||||
WinInfo win_infos[10] = {
|
||||
{y2, x3, 0, 0, "speed (km/h)"}, // 0
|
||||
{y2, x3, 0, x3, "power (W)"}, // 1
|
||||
{y2, x3, 0, x3, "rpm (tr/min)"}, // 1
|
||||
{y4, x3r, 0, x - x3r, "batteries (%)"}, // 2
|
||||
{y4r, x3r, y4, x - x3r, "torque (N/m)"}, // 3
|
||||
{y6, 2 * x3, y2, 0, "rpm (tr/min)"}, // 4
|
||||
{y6, x3r, y2, 2 * x3, "efficiency (Wh/Km)"}, // 5
|
||||
{y6, 2 * x3, y2, 0, "power (W)"}, // 4
|
||||
{y6, x3r, y2, 2 * x3, "efficiency (Wh/Km)"}, // 5
|
||||
{y6, x3, y2 + y6, 0, "batteries temperature (deg C)"}, // 6
|
||||
{y6, x3, y2 + y6, x3, "variator temperature (deg C)"}, // 7
|
||||
{y6, x3r, y2 + y6, x - x3r, "motor temperature (deg C)"}, // 8
|
||||
@ -292,9 +292,9 @@ int main(int argc, char **argv) {
|
||||
|
||||
if (now - t100 >= 100 * delay) {
|
||||
win_int(win[0], speed, 3, use_color, color_high(speed, lspeed, hspeed));
|
||||
win_int(win[1], power, 4, use_color, color_high(power, lpower, hpower));
|
||||
win_int(win[1], rpm, 4, use_color, color_high(rpm, lrpm, hrpm));
|
||||
win_float(win[3], tq, 3, use_color, color_high(tq, ltq, htq));
|
||||
win_bar(win[4], rpm, 6000, use_color, color_high(rpm, lrpm, hrpm));
|
||||
win_bar(win[4], power, hpower, use_color, color_high(power, lpower, hpower));
|
||||
win_float(win[5], eff, 5, use_color, color_high(eff, leff, heff));
|
||||
t100 = now;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user