|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Re: Could someone look this over?
oops. I just edited my last post with another idea, go back and check it.
|
|
#2
|
||||
|
||||
|
Re: Could someone look this over?
also this code
__________ if(currentPWM >= goalPWM + sensitivity) return currentPWM - sensitivity; if(currentPWM <= goalPWM - sensitivity) return currentPWM + sensitivity; __________________________ both IFs can be true when the first IF causes the value to change, then the second one will become true and change it again - I dont think you want that - shouldnt the first IF jump over the second one when its true? |
|
#3
|
||||
|
||||
|
Re: Could someone look this over?
Quote:
|
|
#4
|
||||
|
||||
|
Re: Could someone look this over?
if the printf is producing something you dont expect, its not the printf function thats faulty :c)
when your code is not doing what you think it should be, then something IS wrong in there - so if you printf out a variable and its not what you think should be there, then you have found at least one thing that is wrong in your code. |
|
#5
|
||||
|
||||
|
Re: Could someone look this over?
Quote:
I'll have to play with it some, oh, wait, as I was sitting here I just got an idea. It might not be doing the conversion from a unsigned char to an int correctly. Maybe an explicit cast will help... ![]() ![]() As I said in a previous edited post, we have used dashboard on it and it appeared to work then, but I'm not sure about the version I was using. Thanks for your help. Last edited by Ryan M. : 08-02-2004 at 12:18. |
|
#6
|
||||||
|
||||||
|
Re: Could someone look this over?
Quote:
|
|
#7
|
||||
|
||||
|
Re: Could someone look this over?
Yes!
![]() ![]() ![]() ![]() PS Excessive celebration, 5 yard penalty. Any more suggestions appreciated. Thanks Last edited by Ryan M. : 08-02-2004 at 12:19. |
|
#8
|
||||||
|
||||||
|
Re: Could someone look this over?
Code:
if(currentPWM >= goalPWM + sensitivity)
return currentPWM - sensitivity;
if(currentPWM <= goalPWM - sensitivity)
return currentPWM + sensitivity;
If goalPWM is 254 and sensitivity is 10 and CurrentPWM is 127, the result of (goalPWM + sensitivity) is 8 and so CurrentPWM is greater then 8 and you return 117 not 137 like you hope. |
|
#9
|
||||
|
||||
|
Re: Could someone look this over?
Quote:
And the funny thing is, I had already paritially taken looping around into acount in the code. Last edited by Ryan M. : 08-02-2004 at 12:27. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|