-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutilities.c
executable file
·54 lines (42 loc) · 945 Bytes
/
utilities.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
void driveL(float power) {
motor[lW1] = motor[lW2] = motor[lW3] = power;
}
void driveR(float power) {
motor[rW1] = motor[rW2] = motor[rW3] = power;
}
void setFlywheel(float p) {
motor[fly1] = motor[fly2] = p;
}
void startFlywheelTasks(bool bang = false) {
startTask(RPM);
startTask(error);
if (!bang)
startTask(bangBang);
else
startTask(Flywheel);
startTask(motorrun);
}
void switchToBangBang(int t, bool preload = false) {
Target = t;
stopTask(Flywheel);
startTask(bangBang);
startTask(motorrun);
startTask(toneBack);
if (preload)
startTask(preloads);
}
void switchToPID(int t, bool preload = false) {
Target = t;
stopTask(bangBang);
startTask(Flywheel);
startTask(motorrun);
startTask(toneBack);
if (preload)
startTask(preloads);
}
void stopFlywheelTasks() {
stopTask(motorrun);
stopTask(bangBang);
stopTask(preloads);
setFlywheel(0);
}