-
Notifications
You must be signed in to change notification settings - Fork 4
/
Washer.c
120 lines (96 loc) · 3.1 KB
/
Washer.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#include "Main.h"
#include "Port.h"
#include "Washer.h"
// PROGRAMS AVAILABLE
tByte program_dry[] = {DRY, REPEAT, FINISH};
tByte program_wash[] = {ADD_DETERGENT, ADD_WATER, HEAT, SPIN_MOTOR, TOGGLE_MOTOR, DRAIN_WATER, DRY, REPEAT, FINISH};
tByte program_light_wash[] = {ADD_DETERGENT, ADD_WATER, HEAT, TOGGLE_MOTOR, DRAIN_WATER, DRY, REPEAT, FINISH};
tByte program_very_light_wash[] = {ADD_DETERGENT, ADD_WATER, HEAT, SPIN_MOTOR, DRAIN_WATER, DRY, REPEAT, FINISH};
bit feature_heat;
bit feature_dry;
bit feature_double;
void washer_off_all() {
motor_fast = OFF;
motor_slow = OFF;
motor_reverse = OFF;
water_drain = OFF;
door_lock = OFF;
heater = OFF;
water_valve = OFF;
detergent_valve = OFF;
error = OFF;
}
void washer_program_features(tByte program_number, tByte *features)
{
if(program_number == 6
|| program_number == 14
|| program_number == 18) { // -- COLD WET -- //
features[0] = FALSE; // heat
features[1] = FALSE; // dry
features[2] = FALSE; // double
} else if(program_number == 5
|| program_number == 13
|| program_number == 17) { // -- WET -- //
features[0] = TRUE; // heat
features[1] = FALSE; // dry
features[2] = FALSE; // double
} else if(program_number == 1
|| program_number == 4
|| program_number == 12
|| program_number == 16) { // -- COLD -- //
features[0] = FALSE; // heat
features[1] = TRUE; // dry
features[2] = FALSE; // double
} else if(program_number == 3
|| program_number == 11
|| program_number == 15) { // -- NORMAL -- //
features[0] = TRUE; // heat
features[1] = TRUE; // dry
features[2] = FALSE; // double
} else if(program_number == 10) { // -- HEAVY COLD WET -- //
features[0] = FALSE; // heat
features[1] = FALSE; // dry
features[2] = TRUE; // double
} else if(program_number == 9) { // -- HEAVY WET -- //
features[0] = TRUE; // heat
features[1] = FALSE; // dry
features[2] = TRUE; // double
} else if(program_number == 2
|| program_number == 8) { // -- HEAVY COLD -- //
features[0] = FALSE; // heat
features[1] = TRUE; // dry
features[2] = TRUE; // double
} else if(program_number == 7) { // -- HEAVY -- //
features[0] = TRUE; // heat
features[1] = TRUE; // dry
features[2] = TRUE; // double
}
}
tByte washer_get_program_step(tByte program_number, int step_number) {
if(program_number == 1
|| program_number == 2) {
return program_dry[step_number];
} else if(program_number == 3
|| program_number == 4
|| program_number == 5
|| program_number == 6
|| program_number == 7
|| program_number == 8
|| program_number == 9
|| program_number == 10) {
return program_wash[step_number];
} else if(program_number == 11
|| program_number == 12
|| program_number == 13
|| program_number == 14) {
return program_light_wash[step_number];
} else if(program_number == 15
|| program_number == 16
|| program_number == 17
|| program_number == 18) {
return program_very_light_wash[step_number];
}
}
/*------------------------------------------------------------*-
---- END OF FILE --------------------------------------------
-*------------------------------------------------------------*/