-
Notifications
You must be signed in to change notification settings - Fork 2
/
Auger.pde
48 lines (44 loc) · 1.58 KB
/
Auger.pde
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
void DoAuger() {
#if ANA_AUGER_CURRENT != ABSENT
AugerCurrentValue = -195*(analogRead(ANA_AUGER_CURRENT)-518); //convert current sensor V to mA
if (AugerCurrentValue > AugerCurrentLevelBoundary[AUGER_OFF][0] && AugerCurrentValue < AugerCurrentLevelBoundary[AUGER_OFF][1]) {
AugerCurrentLevel = AUGER_OFF;
auger_on = false;
}
if (AugerCurrentValue > AugerCurrentLevelBoundary[AUGER_ON][0] && AugerCurrentValue < AugerCurrentLevelBoundary[AUGER_ON][1]) {
AugerCurrentLevel = AUGER_ON;
auger_on = true;
}
if (AugerCurrentValue > AugerCurrentLevelBoundary[AUGER_HIGH][0] && AugerCurrentValue < AugerCurrentLevelBoundary[AUGER_HIGH][1]) {
AugerCurrentLevel = AUGER_HIGH;
auger_on = true;
}
#endif
#if ANA_FUEL_SWITCH != ABSENT
FuelSwitchValue = analogRead(ANA_FUEL_SWITCH); // switch voltage, 1024 if on, 0 if off
if (FuelSwitchValue > 600) {
FuelSwitchLevel = SWITCH_ON;
auger_on = true;
} else {
FuelSwitchLevel = SWITCH_OFF;
auger_on = false;
}
// if (FuelSwitchValue > FuelSwitchLevelBoundary[SWITCH_OFF][0] && FuelSwitchValue < FuelSwitchLevelBoundary[SWITCH_OFF][1]) {
// FuelSwitchLevel = SWITCH_OFF;
// auger_on = false;
// }
// if (FuelSwitchValue > FuelSwitchLevelBoundary[SWITCH_ON][0] && FuelSwitchValue < FuelSwitchLevelBoundary[SWITCH_ON][1]) {
// FuelSwitchLevel = SWITCH_ON;
// auger_on = true;
// }
#endif
#if FET_AUGER != ABSENT && ANA_FUEL_SWITCH != ABSENT
if (auger_on) {
analogWrite(FET_AUGER,255);
auger_on = true;
} else {
analogWrite(FET_AUGER,0);
auger_on = false;
}
#endif
}