Revision 195
added more battery detection code (currently commented out for demo purposes)...also uses rangefinders for departing.
branches/autonomous_recharging/code/projects/autonomous_recharging/dragonfly/recharge.c | ||
---|---|---|
131 | 131 |
**/ |
132 | 132 |
void recharge_check_low_battery() |
133 | 133 |
{ |
134 |
//TODO: use battery_low instead of button press |
|
135 |
//if (battery_low()) |
|
134 |
//if (battery_low() || button2_click()) |
|
136 | 135 |
if (button2_click()) |
137 | 136 |
{ |
138 | 137 |
wl_recharge_begin(); |
... | ... | |
150 | 149 |
void recharge_seek() |
151 | 150 |
{ |
152 | 151 |
seek_station(wl_recharge_get_station()); |
153 |
|
|
154 |
//TODO: check if battery is charging |
|
155 |
//if (battery is charging) |
|
156 |
if (recharge_i2c_is_battery_charging()) |
|
152 |
|
|
153 |
if (recharge_i2c_is_battery_charging() || button2_click()) |
|
157 | 154 |
{ |
158 | 155 |
wl_recharge_dock(); |
159 | 156 |
move(0, 0); |
... | ... | |
167 | 164 |
**/ |
168 | 165 |
void recharge_check_charging_complete() |
169 | 166 |
{ |
170 |
//TODO: implement |
|
171 |
//if (battery is charged) |
|
167 |
//if (recharge_i2c_is_battery_full() || button2_click()) |
|
172 | 168 |
if (button2_click()) |
173 | 169 |
{ |
174 | 170 |
wl_recharge_depart(); |
branches/autonomous_recharging/code/projects/autonomous_recharging/dragonfly/departing.c | ||
---|---|---|
32 | 32 |
int depart_station(void) |
33 | 33 |
{ |
34 | 34 |
//TODO: use rangefinders to depart |
35 |
//int front_distance = range_read_distance(IR2);
|
|
35 |
int front_distance = range_read_distance(IR2); |
|
36 | 36 |
//RECHARGE_DEBUG_PUTI(front_distance); |
37 | 37 |
//RECHARGE_DEBUG_PRINT("\n"); |
38 | 38 |
|
39 |
//if(front_distance != -1 && front_distance < 160)
|
|
39 |
if(front_distance != -1 && front_distance < 160) |
|
40 | 40 |
leave_station_count++; |
41 |
//else
|
|
42 |
// leave_station_count = 0;
|
|
41 |
else |
|
42 |
leave_station_count = 0; |
|
43 | 43 |
|
44 | 44 |
if(leave_station_count > 1000) |
45 | 45 |
{ |
Also available in: Unified diff