The unified diff between revisions [7f3278b1..] and [be147b11..] is displayed below. It can also be downloaded as a raw diff.
# # old_revision [7f3278b164104bb0564a391a1f7b4fd955a3904a] # new_revision [be147b11caac304fda1579ac71017eecc3bb79e0] # # patch "Makefile" # from [7a1a49fb3e2f7d3f482e493962f2f02dae51aa93] # to [0d87a7bdf64f764dc4892656b9cd1e2613f05867] # # patch "stick.c" # from [ad24bc7d9d8c95c497a1b5bd7a13d8e1619ca539] # to [4870f5f016221d25b0d8a4d093fda5dbe0f0b30c] # ============================================================ --- Makefile 7a1a49fb3e2f7d3f482e493962f2f02dae51aa93 +++ Makefile 0d87a7bdf64f764dc4892656b9cd1e2613f05867 @@ -7,7 +7,7 @@ CSRCS+=thrust.c CSRCS+=fisqrt.c stick.c trig.c motor.c led.c watchdog.c panic.c status.c CSRCS+=thrust.c -#PROJOPTS=-DUSE_UART -DSEND_DCM +#PROJOPTS=-DUSE_UART -DSEND_DCM -DSTICK_DEBUG_CALIBRATE COPTIM?=-O1 CFLAGS=-march=armv4t -msoft-float $(COPTIM) -Wall -Werror -Wextra $(PROJOPTS) @@ -37,6 +37,8 @@ OBJS=$(SOBJS) $(COBJS) .SUFFIXES: .elf .hex .bin +$(OBJS): Makefile + $(NAME).elf: $(OBJS) $(CC) $(CFLAGS) -nostdlib -nostartfiles -T $(LDSCRIPT) -Wl,-Map -Wl,$(NAME).map -o $(NAME).elf $(OBJS) -lgcc ============================================================ --- stick.c ad24bc7d9d8c95c497a1b5bd7a13d8e1619ca539 +++ stick.c 4870f5f016221d25b0d8a4d093fda5dbe0f0b30c @@ -19,25 +19,32 @@ #define TWO_PI 6.28318531f #define PI 3.14159265f -#define MIN_X 15830 -#define MAX_X 28300 -#define CENTRE_X 22100 +#define MIN_X 14700 +#define MAX_X 29700 +#define CENTRE_X 22200 -#define MIN_Y 18530 -#define MAX_Y 28200 -#define CENTRE_Y 22100 +#define MIN_Y 14700 +#define MAX_Y 29700 +#define CENTRE_Y 22200 -#define MIN_Z 15800 -#define MAX_Z 28304 -#define CENTRE_Z 22100 +#define MIN_Z 14700 +#define MAX_Z 29700 +#define CENTRE_Z 22200 -#define MIN_THR 16500 -#define MAX_THR 28275 +#define MIN_THR 15700 +#define MAX_THR 29700 -#define MIN_REAL_THR 15830 +#define MIN_REAL_THR 14700 #define CENTRE_ZONE 100 +/* With new TX firmware: + * x y thr z + * centre: 22192, 22222, 14687, 22196 + * min: 14686, 14701, 14686, 14687 + * max: 29740, 29740, 29725, 29725 + */ + /* 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)) @@ -77,6 +84,25 @@ void stick_update(float x, float y, floa dcm_attitude_error(x, y, z); } +#ifdef STICK_DEBUG_CALIBRATE +void stick_debug_calibrate() +{ + unsigned int t1 = timer_input(0); + unsigned int t2 = timer_input(1); + unsigned int t3 = timer_input(2); + unsigned int t4 = timer_input(3); + putstr("S:("); + putint(t1); + putstr(","); + putint(t2); + putstr(","); + putint(t3); + putstr(","); + putint(t4); + putstr(")\r\n"); +} +#endif + void stick_input(void) { float x, y, z, throttle; if (timer_allvalid()) { @@ -85,6 +111,11 @@ void stick_input(void) { throttle = timer_input(2); z = timer_input(3); +#ifdef STICK_DEBUG_CALIBRATE + if ((stick_counter % 20) == 0) + stick_debug_calibrate(); +#endif + if (!status_armed()) { if ((throttle < MIN_THR) && (x > (CENTRE_X - CENTRE_ZONE)) &&