diff -u -r ../legOS-0.1.6/direct-sensor.c ./direct-sensor.c --- ../legOS-0.1.6/direct-sensor.c Fri Jan 29 07:47:43 1999 +++ ./direct-sensor.c Thu Mar 18 19:41:29 1999 @@ -28,11 +28,11 @@ // and corrseponding range matching function. // -#define RANGE_SIZE 40U -#define STATE_0_VALUE 1023U -#define STATE_1_VALUE 833U -#define STATE_2_VALUE 405U -#define STATE_3_VALUE 623U +#define RANGE_SIZE (ds_unscale( 40U)) +#define STATE_0_VALUE (ds_unscale(1023U)) +#define STATE_1_VALUE (ds_unscale( 833U)) +#define STATE_2_VALUE (ds_unscale( 405U)) +#define STATE_3_VALUE (ds_unscale( 623U)) #define IN_RANGE( val ) (raw > (val - RANGE_SIZE) && \ raw < (val + RANGE_SIZE) ) @@ -79,7 +79,7 @@ // void ds_rotation_set(unsigned* const sensor,int pos) { unsigned channel=(unsigned) (sensor-&AD_A); - unsigned raw = (*sensor) >> 6; + unsigned raw = (*sensor); RotationState state; if(sensor>=&AD_A && sensor<=&AD_C) { // catch range violations @@ -105,7 +105,7 @@ // void ds_rotation_handler() { unsigned channel =ds_channel; - unsigned raw =(*((&AD_A)+channel)) >> 6; + unsigned raw =(*((&AD_A)+channel)); int cooked =ds_rotations[channel]; RotationState state=rotation_state[channel]; diff -u -r ../legOS-0.1.6/include/direct-sensor.h ./include/direct-sensor.h --- ../legOS-0.1.6/include/direct-sensor.h Fri Jan 29 07:47:43 1999 +++ ./include/direct-sensor.h Tue Feb 16 19:34:13 1999 @@ -56,6 +56,8 @@ #define ROTATION_3 (ds_rotations[0]) #endif +#define ds_scale(x) (x>>6) +#define ds_unscale(x) (x<<6) /////////////////////////////////////////////////////////////////////////////// //