-
Notifications
You must be signed in to change notification settings - Fork 0
/
Failsafe.ino
55 lines (45 loc) · 979 Bytes
/
Failsafe.ino
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
void failsafe(byte failsafeType)
{
int longFailsafeTimeout = 0;
if (failsafeType)
{
longFailsafeTimeout = 300;
//Serial.println("WiFi Failsafe");
}
else
{
longFailsafeTimeout = 150;
//Serial.println("LockScreen Failsafe");
}
for(int i=0; i<3; i++)
rcInput[i] = 0;
if(failsafeCounter > longFailsafeTimeout)
{
longFailsafeTriggered = 1;
rcInput[3] -= LAND_RATE;
if(rcInput[3] <0)
rcInput[3] = 0;
delay(10);
//Serial.println("looooooooooooong failsafe..........................................................");
}
else
failsafeCounter++;
if(!motorValue[0] && !motorValue[1] && !motorValue[2] && !motorValue[3])
{
longFailsafeTriggered = 0;
}
}
/*
void long_failsafe()
{
int landRate = 1;
while((motorValue[0]+motorValue[1]+motorValue[2]+motorValue[3]) > 300)
{
for(int i=0; i<4; i++)
{
motorValue[i] -= landRate;
delay(10);
}
}
}
*/