View Single Post
  #7   Spotlight this post!  
Unread 05-04-2006, 23:20
Tom Bottiglieri Tom Bottiglieri is offline
Registered User
FRC #0254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: Jan 2004
Rookie Year: 2003
Location: San Francisco, CA
Posts: 3,186
Tom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond repute
Re: Critique this code

Why did you use integer math in control_system.c and floating point in drive_control.c. All assignments are being dropped into int variables, so multiplying by 1.30 is just going to put extra strain on the processor to just get the same answer.

Try
Code:
targetticks = (percentage * 26) /20;
Yay for math by multiples of 2.

Another general question for all of the PIC gurus out there.. which would be more efficient, if there is any difference?
Code:
targetticks = (percentage * 26) /20;

or...

targetticks = (percentage * 13) /10;