Bye bye Wii Motion Plus, hello MPU6050. Also, increase control loop

to 200Hz, add SD card logging, and a number of other changes.
This commit is contained in:
2014-05-06 21:03:48 +00:00
parent b482b85ffd
commit e8adff93c1
25 changed files with 1725 additions and 581 deletions

22
stick.c
View File

@@ -12,9 +12,9 @@
#include "timer.h"
#include "trig.h"
#include "motor.h"
#include "wmp.h"
#include "status.h"
#include "watchdog.h"
#include "log.h"
#define TWO_PI 6.28318531f
#define PI 3.14159265f
@@ -105,11 +105,23 @@ void stick_debug_calibrate()
void stick_input(void) {
float x, y, z, throttle;
unsigned int xi, yi, zi, throttlei;
if (timer_allvalid()) {
x = timer_input(0);
y = timer_input(1);
throttle = timer_input(2);
z = timer_input(3);
xi = timer_input(0);
yi = timer_input(1);
throttlei = timer_input(2);
zi = timer_input(3);
log_put_uint16(xi);
log_put_uint16(yi);
log_put_uint16(throttlei);
log_put_uint16(zi);
x = xi;
y = yi;
throttle = throttlei;
z = zi;
#ifdef STICK_DEBUG_CALIBRATE
if ((stick_counter % 100) == 0)