better interuption mechanism
This commit is contained in:
parent
e474653363
commit
8fa46b3fbc
26
src/main.c
26
src/main.c
@ -1,3 +1,4 @@
|
||||
#include <ctype.h>
|
||||
#include <ncurses.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -281,11 +282,22 @@ int main(int argc, char **argv) {
|
||||
float ltq = 1.8f, htq = 3.5f, leff = 0.0f, heff = 300.0f, lbat_temp = 0.0f, hbat_temp = 150.0f, lvar_temp = 0.0f, hvar_temp = 150.0f, lmot_temp = 0.0f, hmot_temp = 150.0f;
|
||||
long t100 = 0, t1000 = 0;
|
||||
int ch = ERR;
|
||||
while(ch == ERR) {
|
||||
if (fake_data) {
|
||||
get_fake_data(&speed, lspeed, hspeed, &power, lpower, hpower, &bat, lbat, hbat, &tq, ltq, htq, &rpm, lrpm, hrpm, &eff, leff, heff, &bat_temp, lbat_temp, hbat_temp, &var_temp, lvar_temp, hvar_temp, &mot_temp, lmot_temp, hmot_temp);
|
||||
} else {
|
||||
//real_data()
|
||||
|
||||
while(1) {
|
||||
|
||||
ch = tolower(getch());
|
||||
switch (ch) {
|
||||
case 'q' :
|
||||
goto end;
|
||||
case ERR :
|
||||
default :
|
||||
if (fake_data) {
|
||||
get_fake_data(&speed, lspeed, hspeed, &power, lpower, hpower, &bat, lbat, hbat, &tq, ltq, htq, &rpm, lrpm, hrpm, &eff, leff, heff, &bat_temp, lbat_temp, hbat_temp, &var_temp, lvar_temp, hvar_temp, &mot_temp, lmot_temp, hmot_temp);
|
||||
} else {
|
||||
//real_data()
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
long now = now_ms();
|
||||
@ -306,10 +318,10 @@ int main(int argc, char **argv) {
|
||||
t1000 = now;
|
||||
}
|
||||
//win[9];
|
||||
ch = getch();
|
||||
napms(10);
|
||||
};
|
||||
|
||||
|
||||
end:
|
||||
for (int i = 0; i < 10; i++) {
|
||||
delwin(win[i]);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user