Add missing file and tidy up somewhat.
This commit is contained in:
22
stick.c
22
stick.c
@@ -59,9 +59,9 @@ float stick_yaw = 0.0f;
|
||||
|
||||
unsigned int stick_counter;
|
||||
|
||||
void stick_update(float x, float y, float z)
|
||||
void stick_update(vec3f stick)
|
||||
{
|
||||
float tz = delta_t * z;
|
||||
float tz = delta_t * stick.z;
|
||||
|
||||
stick_yaw += tz;
|
||||
|
||||
@@ -72,16 +72,16 @@ void stick_update(float x, float y, float z)
|
||||
stick_yaw -= TWO_PI;
|
||||
|
||||
#if 0
|
||||
z = stick_yaw;
|
||||
stick.z = stick_yaw;
|
||||
#endif
|
||||
|
||||
x = sine(x);
|
||||
y = sine(y);
|
||||
stick.x = sine(stick.x);
|
||||
stick.y = sine(stick.y);
|
||||
#if 0
|
||||
z = 1.0/fisqrt(1-x*x-y*y);
|
||||
stick.z = 1.0/fisqrt(1-stick.x*stick.x-stick.y*stick.y);
|
||||
#endif
|
||||
|
||||
dcm_attitude_error(x, y, z);
|
||||
dcm_attitude_error(stick);
|
||||
}
|
||||
|
||||
#ifdef STICK_DEBUG_CALIBRATE
|
||||
@@ -168,9 +168,7 @@ void stick_input(void) {
|
||||
watchdog_kick(WATCHDOG_STICK);
|
||||
|
||||
/* So the controls are back to front. Let's fix that. */
|
||||
x = -x;
|
||||
y = -y;
|
||||
z = -z;
|
||||
vec3f stick = {-x, -y, -z};
|
||||
|
||||
#if 0
|
||||
if ((stick_counter % 100) == 0) {
|
||||
@@ -181,10 +179,10 @@ void stick_input(void) {
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
stick_update(x, y, z);
|
||||
stick_update(stick);
|
||||
#else
|
||||
if ((stick_counter % 100) == 0)
|
||||
stick_update(x, y, z);
|
||||
stick_update(stick);
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user