Project

General

Profile

Revision 100

Did more work on autonomous recharging for the robot.

View differences:

recharge.c
1
#include <move.h>
2
#include <battery.h>
3
#include <dio.h>
4

  
1 5
#include <wl_defs.h>
2 6
#include "wl_recharge_group.h"
7
#include "seeking.h"
8
#include "departing.h"
3 9

  
4
#include <move.h>
10
// Function prototypes
11
void recharge_check_low_battery(void);
12
void recharge_check_charging_complete(void);
13
void recharge_seek(void);
14
void recharge_depart(void);
5 15

  
6 16
/**
7 17
 * Initializes recharging. Before this function may be called,
......
61 71
			WL_DEBUG_PRINT("Unexpected state.\n");
62 72
			break;
63 73
	}
74

  
75
	// show colors if we are debugging
76
	#ifdef RECHARGE_DEBUG
77
	switch (wl_recharge_get_state())
78
	{
79
		
80
	}
81
	#endif
64 82
	
65 83
	return wl_recharge_get_state() != NOT_RECHARGING;
66 84
}
......
72 90
 **/
73 91
void recharge_check_low_battery()
74 92
{
75
	//TODO: implement
76
	if (battery is low)
93
	//TODO: use battery_low instead of button press
94
	//if (battery_low())
95
	if (button2_click())
77 96
	{
78 97
		wl_recharge_begin();
79 98
		move(0, 0);
......
89 108
 **/
90 109
void recharge_seek()
91 110
{
92
	seek_station();
111
	seek_station(wl_recharge_get_station());
93 112

  
94
	if (battery is charging)
113
	//TODO: check if battery is charging
114
	//if (battery is charging)
115
	if (button2_click())
95 116
		wl_recharge_dock();
96 117
}
97 118

  
......
102 123
 **/
103 124
void recharge_check_charging_complete()
104 125
{
105
	if (battery is charged)
126
	//TODO: implement
127
	//if (battery is charged)
128
	if (button2_click())
106 129
		wl_recharge_depart();
107 130
}
108 131

  

Also available in: Unified diff