Store the configuration on the SD card

This commit is contained in:
2015-08-13 14:10:09 +00:00
parent 53a8072424
commit d0f9f46f9c
16 changed files with 271 additions and 26 deletions

29
stick.c
View File

@@ -15,24 +15,25 @@
#include "status.h"
#include "watchdog.h"
#include "log.h"
#include "config.h"
#define TWO_PI 6.28318531f
#define PI 3.14159265f
#define MIN_X 8720
#define MAX_X 23800
#define CENTRE_X 16260
#define MIN_X config.stick.timing.x.min
#define MAX_X config.stick.timing.x.max
#define CENTRE_X config.stick.timing.x.centre
#define MIN_Y 8720
#define MAX_Y 23800
#define CENTRE_Y 16260
#define MIN_Y config.stick.timing.y.min
#define MAX_Y config.stick.timing.y.max
#define CENTRE_Y config.stick.timing.y.centre
#define MIN_Z 8720
#define MAX_Z 23800
#define CENTRE_Z 16300
#define MIN_Z config.stick.timing.z.min
#define MAX_Z config.stick.timing.z.max
#define CENTRE_Z config.stick.timing.z.centre
#define MIN_THR 9720
#define MAX_THR 23750
#define MIN_THR config.stick.timing.throttle.min
#define MAX_THR config.stick.timing.throttle.max
#define MIN_REAL_THR 8720
@@ -46,11 +47,11 @@
*/
/* Full scale is a roll/pitch angle of 30 degrees from the vertical */
#define SCALE_X (TWO_PI*30.0/360.0 / (MAX_X-CENTRE_X))
#define SCALE_Y (TWO_PI*30.0/360.0 / (MAX_Y-CENTRE_Y))
#define SCALE_X (TWO_PI*config.stick.sensitivity.x/360.0 / (MAX_X-CENTRE_X))
#define SCALE_Y (TWO_PI*config.stick.sensitivity.y/360.0 / (MAX_Y-CENTRE_Y))
/* Full scale is a complete rotation in one second */
#define SCALE_Z (TWO_PI / (MAX_Z-CENTRE_Z))
#define SCALE_Z (TWO_PI*config.stick.sensitivity.z/360.0 / (MAX_Z-CENTRE_Z))
/* 0 is min throttle, 1 is max throttle */
#define SCALE_THROTTLE (1.0f/(MAX_THR - MIN_THR))