|
Re: Dead zone for RC control
A very readable way to do it is to make an inline function like this:
Code:
#define STOP 127
#define DEAD_ZONE 15 // or any other number, fool around with this to make it work as you want it to
#define IN_DEAD_ZONE(x) (x <= DEAD_ZONE + STOP && x>= STOP - DEAD_ZONE)
This would work with something like this:
Code:
if (IN_DEAD_ZONE(p1_y))
p1_y = STOP;
__________________
--
"Weeks of coding can save you hours of planning"
"If the code was hard to write, I'm dam well going to make it hard to read!"
Last edited by ida_noeman : 15-02-2006 at 18:23.
|