diff --git a/conf/airframes/dragon.xml b/conf/airframes/dragon.xml index d526ff1e11..82760f5045 100644 --- a/conf/airframes/dragon.xml +++ b/conf/airframes/dragon.xml @@ -82,7 +82,7 @@ include $(PAPARAZZI_SRC)/conf/autopilot/tiny_test.makefile -ap.CFLAGS += -Werror + diff --git a/conf/autopilot/tiny_test.makefile b/conf/autopilot/tiny_test.makefile index de1c29ae4a..b876ee292d 100644 --- a/conf/autopilot/tiny_test.makefile +++ b/conf/autopilot/tiny_test.makefile @@ -7,7 +7,9 @@ ap.ARCH = arm7tdmi ap.TARGET = autopilot ap.TARGETDIR = autopilot ap.CFLAGS += -DAP -ap.CFLAGS += -DGPS -DUBX +ap.CFLAGS += -DMODEM +# -DGPS -DUBX -DDOWNLINK ap.srcs = inter_mcu.c pid.c estimator.c cam.c main_ap.c mainloop.c main.c $(SRC_ARCH)/uart.c $(SRC_ARCH)/armVIC.c -ap.srcs += gps_ubx.c gps.c nav.c +ap.srcs += nav.c $(SRC_ARCH)/modem.c +# ap.srcs += gps_ubx.c gps.c # ap.srcs += $(SRC_ARCH)/modem.c $(SRC_ARCH)/adc_ap.c $(SRC_ARCH)/uart_ap.c $(SRC_ARCH)/servo.c diff --git a/conf/messages.xml b/conf/messages.xml index 29a1b1b0c5..4ff949160e 100644 --- a/conf/messages.xml +++ b/conf/messages.xml @@ -46,6 +46,7 @@ + @@ -84,13 +85,11 @@ - + - - - + @@ -207,6 +206,11 @@ + + + + + diff --git a/sw/airborne/arm7/Makefile b/sw/airborne/arm7/Makefile index 788d5b19fa..27b0d8fcbf 100644 --- a/sw/airborne/arm7/Makefile +++ b/sw/airborne/arm7/Makefile @@ -198,8 +198,9 @@ endif #LPC21ISP = lpc21isp LPC21ISP = lpc21isp LPC21ISP_PORT = /dev/ttyS0 -LPC21ISP_BAUD = 115200 -LPC21ISP_XTAL = 14746 +LPC21ISP_BAUD = 38400 +#LPC21ISP_XTAL = 14746 +LPC21ISP_XTAL = 12000 LPC21ISP_FLASHFILE = $(TARGET).hex # verbose output: #LPC21ISP_DEBUG = -debug diff --git a/sw/airborne/arm7/main.c b/sw/airborne/arm7/main.c index f6cab56b94..466e9acd69 100644 --- a/sw/airborne/arm7/main.c +++ b/sw/airborne/arm7/main.c @@ -91,7 +91,7 @@ static void sysInit(void) { initSysTime(); // initialize the system timer uart0Init(UART_BAUD(HOST_BAUD), UART_8N1, UART_FIFO_8); // setup the UART - uart1Init(B38400, UART_8N1, UART_FIFO_8); // setup the UART + // uart1Init(B38400, UART_8N1, UART_FIFO_8); // setup the UART adc_init(); servos_init(); ppm_init(); @@ -110,11 +110,12 @@ static void periodic_task ( void ) { /* modem_put_one_byte(0x42); */ // MODEM_PRINT_GPS(); if (!(foo%10)) { - if (IO0PIN & LED1_BIT) - IO0CLR = LED1_BIT; + if (IO1PIN & LED_TINY_BIT) + // IO0CLR = LED1_BIT; + IO1CLR = LED_TINY_BIT; else - IO0SET = LED1_BIT; - MODEM_PRINT_GPS(); + //IO0SET = LED1_BIT; + IO1SET = LED_TINY_BIT; // PRINT_ADC(); DOWNLINK_SEND_IDENT(&AC_ID); diff --git a/sw/airborne/arm7/modem.c b/sw/airborne/arm7/modem.c index 73dc2a8139..3386382008 100644 --- a/sw/airborne/arm7/modem.c +++ b/sw/airborne/arm7/modem.c @@ -5,8 +5,6 @@ #include "armVIC.h" #include "config.h" -//#define TX_BUF_SIZE 256 - uint8_t modem_nb_ovrn; uint8_t tx_head; volatile uint8_t tx_tail; @@ -46,7 +44,7 @@ void modem_init ( void ) { VICIntSelect &= ~VIC_BIT(VIC_TIMER1); /* enable TIMER1 interrupt */ VICIntEnable = VIC_BIT(VIC_TIMER1); - /* on slot vic slot 5 */ + /* on slot vic slot 1 */ VICVectCntl1 = VIC_ENABLE | VIC_TIMER1; /* address of the ISR */ VICVectAddr1 = (uint32_t)TIMER1_ISR; @@ -58,12 +56,6 @@ void modem_init ( void ) { T1TCR = TCR_ENABLE; } -void modem_put_one_byte( uint8_t _byte) { - tx_buf[tx_head] = _byte; - tx_head++; - // if (tx_head >= TX_BUF_SIZE) tx_head = 0; /* TX_BUF_SIZE == 256 */ -} - static inline uint8_t get_next_bit( void ) { uint8_t ret; /* start bit */ @@ -99,7 +91,7 @@ static inline uint8_t get_next_bit( void ) { void TIMER1_ISR ( void ) { ISR_ENTRY(); - IO0CLR = LED2_BIT; + // IO1CLR = LED_2_BIT; static uint8_t modem_bit; DACR = modem_sample[modem_bit][modem_phase][modem_sample_idx] << 6; @@ -108,16 +100,12 @@ void TIMER1_ISR ( void ) { modem_sample_idx = 0; modem_phase ^= modem_bit; modem_bit = get_next_bit(); - // if (modem_bit) - // modem_phase = !modem_phase; } - /* trigger next match */ - // T1MR0 += SAMPLE_PERIOD; /* clear interrupt */ T1IR = TIR_MR0I; VICVectAddr = 0x00000000; - IO0SET = LED2_BIT; + // IO1SET = LED_2_BIT; ISR_EXIT(); } diff --git a/sw/airborne/arm7/modem.h b/sw/airborne/arm7/modem.h deleted file mode 100644 index 8d043b10cc..0000000000 --- a/sw/airborne/arm7/modem.h +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Paparazzi mcu0 cmx469 modem functions - * - * Copyright (C) 2003 Pascal Brisset, Antoine Drouin - * - * This file is part of paparazzi. - * - * paparazzi is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * paparazzi is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with paparazzi; see the file COPYING. If not, write to - * the Free Software Foundation, 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - */ - -#ifndef MODEM_H -#define MODEM_H - -#include "inttypes.h" - -void modem_init( void ); -extern uint8_t modem_nb_ovrn; - -#ifdef MODEM - -#include "airframe.h" -#include "modem_hw.h" - - -#define TX_BUF_SIZE 255 -extern uint8_t tx_head; -extern volatile uint8_t tx_tail; -extern uint8_t tx_buf[ TX_BUF_SIZE ]; - -extern uint8_t tx_byte; -extern uint8_t tx_byte_idx; - -extern uint8_t ck_a, ck_b; - -#define STX 0x05 - -#define ModemStartMessage(id) \ - { MODEM_PUT_1_BYTE(STX); MODEM_PUT_1_BYTE(id); ck_a = id; ck_b = id; } - -#define ModemEndMessage() \ - { MODEM_PUT_1_BYTE(ck_a); MODEM_PUT_1_BYTE(ck_b); MODEM_CHECK_RUNNING(); } - -#if TX_BUF_SIZE == 256 -#define UPDATE_HEAD() { \ - tx_head++; \ - if (tx_head >= TX_BUF_SIZE) tx_head = 0; \ -} -#else -#define UPDATE_HEAD() { \ - tx_head++; \ -} -#endif - -#define MODEM_CHECK_FREE_SPACE(_space) (tx_head>=tx_tail? _space < (TX_BUF_SIZE - (tx_head - tx_tail)) : _space < (tx_tail - tx_head)) - -#define MODEM_PUT_1_BYTE(_byte) { \ - tx_buf[tx_head] = _byte; \ - UPDATE_HEAD(); \ -} - -#define MODEM_PUT_1_BYTE_BY_ADDR(_byte) { \ - tx_buf[tx_head] = *(_byte); \ - ck_a += *(_byte); \ - ck_b += ck_a; \ - UPDATE_HEAD(); \ -} - -#define MODEM_PUT_2_BYTE_BY_ADDR(_byte) { \ - MODEM_PUT_1_BYTE_BY_ADDR(_byte); \ - MODEM_PUT_1_BYTE_BY_ADDR(_byte+1); \ -} - -#define MODEM_PUT_4_BYTE_BY_ADDR(_byte) { \ - MODEM_PUT_1_BYTE_BY_ADDR(_byte); \ - MODEM_PUT_1_BYTE_BY_ADDR(_byte+1); \ - MODEM_PUT_1_BYTE_BY_ADDR(_byte+2); \ - MODEM_PUT_1_BYTE_BY_ADDR(_byte+3); \ -} - -#define MODEM_LOAD_NEXT_BYTE() { \ - tx_byte = tx_buf[tx_tail]; \ - tx_byte_idx = 0; \ - tx_tail++; \ - if( tx_tail >= TX_BUF_SIZE ) \ - tx_tail = 0; \ -} - - - -#endif // MODEM - -#endif /* MODEM_H */ diff --git a/sw/airborne/arm7/sys_time_hw.h b/sw/airborne/arm7/sys_time_hw.h index 5f62936b3a..bf3238fc13 100644 --- a/sw/airborne/arm7/sys_time_hw.h +++ b/sw/airborne/arm7/sys_time_hw.h @@ -58,8 +58,9 @@ static inline void sys_time_init( void ) { #define SysTicsOfSec(s) (uint32_t)(s * PCLK / T0_PCLK_DIV + 0.5) #define FIFTY_MS SysTicsOfSec( 50e-3 ) +#define AVR_PERIOD_MS SysTicsOfSec( 15.625e-3 ) -#define PERIODIC_TASK_PERIOD FIFTY_MS +#define PERIODIC_TASK_PERIOD AVR_PERIOD_MS static inline bool_t sys_time_periodic( void ) { uint32_t now = T0TC; diff --git a/sw/airborne/arm7/test/Makefile b/sw/airborne/arm7/test/Makefile index 5c378551f6..4480ce7e0f 100644 --- a/sw/airborne/arm7/test/Makefile +++ b/sw/airborne/arm7/test/Makefile @@ -186,8 +186,10 @@ DIRARMBIN = $(DIRARM)/bin/ LPC21ISP = $(DIRARMBIN)/lpc21isp #LPC21ISP = $(DIRARMBIN)/lpc21isp_beta LPC21ISP_PORT = /dev/ttyS0 -LPC21ISP_BAUD = 115200 -LPC21ISP_XTAL = 14746 +#LPC21ISP_BAUD = 115200 +LPC21ISP_BAUD = 38400 +#LPC21ISP_XTAL = 14746 +LPC21ISP_XTAL = 12000 LPC21ISP_FLASHFILE = $(TARGET).hex # verbose output: ## LPC21ISP_DEBUG = -debug diff --git a/sw/airborne/arm7/test/crt0.S b/sw/airborne/arm7/test/crt0.S index d6a5977e2a..f94df25b2b 100644 --- a/sw/airborne/arm7/test/crt0.S +++ b/sw/airborne/arm7/test/crt0.S @@ -1,4 +1,11 @@ - .global main // int main(void) +/* + crt0.S for LPC2xxx + - based on examples from R O Software + - based on examples from newlib-lpc + - based on an example from Anglia Designs + + collected and modified by Martin Thomas +*/ .global _etext // -> .data initial values in ROM .global _data // -> .data area in RAM @@ -6,8 +13,6 @@ .global __bss_start // -> .bss area in RAM .global __bss_end__ // end of .bss area .global _stack // top of stack - - .global irq_dispatcher // Stack Sizes .set UND_STACK_SIZE, 0x00000004 @@ -28,62 +33,10 @@ .equ I_BIT, 0x80 // when I bit is set, IRQ is disabled .equ F_BIT, 0x40 // when F bit is set, FIQ is disabled -#define FOSC 14745600 /* External clock input frequency (must be between 10 MHz and 25 MHz) */ - -#define USE_PLL 1 /* 0 = do not use on-chip PLL, - 1 = use on-chip PLL) */ -#define PLL_MUL 4 /* PLL multiplication factor (1 to 32) */ -#define PLL_DIV 2 /* PLL division factor (1, 2, 4, or 8) */ -#define PBSD 4 /* Peripheral bus speed divider (1, 2, or 4) */ - -/* initialize the MAM (Memory Accelerator Module) */ -#if (FOSC * PLL_MUL) < 20000000 -#define MAM_TIMING 1 /* number of CCLK to read from the FLASH */ -#elif (FOSC * PLL_MUL) < 40000000 -#define MAM_TIMING 2 /* number of CCLK to read from the FLASH */ -#else -#define MAM_TIMING 3 /* number of CCLK to read from the FLASH */ -#endif -#define MAM_SETTING 2 /* 0=disabled, - 1=partly enabled (enabled for code prefetch, but not for data), - 2=fully enabled */ -#define MEM_MAPPING 1 /* 0=Boot loader, - 1=User Flash, - 2=User RAM */ - -#define VAL_PLLCFG_MSEL ((PLL_MUL - 1) << 0) -#if (PLL_DIV == 1) -#define PLL_DIV_VALUE 0x00 -#elif (PLL_DIV == 2) -#define PLL_DIV_VALUE 0x01 -#elif (PLL_DIV == 4) -#define PLL_DIV_VALUE 0x10 -#elif (PLL_DIV == 8) -#define PLL_DIV_VALUE 0x11 -#endif -#define VAL_PLLCFG_PSEL (PLL_DIV_VALUE << 5) -#define VAL_PLLCFG (VAL_PLLCFG_MSEL | VAL_PLLCFG_PSEL) - - -# Phase Locked Loop (PLL) definitions - .equ PLL_BASE, 0xE01FC080 /* PLL Base Address */ - .equ PLLCON_OFS, 0x00 /* PLL Control Offset*/ - .equ PLLCFG_OFS, 0x04 /* PLL Configuration Offset */ - .equ PLLSTAT_OFS, 0x08 /* PLL Status Offset */ - .equ PLLFEED_OFS, 0x0C /* PLL Feed Offset */ - .equ PLLCON_PLLE, (1<<0) /* PLL Enable */ - .equ PLLCON_PLLC, (1<<1) /* PLL Connect */ - .equ PLLSTAT_PLOCK, (1<<10) /* PLL Lock Status */ - .equ MAM_BASE, 0xE01FC000 /* Memory Accelerator Module */ - .equ MAMCR_OFS, 0x00 /* MAM Control */ - .equ MAMTIM_OFS, 0x04 /* MAM Timing */ - .equ MEMMAP_BASE, 0xE01FC040 /* Memory Mapping Base */ - .equ MEMMAP_OFS, 0x00 /* Memory Mapping */ - .equ VIC_BASE, 0xFFFFF000 /* Vector Interrupt Controller */ - .equ VICIRQStats_OFS,0x10 /* IRQ Status Register */ - .equ VICIntEnClr_OFS,0x14 /* VIC Interrupt Enable Clear */ - .text + .arm + .section .init, "ax" + .code 32 .align 2 @@ -100,20 +53,9 @@ Vectors: ldr pc,_pabt // program abort - _pabt ldr pc,_dabt // data abort - _dabt nop // reserved - b irq_handler // IRQ - jump to fct + ldr pc,[pc,#-0xFF0] // IRQ - read the VIC ldr pc,_fiq // FIQ - _fiq -irq_handler: - stmfd sp!,{r0-r12,lr} // save regs r0-r12 and link register - - ldr r1, =VIC_BASE // load IRQ status - ldr r0, [r1, #VICIRQStats_OFS] - bl irq_dispatcher // c-function irq - - ldmfd sp!,{r0-r12,lr} // restore regs and lr - subs pc,lr,#4 - - #if 0 // Use this group for production _undf: .word _reset // undefined - _reset @@ -152,55 +94,6 @@ _start: start: _mainCRTStartup: -#if (USE_PLL == 1) - LDR R0, =PLL_BASE - MOV R1, #0xAA - MOV R2, #0x55 - -# Disable PLL before programming - MOV R3,#0 - STR R3, [R0, #PLLCON_OFS] - STR R1, [R0, #PLLFEED_OFS] - STR R2, [R0, #PLLFEED_OFS] - -# Configure and Enable PLL - MOV R3, #VAL_PLLCFG - STR R3, [R0, #PLLCFG_OFS] - MOV R3, #PLLCON_PLLE - STR R3, [R0, #PLLCON_OFS] - STR R1, [R0, #PLLFEED_OFS] - STR R2, [R0, #PLLFEED_OFS] - -# Wait until PLL Locked -PLL_Loop: LDR R3, [R0, #PLLSTAT_OFS] - ANDS R3, R3, #PLLSTAT_PLOCK - BEQ PLL_Loop - -# Switch to PLL Clock - MOV R3, #(PLLCON_PLLE | PLLCON_PLLC) - STR R3, [R0, #PLLCON_OFS] - STR R1, [R0, #PLLFEED_OFS] - STR R2, [R0, #PLLFEED_OFS] -#endif - // switch on MAM - ldr R0, =MAM_BASE - mov R1, #MAM_TIMING - mov R2, #MAM_SETTING - str R1, [R0, #MAMTIM_OFS] - str R2, [R0, #MAMCR_OFS] - - // set interrupt table location - ldr R0, =MEMMAP_BASE - mov R1, #MEM_MAPPING - str R1, [R0, #MEMMAP_OFS] - - // turn off interrupts - ldr R0, =VIC_BASE - mov R1, #0xFFFFFFFF - str R1, [R0, #VICIntEnClr_OFS] - - - // Initialize Interrupt System // - Set stack location for each mode // - Leave in System Mode with Interrupts Disabled @@ -263,11 +156,6 @@ ctor_loop: B ctor_loop ctor_end: -enable_irq: - mrs r0,CPSR // get current CPSR - bic r0,r0,#I_BIT // clear I bit, normal interrupts enabled - msr CPSR_c,r0 // write CPSR - // Call main program: main(0) // -------------------------- mov r0,#0 // no arguments (argc = 0) @@ -277,10 +165,27 @@ enable_irq: mov r7,r0 // null frame pointer for thumb ldr r10,=main mov lr,pc + +/* Enter the C code, use BX instruction so as to never return */ +/* use BLX (?) main if you want to use c++ destructors below */ + bx r10 // enter main() /* "global object"-dtors are never called and it should not be needed since there is no OS to exit to. */ +/* Call destructors */ +# LDR r0, =__dtors_start__ +# LDR r1, =__dtors_end__ +dtor_loop: +# CMP r0, r1 +# BEQ dtor_end +# LDR r2, [r0], #4 +# STMFD sp!, {r0-r1} +# MOV lr, pc +# MOV pc, r2 +# LDMFD sp!, {r0-r1} +# B dtor_loop +dtor_end: .size _start, . - _start .endfunc diff --git a/sw/airborne/arm7/uart.c b/sw/airborne/arm7/uart.c index cd089f8eb1..e8e6de5cfe 100644 --- a/sw/airborne/arm7/uart.c +++ b/sw/airborne/arm7/uart.c @@ -380,8 +380,8 @@ void uart1Init(uint16_t baud, uint8_t mode, uint8_t fmode) // initialize the interrupt vector VICIntSelect &= ~VIC_BIT(VIC_UART1); // UART1 selected as IRQ VICIntEnable = VIC_BIT(VIC_UART1); // UART1 interrupt enabled - VICVectCntl1 = VIC_ENABLE | VIC_UART1; - VICVectAddr1 = (uint32_t)uart1ISR; // address of the ISR + VICVectCntl2 = VIC_ENABLE | VIC_UART1; + VICVectAddr2 = (uint32_t)uart1ISR; // address of the ISR #ifdef UART1_TX_INT_MODE uart1_tx_extract_idx = uart1_tx_insert_idx = 0; diff --git a/sw/airborne/downlink.h b/sw/airborne/downlink.h index 0ccc53be78..265b9bf80e 100644 --- a/sw/airborne/downlink.h +++ b/sw/airborne/downlink.h @@ -43,8 +43,13 @@ #define PERIODIC_SEND_BAT() Downlink({ int16_t e = energy; DOWNLINK_SEND_BAT(&desired_gaz, &vsupply, &estimator_flight_time, &low_battery, &block_time, &stage_time, &e); }) -#define PERIODIC_SEND_DEBUG() DOWNLINK_SEND_DEBUG(&link_fbw_nb_err, &link_fbw_fbw_nb_err, &modem_nb_ovrn, &gps_nb_ovrn, &mcu1_ppm_cpt); +#ifdef MCU_SPI_LINK +#define PERIODIC_SEND_DEBUG_MCU_LINK() DOWNLINK_SEND_DEBUG_MCU_LINK(&link_fbw_nb_err, &link_fbw_fbw_nb_err, &mcu1_ppm_cpt); +#else +#define PERIODIC_SEND_DEBUG_MCU_LINK() {} +#endif +#define PERIODIC_SEND_DEBUG_MODEM() DOWNLINK_SEND_DEBUG_MODEM(&modem_nb_ovrn) #define PERIODIC_SEND_ATTITUDE() Downlink({ \ int8_t phi = DegOfRad(estimator_phi); \ int8_t psi = DegOfRad(estimator_psi); \ @@ -52,7 +57,6 @@ DOWNLINK_SEND_ATTITUDE(&phi, &psi, &theta); \ }) -#define PERIODIC_SEND_ADC() DOWNLINK_SEND_ADC(&ir_roll, &ir_pitch); #define PERIODIC_SEND_PPRZ_MODE() DOWNLINK_SEND_PPRZ_MODE(&pprz_mode, &vertical_mode, &lateral_mode, &horizontal_mode, &inflight_calib_mode, &mcu1_status, &ir_estim_mode); #define PERIODIC_SEND_DESIRED() DOWNLINK_SEND_DESIRED(&desired_roll, &desired_pitch, &desired_x, &desired_y, &desired_altitude, &desired_climb); @@ -73,7 +77,17 @@ #define PERIODIC_SEND_SETTINGS() {} #endif +#ifdef INFRARED +#define PERIODIC_SEND_ADC() DOWNLINK_SEND_ADC(&ir_roll, &ir_pitch); #define SEND_RAD_OF_IR() Downlink({ int16_t rad = DeciDegOfRad(estimator_rad); DOWNLINK_SEND_RAD_OF_IR(&ir_roll, &rad, &estimator_rad_of_ir);}) +#define PERIODIC_SEND_CALIB_START() if (!estimator_flight_time && calib_status == WAITING_CALIB_CONTRAST) { DOWNLINK_SEND_CALIB_START(); } +#define PERIODIC_SEND_CALIB_CONTRAST() if (!estimator_flight_time && calib_status == CALIB_DONE) { DOWNLINK_SEND_CALIB_CONTRAST(&ir_contrast); } +#else +#define PERIODIC_SEND_ADC() {} +#define SEND_RAD_OF_IR() {} +#define PERIODIC_SEND_CALIB_START() {} +#define PERIODIC_SEND_CALIB_CONTRAST() {} +#endif #define PERIODIC_SEND_CALIBRATION() DOWNLINK_SEND_CALIBRATION(&climb_sum_err, &climb_pgain, &course_pgain) @@ -81,10 +95,6 @@ #define PERIODIC_SEND_SEGMENT() if (in_segment) { DOWNLINK_SEND_SEGMENT(&segment_x_1, &segment_y_1, &segment_x_2, &segment_y_2); } -#define PERIODIC_SEND_CALIB_START() if (!estimator_flight_time && calib_status == WAITING_CALIB_CONTRAST) { DOWNLINK_SEND_CALIB_START(); } - -#define PERIODIC_SEND_CALIB_CONTRAST() if (!estimator_flight_time && calib_status == CALIB_DONE) { DOWNLINK_SEND_CALIB_CONTRAST(&ir_contrast); } - #ifdef IMU_ANALOG #define PERIODIC_SEND_IMU() { int16_t dummy = 42; DOWNLINK_SEND_IMU(&(from_fbw.euler_dot[0]), &(from_fbw.euler_dot[1]), &(from_fbw.euler_dot[2]), &dummy, &dummy, &dummy); } #else diff --git a/sw/airborne/gps.c b/sw/airborne/gps.c index cb0c81361b..aa92d6ccd3 100644 --- a/sw/airborne/gps.c +++ b/sw/airborne/gps.c @@ -60,7 +60,7 @@ void estimator_update_state_gps( void ) { * \a DOWNLINK_SEND_TAKEOFF */ void use_gps_pos( void ) { - DOWNLINK_SEND_GPS(&gps_mode, &gps_utm_east, &gps_utm_north, &gps_course, &gps_alt, &gps_gspeed,&gps_climb, &gps_itow, &gps_utm_zone); + DOWNLINK_SEND_GPS(&gps_mode, &gps_utm_east, &gps_utm_north, &gps_course, &gps_alt, &gps_gspeed,&gps_climb, &gps_itow, &gps_utm_zone, &gps_nb_ovrn); if (GPS_FIX_VALID(gps_mode)) { last_gps_msg_t = cputime; estimator_update_state_gps(); diff --git a/sw/airborne/if_calib.c b/sw/airborne/if_calib.c index 3b7e2ff794..7ca5ebf166 100644 --- a/sw/airborne/if_calib.c +++ b/sw/airborne/if_calib.c @@ -41,8 +41,6 @@ -uint8_t inflight_calib_mode = IF_CALIB_MODE_NONE; - #include "estimator.h" /** Includes generated code from airframe.xml */ diff --git a/sw/airborne/main_ap.c b/sw/airborne/main_ap.c index 45378633d4..f1c25a6f9c 100644 --- a/sw/airborne/main_ap.c +++ b/sw/airborne/main_ap.c @@ -58,6 +58,9 @@ #endif +uint8_t inflight_calib_mode = IF_CALIB_MODE_NONE; + + // // // FIXME estimator_flight_time should not be manipuled here anymore @@ -205,7 +208,7 @@ uint8_t ac_ident = AC_ID; /** \brief Send a serie of initialisation messages followed by a stream of periodic ones * - * Called at 20Hz. + * Called at 10Hz. */ static inline void reporting_task( void ) { static uint8_t boot = TRUE; @@ -219,7 +222,9 @@ static inline void reporting_task( void ) { } /** then report periodicly */ else { + IO1CLR = LED_2_BIT; PeriodicSend(); + IO1SET = LED_2_BIT; } } @@ -283,7 +288,7 @@ inline void telecommand_task( void ) { * \brief Compute desired_course */ static void navigation_task( void ) { -#ifdef FAILSAFE_DELAY_WITHOUT_GPS +#if defined GPS && defined FAILSAFE_DELAY_WITHOUT_GPS /** This section is used for the failsafe of GPS */ static uint8_t last_pprz_mode; static bool_t has_lost_gps = FALSE; @@ -307,7 +312,7 @@ static void navigation_task( void ) { has_lost_gps = FALSE; PERIODIC_SEND_PPRZ_MODE(); } -#endif /* FAILSAFE_DELAY_WITHOUT_GPS */ +#endif /* GPS && FAILSAFE_DELAY_WITHOUT_GPS */ /** Default to keep compatibility with previous behaviour */ lateral_mode = LATERAL_MODE_COURSE; diff --git a/sw/airborne/mainloop.c b/sw/airborne/mainloop.c index 1ec6737a48..25024881e3 100644 --- a/sw/airborne/mainloop.c +++ b/sw/airborne/mainloop.c @@ -136,12 +136,10 @@ void event_task_ap( void ) { #ifdef GPS if (GpsBuffer()) { ReadGpsBuffer(); -#ifdef DEBUG_ARM7 - if (IO1PIN & LED_2_BIT) - IO1CLR = LED_2_BIT; - else - IO1SET = LED_2_BIT; -#endif + /* if (IO1PIN & LED_2_BIT) */ + /* IO1CLR = LED_2_BIT; */ + /* else */ + /* IO1SET = LED_2_BIT; */ } if (gps_msg_received) { /* parse and use GPS messages */ diff --git a/sw/airborne/modem.h b/sw/airborne/modem.h index 8d043b10cc..0549e51e43 100644 --- a/sw/airborne/modem.h +++ b/sw/airborne/modem.h @@ -73,8 +73,9 @@ extern uint8_t ck_a, ck_b; } #define MODEM_PUT_1_BYTE_BY_ADDR(_byte) { \ - tx_buf[tx_head] = *(_byte); \ - ck_a += *(_byte); \ + uint8_t _x = *(_byte); \ + tx_buf[tx_head] = _x; \ + ck_a += _x; \ ck_b += ck_a; \ UPDATE_HEAD(); \ } diff --git a/sw/tools/gen_messages.ml b/sw/tools/gen_messages.ml index 216c2c1edf..b056d2f95c 100644 --- a/sw/tools/gen_messages.ml +++ b/sw/tools/gen_messages.ml @@ -131,7 +131,7 @@ module Gen_onboard = struct let print_avr_field = fun avr_h (t, name, (_f:format option)) -> match t with Basic _ -> - fprintf avr_h "\t MODEM_PUT_%d_BYTE_BY_ADDR((uint8_t*)(%s)); \\\n" (sizeof t) name + fprintf avr_h "\t MODEM_PUT_%d_BYTE_BY_ADDR((const uint8_t*)(%s)); \\\n" (sizeof t) name | Array (t, i) -> let s = sizeof (Basic t) in fprintf avr_h "\t {\\\n\t int i;\\\n\t for(i = 0; i < %d; i++) {\\\n" i;