Project

General

Profile

Revision 1371

Added by Rich Hong over 14 years ago

Remove some unused code in encoders

Also update binary and docs

View differences:

encoders.c
19 19
int right_dx;
20 20
long int timecount;
21 21

  
22
int left_v;
23
int right_v;
24

  
25

  
26 22
volatile short int data_ready;
27 23

  
28 24
void encoder_recv(char data);
......
61 57
	left_data = -1;
62 58
	right_data = -1;
63 59
	
64
	
65
	left_v=0;
66
	right_v=0;
67
	
68 60
	//RING_BUFFER_INIT(enc_buffer,BUFFER_SIZE);
69 61
	left_data_idx = 0;
70 62
	right_data_idx = 0;
......
203 195
			//Adjust left accumulator
204 196
			dx = left_data - left_data_array_prev();
205 197
			
206
			//Adjust velocity: save last dx
207
			left_v = left_dx;
208
			
209 198
			if(left_data_array_prev()==0)  dx=0;
210 199

  
211 200
			if(dx > 512) left_dx += dx - 1023; //Underflow
212 201
			else if(dx < -512) left_dx += dx + 1023; //Overflow
213 202
			else left_dx += dx;
214
			
215
			//Adjust velocity: update
216
			left_v = left_dx - left_v;
217 203
		}
218 204

  
219 205
		/*Above 1023 is invalid data*/	

Also available in: Unified diff