-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWarningSystem.c
66 lines (60 loc) · 2.02 KB
/
WarningSystem.c
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/****************************************************
* WarningSystem.c
* Created on: 10-Mai-2024 09:40:44
* Implementation of the Class WarningSystem
* Original author: The Administrator
****************************************************/
#include <pthread.h>
#include "WarningSystem.h"
void *startWarningSystem()
{
while (1){
if (!readButton()){
setButtonMode(!getButtonMode());
}
printf("button: %d\n", getButtonMode());
//printf("visibility: %d\n", readVisibility());
//printf("infrared: %d\n", getInfrared());
//printf("altitude: %d\n", readAltimeter());
//printf("speed: %d\n", readSpeed());
//if (readAltimeter() < 8000 && readAltimeter() > 3000 && !getInfrared()){
//printf("RISK: None\n");
//setLedOne(0);
//}
//else if (readAltimeter() > 8000 && !getInfrared()){
//printf("RISK: Low\n");
//setLedOne(1);
//}
//else if (readAltimeter() < 3000 && !getInfrared()){
//printf("RISK: Middle\n");
//setLedOne(1);
//}
//else if (readAltimeter() < 8000 && getAltitude() > 3000 && getInfrared()){
//printf("RISK: High\n");
//}
//else if (readAltimeter() > 8000 && getInfrared()){
//printf("RISK: High\n");
//setLedOne(1);
//}
//else if (readAltimeter() < 3000 && getInfrared() && getSpeed() < 800){
//printf("RISK: Very High\n");
//setLedOne(1);
//}
//else if (readAltimeter() < 3000 && getInfrared() && getSpeed() > 800){
//printf("RISK: Extremely High\n");
//setLedOne(1);
//}
// Adjusted the lighting
if (readVisibility() > 200 && getInfrared()){
printf("WARNING OBSTACLE DETECTED\n");
}
else if (readVisibility() < 200 && getInfrared() && getButtonMode()){
printf("LOW VISIBILITY, INITILIAZING EVASION\n");
}
else if (readVisibility() < 200 && getInfrared() && !getButtonMode()){
printf("NOT IN AUTOMATIC, PLEASE EVADE\n");
}
delay(200);
}
pthread_exit (NULL);
}