-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdisplayHandler.h
40 lines (36 loc) · 2.44 KB
/
displayHandler.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <stdio.h>
#include <stdlib.h>
void *displayHandlerThreadExecute(void *vargp)
{
while (1)
{
system("clear");
// system("cls");
printf("=================== Welcome to CRT system ====================\n\n");
// printf("\n");
printf("=========================== LAMPS ============================\n");
printf("Fuel -> \e[0;%dm%s\e[0m\n", systemStatus.lamp.fuel == 0 ? 32 : 31, systemStatus.lamp.fuel == 0 ? "green" : "red");
printf("Engine Pressure -> \e[0;%dm%s\e[0m\n", systemStatus.lamp.enginePressure == 0 ? 32 : 31, systemStatus.lamp.enginePressure == 0 ? "green" : "red");
printf("Engine Temperature -> \e[0;%dm%s\e[0m\n", systemStatus.lamp.engineTemperature == 0 ? 32 : 31, systemStatus.lamp.engineTemperature == 0 ? "green" : "red");
printf("Smoke Detector 1 -> \e[0;%dm%s\e[0m\n", systemStatus.lamp.smokeDetector1 == 0 ? 32 : 31, systemStatus.lamp.smokeDetector1 == 0 ? "green" : "red");
printf("Smoke Detector 2 -> \e[0;%dm%s\e[0m\n", systemStatus.lamp.smokeDetector2 == 0 ? 32 : 31, systemStatus.lamp.smokeDetector2 == 0 ? "green" : "red");
printf("=========================== DIALS ============================\n");
printf("Fuel -> %f %s\n", systemStatus.dial.fuelLevel, FUEL_UNITS);
printf("Engine Pressure -> %f %s\n", systemStatus.dial.enginePressure, ENGINE_PRESSURE_UNITS);
printf("Engine Temperature -> %f %s\n", systemStatus.dial.engineTemperature, ENGINE_TEMPERATURE_UNITS);
printf("=========================== WARNINGS =========================\n");
// TODO: print warnings
printf("=========================== READINGS ==========================\n");
// TODO: print readings
printf("=============================================================\n");
printf("Select OPTION : ACK Warning (Y) , IGNORE Warning (N) , REQUEST Reading (R) ,\n");
printf("Quit (K) , SIMULATE Smoke1 (1) , SIMULATE Smoke2 (2) , CLEAR Readings (C)\n");
printf("SIMULATE Over Pressure (Z) , SIMULATE Over Temperature (X)\n");
printf("============================================================\n\n\n");
printf("============================================================\n");
printf("Select READING: Fuel (F) , Pressure (P) , Temperature (T)\n");
printf("============================================================\n");
fflush(stdout);
sleep(1);
}
}