diff --git a/conf/airframes/CDW/ChimuLisaFw.xml b/conf/airframes/CDW/ChimuLisaFw.xml index 812d8ed402..3c7ed0971c 100644 --- a/conf/airframes/CDW/ChimuLisaFw.xml +++ b/conf/airframes/CDW/ChimuLisaFw.xml @@ -158,8 +158,8 @@ - - + +
@@ -194,7 +194,7 @@ - diff --git a/conf/airframes/CDW/ChimuTinyFw.xml b/conf/airframes/CDW/ChimuTinyFw.xml index d1d6271509..c7bddb800d 100644 --- a/conf/airframes/CDW/ChimuTinyFw.xml +++ b/conf/airframes/CDW/ChimuTinyFw.xml @@ -1,6 +1,6 @@ - diff --git a/conf/airframes/CDW/ChimuTinyFwSpi.xml b/conf/airframes/CDW/ChimuTinyFwSpi.xml index 6d10394322..43e48e551d 100644 --- a/conf/airframes/CDW/ChimuTinyFwSpi.xml +++ b/conf/airframes/CDW/ChimuTinyFwSpi.xml @@ -1,6 +1,6 @@ - diff --git a/conf/airframes/CDW/LisaFw.xml b/conf/airframes/CDW/LisaFw.xml index 37cb8df3ea..2c667efd6c 100644 --- a/conf/airframes/CDW/LisaFw.xml +++ b/conf/airframes/CDW/LisaFw.xml @@ -36,7 +36,7 @@ - + @@ -74,13 +74,13 @@
- - + + - +
@@ -88,7 +88,7 @@
- +
@@ -100,7 +100,7 @@
- +
diff --git a/conf/airframes/CDW/TinyFw.xml b/conf/airframes/CDW/TinyFw.xml index 31523ce721..c6cc4ae453 100644 --- a/conf/airframes/CDW/TinyFw.xml +++ b/conf/airframes/CDW/TinyFw.xml @@ -34,7 +34,7 @@ - + @@ -69,13 +69,13 @@
- - + + - +
@@ -83,7 +83,7 @@
- +
@@ -95,7 +95,7 @@
- +
diff --git a/conf/airframes/ENAC/fixed-wing/firestorm.xml b/conf/airframes/ENAC/fixed-wing/firestorm.xml index 124a14b520..2e128397b7 100644 --- a/conf/airframes/ENAC/fixed-wing/firestorm.xml +++ b/conf/airframes/ENAC/fixed-wing/firestorm.xml @@ -42,7 +42,7 @@ - + @@ -61,7 +61,7 @@ - +
@@ -90,13 +90,13 @@
- - + + - +
@@ -106,7 +106,7 @@
- +
@@ -120,7 +120,7 @@
- +
@@ -204,7 +204,7 @@
- + CONFIG = \"tiny_1_1.h\" @@ -222,13 +222,13 @@ ap.CFLAGS += -DACTUATORS=\"servos_4015_MAT_hw.h\" -DSERVOS_4015_MAT ap.srcs += $(SRC_ARCH)/servos_4015_MAT_hw.c actuators.c ap.CFLAGS += -DRADIO_CONTROL -ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c +ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c ap.CFLAGS += -DDOWNLINK -DUSE_UART0 -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_FBW_DEVICE=Uart0 -DDOWNLINK_AP_DEVICE=Uart0 -DPPRZ_UART=Uart0 -DDATALINK=PPRZ -DUART0_BAUD=B9600 ap.srcs += downlink.c $(SRC_ARCH)/mcu_periph/uart_arch.c datalink.c pprz_transport.c ap.CFLAGS += -DINTER_MCU -ap.srcs += inter_mcu.c +ap.srcs += inter_mcu.c ap.CFLAGS += -DADC -DUSE_ADC_0 -DUSE_ADC_1 -DUSE_ADC_2 -DUSE_ADC_3 ap.srcs += $(SRC_ARCH)/adc_hw.c diff --git a/conf/airframes/ENAC/fixed-wing/funjet1.xml b/conf/airframes/ENAC/fixed-wing/funjet1.xml index 47d29560c7..0eab718515 100644 --- a/conf/airframes/ENAC/fixed-wing/funjet1.xml +++ b/conf/airframes/ENAC/fixed-wing/funjet1.xml @@ -42,7 +42,7 @@ - + @@ -60,7 +60,7 @@ - +
@@ -90,13 +90,13 @@
- - + + - +
@@ -104,7 +104,7 @@
- +
@@ -121,7 +121,7 @@
- +
@@ -241,7 +241,7 @@ ap.CFLAGS += -DACTUATORS=\"servos_4017_hw.h\" -DSERVOS_4017 ap.srcs += $(SRC_ARCH)/servos_4017_hw.c actuators.c ap.CFLAGS += -DRADIO_CONTROL -ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c +ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c #ap.CFLAGS += -DDOWNLINK -DUSE_UART1 -DDOWNLINK_TRANSPORT=XBeeTransport -DXBEE_UART=Uart1 -DDATALINK=XBEE -DUART1_BAUD=B9600 #ap.srcs += downlink.c $(SRC_ARCH)/mcu_periph/uart_arch.c datalink.c xbee.c @@ -252,7 +252,7 @@ ap.srcs += downlink.c $(SRC_ARCH)/mcu_periph/uart_arch.c datalink.c pprz_transpo ap.CFLAGS += -DINTER_MCU -ap.srcs += inter_mcu.c +ap.srcs += inter_mcu.c ap.CFLAGS += -DADC -DUSE_ADC_0 -DUSE_ADC_1 -DUSE_ADC_2 -DUSE_ADC_3 ap.srcs += $(SRC_ARCH)/adc_hw.c @@ -290,7 +290,7 @@ ap.srcs += subsystems/navigation/nav_survey_rectangle.c ap.CFLAGS += -DUSE_MODULES sim.CFLAGS += -DUSE_MODULES -# for infrared +# for infrared ap.srcs += i2c.c $(SRC_ARCH)/i2c_hw.c ap.CFLAGS += -DUSE_I2C0 -DI2C0_SCLL=150 -DI2C0_SCLH=150 @@ -314,7 +314,7 @@ sim.srcs += subsystems/navigation/nav_line.c subsystems/navigation/nav_survey_re -# a test program to setup actuators +# a test program to setup actuators setup_actuators.ARCHDIR = $(ARCHI) setup_actuators.CFLAGS += -DFBW -DBOARD_CONFIG=\"tiny.h\" -DUSE_LED -DTIME_LED=1 -DACTUATORS=\"servos_4015_hw.h\" -DSERVOS_4015 -DUSE_UART1 -DUART1_BAUD=B9600 -DDATALINK=PPRZ -DPPRZ_UART=Uart1 diff --git a/conf/airframes/ENAC/fixed-wing/funjet2.xml b/conf/airframes/ENAC/fixed-wing/funjet2.xml index b1b5b3861d..427e89f074 100644 --- a/conf/airframes/ENAC/fixed-wing/funjet2.xml +++ b/conf/airframes/ENAC/fixed-wing/funjet2.xml @@ -128,7 +128,7 @@ - +
@@ -146,7 +146,7 @@ - +
diff --git a/conf/airframes/ENAC/fixed-wing/funjet2_nc.xml b/conf/airframes/ENAC/fixed-wing/funjet2_nc.xml index c7e177da46..18931347d0 100644 --- a/conf/airframes/ENAC/fixed-wing/funjet2_nc.xml +++ b/conf/airframes/ENAC/fixed-wing/funjet2_nc.xml @@ -126,7 +126,7 @@ - +
@@ -144,7 +144,7 @@ - +
diff --git a/conf/airframes/ENAC/fixed-wing/funjet2_new.xml b/conf/airframes/ENAC/fixed-wing/funjet2_new.xml index f1edbb278c..49fa555e8d 100644 --- a/conf/airframes/ENAC/fixed-wing/funjet2_new.xml +++ b/conf/airframes/ENAC/fixed-wing/funjet2_new.xml @@ -126,7 +126,7 @@ - +
@@ -144,7 +144,7 @@ - +
diff --git a/conf/airframes/ENAC/fixed-wing/funjet3.xml b/conf/airframes/ENAC/fixed-wing/funjet3.xml index 40fe027ca5..b3b3f1dc30 100644 --- a/conf/airframes/ENAC/fixed-wing/funjet3.xml +++ b/conf/airframes/ENAC/fixed-wing/funjet3.xml @@ -115,7 +115,7 @@ - +
diff --git a/conf/airframes/ENAC/fixed-wing/merlin.xml b/conf/airframes/ENAC/fixed-wing/merlin.xml index 17d65550e7..4490c38600 100644 --- a/conf/airframes/ENAC/fixed-wing/merlin.xml +++ b/conf/airframes/ENAC/fixed-wing/merlin.xml @@ -97,9 +97,9 @@ - +
- +
@@ -117,7 +117,7 @@
- + diff --git a/conf/airframes/ENAC/fixed-wing/minimag1.xml b/conf/airframes/ENAC/fixed-wing/minimag1.xml index 4235bd68c9..75e1f04b74 100644 --- a/conf/airframes/ENAC/fixed-wing/minimag1.xml +++ b/conf/airframes/ENAC/fixed-wing/minimag1.xml @@ -116,7 +116,7 @@
- +
@@ -129,7 +129,7 @@
- +
@@ -193,6 +193,6 @@
- + diff --git a/conf/airframes/ENAC/fixed-wing/slayer2.xml b/conf/airframes/ENAC/fixed-wing/slayer2.xml index 5be6b30153..70068d7f41 100644 --- a/conf/airframes/ENAC/fixed-wing/slayer2.xml +++ b/conf/airframes/ENAC/fixed-wing/slayer2.xml @@ -35,7 +35,7 @@ - + @@ -81,11 +81,11 @@
- - +
@@ -93,7 +93,7 @@
- +
@@ -154,7 +154,7 @@ - + @@ -210,7 +210,7 @@ ap.CFLAGS += -DACTUATORS=\"servos_4015_MAT_hw.h\" -DSERVOS_4015_MAT ap.srcs += $(SRC_ARCH)/servos_4015_MAT_hw.c actuators.c ap.CFLAGS += -DRADIO_CONTROL -ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c +ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c #ap.CFLAGS += -DDOWNLINK -DUSE_UART0 -DDOWNLINK_TRANSPORT=XBeeTransport -DDOWNLINK_FBW_DEVICE=Uart0 -DDOWNLINK_AP_DEVICE=Uart0 -DXBEE_UART=Uart0 -DDATALINK=XBEE -DUART0_BAUD=B9600 #ap.srcs += downlink.c $(SRC_ARCH)/mcu_periph/uart_arch.c datalink.c xbee.c @@ -225,7 +225,7 @@ ap.srcs += downlink.c $(SRC_ARCH)/mcu_periph/uart_arch.c datalink.c pprz_transpo ap.CFLAGS += -DINTER_MCU -ap.srcs += inter_mcu.c +ap.srcs += inter_mcu.c ap.CFLAGS += -DADC -DUSE_ADC_0 -DUSE_ADC_1 -DUSE_ADC_4 -DUSE_ADC_5 -DUSE_ADC_6 ap.srcs += $(SRC_ARCH)/adc_hw.c @@ -274,9 +274,9 @@ sim.ARCHDIR = $(ARCHI) sim.CFLAGS += -DSITL -DAP -DFBW -DRADIO_CONTROL -DINTER_MCU -DDOWNLINK -DDOWNLINK_TRANSPORT=IvyTransport -DUSE_INFRARED -DNAV -DUSE_LED -DWIND_INFO sim.srcs = latlong.c radio_control.c downlink.c commands.c gps.c inter_mcu.c infrared.c fw_v_ctl.c subsystems/nav.c estimator.c sys_time.c main_fbw.c main_ap.c datalink.c $(SRC_ARCH)/ppm_hw.c $(SRC_ARCH)/sim_gps.c $(SRC_ARCH)/sim_ir.c $(SRC_ARCH)/sim_ap.c $(SRC_ARCH)/ivy_transport.c $(SRC_ARCH)/sim_adc_generic.c $(SRC_ARCH)/led_hw.c -sim.CFLAGS += -DBOARD_CONFIG=\"tiny.h\" -DAGR_CLIMB -DLOITER_TRIM -DALT_KALMAN -DUSE_BARO_MS5534A +sim.CFLAGS += -DBOARD_CONFIG=\"tiny.h\" -DAGR_CLIMB -DLOITER_TRIM -DALT_KALMAN -DUSE_BARO_MS5534A -sim.srcs += subsystems/navigation/nav_survey_rectangle.c subsystems/navigation/nav_line.c $(SRC_ARCH)/sim_baro.c +sim.srcs += subsystems/navigation/nav_survey_rectangle.c subsystems/navigation/nav_line.c $(SRC_ARCH)/sim_baro.c sim.srcs += fw_h_ctl.c # sim.srcs += fw_h_ctl_a.c diff --git a/conf/airframes/ENAC/fixed-wing/soarzi.xml b/conf/airframes/ENAC/fixed-wing/soarzi.xml index e0cf78c35f..ab7f242bbe 100644 --- a/conf/airframes/ENAC/fixed-wing/soarzi.xml +++ b/conf/airframes/ENAC/fixed-wing/soarzi.xml @@ -92,7 +92,7 @@
- +
@@ -105,7 +105,7 @@
- +
@@ -147,7 +147,7 @@ - +
@@ -188,7 +188,7 @@ ap.CFLAGS += -DACTUATORS=\"servos_4015_MAT_hw.h\" -DSERVOS_4015_MAT ap.srcs += $(SRC_ARCH)/servos_4015_MAT_hw.c actuators.c ap.CFLAGS += -DRADIO_CONTROL -ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c +ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c #XBEE ap.CFLAGS += -DDOWNLINK -DUSE_UART0 -DDOWNLINK_TRANSPORT=XBeeTransport -DDOWNLINK_FBW_DEVICE=Uart0 -DDOWNLINK_AP_DEVICE=Uart0 -DXBEE_UART=Uart0 -DDATALINK=XBEE -DUART0_BAUD=B9600 #XBEE ap.srcs += downlink.c $(SRC_ARCH)/mcu_periph/uart_arch.c datalink.c xbee.c @@ -198,7 +198,7 @@ ap.srcs += downlink.c $(SRC_ARCH)/mcu_periph/uart_arch.c datalink.c pprz_transpo ap.CFLAGS += -DINTER_MCU -ap.srcs += inter_mcu.c +ap.srcs += inter_mcu.c ap.CFLAGS += -DADC -DUSE_ADC_0 -DUSE_ADC_1 -DUSE_ADC_4 ap.srcs += $(SRC_ARCH)/adc_hw.c diff --git a/conf/airframes/ENAC/fixed-wing/solarstorm.xml b/conf/airframes/ENAC/fixed-wing/solarstorm.xml index ec953714e9..dbec277f60 100644 --- a/conf/airframes/ENAC/fixed-wing/solarstorm.xml +++ b/conf/airframes/ENAC/fixed-wing/solarstorm.xml @@ -42,7 +42,7 @@ - + @@ -60,7 +60,7 @@ - +
@@ -93,13 +93,13 @@ - +
- +
@@ -113,7 +113,7 @@
- +
@@ -197,7 +197,7 @@
- + CONFIG = \"tiny_1_1.h\" @@ -215,13 +215,13 @@ ap.CFLAGS += -DACTUATORS=\"servos_4015_MAT_hw.h\" -DSERVOS_4015_MAT ap.srcs += $(SRC_ARCH)/servos_4015_MAT_hw.c actuators.c ap.CFLAGS += -DRADIO_CONTROL -ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c +ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c ap.CFLAGS += -DDOWNLINK -DUSE_UART0 -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_FBW_DEVICE=Uart0 -DDOWNLINK_AP_DEVICE=Uart0 -DPPRZ_UART=Uart0 -DDATALINK=PPRZ -DUART0_BAUD=B9600 ap.srcs += downlink.c $(SRC_ARCH)/mcu_periph/uart_arch.c datalink.c pprz_transport.c ap.CFLAGS += -DINTER_MCU -ap.srcs += inter_mcu.c +ap.srcs += inter_mcu.c ap.CFLAGS += -DADC -DUSE_ADC_0 -DUSE_ADC_1 -DUSE_ADC_2 -DUSE_ADC_3 ap.srcs += $(SRC_ARCH)/adc_hw.c diff --git a/conf/airframes/ENAC/fixed-wing/spocII.xml b/conf/airframes/ENAC/fixed-wing/spocII.xml index 675df4be66..5aad0acf1f 100644 --- a/conf/airframes/ENAC/fixed-wing/spocII.xml +++ b/conf/airframes/ENAC/fixed-wing/spocII.xml @@ -54,7 +54,7 @@ - + @@ -82,13 +82,13 @@
- - + + - +
@@ -98,7 +98,7 @@
- +
@@ -115,7 +115,7 @@
- +
@@ -221,14 +221,14 @@ ap.CFLAGS += -DACTUATORS=\"servos_4017_hw.h\" -DSERVOS_4017 ap.srcs += $(SRC_ARCH)/servos_4017_hw.c actuators.c ap.CFLAGS += -DRADIO_CONTROL -ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c +ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c #TRANSPARENT ap.CFLAGS += -DDOWNLINK -DUSE_UART1 -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_FBW_DEVICE=Uart1 -DDOWNLINK_AP_DEVICE=Uart1 -DPPRZ_UART=Uart1 -DDATALINK=PPRZ -DUART1_BAUD=B57600 ap.srcs += downlink.c $(SRC_ARCH)/mcu_periph/uart_arch.c datalink.c pprz_transport.c ap.CFLAGS += -DINTER_MCU -ap.srcs += inter_mcu.c +ap.srcs += inter_mcu.c ap.CFLAGS += -DADC -DUSE_ADC_0 -DUSE_ADC_1 -DUSE_ADC_2 -DUSE_ADC_5 ap.srcs += $(SRC_ARCH)/adc_hw.c @@ -271,7 +271,7 @@ jsbsim.srcs += subsystems/navigation/nav_line.c subsystems/navigation/nav_survey jsbsim.srcs += $(SIMDIR)/sim_ac_fw.c -# a test program to setup actuators +# a test program to setup actuators setup_actuators.ARCHDIR = $(ARCHI) setup_actuators.CFLAGS += -DFBW -DBOARD_CONFIG=\"tiny.h\" -DUSE_LED -DTIME_LED=1 -DACTUATORS=\"servos_4015_hw.h\" -DSERVOS_4015 -DUSE_UART1 -DUART1_BAUD=B9600 -DDATALINK=PPRZ -DPPRZ_UART=Uart1 diff --git a/conf/airframes/ENAC/fixed-wing/spocIII-1.xml b/conf/airframes/ENAC/fixed-wing/spocIII-1.xml index f1ed87e6be..7787074007 100644 --- a/conf/airframes/ENAC/fixed-wing/spocIII-1.xml +++ b/conf/airframes/ENAC/fixed-wing/spocIII-1.xml @@ -99,7 +99,7 @@
- +
@@ -117,7 +117,7 @@
- +
diff --git a/conf/airframes/ENAC/fixed-wing/spocIII-2.xml b/conf/airframes/ENAC/fixed-wing/spocIII-2.xml index 4332ecacd8..d5408ba0ae 100644 --- a/conf/airframes/ENAC/fixed-wing/spocIII-2.xml +++ b/conf/airframes/ENAC/fixed-wing/spocIII-2.xml @@ -103,7 +103,7 @@
- +
@@ -121,7 +121,7 @@
- +
diff --git a/conf/airframes/ENAC/fixed-wing/spocIII-3.xml b/conf/airframes/ENAC/fixed-wing/spocIII-3.xml index cfc617b9a1..69bf25864c 100644 --- a/conf/airframes/ENAC/fixed-wing/spocIII-3.xml +++ b/conf/airframes/ENAC/fixed-wing/spocIII-3.xml @@ -106,7 +106,7 @@
- +
@@ -124,7 +124,7 @@
- +
diff --git a/conf/airframes/ENAC/fixed-wing/twinjet2.xml b/conf/airframes/ENAC/fixed-wing/twinjet2.xml index c4881fe2b3..c567c58b5b 100644 --- a/conf/airframes/ENAC/fixed-wing/twinjet2.xml +++ b/conf/airframes/ENAC/fixed-wing/twinjet2.xml @@ -111,7 +111,7 @@
- +
@@ -126,7 +126,7 @@
- +
@@ -229,7 +229,7 @@ ap.CFLAGS += -DFBW -DAP -DBOARD_CONFIG=$(CONFIG) -DUSE_LED -DTIME_LED=1 ap.srcs = sys_time.c $(SRC_ARCH)/sys_time_hw.c $(SRC_ARCH)/armVIC.c main_fbw.c main_ap.c main.c ap.CFLAGS += -DINTER_MCU -ap.srcs += inter_mcu.c +ap.srcs += inter_mcu.c ap.srcs += commands.c @@ -238,7 +238,7 @@ ap.CFLAGS += -DACTUATORS=\"servos_4017_hw.h\" -DSERVOS_4017 ap.srcs += $(SRC_ARCH)/servos_4017_hw.c actuators.c ap.CFLAGS += -DRADIO_CONTROL -ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c +ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c ########## Modems ap.CFLAGS += -DDOWNLINK -DUSE_UART1 -DDOWNLINK_TRANSPORT=XBeeTransport -DXBEE_UART=Uart1 -DDATALINK=XBEE -DUART1_BAUD=B57600 @@ -288,7 +288,7 @@ ap.CFLAGS += -DUSE_LIGHT ap.srcs += light.c ########## Max3100 -ap.CFLAGS += -DMAX3100_BAUD_RATE=MAX3100_B9600 +ap.CFLAGS += -DMAX3100_BAUD_RATE=MAX3100_B9600 ap.CFLAGS += -DGCS_NUMBER=\"+33640286530\" diff --git a/conf/airframes/ENAC/malolo_sim.xml b/conf/airframes/ENAC/malolo_sim.xml index 47b1da3cd3..4d8c4f4cde 100644 --- a/conf/airframes/ENAC/malolo_sim.xml +++ b/conf/airframes/ENAC/malolo_sim.xml @@ -34,7 +34,7 @@ - + @@ -52,7 +52,7 @@ - +
@@ -80,20 +80,20 @@
- - + + - +
- +
@@ -108,7 +108,7 @@
- +
@@ -152,7 +152,7 @@ - + @@ -193,7 +193,7 @@
- + - + @@ -138,7 +138,7 @@ - +
@@ -183,7 +183,7 @@
- +
@@ -193,7 +193,7 @@
- + include $(PAPARAZZI_SRC)/conf/autopilot/tiny.makefile @@ -208,13 +208,13 @@ ap.CFLAGS += -DACTUATORS=\"servos_4015_MAT_hw.h\" -DSERVOS_4015_MAT ap.srcs += $(SRC_ARCH)/servos_4015_MAT_hw.c actuators.c ap.CFLAGS += -DRADIO_CONTROL -DRADIO_CONTROL_TYPE=RC_FUTABA -ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c +ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c ap.CFLAGS += -DDOWNLINK -DUSE_UART0 -DDOWNLINK_TRANSPORT=XBeeTransport -DDOWNLINK_FBW_DEVICE=Uart0 -DDOWNLINK_AP_DEVICE=Uart0 -DXBEE_UART=Uart0 -DDATALINK=XBEE -DUART0_BAUD=B57600 ap.srcs += downlink.c $(SRC_ARCH)/uart_hw.c datalink.c xbee.c ap.CFLAGS += -DINTER_MCU -ap.srcs += inter_mcu.c +ap.srcs += inter_mcu.c ap.CFLAGS += -DADC -DUSE_ADC_0 -DUSE_ADC_1 -DUSE_ADC_2 ap.srcs += $(SRC_ARCH)/adc_hw.c @@ -227,7 +227,7 @@ ap.CFLAGS += -DINFRARED -DALT_KALMAN ap.srcs += infrared.c estimator.c ap.CFLAGS += -DNAV -DAGR_CLIMB -DLOITER_TRIM -ap.srcs += nav.c fw_h_ctl.c fw_v_ctl.c nav_survey_rectangle.c nav_line.c +ap.srcs += nav.c fw_h_ctl.c fw_v_ctl.c nav_survey_rectangle.c nav_line.c # Hack to use the same tuning file than slayer1 #�ap.CFLAGS += -DUSE_GPIO @@ -250,18 +250,18 @@ ap.srcs += tcas.c # Losange Cartography with Onboard Camera ap.CFLAGS += -DUSE_ONBOARD_CAMERA -ap.srcs +=nav_survey_losange_carto.c +ap.srcs +=nav_survey_losange_carto.c + - ################################################################################################# # Config for SITL simulation include $(PAPARAZZI_SRC)/conf/autopilot/sitl.makefile sim.CFLAGS += -DCONFIG=\"tiny.h\" -DAGR_CLIMB -DLOITER_TRIM -DALT_KALMAN -DFORMATION -DTRAFFIC_INFO -DTCAS -sim.srcs += nav_survey_rectangle.c nav_line.c external.c traffic_info.c formation.c snav.c tcas.c +sim.srcs += nav_survey_rectangle.c nav_line.c external.c traffic_info.c formation.c snav.c tcas.c # Losange Cartography with Onboard Camera sim.CFLAGS += -DUSE_ONBOARD_CAMERA -sim.srcs += nav_survey_losange_carto.c +sim.srcs += nav_survey_losange_carto.c #pour les printf de debug sim.CFLAGS += -DDEBUG_PRINTF diff --git a/conf/airframes/LAAS/mmlaas_N2.xml b/conf/airframes/LAAS/mmlaas_N2.xml index 134dfba4ed..3863fd19ee 100644 --- a/conf/airframes/LAAS/mmlaas_N2.xml +++ b/conf/airframes/LAAS/mmlaas_N2.xml @@ -116,7 +116,7 @@
- +
@@ -130,7 +130,7 @@
- +
diff --git a/conf/airframes/LAAS/mmlaas_N3.xml b/conf/airframes/LAAS/mmlaas_N3.xml index 515b5179ad..c6877b0211 100644 --- a/conf/airframes/LAAS/mmlaas_N3.xml +++ b/conf/airframes/LAAS/mmlaas_N3.xml @@ -116,7 +116,7 @@
- +
@@ -130,7 +130,7 @@
- +
diff --git a/conf/airframes/NoVa_L.xml b/conf/airframes/NoVa_L.xml index f4253e73cf..e78a9fdccc 100644 --- a/conf/airframes/NoVa_L.xml +++ b/conf/airframes/NoVa_L.xml @@ -236,7 +236,7 @@
- - + diff --git a/conf/airframes/PPZUAV/fixed-wing/kalscott_easystar.xml b/conf/airframes/PPZUAV/fixed-wing/kalscott_easystar.xml index 2fddd20c7e..67c5017f07 100644 --- a/conf/airframes/PPZUAV/fixed-wing/kalscott_easystar.xml +++ b/conf/airframes/PPZUAV/fixed-wing/kalscott_easystar.xml @@ -1,35 +1,35 @@ - - + - + - + - + - - + + - - + +
@@ -79,12 +79,12 @@ - +
- +
@@ -142,11 +142,11 @@
- +
-
+ CONFIG = \"tiny_2_1_1.h\" @@ -156,7 +156,7 @@ include $(PAPARAZZI_SRC)/conf/autopilot/tiny.makefile FLASH_MODE=IAP -ap.CFLAGS += -DFBW -DAP -DBOARD_CONFIG=$(CONFIG) -DUSE_LED -DTIME_LED=1 -DUSE_MODULES +ap.CFLAGS += -DFBW -DAP -DBOARD_CONFIG=$(CONFIG) -DUSE_LED -DTIME_LED=1 -DUSE_MODULES ap.srcs = sys_time.c $(SRC_ARCH)/sys_time_hw.c $(SRC_ARCH)/armVIC.c main_fbw.c main_ap.c main.c ap.srcs += commands.c @@ -167,17 +167,17 @@ ap.srcs += $(SRC_ARCH)/servos_4017_hw.c actuators.c # Radio configuration ap.CFLAGS += -DRADIO_CONTROL -ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c +ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c # Telemetry configuration ap.CFLAGS += -DDOWNLINK -DUSE_UART1 -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_FBW_DEVICE=Uart1 -DDOWNLINK_AP_DEVICE=Uart1 -DPPRZ_UART=Uart1 -DDATALINK=PPRZ -DUART1_BAUD=B57600 ap.srcs += downlink.c $(SRC_ARCH)/mcu_periph/uart_arch.c datalink.c pprz_transport.c ap.CFLAGS += -DINTER_MCU -ap.srcs += inter_mcu.c +ap.srcs += inter_mcu.c # ADC configuration -ap.CFLAGS += -DADC -DUSE_ADC_0 -DUSE_ADC_1 -DUSE_ADC_2 +ap.CFLAGS += -DADC -DUSE_ADC_0 -DUSE_ADC_1 -DUSE_ADC_2 ap.srcs += $(SRC_ARCH)/adc_hw.c # USE_GPS configuration @@ -188,8 +188,8 @@ ap.CFLAGS += -DUSE_INFRARED -DALT_KALMAN ap.srcs += infrared.c estimator.c # Control loops -ap.CFLAGS += -DNAV -DLOITER_TRIM -ap.srcs += subsystems/nav.c fw_h_ctl.c fw_v_ctl.c +ap.CFLAGS += -DNAV -DLOITER_TRIM +ap.srcs += subsystems/nav.c fw_h_ctl.c fw_v_ctl.c ap.srcs += subsystems/navigation/nav_line.c ap.srcs += subsystems/navigation/nav_survey_rectangle.c @@ -198,8 +198,8 @@ ap.srcs += subsystems/navigation/nav_survey_rectangle.c # Config for SITL simulation include $(PAPARAZZI_SRC)/conf/autopilot/sitl.makefile -sim.CFLAGS += -DBOARD_CONFIG=\"tiny.h\" -DLOITER_TRIM -DALT_KALMAN -DUSE_MODULES -sim.srcs += subsystems/navigation/nav_line.c subsystems/navigation/nav_survey_rectangle.c +sim.CFLAGS += -DBOARD_CONFIG=\"tiny.h\" -DLOITER_TRIM -DALT_KALMAN -DUSE_MODULES +sim.srcs += subsystems/navigation/nav_line.c subsystems/navigation/nav_survey_rectangle.c diff --git a/conf/airframes/PPZUAV/imu-calibrations/ppzuav_booz2imu_004.xml b/conf/airframes/PPZUAV/imu-calibrations/ppzuav_booz2imu_004.xml index bf273a1bfc..fc4de3bf05 100644 --- a/conf/airframes/PPZUAV/imu-calibrations/ppzuav_booz2imu_004.xml +++ b/conf/airframes/PPZUAV/imu-calibrations/ppzuav_booz2imu_004.xml @@ -21,7 +21,7 @@ - + @@ -33,7 +33,7 @@ - + diff --git a/conf/airframes/Paul/minimag1.xml b/conf/airframes/Paul/minimag1.xml index cfe17c9d28..ca7a519a97 100644 --- a/conf/airframes/Paul/minimag1.xml +++ b/conf/airframes/Paul/minimag1.xml @@ -84,7 +84,7 @@ - +
@@ -97,7 +97,7 @@
- +
@@ -139,7 +139,7 @@ - +
@@ -165,7 +165,7 @@
- +
@@ -185,13 +185,13 @@ ap.CFLAGS += -DACTUATORS=\"servos_4017_hw.h\" -DSERVOS_4017 ap.srcs += $(SRC_ARCH)/servos_4017_hw.c actuators.c ap.CFLAGS += -DRADIO_CONTROL -DRADIO_CONTROL_TYPE=RC_FUTABA -ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c +ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c ap.CFLAGS += -DDOWNLINK -DUSE_UART1 -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_FBW_DEVICE=Uart1 -DDOWNLINK_AP_DEVICE=Uart1 -DPPRZ_UART=Uart1 -DDATALINK=PPRZ -DUART1_BAUD=B57600 ap.srcs += downlink.c $(SRC_ARCH)/mcu_periph/uart_arch.c datalink.c pprz_transport.c ap.CFLAGS += -DINTER_MCU -ap.srcs += inter_mcu.c +ap.srcs += inter_mcu.c ap.CFLAGS += -DADC -DUSE_ADC_0 -DUSE_ADC_1 -DUSE_ADC_3 ap.srcs += $(SRC_ARCH)/adc_hw.c diff --git a/conf/airframes/Poine/antenna.xml b/conf/airframes/Poine/antenna.xml index 98d24b8294..40ee8725ba 100644 --- a/conf/airframes/Poine/antenna.xml +++ b/conf/airframes/Poine/antenna.xml @@ -28,7 +28,7 @@ ant.CFLAGS += -DUSE_LED ant.CFLAGS += -DUSE_UART0 -DUART0_BAUD=B38400 ant.srcs += $(SRC_ARCH)/mcu_periph/uart_arch.c -ant.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=Uart0 +ant.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=Uart0 ant.srcs += downlink.c pprz_transport.c ant.CFLAGS += -DDOWNLINK_AP_DEVICE=Uart0 -DAP @@ -43,7 +43,7 @@ ant.srcs += avr/ant_tracker.c -#ant.CFLAGS += +#ant.CFLAGS += ant.srcs += avr/ant_v2x.c avr/ant_spi.c ant.srcs += avr/ant_servo.c diff --git a/conf/airframes/Poine/autoplato.xml b/conf/airframes/Poine/autoplato.xml index 48a5844d0e..e2f8a9e24a 100644 --- a/conf/airframes/Poine/autoplato.xml +++ b/conf/airframes/Poine/autoplato.xml @@ -21,7 +21,7 @@ test_usb.srcs += sys_time.c $(SRC_ARCH)/sys_time_hw.c $(SRC_ARCH)/armVIC.c #test_usb.CFLAGS += -DUSE_UART1 -DUART1_BAUD=B57600 #test_usb.srcs += $(SRC_ARCH)/mcu_periph/uart_arch.c -#test_usb.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=Uart1 +#test_usb.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=Uart1 #test_usb.srcs += downlink.c pprz_transport.c test_usb.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DUSE_USB_SERIAL diff --git a/conf/airframes/Poine/beth.xml b/conf/airframes/Poine/beth.xml index b542d440ec..38269d5b50 100644 --- a/conf/airframes/Poine/beth.xml +++ b/conf/airframes/Poine/beth.xml @@ -115,7 +115,7 @@ main_stm32.srcs += sys_time.c $(SRC_ARCH)/sys_time_hw.c main_stm32.CFLAGS += -DUSE_UART2 -DUART2_BAUD=B57600 main_stm32.srcs += $(SRC_ARCH)/mcu_periph/uart_arch.c -main_stm32.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=Uart2 +main_stm32.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=Uart2 main_stm32.srcs += downlink.c pprz_transport.c @@ -143,7 +143,7 @@ main_stm32.srcs += subsystems/imu.c \ main_stm32.CFLAGS += -DUSE_DMA1_C4_IRQ main_stm32.srcs += $(SRC_FIRMWARE)/commands.c -main_stm32.srcs += firmwares/rotorcraft/actuators/actuators_asctec.c +main_stm32.srcs += firmwares/rotorcraft/actuators/actuators_asctec.c #\ # $(SRC_BOOZ_ARCH)/actuators/actuators_asctec_arch.c main_stm32.CFLAGS += -DACTUATORS_ASCTEC_DEVICE=i2c1 @@ -187,7 +187,7 @@ main_coders.srcs += sys_time.c $(SRC_ARCH)/sys_time_hw.c main_coders.CFLAGS += -DUSE_UART1 -DUART1_BAUD=B57600 main_coders.srcs += $(SRC_ARCH)/mcu_periph/uart_arch.c -main_coders.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=Uart1 +main_coders.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=Uart1 main_coders.srcs += downlink.c pprz_transport.c #main_coders.CFLAGS += -DUSE_I2C2 @@ -260,7 +260,7 @@ overo_test_uart.srcs += $(SRC_BETH)/overo_gcs_com.c #overo_test_uart.CFLAGS += -DUBX -DUSE_GPS -DUSE_UART0 -DUART0_BAUD=B9600 -DGPS_CONFIGURE -DGPS_BAUD=B38400 -DGPS_LINK=Uart0 -DGPS_USE_LATLONG overo_test_uart.CFLAGS += -DUBX -DUSE_GPS -DUSE_UART0 -DUART0_BAUD=B38400 -DGPS_LINK=Uart0 -DGPS_USE_LATLONG overo_test_uart.srcs += gps_ubx.c gps.c latlong.c $(SRC_BETH)/uart_hw.c -overo_test_uart.CFLAGS +=-DUSE_UART1 -DUART1_BAUD=B57600 -DDOWNLINK_DEVICE=Uart1 -DPPRZ_UART=Uart1 -DDATALINK=PPRZ +overo_test_uart.CFLAGS +=-DUSE_UART1 -DUART1_BAUD=B57600 -DDOWNLINK_DEVICE=Uart1 -DPPRZ_UART=Uart1 -DDATALINK=PPRZ overo_test_uart.srcs += pprz_transport.c $(SRC_BETH)/rcv_telemetry.c # @@ -306,7 +306,7 @@ overo_sfb.CFLAGS += -DOVERO_LINK_MSG_UP=AutopilotMessageBethUp -DOVERO_LINK_MSG_ overo_sfb.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=UdpTransport overo_sfb.srcs += $(SRC_FMS)/udp_transport2.c downlink.c overo_sfb.srcs += $(SRC_FMS)/fms_network.c -overo_sfb.LDFLAGS += -levent +overo_sfb.LDFLAGS += -levent overo_sfb.LDFLAGS += -lm overo_sfb.srcs += $(SRC_BETH)/overo_gcs_com.c diff --git a/conf/airframes/Poine/bl_mc.xml b/conf/airframes/Poine/bl_mc.xml index 21d5e7adee..7e93514d9d 100644 --- a/conf/airframes/Poine/bl_mc.xml +++ b/conf/airframes/Poine/bl_mc.xml @@ -26,13 +26,13 @@ main.srcs = main_bl_mc.c main.CFLAGS += -DPERIODIC_TASK_PERIOD='SYS_TICS_OF_SEC(1e-2)' main.srcs += sys_time.c $(SRC_ARCH)/sys_time_hw.c -main.CFLAGS += -DUSE_LED +main.CFLAGS += -DUSE_LED #-DTIME_LED=1 main.CFLAGS += -DUSE_UART1 -DUART1_BAUD=B38400 main.srcs += $(SRC_ARCH)/mcu_periph/uart_arch.c -main.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=Uart1 +main.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=Uart1 main.srcs += downlink.c pprz_transport.c main.srcs += $(SRC_ARCH)/bl_mc_power.c diff --git a/conf/airframes/Poine/booz2_a2.xml b/conf/airframes/Poine/booz2_a2.xml index 6897d29285..2f7880f34f 100644 --- a/conf/airframes/Poine/booz2_a2.xml +++ b/conf/airframes/Poine/booz2_a2.xml @@ -31,15 +31,15 @@ - + - + - + @@ -56,9 +56,9 @@ - + - + diff --git a/conf/airframes/Poine/booz2_a3.xml b/conf/airframes/Poine/booz2_a3.xml index 1ef44bbfc4..78cb488fba 100644 --- a/conf/airframes/Poine/booz2_a3.xml +++ b/conf/airframes/Poine/booz2_a3.xml @@ -27,10 +27,10 @@ - + - + @@ -43,9 +43,9 @@ - + - + diff --git a/conf/airframes/Poine/booz2_a4.xml b/conf/airframes/Poine/booz2_a4.xml index e4d18a41fe..15709b8d41 100644 --- a/conf/airframes/Poine/booz2_a4.xml +++ b/conf/airframes/Poine/booz2_a4.xml @@ -29,10 +29,10 @@ - + - + @@ -47,7 +47,7 @@ - + diff --git a/conf/airframes/Poine/booz2_a7.xml b/conf/airframes/Poine/booz2_a7.xml index 76468c990c..a563e80f20 100644 --- a/conf/airframes/Poine/booz2_a7.xml +++ b/conf/airframes/Poine/booz2_a7.xml @@ -208,7 +208,7 @@
- - +
@@ -127,7 +127,7 @@ - + @@ -173,14 +173,14 @@ ap.srcs += $(SRC_ARCH)/servos_4015_MAT_hw.c actuators.c # 41.200MHz ap.CFLAGS += -DRADIO_CONTROL -ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c +ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c -# transparent +# transparent ap.CFLAGS += -DDOWNLINK -DUSE_UART0 -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_FBW_DEVICE=Uart0 -DDOWNLINK_AP_DEVICE=Uart0 -DPPRZ_UART=Uart0 -DDATALINK=PPRZ -DUART0_BAUD=B9600 ap.srcs += downlink.c $(SRC_ARCH)/mcu_periph/uart_arch.c datalink.c pprz_transport.c ap.CFLAGS += -DINTER_MCU -ap.srcs += inter_mcu.c +ap.srcs += inter_mcu.c ap.CFLAGS += -DADC -DUSE_ADC_0 -DUSE_ADC_1 -DUSE_ADC_2 -DUSE_ADC_3 ap.srcs += $(SRC_ARCH)/adc_hw.c diff --git a/conf/airframes/Poine/fuckyou.xml b/conf/airframes/Poine/fuckyou.xml index 7f33e1cb89..f8b4617694 100644 --- a/conf/airframes/Poine/fuckyou.xml +++ b/conf/airframes/Poine/fuckyou.xml @@ -4,7 +4,7 @@ HOST=auto3 - + # test 1 test42.ARCHDIR = omap test42.CFLAGS += -I$(ACINCLUDE) -I. -I$(PAPARAZZI_HOME)/var/include diff --git a/conf/airframes/Poine/motor_bench.xml b/conf/airframes/Poine/motor_bench.xml index dca7fe4d33..741c80dd4a 100644 --- a/conf/airframes/Poine/motor_bench.xml +++ b/conf/airframes/Poine/motor_bench.xml @@ -24,7 +24,7 @@ main.srcs += $(SRC_ARCH)/armVIC.c main.CFLAGS += -DUSE_UART0 -DUART0_BAUD=B115200 main.srcs += $(SRC_ARCH)/mcu_periph/uart_arch.c -main.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=Uart0 +main.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=Uart0 main.srcs += downlink.c pprz_transport.c main.CFLAGS += -DDATALINK=PPRZ -DPPRZ_UART=Uart0 diff --git a/conf/airframes/Poine/pt_ant.xml b/conf/airframes/Poine/pt_ant.xml index 765384cf20..c73a262c56 100644 --- a/conf/airframes/Poine/pt_ant.xml +++ b/conf/airframes/Poine/pt_ant.xml @@ -33,7 +33,7 @@ main.srcs += $(SRC_ARCH)/armVIC.c main.CFLAGS += -DUSE_UART0 -DUART0_BAUD=B38400 main.srcs += $(SRC_ARCH)/mcu_periph/uart_arch.c -main.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=Uart0 +main.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=Uart0 main.srcs += downlink.c pprz_transport.c $(PT_ANT)/pt_ant_telemetry.c main.CFLAGS += -DDATALINK=PPRZ -DPPRZ_UART=Uart0 @@ -48,7 +48,7 @@ main.srcs += AMI601.c i2c.c $(SRC_ARCH)/i2c_hw.c main.CFLAGS += -DUSE_UART1 -DUART1_BAUD=B9600 #main.CFLAGS += -DUSE_GPS -DUBX -DGPS_LINK=Uart1 -#main.CFLAGS += -DGPS_USER_CALLBACK=pt_ant_estimator_update_self_gps -DGPS_USER_CALLBACK_HEADER=\"pt_ant_estimator.h\" +#main.CFLAGS += -DGPS_USER_CALLBACK=pt_ant_estimator_update_self_gps -DGPS_USER_CALLBACK_HEADER=\"pt_ant_estimator.h\" #main.CFLAGS += -DGPS_CONFIGURE -DGPS_BAUD=38400 #main.srcs += gps_ubx.c gps.c diff --git a/conf/airframes/Poine/test_libeknav.xml b/conf/airframes/Poine/test_libeknav.xml index 4f7edfa135..0c54159b75 100644 --- a/conf/airframes/Poine/test_libeknav.xml +++ b/conf/airframes/Poine/test_libeknav.xml @@ -11,7 +11,7 @@ LIB_EIGEN_DIR = /opt/paparazzi/omap/overo-oe/tmp/sysroots/armv7a-angstrom-linux-gnueabi/usr/include/eigen2 - LIB_EIGEN_CFLAGS = -I$(LIB_EIGEN_DIR) -DEIGEN_DONT_VECTORIZE -DEIGEN_DONT_ALIGN -DNDEBUG + LIB_EIGEN_CFLAGS = -I$(LIB_EIGEN_DIR) -DEIGEN_DONT_VECTORIZE -DEIGEN_DONT_ALIGN -DNDEBUG LIBEKNAV_SRCS = fms/libeknav/basic_ins_qkf.cpp \ fms/libeknav/ins_qkf_predict.cpp \ @@ -45,7 +45,7 @@ test3.srcs += fms/fms_periodic.c test3.CXXFLAGS += -DOVERO_LINK_MSG_UP=AutopilotMessageVIUp -DOVERO_LINK_MSG_DOWN=AutopilotMessageVIDown test3.srcs += fms/fms_spi_link.c - + # test 4: Flags like test3 test4.ARCHDIR = omap test4.CXXFLAGS += $(LIB_EIGEN_CFLAGS) diff --git a/conf/airframes/Poine/test_settings.xml b/conf/airframes/Poine/test_settings.xml index 644d4e99a7..7e4e4c9574 100644 --- a/conf/airframes/Poine/test_settings.xml +++ b/conf/airframes/Poine/test_settings.xml @@ -1,6 +1,6 @@ - diff --git a/conf/airframes/Poine/turntable.xml b/conf/airframes/Poine/turntable.xml index dc97e08e98..ae8f5a4f37 100644 --- a/conf/airframes/Poine/turntable.xml +++ b/conf/airframes/Poine/turntable.xml @@ -26,7 +26,7 @@ main.srcs += sys_time.c $(MB)/turntable_systime.c main.CFLAGS += -DUSE_UART0 -DUART0_BAUD=B115200 main.srcs += $(SRC_ARCH)/mcu_periph/uart_arch.c -main.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=Uart0 +main.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=Uart0 main.srcs += downlink.c pprz_transport.c diff --git a/conf/airframes/TU_Delft/Trip50A.xml b/conf/airframes/TU_Delft/Trip50A.xml index 36081877f7..857bb271f7 100644 --- a/conf/airframes/TU_Delft/Trip50A.xml +++ b/conf/airframes/TU_Delft/Trip50A.xml @@ -1,6 +1,6 @@ - - @@ -187,8 +187,8 @@ - - + + @@ -201,7 +201,7 @@ inline static void h_ctl_roll_loop( void ) { - h_ctl_roll_rate_gain * estimator_p + v_ctl_throttle_setpoint * h_ctl_aileron_of_throttle; - h_ctl_aileron_setpoint = TRIM_PPRZ(cmd); + h_ctl_aileron_setpoint = TRIM_PPRZ(cmd); } --> @@ -231,7 +231,7 @@ inline static void h_ctl_roll_loop( void ) {
- - @@ -192,8 +192,8 @@ - - + + @@ -206,7 +206,7 @@ inline static void h_ctl_roll_loop( void ) { - h_ctl_roll_rate_gain * estimator_p + v_ctl_throttle_setpoint * h_ctl_aileron_of_throttle; - h_ctl_aileron_setpoint = TRIM_PPRZ(cmd); + h_ctl_aileron_setpoint = TRIM_PPRZ(cmd); } --> @@ -236,7 +236,7 @@ inline static void h_ctl_roll_loop( void ) { - @@ -98,12 +98,12 @@
- + - +
@@ -112,7 +112,7 @@
- +
@@ -142,15 +142,15 @@ - @@ -187,8 +187,8 @@ - - + + @@ -201,7 +201,7 @@ inline static void h_ctl_roll_loop( void ) { - h_ctl_roll_rate_gain * estimator_p + v_ctl_throttle_setpoint * h_ctl_aileron_of_throttle; - h_ctl_aileron_setpoint = TRIM_PPRZ(cmd); + h_ctl_aileron_setpoint = TRIM_PPRZ(cmd); } --> @@ -231,7 +231,7 @@ inline static void h_ctl_roll_loop( void ) {
- - + @@ -191,9 +191,9 @@ - - + diff --git a/conf/airframes/UofAdelaide/booz2_a1000.xml b/conf/airframes/UofAdelaide/booz2_a1000.xml index a1d966b225..bc0f5c553a 100755 --- a/conf/airframes/UofAdelaide/booz2_a1000.xml +++ b/conf/airframes/UofAdelaide/booz2_a1000.xml @@ -55,7 +55,7 @@ - @@ -68,10 +68,10 @@ - + - + @@ -89,9 +89,9 @@ - - + @@ -122,7 +122,7 @@ second attempt - + - + diff --git a/conf/airframes/demo.xml b/conf/airframes/demo.xml index 8fd502eaca..d7fd2dc445 100644 --- a/conf/airframes/demo.xml +++ b/conf/airframes/demo.xml @@ -65,12 +65,12 @@ demo4.srcs += $(SRC_ARCH)/armVIC.c demo4.CFLAGS += -DUSE_UART0 -DUART0_BAUD=B38400 demo4.srcs += $(SRC_ARCH)/mcu_periph/uart_arch.c -demo4.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=Uart0 +demo4.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=Uart0 demo4.srcs += downlink.c pprz_transport.c # # DATALINK : receives datalink messages. demonstrates the "settings" service -# which lets you adjust variables described in the settings.xml file +# which lets you adjust variables described in the settings.xml file # IvySendMsg("1ME RAW_DATALINK 144 SETTING;0;0;%d", foo_value); # demo5.ARCHDIR = $(ARCH) @@ -88,7 +88,7 @@ demo5.srcs += $(SRC_ARCH)/armVIC.c demo5.CFLAGS += -DUSE_UART0 -DUART0_BAUD=B38400 demo5.srcs += $(SRC_ARCH)/mcu_periph/uart_arch.c -demo5.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=Uart0 +demo5.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=Uart0 demo5.srcs += downlink.c pprz_transport.c demo5.CFLAGS += -DDATALINK=PPRZ -DPPRZ_UART=Uart0 @@ -114,7 +114,7 @@ demo6.CFLAGS += -DUSE_USB_SERIAL demo6.srcs += $(SRC_ARCH)/lpcusb/usbhw_lpc.c $(SRC_ARCH)/lpcusb/usbcontrol.c $(SRC_ARCH)/lpcusb/usbstdreq.c $(SRC_ARCH)/lpcusb/usbinit.c demo6.srcs += $(SRC_ARCH)/usb_ser_hw.c -demo6.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=UsbS +demo6.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=UsbS demo6.srcs += downlink.c pprz_transport.c //demo6.CFLAGS += -DDATALINK=PPRZ -DPPRZ_UART=Uart0 diff --git a/conf/airframes/demo_module.xml b/conf/airframes/demo_module.xml index fc3166cfd7..6c6b05f160 100644 --- a/conf/airframes/demo_module.xml +++ b/conf/airframes/demo_module.xml @@ -80,7 +80,7 @@
- +
@@ -89,7 +89,7 @@
- +
@@ -168,7 +168,7 @@ ap.CFLAGS += -DFBW -DAP -DBOARD_CONFIG=$(CONFIG) -DUSE_LED -DTIME_LED=1 ap.srcs = sys_time.c $(SRC_ARCH)/sys_time_hw.c $(SRC_ARCH)/armVIC.c $(SRC_FIRMWARE)/main_fbw.c $(SRC_FIRMWARE)/main_ap.c $(SRC_FIRMWARE)/main.c ap.CFLAGS += -DINTER_MCU -ap.srcs += inter_mcu.c +ap.srcs += inter_mcu.c ap.srcs += commands.c @@ -177,7 +177,7 @@ ap.CFLAGS += -DACTUATORS=\"servos_4017_hw.h\" -DSERVOS_4017 ap.srcs += $(SRC_ARCH)/servos_4017_hw.c actuators.c ap.CFLAGS += -DRADIO_CONTROL -ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c +ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c ########## Modem ap.CFLAGS += -DDOWNLINK -DUSE_UART1 -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_FBW_DEVICE=Uart1 -DDOWNLINK_AP_DEVICE=Uart1 -DPPRZ_UART=Uart1 -DDATALINK=PPRZ -DUART1_BAUD=B9600 diff --git a/conf/airframes/esden/jt_lisam.xml b/conf/airframes/esden/jt_lisam.xml index bf2dfe8528..9381f40d18 100644 --- a/conf/airframes/esden/jt_lisam.xml +++ b/conf/airframes/esden/jt_lisam.xml @@ -22,7 +22,7 @@ - +
@@ -50,7 +50,7 @@
- + diff --git a/conf/airframes/esden/lisa_asctec.xml b/conf/airframes/esden/lisa_asctec.xml index 532218f44a..44251fb9ea 100644 --- a/conf/airframes/esden/lisa_asctec.xml +++ b/conf/airframes/esden/lisa_asctec.xml @@ -47,7 +47,7 @@ - + @@ -57,7 +57,7 @@ - + @@ -67,7 +67,7 @@ - + diff --git a/conf/airframes/esden/lisa_asctec_aspirin.xml b/conf/airframes/esden/lisa_asctec_aspirin.xml index 04f00b91c6..fa52416db1 100644 --- a/conf/airframes/esden/lisa_asctec_aspirin.xml +++ b/conf/airframes/esden/lisa_asctec_aspirin.xml @@ -47,7 +47,7 @@ - + @@ -57,7 +57,7 @@ - + @@ -67,7 +67,7 @@ - + diff --git a/conf/airframes/esden/lisa_m_pwm.xml b/conf/airframes/esden/lisa_m_pwm.xml index 1e9368344f..34b819a1f1 100644 --- a/conf/airframes/esden/lisa_m_pwm.xml +++ b/conf/airframes/esden/lisa_m_pwm.xml @@ -61,7 +61,7 @@ - + @@ -71,7 +71,7 @@ - + @@ -81,7 +81,7 @@ - + diff --git a/conf/airframes/esden/lisa_pwm_aspirin.xml b/conf/airframes/esden/lisa_pwm_aspirin.xml index b32a7b33c4..f5a0931048 100644 --- a/conf/airframes/esden/lisa_pwm_aspirin.xml +++ b/conf/airframes/esden/lisa_pwm_aspirin.xml @@ -55,7 +55,7 @@
- + diff --git a/conf/airframes/esden/synerani_4B.xml b/conf/airframes/esden/synerani_4B.xml index f8ebedbca7..2c113fb72a 100644 --- a/conf/airframes/esden/synerani_4B.xml +++ b/conf/airframes/esden/synerani_4B.xml @@ -17,7 +17,7 @@ - + - +
- +
@@ -104,7 +104,7 @@
- +
@@ -180,7 +180,7 @@
- +
@@ -236,7 +236,7 @@ ap.CFLAGS += -DACTUATORS=\"servos_4017_hw.h\" -DSERVOS_4017 ap.srcs += $(SRC_ARCH)/servos_4017_hw.c actuators.c ap.CFLAGS += -DRADIO_CONTROL -ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c +ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c ap.CFLAGS += -DDOWNLINK -DUSE_UART1 -DDOWNLINK_TRANSPORT=XBeeTransport -DXBEE_UART=Uart1 -DDATALINK=XBEE -DUART1_BAUD=B57600 ap.srcs += downlink.c $(SRC_ARCH)/mcu_periph/uart_arch.c datalink.c xbee.c @@ -247,7 +247,7 @@ ap.srcs += downlink.c $(SRC_ARCH)/mcu_periph/uart_arch.c datalink.c xbee.c ap.CFLAGS += -DINTER_MCU -ap.srcs += inter_mcu.c +ap.srcs += inter_mcu.c ap.CFLAGS += -DADC -DUSE_ADC_0 -DUSE_ADC_1 -DUSE_ADC_2 -DUSE_ADC_4 ap.srcs += $(SRC_ARCH)/adc_hw.c diff --git a/conf/airframes/mm/extra/probe_t.xml b/conf/airframes/mm/extra/probe_t.xml index c35b765f3c..ba0ea6213f 100644 --- a/conf/airframes/mm/extra/probe_t.xml +++ b/conf/airframes/mm/extra/probe_t.xml @@ -61,7 +61,7 @@ - + @@ -108,9 +108,9 @@ - +
- +
@@ -123,7 +123,7 @@
- +
@@ -199,7 +199,7 @@
- +
diff --git a/conf/airframes/mm/extra/rctx.xml b/conf/airframes/mm/extra/rctx.xml index ec0c2d90d2..6001747f16 100644 --- a/conf/airframes/mm/extra/rctx.xml +++ b/conf/airframes/mm/extra/rctx.xml @@ -16,9 +16,9 @@ - +
- +
@@ -36,7 +36,7 @@ ap.CFLAGS += -DFBW -DAP -DCONFIG=$(CONFIG) -DUSE_LED ap.srcs = sys_time.c $(SRC_ARCH)/sys_time_hw.c $(SRC_ARCH)/armVIC.c main_rctx.c ap.CFLAGS += -DRADIO_CONTROL -DRADIO_CONTROL_TYPE=RC_FUTABA -ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c +ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c ap.CFLAGS += -DDOWNLINK -DUSE_UART1 -DDOWNLINK_TRANSPORT=XBeeTransport -DXBEE_UART=Uart1 -DDATALINK=XBEE -DUART1_BAUD=B57600 ap.srcs += downlink.c $(SRC_ARCH)/mcu_periph/uart_arch.c xbee.c diff --git a/conf/airframes/mm/extra/turbine_trigger.xml b/conf/airframes/mm/extra/turbine_trigger.xml index 59b3a1db34..55f565b058 100644 --- a/conf/airframes/mm/extra/turbine_trigger.xml +++ b/conf/airframes/mm/extra/turbine_trigger.xml @@ -53,7 +53,7 @@ - + @@ -98,9 +98,9 @@ - +
- +
@@ -110,7 +110,7 @@
- +
diff --git a/conf/airframes/mm/fixed-wing/drops.xml b/conf/airframes/mm/fixed-wing/drops.xml index 9fcb3e4fd8..faf6c1cb79 100644 --- a/conf/airframes/mm/fixed-wing/drops.xml +++ b/conf/airframes/mm/fixed-wing/drops.xml @@ -92,7 +92,7 @@ - +
@@ -124,7 +124,7 @@ - +
@@ -132,9 +132,9 @@ - +
- +
@@ -148,7 +148,7 @@
- +
@@ -252,7 +252,7 @@ ap.CFLAGS += -DACTUATORS=\"servos_4017_hw.h\" -DSERVOS_4017 ap.srcs += $(SRC_ARCH)/servos_4017_hw.c actuators.c ap.CFLAGS += -DRADIO_CONTROL -DRADIO_CONTROL_AUTO1 -ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c +ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c ap.CFLAGS += -DDOWNLINK -DUSE_UART1 -DDOWNLINK_TRANSPORT=XBeeTransport -DXBEE_UART=Uart1 -DDATALINK=XBEE -DUART1_BAUD=B57600 ap.srcs += downlink.c $(SRC_ARCH)/mcu_periph/uart_arch.c datalink.c xbee.c @@ -262,7 +262,7 @@ ap.srcs += downlink.c $(SRC_ARCH)/mcu_periph/uart_arch.c datalink.c xbee.c #ap.srcs += downlink.c $(SRC_ARCH)/mcu_periph/uart_arch.c datalink.c pprz_transport.c ap.CFLAGS += -DINTER_MCU -ap.srcs += inter_mcu.c +ap.srcs += inter_mcu.c ap.CFLAGS += -DADC -DUSE_ADC_0 -DUSE_ADC_1 -DUSE_ADC_2 -DUSE_ADC_3 ap.srcs += $(SRC_ARCH)/adc_hw.c diff --git a/conf/airframes/mm/fixed-wing/funjetdca.xml b/conf/airframes/mm/fixed-wing/funjetdca.xml index f7f7c92b6d..77653a653b 100644 --- a/conf/airframes/mm/fixed-wing/funjetdca.xml +++ b/conf/airframes/mm/fixed-wing/funjetdca.xml @@ -80,7 +80,7 @@ - + @@ -124,9 +124,9 @@
- +
- +
@@ -137,7 +137,7 @@
- +
diff --git a/conf/airframes/mm/fixed-wing/funjetdcb.xml b/conf/airframes/mm/fixed-wing/funjetdcb.xml index 90c5701c00..543dadf191 100644 --- a/conf/airframes/mm/fixed-wing/funjetdcb.xml +++ b/conf/airframes/mm/fixed-wing/funjetdcb.xml @@ -80,7 +80,7 @@ - + @@ -124,9 +124,9 @@
- +
- +
@@ -137,7 +137,7 @@
- +
diff --git a/conf/airframes/mm/fixed-wing/funjetdcc.xml b/conf/airframes/mm/fixed-wing/funjetdcc.xml index ea06dceedb..76a077a444 100644 --- a/conf/airframes/mm/fixed-wing/funjetdcc.xml +++ b/conf/airframes/mm/fixed-wing/funjetdcc.xml @@ -80,7 +80,7 @@ - + @@ -124,9 +124,9 @@
- +
- +
@@ -137,7 +137,7 @@
- +
diff --git a/conf/airframes/mm/fixed-wing/funjeteth1.xml b/conf/airframes/mm/fixed-wing/funjeteth1.xml index b0e551ada1..d0b9b75d5b 100644 --- a/conf/airframes/mm/fixed-wing/funjeteth1.xml +++ b/conf/airframes/mm/fixed-wing/funjeteth1.xml @@ -37,7 +37,7 @@ - + @@ -85,9 +85,9 @@ - +
- +
@@ -100,7 +100,7 @@
- +
@@ -176,7 +176,7 @@
- +
@@ -213,7 +213,7 @@ ap.CFLAGS += -DACTUATORS=\"servos_4017_hw.h\" -DSERVOS_4017 ap.srcs += $(SRC_ARCH)/servos_4017_hw.c actuators.c ap.CFLAGS += -DRADIO_CONTROL -ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c +ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c ap.CFLAGS += -DDOWNLINK -DUSE_UART1 -DDOWNLINK_TRANSPORT=XBeeTransport -DXBEE_UART=Uart1 -DDATALINK=XBEE -DUART1_BAUD=B57600 ap.srcs += downlink.c $(SRC_ARCH)/mcu_periph/uart_arch.c datalink.c xbee.c @@ -223,7 +223,7 @@ ap.srcs += downlink.c $(SRC_ARCH)/mcu_periph/uart_arch.c datalink.c xbee.c #ap.srcs += downlink.c $(SRC_ARCH)/mcu_periph/uart_arch.c datalink.c pprz_transport.c ap.CFLAGS += -DINTER_MCU -ap.srcs += inter_mcu.c +ap.srcs += inter_mcu.c ap.CFLAGS += -DADC -DUSE_ADC_0 -DUSE_ADC_1 -DUSE_ADC_2 -DUSE_ADC_6 ap.srcs += $(SRC_ARCH)/adc_hw.c diff --git a/conf/airframes/mm/fixed-wing/funjeteth2.xml b/conf/airframes/mm/fixed-wing/funjeteth2.xml index 1aee3db2a0..fdd700591a 100644 --- a/conf/airframes/mm/fixed-wing/funjeteth2.xml +++ b/conf/airframes/mm/fixed-wing/funjeteth2.xml @@ -37,7 +37,7 @@ - + @@ -85,9 +85,9 @@ - +
- +
@@ -101,7 +101,7 @@
- +
@@ -177,7 +177,7 @@
- +
@@ -214,7 +214,7 @@ ap.CFLAGS += -DACTUATORS=\"servos_4017_hw.h\" -DSERVOS_4017 ap.srcs += $(SRC_ARCH)/servos_4017_hw.c actuators.c ap.CFLAGS += -DRADIO_CONTROL -ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c +ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c ap.CFLAGS += -DDOWNLINK -DUSE_UART1 -DDOWNLINK_TRANSPORT=XBeeTransport -DXBEE_UART=Uart1 -DDATALINK=XBEE -DUART1_BAUD=B57600 ap.srcs += downlink.c $(SRC_ARCH)/mcu_periph/uart_arch.c datalink.c xbee.c @@ -224,7 +224,7 @@ ap.srcs += downlink.c $(SRC_ARCH)/mcu_periph/uart_arch.c datalink.c xbee.c #ap.srcs += downlink.c $(SRC_ARCH)/mcu_periph/uart_arch.c datalink.c pprz_transport.c ap.CFLAGS += -DINTER_MCU -ap.srcs += inter_mcu.c +ap.srcs += inter_mcu.c ap.CFLAGS += -DADC -DUSE_ADC_0 -DUSE_ADC_1 -DUSE_ADC_2 -DUSE_ADC_6 ap.srcs += $(SRC_ARCH)/adc_hw.c diff --git a/conf/airframes/mm/fixed-wing/funjetfmi1.xml b/conf/airframes/mm/fixed-wing/funjetfmi1.xml index 183fe6112c..4941da26af 100644 --- a/conf/airframes/mm/fixed-wing/funjetfmi1.xml +++ b/conf/airframes/mm/fixed-wing/funjetfmi1.xml @@ -37,7 +37,7 @@ - + @@ -83,9 +83,9 @@ - +
- +
@@ -99,7 +99,7 @@
- +
@@ -175,7 +175,7 @@
- +
@@ -216,7 +216,7 @@ ap.CFLAGS += -DACTUATORS=\"servos_4017_hw.h\" -DSERVOS_4017 ap.srcs += $(SRC_ARCH)/servos_4017_hw.c actuators.c ap.CFLAGS += -DRADIO_CONTROL -ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c +ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c ap.CFLAGS += -DDOWNLINK -DUSE_UART1 -DDOWNLINK_TRANSPORT=XBeeTransport -DXBEE_UART=Uart1 -DDATALINK=XBEE -DUART1_BAUD=B57600 ap.srcs += downlink.c $(SRC_ARCH)/mcu_periph/uart_arch.c datalink.c xbee.c @@ -227,7 +227,7 @@ ap.srcs += downlink.c $(SRC_ARCH)/mcu_periph/uart_arch.c datalink.c xbee.c ap.CFLAGS += -DINTER_MCU -ap.srcs += inter_mcu.c +ap.srcs += inter_mcu.c ap.CFLAGS += -DADC -DUSE_ADC_0 -DUSE_ADC_1 -DUSE_ADC_2 ap.srcs += $(SRC_ARCH)/adc_hw.c diff --git a/conf/airframes/mm/fixed-wing/funjetfmi2.xml b/conf/airframes/mm/fixed-wing/funjetfmi2.xml index 0e006dc4e1..c076a05477 100644 --- a/conf/airframes/mm/fixed-wing/funjetfmi2.xml +++ b/conf/airframes/mm/fixed-wing/funjetfmi2.xml @@ -36,7 +36,7 @@ - + @@ -82,9 +82,9 @@ - +
- +
@@ -98,7 +98,7 @@
- +
@@ -174,7 +174,7 @@
- +
@@ -215,7 +215,7 @@ ap.CFLAGS += -DACTUATORS=\"servos_4017_hw.h\" -DSERVOS_4017 ap.srcs += $(SRC_ARCH)/servos_4017_hw.c actuators.c ap.CFLAGS += -DRADIO_CONTROL -ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c +ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c ap.CFLAGS += -DDOWNLINK -DUSE_UART1 -DDOWNLINK_TRANSPORT=XBeeTransport -DXBEE_UART=Uart1 -DDATALINK=XBEE -DUART1_BAUD=B57600 ap.srcs += downlink.c $(SRC_ARCH)/mcu_periph/uart_arch.c datalink.c xbee.c @@ -226,7 +226,7 @@ ap.srcs += downlink.c $(SRC_ARCH)/mcu_periph/uart_arch.c datalink.c xbee.c ap.CFLAGS += -DINTER_MCU -ap.srcs += inter_mcu.c +ap.srcs += inter_mcu.c ap.CFLAGS += -DADC -DUSE_ADC_0 -DUSE_ADC_1 -DUSE_ADC_2 ap.srcs += $(SRC_ARCH)/adc_hw.c diff --git a/conf/airframes/mm/fixed-wing/funjetfmi3.xml b/conf/airframes/mm/fixed-wing/funjetfmi3.xml index 467eb62730..564d49b045 100644 --- a/conf/airframes/mm/fixed-wing/funjetfmi3.xml +++ b/conf/airframes/mm/fixed-wing/funjetfmi3.xml @@ -36,7 +36,7 @@ - + @@ -82,9 +82,9 @@ - +
- +
@@ -98,7 +98,7 @@
- +
@@ -174,7 +174,7 @@
- +
@@ -215,7 +215,7 @@ ap.CFLAGS += -DACTUATORS=\"servos_4017_hw.h\" -DSERVOS_4017 ap.srcs += $(SRC_ARCH)/servos_4017_hw.c actuators.c ap.CFLAGS += -DRADIO_CONTROL -ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c +ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c ap.CFLAGS += -DDOWNLINK -DUSE_UART1 -DDOWNLINK_TRANSPORT=XBeeTransport -DXBEE_UART=Uart1 -DDATALINK=XBEE -DUART1_BAUD=B57600 ap.srcs += downlink.c $(SRC_ARCH)/mcu_periph/uart_arch.c datalink.c xbee.c @@ -226,7 +226,7 @@ ap.srcs += downlink.c $(SRC_ARCH)/mcu_periph/uart_arch.c datalink.c xbee.c ap.CFLAGS += -DINTER_MCU -ap.srcs += inter_mcu.c +ap.srcs += inter_mcu.c ap.CFLAGS += -DADC -DUSE_ADC_0 -DUSE_ADC_1 -DUSE_ADC_2 ap.srcs += $(SRC_ARCH)/adc_hw.c diff --git a/conf/airframes/mm/fixed-wing/funjetmm.xml b/conf/airframes/mm/fixed-wing/funjetmm.xml index 17fd3c558a..429d313314 100644 --- a/conf/airframes/mm/fixed-wing/funjetmm.xml +++ b/conf/airframes/mm/fixed-wing/funjetmm.xml @@ -105,7 +105,7 @@ - + @@ -154,9 +154,9 @@ - +
- +
@@ -169,7 +169,7 @@
- +
diff --git a/conf/airframes/mm/fixed-wing/funjetmm2.xml b/conf/airframes/mm/fixed-wing/funjetmm2.xml index b9dd882225..03a942f097 100644 --- a/conf/airframes/mm/fixed-wing/funjetmm2.xml +++ b/conf/airframes/mm/fixed-wing/funjetmm2.xml @@ -39,7 +39,7 @@ - + @@ -88,9 +88,9 @@ - +
- +
@@ -104,7 +104,7 @@
- +
@@ -180,7 +180,7 @@
- +
@@ -221,7 +221,7 @@ ap.CFLAGS += -DACTUATORS=\"servos_4017_hw.h\" -DSERVOS_4017 ap.srcs += $(SRC_ARCH)/servos_4017_hw.c actuators.c ap.CFLAGS += -DRADIO_CONTROL -ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c +ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c ap.CFLAGS += -DDOWNLINK -DUSE_UART1 -DDOWNLINK_TRANSPORT=XBeeTransport -DXBEE_UART=Uart1 -DDATALINK=XBEE -DUART1_BAUD=B57600 ap.srcs += downlink.c $(SRC_ARCH)/mcu_periph/uart_arch.c datalink.c xbee.c @@ -232,7 +232,7 @@ ap.srcs += downlink.c $(SRC_ARCH)/mcu_periph/uart_arch.c datalink.c xbee.c ap.CFLAGS += -DINTER_MCU -ap.srcs += inter_mcu.c +ap.srcs += inter_mcu.c ap.CFLAGS += -DADC -DUSE_ADC_0 -DUSE_ADC_1 -DUSE_ADC_2 -DUSE_ADC_4 ap.srcs += $(SRC_ARCH)/adc_hw.c diff --git a/conf/airframes/mm/fixed-wing/fw_ins_arduimu.xml b/conf/airframes/mm/fixed-wing/fw_ins_arduimu.xml index bd593ded79..c41ab6803c 100644 --- a/conf/airframes/mm/fixed-wing/fw_ins_arduimu.xml +++ b/conf/airframes/mm/fixed-wing/fw_ins_arduimu.xml @@ -84,7 +84,7 @@ - + @@ -115,9 +115,9 @@ - +
- +
@@ -130,7 +130,7 @@
- +
diff --git a/conf/airframes/mm/fixed-wing/merlin.xml b/conf/airframes/mm/fixed-wing/merlin.xml index c901aafb24..ff576007fb 100644 --- a/conf/airframes/mm/fixed-wing/merlin.xml +++ b/conf/airframes/mm/fixed-wing/merlin.xml @@ -79,9 +79,9 @@
- +
- +
@@ -96,7 +96,7 @@
- + @@ -134,7 +134,7 @@ - +
diff --git a/conf/airframes/mm/fixed-wing/miniwing.xml b/conf/airframes/mm/fixed-wing/miniwing.xml index 68bee9865c..f4c41ba9f6 100644 --- a/conf/airframes/mm/fixed-wing/miniwing.xml +++ b/conf/airframes/mm/fixed-wing/miniwing.xml @@ -35,7 +35,7 @@ - + @@ -81,9 +81,9 @@
- +
- +
@@ -96,7 +96,7 @@
- +
@@ -172,7 +172,7 @@
- + CONFIG = \"tiny_2_1.h\" @@ -195,7 +195,7 @@ ap.CFLAGS += -DDOWNLINK -DUSE_UART1 -DDOWNLINK_TRANSPORT=XBeeTransport -DXBEE_UA ap.srcs += downlink.c $(SRC_ARCH)/mcu_periph/uart_arch.c datalink.c xbee.c ap.CFLAGS += -DINTER_MCU -ap.srcs += inter_mcu.c +ap.srcs += inter_mcu.c ap.CFLAGS += -DADC -DUSE_ADC_0 -DUSE_ADC_1 -DUSE_ADC_2 ap.srcs += $(SRC_ARCH)/adc_hw.c diff --git a/conf/airframes/mm/fixed-wing/slowfast.xml b/conf/airframes/mm/fixed-wing/slowfast.xml index e2490384cf..7632f529d5 100644 --- a/conf/airframes/mm/fixed-wing/slowfast.xml +++ b/conf/airframes/mm/fixed-wing/slowfast.xml @@ -57,7 +57,7 @@ - + @@ -74,7 +74,7 @@ - +
@@ -106,7 +106,7 @@ - +
@@ -116,9 +116,9 @@ - +
- +
@@ -132,7 +132,7 @@
- +
@@ -236,7 +236,7 @@ ap.CFLAGS += -DACTUATORS=\"servos_4017_hw.h\" -DSERVOS_4017 ap.srcs += $(SRC_ARCH)/servos_4017_hw.c actuators.c ap.CFLAGS += -DRADIO_CONTROL -ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c +ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c ap.CFLAGS += -DDOWNLINK -DUSE_UART1 -DDOWNLINK_TRANSPORT=XBeeTransport -DXBEE_UART=Uart1 -DDATALINK=XBEE -DUART1_BAUD=B57600 ap.srcs += downlink.c $(SRC_ARCH)/mcu_periph/uart_arch.c datalink.c xbee.c @@ -247,7 +247,7 @@ ap.srcs += downlink.c $(SRC_ARCH)/mcu_periph/uart_arch.c datalink.c xbee.c ap.CFLAGS += -DINTER_MCU -ap.srcs += inter_mcu.c +ap.srcs += inter_mcu.c ap.CFLAGS += -DADC -DUSE_ADC_0 -DUSE_ADC_1 -DUSE_ADC_2 -DUSE_ADC_3 ap.srcs += $(SRC_ARCH)/adc_hw.c diff --git a/conf/airframes/mm/fixed-wing/slowfast2.xml b/conf/airframes/mm/fixed-wing/slowfast2.xml index 622adedb12..917858c056 100644 --- a/conf/airframes/mm/fixed-wing/slowfast2.xml +++ b/conf/airframes/mm/fixed-wing/slowfast2.xml @@ -67,7 +67,7 @@ - + @@ -84,7 +84,7 @@ - +
@@ -116,7 +116,7 @@ - +
@@ -126,9 +126,9 @@ - +
- +
@@ -142,7 +142,7 @@
- +
@@ -250,7 +250,7 @@ ap.CFLAGS += -DACTUATORS=\"servos_4017_hw.h\" -DSERVOS_4017 ap.srcs += $(SRC_ARCH)/servos_4017_hw.c actuators.c ap.CFLAGS += -DRADIO_CONTROL -ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c +ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c ap.CFLAGS += -DDOWNLINK -DUSE_UART1 -DDOWNLINK_TRANSPORT=XBeeTransport -DXBEE_UART=Uart1 -DDATALINK=XBEE -DUART1_BAUD=B57600 ap.srcs += downlink.c $(SRC_ARCH)/mcu_periph/uart_arch.c datalink.c xbee.c @@ -261,7 +261,7 @@ ap.srcs += downlink.c $(SRC_ARCH)/mcu_periph/uart_arch.c datalink.c xbee.c ap.CFLAGS += -DINTER_MCU -ap.srcs += inter_mcu.c +ap.srcs += inter_mcu.c ap.CFLAGS += -DADC -DUSE_ADC_0 -DUSE_ADC_1 -DUSE_ADC_2 -DUSE_ADC_3 ap.srcs += $(SRC_ARCH)/adc_hw.c diff --git a/conf/airframes/obsolete/logger_sd.xml b/conf/airframes/obsolete/logger_sd.xml index 0d6a3714b3..3da654143f 100644 --- a/conf/airframes/obsolete/logger_sd.xml +++ b/conf/airframes/obsolete/logger_sd.xml @@ -6,7 +6,7 @@ short, microSD card can be directly soldered to Molex cable. For now only non SDHC SD cards (<= 2GB) are supported. martinmm@pfump.org - microSD TinyV2 SPI J3 + microSD TinyV2 SPI J3 8 nc 7 DO 5 MISO 6 GND 1 GND @@ -19,7 +19,7 @@ Looking onto the gold plated connector side of the microSD card: ############### - I 8 + I 8 I 7 I 6 I 5 @@ -61,15 +61,15 @@ ap.CFLAGS += -DHW_ENDPOINT_LPC2000_SPINUM=1 #efsl ap.CFLAGS += -I $(SRC_ARCH)/efsl/inc -I $(SRC_ARCH)/efsl/conf -ap.srcs += $(SRC_ARCH)/efsl/src/efs.c $(SRC_ARCH)/efsl/src/plibc.c -ap.srcs += $(SRC_ARCH)/efsl/src/disc.c $(SRC_ARCH)/efsl/src/partition.c -ap.srcs += $(SRC_ARCH)/efsl/src/time.c $(SRC_ARCH)/efsl/src/fs.c +ap.srcs += $(SRC_ARCH)/efsl/src/efs.c $(SRC_ARCH)/efsl/src/plibc.c +ap.srcs += $(SRC_ARCH)/efsl/src/disc.c $(SRC_ARCH)/efsl/src/partition.c +ap.srcs += $(SRC_ARCH)/efsl/src/time.c $(SRC_ARCH)/efsl/src/fs.c ap.srcs += $(SRC_ARCH)/efsl/src/fat.c $(SRC_ARCH)/efsl/src/file.c -ap.srcs += $(SRC_ARCH)/efsl/src/dir.c $(SRC_ARCH)/efsl/src/ls.c +ap.srcs += $(SRC_ARCH)/efsl/src/dir.c $(SRC_ARCH)/efsl/src/ls.c ap.srcs += $(SRC_ARCH)/efsl/src/mkfs.c $(SRC_ARCH)/efsl/src/debug.c ap.srcs += $(SRC_ARCH)/efsl/src/ioman.c $(SRC_ARCH)/efsl/src/ui.c -ap.srcs += $(SRC_ARCH)/efsl/src/extract.c -ap.srcs += $(SRC_ARCH)/efsl/src/interfaces/lpc2000_spi.c +ap.srcs += $(SRC_ARCH)/efsl/src/extract.c +ap.srcs += $(SRC_ARCH)/efsl/src/interfaces/lpc2000_spi.c ap.srcs += $(SRC_ARCH)/efsl/src/interfaces/sd.c #usb mass storage @@ -79,9 +79,9 @@ ap.CFLAGS += -I $(SRC_ARCH)/lpcusb -I $(SRC_ARCH)/lpcusb/examples ap.srcs += $(SRC_ARCH)/usb_msc_hw.c ap.srcs += $(SRC_ARCH)/lpcusb/usbhw_lpc.c $(SRC_ARCH)/lpcusb/usbcontrol.c ap.srcs += $(SRC_ARCH)/lpcusb/usbstdreq.c $(SRC_ARCH)/lpcusb/usbinit.c -ap.srcs += $(SRC_ARCH)/lpcusb/examples/msc_bot.c -ap.srcs += $(SRC_ARCH)/lpcusb/examples/msc_scsi.c -ap.srcs += $(SRC_ARCH)/lpcusb/examples/blockdev_sd.c +ap.srcs += $(SRC_ARCH)/lpcusb/examples/msc_bot.c +ap.srcs += $(SRC_ARCH)/lpcusb/examples/msc_scsi.c +ap.srcs += $(SRC_ARCH)/lpcusb/examples/blockdev_sd.c ap.srcs += $(SRC_ARCH)/lpcusb/examples/lpc2000_spi.c diff --git a/conf/airframes/obsolete/tiny_hitl.xml b/conf/airframes/obsolete/tiny_hitl.xml index 4638d90d03..b784c66a5f 100644 --- a/conf/airframes/obsolete/tiny_hitl.xml +++ b/conf/airframes/obsolete/tiny_hitl.xml @@ -81,7 +81,7 @@
- +
@@ -129,7 +129,7 @@ - + @@ -175,14 +175,14 @@ ap.srcs += $(SRC_ARCH)/servos_4015_MAT_hw.c actuators.c # 41.200MHz ap.CFLAGS += -DRADIO_CONTROL -ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c +ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c -# transparent +# transparent ap.CFLAGS += -DDOWNLINK -DUSE_UART0 -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_FBW_DEVICE=Uart0 -DDOWNLINK_AP_DEVICE=Uart0 -DPPRZ_UART=Uart0 -DDATALINK=PPRZ -DUART0_BAUD=B9600 ap.srcs += downlink.c $(SRC_ARCH)/mcu_periph/uart_arch.c datalink.c pprz_transport.c ap.CFLAGS += -DINTER_MCU -ap.srcs += inter_mcu.c +ap.srcs += inter_mcu.c ap.CFLAGS += -DADC -DUSE_ADC_0 -DUSE_ADC_1 -DUSE_ADC_2 -DUSE_ADC_3 ap.srcs += $(SRC_ARCH)/adc_hw.c diff --git a/conf/airframes/obsolete/vor.xml b/conf/airframes/obsolete/vor.xml index ef449a636a..57f2edc770 100644 --- a/conf/airframes/obsolete/vor.xml +++ b/conf/airframes/obsolete/vor.xml @@ -23,7 +23,7 @@ main.srcs += firmwares/vor/lpc_vor_convertions.c main.CFLAGS += -DUSE_UART0 -DUART0_BAUD=B9600 main.srcs += $(SRC_ARCH)/mcu_periph/uart_arch.c -main.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=Uart0 +main.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=Uart0 main.srcs += downlink.c pprz_transport.c main.srcs += firmwares/vor/vor_int_demod_decim.c diff --git a/conf/airframes/obsolete/whirly.xml b/conf/airframes/obsolete/whirly.xml index 145843f1d7..cd81a31856 100644 --- a/conf/airframes/obsolete/whirly.xml +++ b/conf/airframes/obsolete/whirly.xml @@ -72,7 +72,7 @@ -USER = +USER = HOST = whirly-dev TARGET_DIR = ~ diff --git a/conf/airframes/osam_xsens_twog.xml b/conf/airframes/osam_xsens_twog.xml index 26ce1c2a7a..26eb2afceb 100644 --- a/conf/airframes/osam_xsens_twog.xml +++ b/conf/airframes/osam_xsens_twog.xml @@ -73,7 +73,7 @@ - + @@ -130,14 +130,14 @@ - +
-->
- +
@@ -205,5 +205,5 @@
- + diff --git a/conf/airframes/test_i2c.xml b/conf/airframes/test_i2c.xml index 8ddf557a10..53bf60d7dd 100644 --- a/conf/airframes/test_i2c.xml +++ b/conf/airframes/test_i2c.xml @@ -24,7 +24,7 @@ mb.CFLAGS += -DUSE_LED mb.CFLAGS += -DUSE_UART0 -DUART0_BAUD=B38400 mb.srcs += $(SRC_ARCH)/mcu_periph/uart_arch.c -mb.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=Uart0 +mb.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=Uart0 mb.srcs += downlink.c pprz_transport.c mb.CFLAGS += -DDATALINK=PPRZ -DPPRZ_UART=Uart0 diff --git a/conf/airframes/usb_test.xml b/conf/airframes/usb_test.xml index 197e442754..7a011cbf86 100644 --- a/conf/airframes/usb_test.xml +++ b/conf/airframes/usb_test.xml @@ -52,7 +52,7 @@ - + @@ -99,7 +99,7 @@
- +
@@ -110,7 +110,7 @@
- +
diff --git a/conf/airframes/wind_tunnel.xml b/conf/airframes/wind_tunnel.xml index 418362b110..9c4df1af93 100644 --- a/conf/airframes/wind_tunnel.xml +++ b/conf/airframes/wind_tunnel.xml @@ -24,7 +24,7 @@ ap.srcs += $(SRC_ARCH)/armVIC.c ap.CFLAGS += -DUSE_UART0 -DUART0_BAUD=B38400 ap.srcs += $(SRC_ARCH)/mcu_periph/uart_arch.c -ap.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=Uart0 +ap.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=Uart0 ap.srcs += downlink.c pprz_transport.c ap.CFLAGS += -DDATALINK=PPRZ -DPPRZ_UART=Uart0 @@ -54,7 +54,7 @@ mb.srcs += $(SRC_ARCH)/armVIC.c mb.CFLAGS += -DUSE_UART0 -DUART0_BAUD=B38400 mb.srcs += $(SRC_ARCH)/mcu_periph/uart_arch.c -mb.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=Uart0 +mb.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_DEVICE=Uart0 mb.srcs += downlink.c pprz_transport.c mb.CFLAGS += -DDATALINK=PPRZ -DPPRZ_UART=Uart0 diff --git a/conf/autopilot/lisa_l_test_progs.makefile b/conf/autopilot/lisa_l_test_progs.makefile index a2292f254f..1b5f29999b 100644 --- a/conf/autopilot/lisa_l_test_progs.makefile +++ b/conf/autopilot/lisa_l_test_progs.makefile @@ -310,7 +310,7 @@ test_adc.CFLAGS += -DUSE_ADC1_2_IRQ_HANDLER # -# common test +# common test # # configuration # SYS_TIME_LED @@ -328,7 +328,7 @@ COMMON_TEST_SRCS = $(SRC_AIRBORNE)/mcu.c \ COMMON_TEST_CFLAGS += -DUSE_LED COMMON_TEST_SRCS += $(SRC_ARCH)/led_hw.c COMMON_TEST_CFLAGS += -DUSE_SYS_TIME -DSYS_TIME_LED=$(SYS_TIME_LED) -COMMON_TEST_CFLAGS += -DPERIODIC_TASK_PERIOD='SYS_TICS_OF_SEC((1./$(PERIODIC_FREQUENCY).))' +COMMON_TEST_CFLAGS += -DPERIODIC_TASK_PERIOD='SYS_TICS_OF_SEC((1./$(PERIODIC_FREQUENCY).))' COMMON_TEST_CFLAGS += -DPERIODIC_FREQUENCY=$(PERIODIC_FREQUENCY) COMMON_TEST_SRCS += sys_time.c $(SRC_ARCH)/sys_time_hw.c COMMON_TEST_CFLAGS += -DUSE_$(MODEM_PORT) -D$(MODEM_PORT)_BAUD=$(MODEM_BAUD) @@ -443,7 +443,7 @@ ifeq ($(AHRS), icq) #test_ahrs.CFLAGS += -DAHRS_TYPE=\"ICQ\" test_ahrs.CFLAGS += -DAHRS_PROPAGATE_FREQUENCY=512 test_ahrs.CFLAGS += -DAHRS_TYPE_H=\"subsystems/ahrs/ahrs_int_cmpl.h\" -test_ahrs.srcs +=subsystems/ahrs/ahrs_int_cmpl.c +test_ahrs.srcs +=subsystems/ahrs/ahrs_int_cmpl.c endif ifeq ($(AHRS), flq) diff --git a/conf/autopilot/lisa_m_test_progs.makefile b/conf/autopilot/lisa_m_test_progs.makefile index 2922f9aeec..e5c334f6f0 100644 --- a/conf/autopilot/lisa_m_test_progs.makefile +++ b/conf/autopilot/lisa_m_test_progs.makefile @@ -412,7 +412,7 @@ test_imu_aspirin.srcs = $(SRC_AIRBORNE)/mcu.c \ $(SRC_ARCH)/mcu_arch.c \ $(SRC_ARCH)/stm32_exceptions.c \ $(SRC_ARCH)/stm32_vector_table.c\ - booz/test/booz_test_imu.c + booz/test/booz_test_imu.c test_imu_aspirin.CFLAGS += -DUSE_LED test_imu_aspirin.srcs += $(SRC_ARCH)/led_hw.c diff --git a/conf/autopilot/subsystems/rotorcraft/imu_crista_hmc5843.makefile b/conf/autopilot/subsystems/rotorcraft/imu_crista_hmc5843.makefile index 6332c4ec38..9a5faee8fd 100644 --- a/conf/autopilot/subsystems/rotorcraft/imu_crista_hmc5843.makefile +++ b/conf/autopilot/subsystems/rotorcraft/imu_crista_hmc5843.makefile @@ -60,14 +60,14 @@ # imu Crista -imu_CFLAGS += -DIMU_TYPE_H=\"subsystems/imu/imu_crista.h\" +imu_CFLAGS += -DIMU_TYPE_H=\"subsystems/imu/imu_crista.h\" imu_srcs += $(SRC_SUBSYSTEMS)/imu.c imu_srcs += $(SRC_SUBSYSTEMS)/imu/imu_crista.c imu_srcs += $(SRC_ARCH)/subsystems/imu/imu_crista_arch.c imu_srcs += peripherals/hmc5843.c imu_srcs += $(SRC_ARCH)/peripherals/hmc5843_arch.c -imu_CFLAGS += -DUSE_HMC5843 +imu_CFLAGS += -DUSE_HMC5843 ifeq ($(ARCH), lpc21) imu_CFLAGS += -DUSE_I2C1 diff --git a/conf/flight_plans/EMAV2008.xml b/conf/flight_plans/EMAV2008.xml index 2cadcfc0a2..4e10939332 100644 --- a/conf/flight_plans/EMAV2008.xml +++ b/conf/flight_plans/EMAV2008.xml @@ -59,7 +59,7 @@ - + diff --git a/conf/flight_plans/clover.xml b/conf/flight_plans/clover.xml index 655baedcd4..e5f82bdf5f 100644 --- a/conf/flight_plans/clover.xml +++ b/conf/flight_plans/clover.xml @@ -9,7 +9,7 @@ - + diff --git a/conf/flight_plans/corsica.xml b/conf/flight_plans/corsica.xml index 16197dab1a..b429892412 100644 --- a/conf/flight_plans/corsica.xml +++ b/conf/flight_plans/corsica.xml @@ -15,11 +15,11 @@ - + - + diff --git a/conf/flight_plans/versatile_carto_fixe_muret.xml b/conf/flight_plans/versatile_carto_fixe_muret.xml index a30a00ba30..0c52f2d526 100644 --- a/conf/flight_plans/versatile_carto_fixe_muret.xml +++ b/conf/flight_plans/versatile_carto_fixe_muret.xml @@ -1,6 +1,6 @@ - +
@@ -59,7 +59,7 @@ float varsweepsize=110; - + @@ -69,25 +69,25 @@ float varsweepsize=110; - + - + - + - + - + @@ -101,7 +101,7 @@ float varsweepsize=110; - + @@ -115,7 +115,7 @@ float varsweepsize=110; - + diff --git a/conf/gui.xml b/conf/gui.xml index c3be4ac0a0..93f99e18fc 100644 --- a/conf/gui.xml +++ b/conf/gui.xml @@ -1,9 +1,9 @@ @@ -107,19 +107,19 @@ It has 9 buttons. - + - + - + @@ -131,12 +131,12 @@ It has 9 buttons. - + - + diff --git a/conf/joystick/logitech_dual_action.xml b/conf/joystick/logitech_dual_action.xml index e9d7572d7c..5c66929bf9 100644 --- a/conf/joystick/logitech_dual_action.xml +++ b/conf/joystick/logitech_dual_action.xml @@ -24,7 +24,7 @@ The "mode" button swaps the axes on the left stick and the d pad.
- diff --git a/conf/modules/digital_cam_i2c.xml b/conf/modules/digital_cam_i2c.xml index 3fe59ff84a..6315d791c6 100644 --- a/conf/modules/digital_cam_i2c.xml +++ b/conf/modules/digital_cam_i2c.xml @@ -6,7 +6,7 @@ - + diff --git a/conf/modules/pbn.xml b/conf/modules/pbn.xml index 0faa38ce5f..e8eebb3973 100644 --- a/conf/modules/pbn.xml +++ b/conf/modules/pbn.xml @@ -1,7 +1,7 @@ - +
@@ -21,8 +21,8 @@ - - + +
diff --git a/conf/settings/lisa.xml b/conf/settings/lisa.xml index f717d6034f..9f95c86edb 100644 --- a/conf/settings/lisa.xml +++ b/conf/settings/lisa.xml @@ -10,7 +10,7 @@ - + diff --git a/conf/settings/mercury_csc.xml b/conf/settings/mercury_csc.xml index 9e7969e1ff..f46fd98a93 100644 --- a/conf/settings/mercury_csc.xml +++ b/conf/settings/mercury_csc.xml @@ -5,7 +5,7 @@ - + 0.7 0.0 @@ -255,8 +255,8 @@ aero/alpha-deg -10.0 0.02748 - -8.0 0.02243 - -6.0 0.02335 + -8.0 0.02243 + -6.0 0.02335 -4.0 0.02770 -2.0 0.03369 0.0 0.04284 @@ -316,7 +316,7 @@ aero/alpha-deg -23 -0.7 - -21 -0.9 + -21 -0.9 -20 -1.0 -10 -0.1647 0 0.7394 diff --git a/conf/simulator/Corsica/Engines/18x8.xml b/conf/simulator/Corsica/Engines/18x8.xml index 6f4aae8cf6..3dd84ebec3 100644 --- a/conf/simulator/Corsica/Engines/18x8.xml +++ b/conf/simulator/Corsica/Engines/18x8.xml @@ -44,7 +44,7 @@ 0.7 0.0572 0.8 0.0467 1.0 0.0167 - 1.4 -0.0803 + 1.4 -0.0803 diff --git a/conf/simulator/Malolo1/Engines/18x8.xml b/conf/simulator/Malolo1/Engines/18x8.xml index 6f4aae8cf6..3dd84ebec3 100644 --- a/conf/simulator/Malolo1/Engines/18x8.xml +++ b/conf/simulator/Malolo1/Engines/18x8.xml @@ -44,7 +44,7 @@ 0.7 0.0572 0.8 0.0467 1.0 0.0167 - 1.4 -0.0803 + 1.4 -0.0803 diff --git a/conf/simulator/Malolo1/Malolo1-set.xml b/conf/simulator/Malolo1/Malolo1-set.xml index c85509bb87..515165581e 100644 --- a/conf/simulator/Malolo1/Malolo1-set.xml +++ b/conf/simulator/Malolo1/Malolo1-set.xml @@ -42,7 +42,7 @@ dynamics model, and external 3D model. Aircraft/Malolo1/Models/Malolo1.xml - + true @@ -85,8 +85,8 @@ dynamics model, and external 3D model. 700 - - + + 48.0 @@ -94,7 +94,7 @@ dynamics model, and external 3D model. 400.0 1000.0 6000.0 - 0.008 + 0.008 0.35 0.001 diff --git a/conf/simulator/Malolo1/Malolo1.xml b/conf/simulator/Malolo1/Malolo1.xml index c12a9ae9c3..b3dafa86fc 100644 --- a/conf/simulator/Malolo1/Malolo1.xml +++ b/conf/simulator/Malolo1/Malolo1.xml @@ -150,7 +150,7 @@ 1.0 - + 36.36 0 @@ -291,11 +291,11 @@ aero/alpha-rad - -1.5700 1.5000 - -0.2600 0.0560 - 0.0000 0.0280 - 0.2600 0.0560 - 1.5700 1.5000 + -1.5700 1.5000 + -0.2600 0.0560 + 0.0000 0.0280 + 0.2600 0.0560 + 1.5700 1.5000
@@ -317,11 +317,11 @@ aero/beta-rad - -1.5700 1.2300 - -0.2600 0.0500 - 0.0000 0.0000 - 0.2600 0.0500 - 1.5700 1.2300 + -1.5700 1.2300 + -0.2600 0.0500 + 0.0000 0.0000 + 0.2600 0.0500 + 1.5700 1.2300
@@ -358,10 +358,10 @@ aero/alpha-rad - -0.2000 -0.7500 - 0.0000 0.2500 - 0.2300 1.4000 - 0.6000 0.7100 + -0.2000 -0.7500 + 0.0000 0.2500 + 0.2300 1.4000 + 0.6000 0.7100
@@ -421,8 +421,8 @@ velocities/mach - 0.0000 0.1300 - 2.0000 0.0570 + 0.0000 0.1300 + 2.0000 0.0570
@@ -461,7 +461,7 @@ velocities/mach 0.0000 -0.5000 - 2.0000 -0.2750 + 2.0000 -0.2750 diff --git a/conf/simulator/Malolo1/Models/Malolo1.xml b/conf/simulator/Malolo1/Models/Malolo1.xml index 09144f72eb..d4869ca6fe 100644 --- a/conf/simulator/Malolo1/Models/Malolo1.xml +++ b/conf/simulator/Malolo1/Models/Malolo1.xml @@ -13,7 +13,7 @@ rhelevon controls/flight/elevator 15 - 0 + 0
0.65 1.4 @@ -31,7 +31,7 @@ rhelevon controls/flight/aileron -15 - 0 + 0
0.65 1.4 @@ -49,7 +49,7 @@ lhelevon controls/flight/elevator 15 - 0 + 0
0.65 -1.4 @@ -67,7 +67,7 @@ lhelevon controls/flight/aileron 15 - 0 + 0
0.65 -1.4 @@ -85,7 +85,7 @@ spin prop2 engines/engine/rpm - -0.2 + -0.2
0 0 @@ -99,5 +99,5 @@ - + diff --git a/conf/simulator/flightgear/hexa.xml b/conf/simulator/flightgear/hexa.xml index dfbc0d6491..437037be55 100644 --- a/conf/simulator/flightgear/hexa.xml +++ b/conf/simulator/flightgear/hexa.xml @@ -6,11 +6,11 @@ 0 - 0 + 0 90 -0.3 0 diff --git a/conf/simulator/flightgear/mikrokopter.xml b/conf/simulator/flightgear/mikrokopter.xml index ca22dd0072..2041604ac4 100644 --- a/conf/simulator/flightgear/mikrokopter.xml +++ b/conf/simulator/flightgear/mikrokopter.xml @@ -6,7 +6,7 @@ 0. - 0. + 0. 90. 0. 0. diff --git a/conf/simulator/flightgear/simple_bipe.xml b/conf/simulator/flightgear/simple_bipe.xml index be55acb671..48723691e0 100644 --- a/conf/simulator/flightgear/simple_bipe.xml +++ b/conf/simulator/flightgear/simple_bipe.xml @@ -6,11 +6,11 @@ -90 - 90 + 90 0 -0.3 0 diff --git a/conf/simulator/jsbsim/aircraft/BOOZ2_A1.xml b/conf/simulator/jsbsim/aircraft/BOOZ2_A1.xml index 5d26746916..221cd780b1 100644 --- a/conf/simulator/jsbsim/aircraft/BOOZ2_A1.xml +++ b/conf/simulator/jsbsim/aircraft/BOOZ2_A1.xml @@ -233,7 +233,7 @@ 0 - + @@ -273,7 +273,7 @@ 0 - + @@ -313,7 +313,7 @@ 0 - + @@ -353,7 +353,7 @@ 0 - + @@ -373,7 +373,7 @@ - + diff --git a/conf/simulator/jsbsim/aircraft/BOOZ2_A1P.xml b/conf/simulator/jsbsim/aircraft/BOOZ2_A1P.xml index 5d26746916..221cd780b1 100644 --- a/conf/simulator/jsbsim/aircraft/BOOZ2_A1P.xml +++ b/conf/simulator/jsbsim/aircraft/BOOZ2_A1P.xml @@ -233,7 +233,7 @@ 0 - + @@ -273,7 +273,7 @@ 0 - + @@ -313,7 +313,7 @@ 0 - + @@ -353,7 +353,7 @@ 0 - + @@ -373,7 +373,7 @@ - + diff --git a/conf/telemetry/tl.xml b/conf/telemetry/tl.xml index 5ff6441e9d..f82332f4c9 100644 --- a/conf/telemetry/tl.xml +++ b/conf/telemetry/tl.xml @@ -9,7 +9,7 @@ - + diff --git a/conf/ubx.xml b/conf/ubx.xml index eaa6053c5b..cb8b5d572b 100644 --- a/conf/ubx.xml +++ b/conf/ubx.xml @@ -96,7 +96,7 @@ - + diff --git a/sw/airborne/ap_downlink.h b/sw/airborne/ap_downlink.h index d50310508f..747587eaea 100644 --- a/sw/airborne/ap_downlink.h +++ b/sw/airborne/ap_downlink.h @@ -165,7 +165,7 @@ # define PERIODIC_SEND_IMU_GYRO_RAW(_chan) {} # define PERIODIC_SEND_IMU_MAG_RAW(_chan) {} # define PERIODIC_SEND_IMU_GYRO(_chan) { DOWNLINK_SEND_IMU_GYRO(_chan, &ins_p, &ins_q, &ins_r)} -# define PERIODIC_SEND_IMU_ACCEL(_chan) { DOWNLINK_SEND_IMU_ACCEL(_chan, &ins_ax, &ins_ay, &ins_az)} +# define PERIODIC_SEND_IMU_ACCEL(_chan) { DOWNLINK_SEND_IMU_ACCEL(_chan, &ins_ax, &ins_ay, &ins_az)} # define PERIODIC_SEND_IMU_MAG(_chan) { DOWNLINK_SEND_IMU_MAG(_chan, &ins_mx, &ins_my, &ins_mz)} # else # define PERIODIC_SEND_IMU_ACCEL_RAW(_chan) {} diff --git a/sw/airborne/arch/lpc21/mcu_periph/dac_arch.c b/sw/airborne/arch/lpc21/mcu_periph/dac_arch.c index adda46e12b..3955ad27a1 100644 --- a/sw/airborne/arch/lpc21/mcu_periph/dac_arch.c +++ b/sw/airborne/arch/lpc21/mcu_periph/dac_arch.c @@ -1,6 +1,6 @@ #include "mcu_periph/dac.h" /* turn on DAC pins */ -void dac_init(void) { +void dac_init(void) { PINSEL1 |= 2 << 18; } diff --git a/sw/airborne/arch/lpc21/mcu_periph/spi_slave_hs_arch.c b/sw/airborne/arch/lpc21/mcu_periph/spi_slave_hs_arch.c index 21f112fb18..d54cd92bb2 100644 --- a/sw/airborne/arch/lpc21/mcu_periph/spi_slave_hs_arch.c +++ b/sw/airborne/arch/lpc21/mcu_periph/spi_slave_hs_arch.c @@ -63,7 +63,7 @@ static void SSP_ISR(void) __attribute__((naked)); #define SSPCR1_VAL (SSP_LBM | SSP_SSE | SSP_MS | SSP_SOD ) -/* SSPCPSR settings +/* SSPCPSR settings * min value as master: 2 * min value as slave: 12 */ @@ -115,7 +115,7 @@ void spi_init(void) { // Enable SPI Slave SetBit(SSPCR1, SSE); - + // Enable Receive interrupt SetBit(SSPIMSC, RXIM); @@ -123,12 +123,12 @@ void spi_init(void) { /* * SSP Status: - * + * * ROVR Read Overrun * WCOL Write Collision (send new byte during a transfer in progress * ABRT SSEL inactive before end of transfer - * - * + * + * */ @@ -149,7 +149,7 @@ static void SSP_ISR(void) { SSP_Write(0x00); } - + //do { uint16_t temp; @@ -161,13 +161,13 @@ static void SSP_ISR(void) { // check for more room in queue if (temp != spi_slave_hs_rx_extract_idx) spi_slave_hs_rx_insert_idx = temp; // update insert index - + // else overrun - } + } // while FIFO not empty //while (SSPSR & RNE); - -/* + +/* // loop until not more interrupt sources while (((iid = U0IIR) & UIIR_NO_INT) == 0) while (U0LSR & ULSR_THRE) diff --git a/sw/airborne/arch/lpc21/mcu_periph/spi_slave_hs_arch.h b/sw/airborne/arch/lpc21/mcu_periph/spi_slave_hs_arch.h index 152c3da0d7..d62f25ef17 100644 --- a/sw/airborne/arch/lpc21/mcu_periph/spi_slave_hs_arch.h +++ b/sw/airborne/arch/lpc21/mcu_periph/spi_slave_hs_arch.h @@ -29,7 +29,7 @@ Highspeed SPI Slave Interface SS on P0.20 Circular Buffer - + */ #include "std.h" diff --git a/sw/airborne/arch/lpc21/mcu_periph/uart_arch.c b/sw/airborne/arch/lpc21/mcu_periph/uart_arch.c index f6017400fc..4e98eb8123 100644 --- a/sw/airborne/arch/lpc21/mcu_periph/uart_arch.c +++ b/sw/airborne/arch/lpc21/mcu_periph/uart_arch.c @@ -44,7 +44,7 @@ static inline void uart_enable_interrupts(struct uart_periph* p) { static inline void uart_set_baudrate(struct uart_periph* p, uint32_t baud) { // set the baudrate - ((uartRegs_t *)(p->reg_addr))->lcr = ULCR_DLAB_ENABLE; // select divisor latches + ((uartRegs_t *)(p->reg_addr))->lcr = ULCR_DLAB_ENABLE; // select divisor latches ((uartRegs_t *)(p->reg_addr))->dll = (uint8_t)baud; // set for baud low byte ((uartRegs_t *)(p->reg_addr))->dlm = (uint8_t)(baud >> 8); // set for baud high byte diff --git a/sw/airborne/arch/omap/mcu_periph/uart_arch.h b/sw/airborne/arch/omap/mcu_periph/uart_arch.h index b3845bf8d0..0acd36c9ac 100644 --- a/sw/airborne/arch/omap/mcu_periph/uart_arch.h +++ b/sw/airborne/arch/omap/mcu_periph/uart_arch.h @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. */ #ifndef UART_ARCH_H diff --git a/sw/airborne/arch/stm32/mcu_arch.c b/sw/airborne/arch/stm32/mcu_arch.c index 3fc74d03bf..4ab5202c37 100644 --- a/sw/airborne/arch/stm32/mcu_arch.c +++ b/sw/airborne/arch/stm32/mcu_arch.c @@ -91,7 +91,7 @@ void mcu_arch_init(void) { RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB | RCC_APB2Periph_GPIOC | RCC_APB2Periph_GPIOD | RCC_APB2Periph_GPIOE | RCC_APB2Periph_AFIO, ENABLE); -#endif +#endif } diff --git a/sw/airborne/arch/stm32/mcu_periph/i2c_arch.c b/sw/airborne/arch/stm32/mcu_periph/i2c_arch.c index 59dfcf823a..8d69b3f9da 100644 --- a/sw/airborne/arch/stm32/mcu_periph/i2c_arch.c +++ b/sw/airborne/arch/stm32/mcu_periph/i2c_arch.c @@ -371,16 +371,16 @@ static inline void i2c_hard_reset(struct i2c_periph *p) GPIO_SetBits(GPIOB, p->scl_pin); while (GPIO_ReadInputDataBit(GPIOB, p->scl_pin) == Bit_RESET); i2c_delay(); - + // Lower SCL, wait GPIO_ResetBits(GPIOB, p->scl_pin); i2c_delay(); - + // Raise SCL, wait GPIO_SetBits(GPIOB, p->scl_pin); i2c_delay(); } - + // Generate a start condition followed by a stop condition GPIO_SetBits(GPIOB, p->scl_pin); i2c_delay(); @@ -388,23 +388,23 @@ static inline void i2c_hard_reset(struct i2c_periph *p) i2c_delay(); GPIO_ResetBits(GPIOB, p->sda_pin); i2c_delay(); - + // Raise both SCL and SDA and wait for SCL high (in case of clock stretching) GPIO_SetBits(GPIOB, p->scl_pin | p->sda_pin); while (GPIO_ReadInputDataBit(GPIOB, p->scl_pin) == Bit_RESET); - + // Wait for SDA to be high while (GPIO_ReadInputDataBit(GPIOB, p->sda_pin) != Bit_SET); - + // SCL and SDA should be high at this point, bus should be free // Return the GPIO pins to the alternate function GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_OD; GPIO_Init(GPIOB, &GPIO_InitStructure); - + I2C_DeInit(p->reg_addr); - + i2c_apply_config(p); - + if (regs->SR2 & I2C_BUSY) { // Reset the I2C block I2C_SoftwareResetCmd(p->reg_addr, ENABLE); diff --git a/sw/airborne/arch/stm32/mcu_periph/i2c_arch.old.c b/sw/airborne/arch/stm32/mcu_periph/i2c_arch.old.c index 195970cc20..e556de255d 100644 --- a/sw/airborne/arch/stm32/mcu_periph/i2c_arch.old.c +++ b/sw/airborne/arch/stm32/mcu_periph/i2c_arch.old.c @@ -366,16 +366,16 @@ static inline void i2c_hard_reset(struct i2c_periph *p) GPIO_SetBits(GPIOB, p->scl_pin); while (GPIO_ReadInputDataBit(GPIOB, p->scl_pin) == Bit_RESET); i2c_delay(); - + // Lower SCL, wait GPIO_ResetBits(GPIOB, p->scl_pin); i2c_delay(); - + // Raise SCL, wait GPIO_SetBits(GPIOB, p->scl_pin); i2c_delay(); } - + // Generate a start condition followed by a stop condition GPIO_SetBits(GPIOB, p->scl_pin); i2c_delay(); diff --git a/sw/airborne/arch/stm32/mcu_periph/uart_arch.h b/sw/airborne/arch/stm32/mcu_periph/uart_arch.h index 6160e8cbb0..71191f04ba 100644 --- a/sw/airborne/arch/stm32/mcu_periph/uart_arch.h +++ b/sw/airborne/arch/stm32/mcu_periph/uart_arch.h @@ -70,8 +70,8 @@ #define UART5_PeriphTx RCC_APB2Periph_GPIOC #define UART5_PeriphRx RCC_APB2Periph_GPIOD -/* this is unexpected the macros in spektrum_arch.c - didn't expect that rx and tx would be spilt over +/* this is unexpected the macros in spektrum_arch.c + didn't expect that rx and tx would be spilt over two ports. As the spektrum code is only interested in the rx pin we define this to be the Peripheral */ #define UART5_Periph RCC_APB2Periph_GPIOD diff --git a/sw/airborne/arch/stm32/subsystems/radio_control/spektrum_arch.c b/sw/airborne/arch/stm32/subsystems/radio_control/spektrum_arch.c index ae8927d88f..e56c2e7a3d 100644 --- a/sw/airborne/arch/stm32/subsystems/radio_control/spektrum_arch.c +++ b/sw/airborne/arch/stm32/subsystems/radio_control/spektrum_arch.c @@ -551,8 +551,8 @@ void SpektrumUartInit(void) { USART_Init(PrimaryUart(_reg), &usart); /* Enable Primary UART Receive interrupts */ USART_ITConfig(PrimaryUart(_reg), USART_IT_RXNE, ENABLE); - - /* required to get the correct baudrate on lisa m */ + + /* required to get the correct baudrate on lisa m */ pprz_usart_set_baudrate(PrimaryUart(_reg), B115200); /* Enable the Primary UART */ USART_Cmd(PrimaryUart(_reg), ENABLE); @@ -585,9 +585,9 @@ void SpektrumUartInit(void) { USART_Init(SecondaryUart(_reg), &usart); /* Enable Secondary UART Receive interrupts */ USART_ITConfig(SecondaryUart(_reg), USART_IT_RXNE, ENABLE); - - /* required to get the correct baudrate on lisa m */ - pprz_usart_set_baudrate(SecondaryUart(_reg), B115200); + + /* required to get the correct baudrate on lisa m */ + pprz_usart_set_baudrate(SecondaryUart(_reg), B115200); /* Enable the Primary UART */ USART_Cmd(SecondaryUart(_reg), ENABLE); #endif diff --git a/sw/airborne/boards/booz/baro_board.c b/sw/airborne/boards/booz/baro_board.c index 482aa7944b..cfcbc8b5b2 100644 --- a/sw/airborne/boards/booz/baro_board.c +++ b/sw/airborne/boards/booz/baro_board.c @@ -36,7 +36,7 @@ struct BaroBoard baro_board; void baro_init( void ) { - + adc_buf_channel(ADC_CHANNEL_BARO, &baro_board.buf, DEFAULT_AV_NB_SAMPLE); baro.status = BS_UNINITIALIZED; diff --git a/sw/airborne/boards/lisa_m/baro_board.h b/sw/airborne/boards/lisa_m/baro_board.h index cbe3454983..00fc719b76 100644 --- a/sw/airborne/boards/lisa_m/baro_board.h +++ b/sw/airborne/boards/lisa_m/baro_board.h @@ -42,7 +42,7 @@ struct bmp085_baro_calibration { int16_t mb; int16_t mc; int16_t md; - + // These values are calculated int32_t b5; }; diff --git a/sw/airborne/boards/lisa_m_1.0.h b/sw/airborne/boards/lisa_m_1.0.h index fd3ddee6bb..0fa3a7f7d4 100644 --- a/sw/airborne/boards/lisa_m_1.0.h +++ b/sw/airborne/boards/lisa_m_1.0.h @@ -29,7 +29,7 @@ #define DefaultVoltageOfAdc(adc) (0.00485*adc) /* Onboard ADCs */ -/* +/* ADC1 PC3/ADC13 ADC2 PA0/ADC0 ADC3 PC0/ADC10 diff --git a/sw/airborne/estimator.c b/sw/airborne/estimator.c index 7753689238..7848de6027 100644 --- a/sw/airborne/estimator.c +++ b/sw/airborne/estimator.c @@ -101,11 +101,11 @@ void estimator_init( void ) { #ifdef USE_AIRSPEED EstimatorSetAirspeed( 0. ); #endif - + #ifdef USE_AOA EstimatorSetAOA( 0. ); #endif - + estimator_flight_time = 0; estimator_airspeed = NOMINAL_AIRSPEED; diff --git a/sw/airborne/firmwares/fixedwing/guidance/guidance_v_n.c b/sw/airborne/firmwares/fixedwing/guidance/guidance_v_n.c index 6daedeaa1a..1cb63583c6 100644 --- a/sw/airborne/firmwares/fixedwing/guidance/guidance_v_n.c +++ b/sw/airborne/firmwares/fixedwing/guidance/guidance_v_n.c @@ -282,7 +282,7 @@ static inline void v_ctl_set_airspeed( void ) { BoundAbs(v_ctl_auto_airspeed_pitch_sum_err, V_CTL_AUTO_AIRSPEED_PITCH_MAX_SUM_ERR / v_ctl_auto_airspeed_pitch_igain); } - + // Reset integrators in manual or before flight if (pprz_mode == PPRZ_MODE_MANUAL || launch == 0) { v_ctl_auto_throttle_sum_err = 0.; diff --git a/sw/airborne/firmwares/fixedwing/main_ap.c b/sw/airborne/firmwares/fixedwing/main_ap.c index 36b6d9f51a..2b4dca044d 100644 --- a/sw/airborne/firmwares/fixedwing/main_ap.c +++ b/sw/airborne/firmwares/fixedwing/main_ap.c @@ -429,7 +429,7 @@ void periodic_task_ap( void ) { // Run at PERIODIC_FREQUENCY (60Hz if not defined) imu_periodic(); if (ahrs_timeout_counter < 255) - ahrs_timeout_counter ++; + ahrs_timeout_counter ++; #endif // USE_IMU diff --git a/sw/airborne/firmwares/non_ap/geiger_counter/geiger_counter.c b/sw/airborne/firmwares/non_ap/geiger_counter/geiger_counter.c index 76c22094b4..08eecb0e38 100644 --- a/sw/airborne/firmwares/non_ap/geiger_counter/geiger_counter.c +++ b/sw/airborne/firmwares/non_ap/geiger_counter/geiger_counter.c @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * */ @@ -58,7 +58,7 @@ void read_i2c() { Wire.send(dat, 2); } -void setup() { +void setup() { /* serial port */ Serial.begin(2400); pinMode(2,OUTPUT); @@ -81,7 +81,7 @@ void setup() { void loop() { unsigned char ser; int i; - + /* wait for data */ if (Serial.available() > 0) { ser = Serial.read(); @@ -103,7 +103,7 @@ void loop() { } else if (b == ',')) { i = 0; stat = FOUND_1; - } else stat = INIT; + } else stat = INIT; break; case FOUND_1: /* read counter 1 */ @@ -113,10 +113,10 @@ void loop() { } else if (b == ',')) { #ifdef DEBUG Serial.println(count_geiger_1, DEC); -#endif +#endif i = 0; stat = FOUND_2; - } else stat = INIT; + } else stat = INIT; break; case FOUND_2: /* read counter 2 */ @@ -124,12 +124,12 @@ void loop() { count_geiger_2 = count_geiger_2 * 10 + (b-'0'); if (++i > 7) state = IDLE; } else if (b == ',')) { -#ifdef DEBUG +#ifdef DEBUG Serial.println(count_geiger_2, DEC); #endif i = 0; stat = FOUND_3; - } else stat = INIT; + } else stat = INIT; break; case FOUND_3: /* ignore 3 */ @@ -138,7 +138,7 @@ void loop() { } else if (b == ',')) { i = 0; stat = FOUND_4; - } else stat = INIT; + } else stat = INIT; break; case FOUND_4: /* ignore 4 */ @@ -147,7 +147,7 @@ void loop() { } else if (b == ',')) { i = 0; stat = FOUND_5; - } else stat = INIT; + } else stat = INIT; break; case FOUND_5: /* read voltage */ @@ -161,11 +161,11 @@ void loop() { #endif received_data = 0; stat = INIT; - } else stat = INIT; + } else stat = INIT; break; default: stat = INIT; - } + } } } diff --git a/sw/airborne/firmwares/rotorcraft/stabilization/quat_setpoint.c b/sw/airborne/firmwares/rotorcraft/stabilization/quat_setpoint.c index 8fd5001414..0c286356d7 100644 --- a/sw/airborne/firmwares/rotorcraft/stabilization/quat_setpoint.c +++ b/sw/airborne/firmwares/rotorcraft/stabilization/quat_setpoint.c @@ -1,5 +1,5 @@ /* - * + * * Copyright (C) 2008-2011 Joby Energy Inc * */ @@ -45,7 +45,7 @@ static void reset_sp_quat(int32_t _psi, int32_t _theta, struct Int32Quat *initia rotated_eulers.phi = _psi; INT32_QUAT_OF_EULERS(pitch_rotated_quat, rotated_eulers); - + // compose rotation about Y axis (pitch axis) to hover pitch_rotation_angle = ANGLE_BFP_OF_REAL(QUAT_SETPOINT_HOVER_PITCH); INT32_QUAT_OF_AXIS_ANGLE(pitch_axis_quat, y_axis, pitch_rotation_angle); @@ -74,7 +74,7 @@ void stabilization_attitude_read_rc_incremental(bool_t enable_alpha_vane, bool_t pprz_t pitch = radio_control.values[RADIO_PITCH]; pprz_t yaw = radio_control.values[RADIO_YAW]; struct Int32Quat prev_sp_quat, q_e2s, temp_quat; - + struct Int32RMat R_e2s; struct Int32Rates sticks_w_bn_e, sticks_w_bn_s; @@ -135,7 +135,7 @@ void stabilization_attitude_read_rc_absolute(struct Int32Eulers sp, bool_t in_fl // convert yaw rate * dt into quaternion INT32_QUAT_OF_EULERS(sticks_quat, sticks_eulers); QUAT_COPY(prev_sp_quat, stab_att_sp_quat) - + // update setpoint by rotating by incremental yaw command INT32_QUAT_COMP_NORM_SHORTEST(stab_att_sp_quat, prev_sp_quat, sticks_quat); } else { /* if not flying, use current body position + pitch/yaw from sticks to compose setpoint */ diff --git a/sw/airborne/firmwares/rotorcraft/stabilization/stabilization_attitude_ref_quat_int.c b/sw/airborne/firmwares/rotorcraft/stabilization/stabilization_attitude_ref_quat_int.c index 3ce53dd8a7..73886a315e 100644 --- a/sw/airborne/firmwares/rotorcraft/stabilization/stabilization_attitude_ref_quat_int.c +++ b/sw/airborne/firmwares/rotorcraft/stabilization/stabilization_attitude_ref_quat_int.c @@ -41,7 +41,7 @@ #define REF_RATE_MAX_Q BFP_OF_REAL(STABILIZATION_ATTITUDE_REF_MAX_Q, REF_RATE_FRAC) #define REF_RATE_MAX_R BFP_OF_REAL(STABILIZATION_ATTITUDE_REF_MAX_R, REF_RATE_FRAC) -#define OMEGA_P STABILIZATION_ATTITUDE_REF_OMEGA_P +#define OMEGA_P STABILIZATION_ATTITUDE_REF_OMEGA_P #define ZETA_P STABILIZATION_ATTITUDE_REF_ZETA_P #define ZETA_OMEGA_P_RES 10 #define ZETA_OMEGA_P BFP_OF_REAL((ZETA_P*OMEGA_P), ZETA_OMEGA_P_RES) diff --git a/sw/airborne/inter_mcu.h b/sw/airborne/inter_mcu.h index 9c23ac17d9..925fbe3c9a 100644 --- a/sw/airborne/inter_mcu.h +++ b/sw/airborne/inter_mcu.h @@ -139,7 +139,7 @@ static inline void inter_mcu_periodic_task(void) { #ifdef SINGLE_MCU // Keep filling the buffer even if no AP commands are received inter_mcu_fill_fbw_state(); -#endif +#endif } else time_since_last_ap++; diff --git a/sw/airborne/math/pprz_geodetic_wgs84.h b/sw/airborne/math/pprz_geodetic_wgs84.h index 640bd7be30..bc0c5c132f 100644 --- a/sw/airborne/math/pprz_geodetic_wgs84.h +++ b/sw/airborne/math/pprz_geodetic_wgs84.h @@ -7,10 +7,10 @@ Ten by Ten Degree WGS-84 Geoid Heights from -180 to +170 Degrees of Longitude Geoid height approximations in meters -Source: +Source: Defense Mapping Agency. 12 Jan 1987. GPS UE Relevant WGS-84 Data Base Package. Washington, DC: Defense Mapping Agency -Link: +Link: http://www.colorado.edu/geography/gcraft/notes/datum/geoid84.html rows are from -180 to +170 starting north +90 to south-90 @@ -43,7 +43,7 @@ rows are from -180 to +170 starting north +90 to south-90 -const int8_t pprz_geodetic_wgs84_int[19][36] = +const int8_t pprz_geodetic_wgs84_int[19][36] = { {13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13}, {3,1,-2,-3,-3,-3,-1,3,1,5,9,11,19,27,31,34,33,34,33,34,28,23,17,13,9,4,4,1,-2,-2,0,2,3,2,1,1}, diff --git a/sw/airborne/modules/benchmark/flight_benchmark.c b/sw/airborne/modules/benchmark/flight_benchmark.c index a965c21b86..6c891a363f 100644 --- a/sw/airborne/modules/benchmark/flight_benchmark.c +++ b/sw/airborne/modules/benchmark/flight_benchmark.c @@ -1,9 +1,9 @@ //Author: Bruzzlee -//This module allows a quantitative assessment of the flight. -//It calculates the sum of squared error of the two-dimensional course (x / y), the altitude and true airspeed. -//The sum of squared error of the course and altitude were separated, because they are regulated separately, and so they dependent on various parameters. -//The module was written to optimize the control parameters and has already been used successfully. +//This module allows a quantitative assessment of the flight. +//It calculates the sum of squared error of the two-dimensional course (x / y), the altitude and true airspeed. +//The sum of squared error of the course and altitude were separated, because they are regulated separately, and so they dependent on various parameters. +//The module was written to optimize the control parameters and has already been used successfully. #include "firmwares/fixedwing/guidance/guidance_v.h" @@ -43,7 +43,7 @@ void flight_benchmark_init( void ) { SquareSumErr_position = 0; ToleranceAispeed = BENCHMARK_TOLERANCE_AIRSPEED; ToleranceAltitude = BENCHMARK_TOLERANCE_ALTITUDE; - TolerancePosition = BENCHMARK_TOLERANCE_POSITION; + TolerancePosition = BENCHMARK_TOLERANCE_POSITION; benchm_reset = 0; benchm_go = 0; } @@ -52,12 +52,12 @@ void flight_benchmark_periodic( void ) { float Err_airspeed = 0; float Err_altitude = 0; float Err_position = 0; - + if (benchm_reset){ flight_benchmark_reset(); benchm_reset = 0; } - + if (benchm_go){ #if defined(USE_AIRSPEED) && defined(BENCHMARK_AIRSPEED) Err_airspeed = fabs(estimator_airspeed - v_ctl_auto_airspeed_setpoint); @@ -66,7 +66,7 @@ void flight_benchmark_periodic( void ) { SquareSumErr_airspeed += (Err_airspeed * Err_airspeed); } #endif - + #ifdef BENCHMARK_ALTITUDE Err_altitude = fabs(estimator_z - v_ctl_altitude_setpoint); if (Err_altitude>ToleranceAltitude){ @@ -74,17 +74,17 @@ void flight_benchmark_periodic( void ) { SquareSumErr_altitude += (Err_altitude * Err_altitude); } #endif - + #ifdef BENCHMARK_POSITION - + //---------------This part is a waste of memory and calculation power - but it works - feel free to optimize it ;-) ----------------- - + // err_temp = waypoints[target].x - estimator_x; float deltaPlaneX = 0; float deltaPlaneY = 0; float Err_position_segment = 0; float Err_position_circle = 0; - + // if (nav_in_segment){ float deltaX = nav_segment_x_2 - nav_segment_x_1; float deltaY = nav_segment_y_2 - nav_segment_y_1; @@ -95,7 +95,7 @@ void flight_benchmark_periodic( void ) { float angleDiff = fabs(anglePlane - anglePath); Err_position_segment = fabs(sin(angleDiff)*sqrt(deltaPlaneX*deltaPlaneX+deltaPlaneY*deltaPlaneY)); // } - + // if (nav_in_circle){ deltaPlaneX = nav_circle_x - estimator_x; deltaPlaneY = nav_circle_y - estimator_y; @@ -106,13 +106,13 @@ void flight_benchmark_periodic( void ) { } else Err_position = Err_position_segment; - + if (Err_position>TolerancePosition){ SquareSumErr_position += (Err_position * Err_position); } #endif } - + DOWNLINK_SEND_FLIGHT_BENCHMARK(DefaultChannel, &SquareSumErr_airspeed, &SquareSumErr_altitude, &SquareSumErr_position, &Err_airspeed, &Err_altitude, &Err_position) } diff --git a/sw/airborne/modules/cartography/cartography.c b/sw/airborne/modules/cartography/cartography.c index 4dc179586d..ab2dd938ff 100644 --- a/sw/airborne/modules/cartography/cartography.c +++ b/sw/airborne/modules/cartography/cartography.c @@ -1,6 +1,6 @@ /* * $Id: cartography.c 2011-04-20 10:43:13Z $ - * + * * Copyright (C) 2011 Vandeportaele Bertrand * * This file is part of paparazzi. @@ -28,9 +28,9 @@ - -#include "estimator.h" -#include "stdio.h" + +#include "estimator.h" +#include "stdio.h" #include "subsystems/nav.h" #include "generated/flight_plan.h" @@ -39,7 +39,7 @@ //////////////////////////////////////////////////////////////////////////////////////////////// //for fast debbuging, the simulation can be accelerated using the gaia software from an xterm console -// /home/bvdp/paparazzi3/sw/simulator/gaia +// /home/bvdp/paparazzi3/sw/simulator/gaia //////////////////////////////////////////////////////////////////////////////////////////////// // for explanations about debugging macros: //http://gcc.gnu.org/onlinedocs/cpp/Stringification.html#Stringification @@ -47,12 +47,12 @@ // Be carefull not to use printf function in ap compilation, only use it in sim compilation // the DEBUG_PRINTF should be defined only in the sim part of the makefile airframe file #ifdef DEBUG_PRINTF -int CPTDEBUG=0; +int CPTDEBUG=0; #define PRTDEB(TYPE,EXP) \ printf("%5d: " #EXP ": %"#TYPE"\n",CPTDEBUG,EXP);fflush(stdout);CPTDEBUG++; #define PRTDEBSTR(EXP) \ printf("%5d: STR: "#EXP"\n",CPTDEBUG);fflush(stdout);CPTDEBUG++; -#else +#else #define PRTDEB(TYPE,EXP) \ ; @@ -64,7 +64,7 @@ printf("%5d: STR: "#EXP"\n",CPTDEBUG);fflush(stdout);CPTDEBUG++; exemple of use for theese macros PRTDEBSTR(Init polysurvey) PRTDEB(u,SurveySize) - + PRTDEB(lf,PolygonCenter.x) PRTDEB(lf,PolygonCenter.y) */ @@ -97,10 +97,10 @@ uint16_t camera_snapshot_image_number=0; //////////////////////////////////////////////////////////////////////////////////////////////// -bool_t survey_losange_uturn;//this flag indicates if the aircraft is turning between 2 rails (1) or if it is flying straight forward in the rail direction (0) +bool_t survey_losange_uturn;//this flag indicates if the aircraft is turning between 2 rails (1) or if it is flying straight forward in the rail direction (0) int railnumber; //indicate the number of the rail being acquired -int numberofrailtodo; +int numberofrailtodo; float distrail; //distance between adjacent rails in meters, the value is set in the init function float distplus; //distance that the aircraft should travel before and after a rail before turning to the next rails in meters, the value is set in the init function @@ -167,7 +167,7 @@ void stop_carto(void) { bool_t nav_survey_Inc_railnumberSinceBoot(void) { railnumberSinceBoot++; - return FALSE; + return FALSE; } /////////////////////////////////////////////////////////////////////////////////////////////// bool_t nav_survey_Snapshoot(void) @@ -175,8 +175,8 @@ bool_t nav_survey_Snapshoot(void) camera_snapshot_image_number=railnumberSinceBoot; PRTDEBSTR(SNAPSHOT) cartography_periodic_downlink_carto_status = MODULES_START; - return FALSE; - + return FALSE; + } /////////////////////////////////////////////////////////////////////////////////////////////// bool_t nav_survey_Snapshoot_Continu(void) @@ -184,8 +184,8 @@ bool_t nav_survey_Snapshoot_Continu(void) camera_snapshot_image_number=railnumberSinceBoot; PRTDEBSTR(SNAPSHOT) cartography_periodic_downlink_carto_status = MODULES_START; - return TRUE; - + return TRUE; + } /////////////////////////////////////////////////////////////////////////////////////////////// bool_t nav_survey_StopSnapshoot(void) @@ -193,8 +193,8 @@ bool_t nav_survey_StopSnapshoot(void) camera_snapshot_image_number=0; PRTDEBSTR(STOP SNAPSHOT) cartography_periodic_downlink_carto_status = MODULES_START; - return FALSE; - + return FALSE; + } /////////////////////////////////////////////////////////////////////////////////////////////// @@ -202,11 +202,11 @@ bool_t nav_survey_computefourth_corner(uint8_t wp1, uint8_t wp2, uint8_t wp3, u { waypoints[wp4].x=waypoints[wp2].x+waypoints[wp3].x-waypoints[wp1].x; waypoints[wp4].y=waypoints[wp2].y+waypoints[wp3].y-waypoints[wp1].y; - + PRTDEBSTR(nav_survey_computefourth_corner) PRTDEB(f,waypoints[wp4].x) PRTDEB(f,waypoints[wp4].y) - return FALSE; + return FALSE; } //////////////////////////////////////////////////////////////////////////////////////////////// @@ -222,40 +222,40 @@ bool_t nav_survey_ComputeProjectionOnLine(struct point pointAf,struct point poi float BB1; float YP; float XP; - + float AMx,AMy,BMx,BMy; //+++++++++++++++++++++++++ATTENTION AUX DIVISIONS PAR 0!!!!!!!!!!!!!!! - - + + xb=pointAf.x; yb=pointAf.y; - + xc=pointBf.x; yc=pointBf.y; - + xa=estimator_xf; ya=estimator_yf; - + //calcul des parametres de la droite pointAf pointBf a = yc - yb; b = xb - xc; c = (yb - yc) * xb + (xc - xb) * yb ; - + //calcul de la distance de la droite à l'avion - - + + if (fabs(a)>1e-10) *distancefromrailf = fabs((a * xa + b * ya + c) / sqrt(a * a + b * b)); //denominateur =0 iniquement si a=b=0 //peut arriver si 2 waypoints sont confondus - else - return 0; - + else + return 0; + PRTDEB(f,a) PRTDEB(f,b) PRTDEB(f,c) PRTDEB(f,*distancefromrailf) - - + + // calcul des coordonnées du projeté orthogonal M(xx,y) de A sur (BC) AA1 = (xc - xb); BB1 = (yc - yb); @@ -263,101 +263,101 @@ bool_t nav_survey_ComputeProjectionOnLine(struct point pointAf,struct point poi { f=(b - (a * BB1 / AA1)); if (fabs(f)>1e-10) - YP = (-(a * xa) - (a * BB1 * ya / AA1) - c) / f; - else - return 0; + YP = (-(a * xa) - (a * BB1 * ya / AA1) - c) / f; + else + return 0; } else - return 0; - - - - + return 0; + + + + XP = (-c - b * YP) / a ; //a !=0 deja testé avant //+++++++++++++++++++++++++ATTENTION AUX DIVISIONS PAR 0!!!!!!!!!!!!!!! //+++++++++++++++++++++++++ATTENTION AUX DIVISIONS PAR 0!!!!!!!!!!!!!!! //+++++++++++++++++++++++++ATTENTION AUX DIVISIONS PAR 0!!!!!!!!!!!!!!! - + PRTDEB(f,AA1) PRTDEB(f,BB1) PRTDEB(f,YP) PRTDEB(f,XP) - + AMx=XP-pointAf.x; AMy=YP-pointAf.y; BMx=XP-pointBf.x; BMy=YP-pointBf.y; - + *normAMf=NORMXY(AMx,AMy); *normBMf=NORMXY(BMx,BMy); - + PRTDEB(f,*normAMf) PRTDEB(f,*normBMf) - + if ( ( (*normAMf) + (*normBMf) ) >1.05*DISTXY(pointBf.x,pointBf.y,pointAf.x,pointAf.y)) { PRTDEBSTR(NOT INSIDE) return 0; } - else + else { PRTDEBSTR(INSIDE) return 1; } } /////////////////////////////////////////////////////////////////////////// -//if distrailinit = 0, the aircraft travel from wp1 -> wp2 then do the inverse travel passing through the wp3, +//if distrailinit = 0, the aircraft travel from wp1 -> wp2 then do the inverse travel passing through the wp3, //This mode could be use to register bands of images aquired in a first nav_survey_losange_carto, done perpendicularly bool_t nav_survey_losange_carto_init(uint8_t wp1, uint8_t wp2, uint8_t wp3, float distrailinit, float distplusinit) { //PRTDEBSTR(nav_survey_losange_carto_init) survey_losange_uturn=FALSE; - - + + point1.x=waypoints[wp1].x; //the coordinates are in meter units, taken from the flight plan, in float type point1.y=waypoints[wp1].y; point2.x=waypoints[wp2].x; point2.y=waypoints[wp2].y; point3.x=waypoints[wp3].x; point3.y=waypoints[wp3].y; - + PRTDEB(u,wp1) PRTDEB(f,point1.x) PRTDEB(f,point1.y) - + PRTDEB(u,wp2) PRTDEB(f,point2.x) PRTDEB(f,point2.y) - + PRTDEB(u,wp3) PRTDEB(f,point3.x) PRTDEB(f,point3.y) - - - + + + vec12.x=point2.x-point1.x; vec12.y=point2.y-point1.y; PRTDEB(f,vec12.x) PRTDEB(f,vec12.y) - + //TODO gerer le cas ou un golio met les points à la meme position -> norm=0 > /0 norm12=NORMXY(vec12.x,vec12.y); - + PRTDEB(f,norm12) - - + + vec13.x=point3.x-point1.x; vec13.y=point3.y-point1.y; PRTDEB(f,vec13.x) PRTDEB(f,vec13.y) - + norm13=NORMXY(vec13.x,vec13.y); PRTDEB(f,norm13) - + //if (distrail<1e-15) //inutile distrail=0 pour recollage et dans ce cas, il prend la valeur norm13 // return FALSE; - - + + if (fabs(distrailinit)<=1) { //is distrailinit==0, then the aircraft should do 2 passes to register the bands distrail=norm13; @@ -368,38 +368,38 @@ bool_t nav_survey_losange_carto_init(uint8_t wp1, uint8_t wp2, uint8_t wp3, flo distrail=fabs(distrailinit); numberofrailtodo=ceil( norm13 / distrail);//round to the upper integer } - + distplus=fabs(distplusinit); - - + + PRTDEB(f,distrail) PRTDEB(f,distplus) PRTDEB(d,numberofrailtodo) PRTDEB(d,railnumber) PRTDEB(d,railnumberSinceBoot) - + railnumber=-1; // the state is before the first rail, which is numbered 0 - + if (norm12<1e-15) return FALSE; if (norm13<1e-15) return FALSE; - - + + angle1213=(180/3.14159) * acos( ( ((vec12.x*vec13.x ) + (vec12.y*vec13.y) ))/(norm12*norm13));//oriented angle between 12 and 13 vectors - + angle1213 = atan2f(vec13.y, vec13.x) - atan2f(vec12.y,vec12.x); while ( angle1213 >= M_PI ) angle1213 -= 2*M_PI; while ( angle1213 <= -M_PI ) angle1213 += 2*M_PI; - + PRTDEB(f,angle1213) - + if (angle1213 >0) - signforturn=-1; + signforturn=-1; else signforturn=1; - - + + return FALSE; //Init function must return false, so that the next function in the flight plan is automatically executed //dans le flight_plan.h // if (! (nav_survey_losange_carto())) @@ -409,28 +409,28 @@ bool_t nav_survey_losange_carto_init(uint8_t wp1, uint8_t wp2, uint8_t wp3, flo bool_t nav_survey_losange_carto(void) { //test pour modifier en vol la valeur distrail - + //distrail=distrailinteractif; - - + + //by default, a 0 is sent in the message DOWNLINK_SEND_CAMERA_SNAPSHOT, //if the aircraft is inside the region to map, camera_snapshot_image_number will be equal to the number of rail since the last boot (not since the nav_survey_losange_carto_init, in order to get different values for differents calls to the cartography function (this number is used to name the images on the hard drive camera_snapshot_image_number=0; - - + + PRTDEB(f,distrail) - - - + + + PRTDEBSTR(nav_survey_losange_carto) PRTDEB(d,railnumber) - + PRTDEB(d,railnumberSinceBoot) - + //PRTDEB(f,estimator_x) //PRTDEB(f,estimator_y) - - //sortir du bloc si données abhérantes + + //sortir du bloc si données abhérantes if (norm13<1e-15) { PRTDEBSTR(norm13<1e-15) @@ -441,40 +441,40 @@ bool_t nav_survey_losange_carto(void) PRTDEBSTR(norm13<1e-15) return FALSE; } - if (distrail<1e-15) + if (distrail<1e-15) { PRTDEBSTR(distrail<1e-15) return FALSE; } - + if (survey_losange_uturn==FALSE) { - - if (railnumber==-1) + + if (railnumber==-1) { //se diriger vers le début du 1°rail PRTDEBSTR(approche debut rail 0) pointA.x=point1.x-(vec12.x/norm12)*distplus*1.2; //on prend une marge plus grande pour arriver en ce point pointA.y=point1.y-(vec12.y/norm12)*distplus*1.2; //car le virage n'est pas tres bien géré - - + + pointB.x=point2.x+(vec12.x/norm12)*distplus*1.2; //on prend une marge plus grande pour arriver en ce point pointB.y=point2.y+(vec12.y/norm12)*distplus*1.2; //car le virage n'est pas tres bien géré - + //PRTDEB(f,pointA.x) //PRTDEB(f,pointA.y) - - + + //the following test can cause problem when the aircraft is quite close to the entry point, as it can turn around for infinte time //if ( DISTXY(estimator_x,estimator_y,pointA.x,pointA.y) >DISTLIMIT) //if ( DISTXY(estimator_x,estimator_y,pointA.x,pointA.y) >DISTLIMIT) - - + + nav_survey_ComputeProjectionOnLine(pointA,pointB,estimator_x,estimator_y,&normAM,&normBM,&distancefromrail); - + if ((DISTXY(estimator_x,estimator_y,pointA.x,pointA.y) >2* DISTLIMIT) || (normBM<(DISTXY(pointB.x,pointB.y,pointA.x,pointA.y)))) { nav_route_xy(estimator_x, estimator_y,pointA.x,pointA.y); - //nav_route_xy(pointB.x, pointB.y,pointA.x,pointA.y); + //nav_route_xy(pointB.x, pointB.y,pointA.x,pointA.y); } else { @@ -482,62 +482,62 @@ bool_t nav_survey_losange_carto(void) //un fois arrivé, on commence le 1° rail; railnumber=0; railnumberSinceBoot++; - + } } - - - if (railnumber>=0) + + + if (railnumber>=0) { pointA.x=(point1.x - ((vec12.x/norm12)*distplus) ) + ((railnumber)*(vec13.x/norm13)* distrail); pointA.y=(point1.y - ((vec12.y/norm12)*distplus) ) + ((railnumber)*(vec13.y/norm13)* distrail); - + pointB.x=(point2.x + ((vec12.x/norm12)*distplus) ) + ((railnumber)*(vec13.x/norm13)* distrail); pointB.y=(point2.y + ((vec12.y/norm12)*distplus) ) + ((railnumber)*(vec13.y/norm13)* distrail); - - - - - + + + + + if ((railnumber %2)==0) //rail n0, 2, 4, donc premiere direction, de wp1 vers wp2 - { + { //rien a faire } else //if ((railnumber %2)==1) //rail n1, 3, 5, donc seconde direction, de wp2 vers wp1 - { - //echange pointA et B + { + //echange pointA et B tempx=pointA.x; tempy=pointA.y; pointA.x=pointB.x; pointA.y=pointB.y; pointB.x=tempx; pointB.y=tempy; - + } - + // PRTDEB(f,pointA.x) - // PRTDEB(f,pointA.y) + // PRTDEB(f,pointA.y) // PRTDEB(f,pointB.x) // PRTDEB(f,pointB.y) ProjectionInsideLimitOfRail=nav_survey_ComputeProjectionOnLine(pointA,pointB,estimator_x,estimator_y,&normAM,&normBM,&distancefromrail); - - - - // if ( ( DISTXY(estimator_x,estimator_y,pointB.x,pointB.y) >DISTLIMIT) && + + + + // if ( ( DISTXY(estimator_x,estimator_y,pointB.x,pointB.y) >DISTLIMIT) && // (normBM>(DISTXY(pointB.x,pointB.y,pointA.x,pointA.y)))) - - + + if (! ( ( DISTXY(estimator_x,estimator_y,pointB.x,pointB.y) (DISTXY(pointB.x,pointB.y,pointA.x,pointA.y)))))) // (normBM>(DISTXY(pointB.x,pointB.y,pointA.x,pointA.y)))) { nav_route_xy(pointA.x,pointA.y,pointB.x,pointB.y); PRTDEBSTR(NAVROUTE) - - + + //est ce que l'avion est dans la zone ou il doit prendre des images? //DEJA APPELE AVANT LE IF // nav_survey_ComputeProjectionOnLine(pointA,pointB,estimator_x,estimator_y,&normAM,&normBM,&distancefromrail); - + if ( (normAM> distplus) && (normBM> distplus) && (distancefromrailnumberofrailtodo) - { + { PRTDEBSTR(fin nav_survey_losange_carto) return FALSE; //apparament, l'avion va au bloc suivant lorsque la fonction renvoie false } - + } } else // (survey_losange_uturn==TRUE) { - - + + if (distrail<200) { //tourne autour d'un point à mi chemin entre les 2 rails - + //attention railnumber a été incrémenté en fin du rail précédent - + if ((railnumber %2)==1) //rail précédent n0, 2, 4, donc premiere direction, de wp1 vers wp2 - { + { PRTDEBSTR(UTURN-IMPAIR) - //fin du rail précédent + //fin du rail précédent pointA.x=(point2.x + ((vec12.x/norm12)*distplus) ) + ((railnumber-1)*(vec13.x/norm13)* distrail); pointA.y=(point2.y + ((vec12.y/norm12)*distplus) ) + ((railnumber-1)*(vec13.y/norm13)* distrail); //début du rail suivant @@ -594,31 +594,31 @@ bool_t nav_survey_losange_carto(void) //milieu waypoints[0].x=(pointA.x+pointB.x)/2; waypoints[0].y=(pointA.y+pointB.y)/2; - + tempcircleradius=distrail/2; - if(tempcircleradius M_PI) angle_between -= 2 * M_PI; + while (angle_between > M_PI) angle_between -= 2 * M_PI; while (angle_between < -M_PI) angle_between += 2 * M_PI; - + angle_between= DegOfRad(angle_between); PRTDEB(f,angle_between ) //if (angle_between> -10 && angle_between< 10) PRTDEBSTR(ON SE CASSE) - + NavCircleWaypoint(0,signforturn*tempcircleradius); - if ( ( DISTXY(estimator_x,estimator_y,pointB.x,pointB.y) -10 && angle_between< 10) ) + if ( ( DISTXY(estimator_x,estimator_y,pointB.x,pointB.y) -10 && angle_between< 10) ) { //l'avion fait le rail suivant survey_losange_uturn=FALSE; @@ -626,9 +626,9 @@ bool_t nav_survey_losange_carto(void) } } else //if ((railnumber %2)==0) //rail précédent n1, 3, 5, donc seconde direction, de wp2 vers wp1 - { + { PRTDEBSTR(UTURN-PAIR) - //fin du rail précédent + //fin du rail précédent pointA.x=(point1.x - ((vec12.x/norm12)*distplus) ) + ((railnumber-1)*(vec13.x/norm13)* distrail); pointA.y=(point1.y - ((vec12.y/norm12)*distplus) ) + ((railnumber-1)*(vec13.y/norm13)* distrail); //début du rail suivant @@ -637,33 +637,33 @@ bool_t nav_survey_losange_carto(void) //milieu waypoints[0].x=(pointA.x+pointB.x)/2; waypoints[0].y=(pointA.y+pointB.y)/2; - + tempcircleradius=distrail/2; - if(tempcircleradius M_PI) angle_between -= 2 * M_PI; + while (angle_between > M_PI) angle_between -= 2 * M_PI; while (angle_between < -M_PI) angle_between += 2 * M_PI; - + angle_between= DegOfRad(angle_between); PRTDEB(f,angle_between ) //if (angle_between> -10 && angle_between< 10) PRTDEBSTR(ON SE CASSE) - + NavCircleWaypoint(0,signforturn*(-1)*tempcircleradius); - if (( DISTXY(estimator_x,estimator_y,pointB.x,pointB.y) -10 && angle_between< 10) ) + if (( DISTXY(estimator_x,estimator_y,pointB.x,pointB.y) -10 && angle_between< 10) ) { //l'avion fait le rail suivant survey_losange_uturn=FALSE; @@ -673,18 +673,18 @@ bool_t nav_survey_losange_carto(void) } else { //Le virage serait trop grand, on va en ligne droite pour ne pas trop éloigner l'avion - + if ((railnumber %2)==1) //rail précédent n0, 2, 4, donc premiere direction, de wp1 vers wp2 - { + { PRTDEBSTR(TRANSIT-IMPAIR) - //fin du rail précédent + //fin du rail précédent pointA.x=(point2.x + ((vec12.x/norm12)*distplus) ) + ((railnumber-1)*(vec13.x/norm13)* distrail); pointA.y=(point2.y + ((vec12.y/norm12)*distplus) ) + ((railnumber-1)*(vec13.y/norm13)* distrail); //début du rail suivant pointB.x=(point2.x + ((vec12.x/norm12)*distplus) ) + ((railnumber)*(vec13.x/norm13)* distrail); - pointB.y=(point2.y + ((vec12.y/norm12)*distplus) ) + ((railnumber)*(vec13.y/norm13)* distrail); + pointB.y=(point2.y + ((vec12.y/norm12)*distplus) ) + ((railnumber)*(vec13.y/norm13)* distrail); nav_route_xy(pointA.x,pointA.y,pointB.x,pointB.y); - if ( DISTXY(estimator_x,estimator_y,pointB.x,pointB.y) true } //////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/sw/airborne/modules/cartography/cartography.h b/sw/airborne/modules/cartography/cartography.h index bbbaa84376..a7ccde3d75 100644 --- a/sw/airborne/modules/cartography/cartography.h +++ b/sw/airborne/modules/cartography/cartography.h @@ -5,7 +5,7 @@ - + void init_carto(void); void periodic_downlink_carto(void); void start_carto(void); @@ -17,11 +17,11 @@ void stop_carto(void); #ifdef USE_ONBOARD_CAMERA -extern bool_t CAMERA_SNAPSHOT_REQUIERED; -extern uint16_t camera_snapshot_image_number; +extern bool_t CAMERA_SNAPSHOT_REQUIERED; +extern uint16_t camera_snapshot_image_number; #endif -extern float distrailinteractif; //pour exporter la variable et pouvoir la changer depuis settings +extern float distrailinteractif; //pour exporter la variable et pouvoir la changer depuis settings @@ -48,4 +48,4 @@ extern bool_t nav_survey_losange_carto(void); // !!!! important il faut mettre #endif - + diff --git a/sw/airborne/modules/cartography/photogrammetry_calculator.c b/sw/airborne/modules/cartography/photogrammetry_calculator.c index 48fd523065..7afeea45e9 100644 --- a/sw/airborne/modules/cartography/photogrammetry_calculator.c +++ b/sw/airborne/modules/cartography/photogrammetry_calculator.c @@ -59,7 +59,7 @@ int photogrammetry_height_max; int photogrammetry_radius_min; -void init_photogrammetry_calculator(void) +void init_photogrammetry_calculator(void) { photogrammetry_sweep_angle = PHOTOGRAMMETRY_SWEEP_ANGLE; @@ -74,7 +74,7 @@ void init_photogrammetry_calculator(void) photogrammetry_calculator_update(); } -void photogrammetry_calculator_update(void) +void photogrammetry_calculator_update(void) { // Photogrammetry Goals diff --git a/sw/airborne/modules/gps_i2c/gps_i2c.c b/sw/airborne/modules/gps_i2c/gps_i2c.c index 23a312312e..e26425f672 100644 --- a/sw/airborne/modules/gps_i2c/gps_i2c.c +++ b/sw/airborne/modules/gps_i2c/gps_i2c.c @@ -82,17 +82,17 @@ void gps_i2c_event(void) { * switch (gps_i2c_status) { case GPS_I2C_STATUS_IDLE: if (gps_i2c_data_ready_to_transmit) { - // Copy data from our buffer to the i2c buffer + // Copy data from our buffer to the i2c buffer uint8_t data_size = Min(gps_i2c_tx_insert_idx-gps_i2c_tx_extract_idx, I2C0_BUF_LEN); uint8_t i; for(i = 0; i < data_size; i++, gps_i2c_tx_extract_idx++) i2c0_buf[i] = gps_i2c_tx_buf[gps_i2c_tx_extract_idx]; - // Start i2c transmit + // Start i2c transmit i2c0_transmit(GPS_I2C_SLAVE_ADDR, data_size, &gps_i2c_done); gps_i2c_done = FALSE; - // Reset flag if finished + // Reset flag if finished if (gps_i2c_tx_extract_idx >= gps_i2c_tx_insert_idx) { gps_i2c_data_ready_to_transmit = FALSE; gps_i2c_tx_insert_idx = 0; @@ -143,5 +143,5 @@ void gps_i2c_event(void) { return; } */ - + } diff --git a/sw/airborne/modules/ins/imu_chimu.c b/sw/airborne/modules/ins/imu_chimu.c index 46787a26c9..4b0111bee5 100644 --- a/sw/airborne/modules/ins/imu_chimu.c +++ b/sw/airborne/modules/ins/imu_chimu.c @@ -25,7 +25,7 @@ File: *.c Description: CHIMU Protocol Parser - + Public Functions: CHIMU_Init Create component instance @@ -57,7 +57,7 @@ static unsigned long UpdateCRC(unsigned long CRC_acc, void *data, unsigned long unsigned char *CRC_input = (unsigned char*)data; for (unsigned long j = data_len; j; --j) { - + CRC_acc = CRC_acc ^ *CRC_input++; // "Divide" the poly into the dividend using CRC XOR subtraction // CRC_acc holds the "remainder" of each divide @@ -136,7 +136,7 @@ static float FloatSwap( float f ) /*--------------------------------------------------------------------------- Name: CHIMU_Init - + ---------------------------------------------------------------------------*/ void CHIMU_Init(CHIMU_PARSER_DATA *pstData) { @@ -165,7 +165,7 @@ void CHIMU_Init(CHIMU_PARSER_DATA *pstData) pstData->m_attrates.euler.theta = 0.0; pstData->m_attrates.euler.psi = 0.0; - for (i=0; im_Payload[i]= 0x00; pstData->m_FullMessage[i]= 0x00; @@ -202,8 +202,8 @@ unsigned char CHIMU_Parse( bUpdate = FALSE; break; case CHIMU_STATE_MACHINE_HEADER2: // Waiting for second header character 0xAE - if(btData == 0xAE) - { + if(btData == 0xAE) + { pstData->m_State = CHIMU_STATE_MACHINE_LEN; pstData->m_FullMessage[pstData->m_Index++]=btData; } else { @@ -211,8 +211,8 @@ unsigned char CHIMU_Parse( } //Fail to see header. Restart. break; case CHIMU_STATE_MACHINE_LEN: // Get chars to read - if( btData <= CHIMU_RX_BUFFERSIZE) - { + if( btData <= CHIMU_RX_BUFFERSIZE) + { pstData->m_MsgLen = btData ; // It might be invalid, but we do a check on buffer size pstData->m_FullMessage[pstData->m_Index++]=btData; pstData->m_State = CHIMU_STATE_MACHINE_DEVICE; @@ -222,7 +222,7 @@ unsigned char CHIMU_Parse( } break; case CHIMU_STATE_MACHINE_DEVICE: // Get device. If not us, ignore and move on. Allows common com with Monkey / Chipmunk - if( (btData == pstData->m_DeviceID) || (btData == 0xAA)) + if( (btData == pstData->m_DeviceID) || (btData == 0xAA)) { //0xAA is global message pstData->m_TempDeviceID = btData; pstData->m_FullMessage[pstData->m_Index++]=btData; @@ -233,8 +233,8 @@ unsigned char CHIMU_Parse( break; case CHIMU_STATE_MACHINE_ID: // Get ID pstData->m_MsgID = btData; // might be invalid, chgeck it out here: - if ( pstData->m_MsgID>CHIMU_COM_ID_HIGH) - { + if ( pstData->m_MsgID>CHIMU_COM_ID_HIGH) + { pstData->m_State = CHIMU_STATE_MACHINE_START; //BuiltInTest(BIT_COM_UART_RECEIPTFAIL, BIT_FAIL); } else { @@ -248,7 +248,7 @@ unsigned char CHIMU_Parse( pstData->m_FullMessage[pstData->m_Index++]=btData; if ((pstData->m_Index) >= (pstData->m_MsgLen + 5)) //Now we have the payload. Verify XSUM and then parse it next { - pstData->m_Checksum = (unsigned char) ((UpdateCRC(0xFFFFFFFF , pstData->m_FullMessage , (unsigned long) (pstData->m_MsgLen)+5)) & 0xFF); + pstData->m_Checksum = (unsigned char) ((UpdateCRC(0xFFFFFFFF , pstData->m_FullMessage , (unsigned long) (pstData->m_MsgLen)+5)) & 0xFF); pstData->m_State = CHIMU_STATE_MACHINE_XSUM; } else { return FALSE; @@ -257,7 +257,7 @@ unsigned char CHIMU_Parse( case CHIMU_STATE_MACHINE_XSUM: // Verify pstData->m_ReceivedChecksum = btData; pstData->m_FullMessage[pstData->m_Index++]=btData; - if (pstData->m_Checksum!=pstData->m_ReceivedChecksum) + if (pstData->m_Checksum!=pstData->m_ReceivedChecksum) { bUpdate = FALSE; //BuiltInTest(BIT_COM_UART_RECEIPTFAIL, BIT_FAIL); @@ -302,12 +302,12 @@ static CHIMU_attitude_data GetEulersFromQuat(CHIMU_attitude_data attitude) if (x > 1.0) x = 1.0; if (x < -1.0) x = -1.0; // - if ((ps.q.v.x * ps.q.v.y + ps.q.v.z * ps.q.s) == 0.5) + if ((ps.q.v.x * ps.q.v.y + ps.q.v.z * ps.q.s) == 0.5) { ps.euler.theta = 2 *atan2(ps.q.v.x, ps.q.s); } else - if ((ps.q.v.x * ps.q.v.y + ps.q.v.z * ps.q.s) == -0.5) + if ((ps.q.v.x * ps.q.v.y + ps.q.v.z * ps.q.s) == -0.5) { ps.euler.theta = -2 *atan2(ps.q.v.x, ps.q.s); } @@ -315,13 +315,13 @@ static CHIMU_attitude_data GetEulersFromQuat(CHIMU_attitude_data attitude) ps.euler.theta = asin(x); } ps.euler.psi = atan2(2.0 * (ps.q.s * ps.q.v.z + ps.q.v.x * ps.q.v.y), (1 - 2 * (sqy + sqz))); - if (ps.euler.psi < 0) + if (ps.euler.psi < 0) { ps.euler.psi = ps.euler.psi + (2 * M_PI); } return(ps); - + } static unsigned char BitTest (unsigned char input, unsigned char n) @@ -331,14 +331,14 @@ static unsigned char BitTest (unsigned char input, unsigned char n) } unsigned char CHIMU_ProcessMessage(unsigned char *pMsgID, unsigned char *pPayloadData, CHIMU_PARSER_DATA *pstData) { - //Msgs from CHIMU are off limits (i.e.any CHIMU messages sent up the uplink should go to - //CHIMU). + //Msgs from CHIMU are off limits (i.e.any CHIMU messages sent up the uplink should go to + //CHIMU). //Any CHIMU messages coming from the ground should be ignored, as that byte stream goes up to CHIMU - // by itself. However, here we should decode CHIMU messages being received and + // by itself. However, here we should decode CHIMU messages being received and // a) pass them down to ground // b) grab the data from the CHIMU for our own needs / purposes - int CHIMU_index =0; + int CHIMU_index =0; float sanity_check=0.0; switch (pstData->m_MsgID){ @@ -365,7 +365,7 @@ unsigned char CHIMU_ProcessMessage(unsigned char *pMsgID, unsigned char *pPayloa memmove (&pstData->m_sensor.rate[0], &pPayloadData[CHIMU_index], sizeof(pstData->m_sensor.rate));CHIMU_index += (sizeof(pstData->m_sensor.rate)); pstData->m_sensor.rate[0] = FloatSwap(pstData->m_sensor.rate[0]); pstData->m_sensor.rate[1] = FloatSwap(pstData->m_sensor.rate[1]); - pstData->m_sensor.rate[2] = FloatSwap(pstData->m_sensor.rate[2]); + pstData->m_sensor.rate[2] = FloatSwap(pstData->m_sensor.rate[2]); memmove (&pstData->m_sensor.mag[0], &pPayloadData[CHIMU_index], sizeof(pstData->m_sensor.mag));CHIMU_index += (sizeof(pstData->m_sensor.mag)); pstData->m_sensor.mag[0] = FloatSwap(pstData->m_sensor.mag[0]); pstData->m_sensor.mag[1] = FloatSwap(pstData->m_sensor.mag[1]); @@ -414,14 +414,14 @@ unsigned char CHIMU_ProcessMessage(unsigned char *pMsgID, unsigned char *pPayloa // TODO: Read configuration bits -/* bC0_SPI_En = BitTest (gConfigInfo, 0); - bC1_HWCentrip_En = BitTest (gConfigInfo, 1); - bC2_TempCal_En = BitTest (gConfigInfo, 2); - bC3_RateOut_En = BitTest (gConfigInfo, 3); - bC4_TBD = BitTest (gConfigInfo, 4); - bC5_Quat_Est = BitTest (gConfigInfo, 5); - bC6_SWCentrip_En = BitTest (gConfigInfo, 6); - bC7_AllowHW_Override = BitTest (gConfigInfo, 7); +/* bC0_SPI_En = BitTest (gConfigInfo, 0); + bC1_HWCentrip_En = BitTest (gConfigInfo, 1); + bC2_TempCal_En = BitTest (gConfigInfo, 2); + bC3_RateOut_En = BitTest (gConfigInfo, 3); + bC4_TBD = BitTest (gConfigInfo, 4); + bC5_Quat_Est = BitTest (gConfigInfo, 5); + bC6_SWCentrip_En = BitTest (gConfigInfo, 6); + bC7_AllowHW_Override = BitTest (gConfigInfo, 7); */ //CHIMU currently (v 1.3) does not compute Eulers if quaternion estimator is selected if(BitTest (pstData->gConfigInfo, 5) == TRUE) @@ -437,15 +437,15 @@ unsigned char CHIMU_ProcessMessage(unsigned char *pMsgID, unsigned char *pPayloa sanity_check += (pstData->m_attitude.q.v.z * pstData->m_attitude.q.v.z); if ((sanity_check > 0.8) && (sanity_check < 1.2)) //Should be 1.0 (normalized quaternion) - { + { // gAttitude = pstData->m_attitude; // gAttRates = pstData->m_attrates; // gSensor = pstData->m_sensor; - } else + } else { //TODO: Log BIT that indicates IMU message incoming failed (maybe SPI error?) } - + return TRUE; break; case CHIMU_Msg_4_BiasSF: diff --git a/sw/airborne/modules/ins/imu_chimu.h b/sw/airborne/modules/ins/imu_chimu.h index 6fea78a658..d1caf15286 100644 --- a/sw/airborne/modules/ins/imu_chimu.h +++ b/sw/airborne/modules/ins/imu_chimu.h @@ -25,7 +25,7 @@ File: *.c Description: CHIMU Protocol Parser - + Public Functions: CHIMU_Init Create component instance @@ -151,7 +151,7 @@ typedef struct { uint8_t gCalStatus; uint8_t gCHIMU_BIT; uint8_t gConfigInfo; - + } CHIMU_PARSER_DATA; /*--------------------------------------------------------------------------- diff --git a/sw/airborne/modules/meteo/charge_sens.c b/sw/airborne/modules/meteo/charge_sens.c index 91a1d2e720..691905cd0f 100644 --- a/sw/airborne/modules/meteo/charge_sens.c +++ b/sw/airborne/modules/meteo/charge_sens.c @@ -24,7 +24,7 @@ /** \file charge_sens.c * \brief I2C interface for University of Reading charge sensor - * + * */ #include "modules/meteo/charge_sens.h" @@ -64,7 +64,7 @@ void charge_sens_event( void ) { charge_trans.status = I2CTransDone; if (++charge_cnt >= CHARGE_NB) { - DOWNLINK_SEND_ATMOSPHERE_CHARGE(DefaultChannel, + DOWNLINK_SEND_ATMOSPHERE_CHARGE(DefaultChannel, &charge[0], &charge[1], &charge[2], &charge[3], &charge[4], &charge[5], &charge[6], &charge[7], &charge[8], &charge[9]); charge_cnt = 0; diff --git a/sw/airborne/modules/meteo/geiger_counter.c b/sw/airborne/modules/meteo/geiger_counter.c index 3c98c238a7..7fadd1560d 100644 --- a/sw/airborne/modules/meteo/geiger_counter.c +++ b/sw/airborne/modules/meteo/geiger_counter.c @@ -24,7 +24,7 @@ /** \file geiger_counter.c * \brief I2C interface for University of Reading Geiger counter - * + * */ #include "modules/meteo/geiger_counter.h" @@ -56,21 +56,21 @@ void geiger_counter_periodic( void ) { void geiger_counter_event( void ) { if (geiger_trans.status == I2CTransSuccess) { - count_geiger_1 = (geiger_trans.buf[3] << 24) | + count_geiger_1 = (geiger_trans.buf[3] << 24) | (geiger_trans.buf[2] << 16) | (geiger_trans.buf[1] << 8) | (geiger_trans.buf[0]); - count_geiger_2 = (geiger_trans.buf[7] << 24) | + count_geiger_2 = (geiger_trans.buf[7] << 24) | (geiger_trans.buf[6] << 16) | (geiger_trans.buf[5] << 8) | (geiger_trans.buf[4]); - volt_geiger = (geiger_trans.buf[9] << 8) | - (geiger_trans.buf[8]); + volt_geiger = (geiger_trans.buf[9] << 8) | + (geiger_trans.buf[8]); geiger_trans.status = I2CTransDone; if (volt_geiger & 0x8000) { volt_geiger &= 0x7FFF; - DOWNLINK_SEND_GEIGER_COUNTER(DefaultChannel, + DOWNLINK_SEND_GEIGER_COUNTER(DefaultChannel, &count_geiger_1, &count_geiger_2, &volt_geiger); } } diff --git a/sw/airborne/modules/meteo/humid_hih.c b/sw/airborne/modules/meteo/humid_hih.c index 6904c54d80..28888bcf0f 100644 --- a/sw/airborne/modules/meteo/humid_hih.c +++ b/sw/airborne/modules/meteo/humid_hih.c @@ -65,7 +65,7 @@ void humid_hih_periodic( void ) { /* get temperature from external source */ fhih_temp = ftempsht; /****************************************/ - + adc_humid_hih = buf_humid_hih.sum / buf_humid_hih.av_nb_sample; /* 36k/68k voltage divider, 3.3V full sweep, 10 bits adc */ diff --git a/sw/airborne/modules/meteo/humid_pcap01.c b/sw/airborne/modules/meteo/humid_pcap01.c index 345095bc3c..9fd713676c 100644 --- a/sw/airborne/modules/meteo/humid_pcap01.c +++ b/sw/airborne/modules/meteo/humid_pcap01.c @@ -246,7 +246,7 @@ void pcap01_event(void) pcap01Value.R_ratio |= pcap01_trans.buf[2]; humidity = pcap01Value.C_ratio * (-0.0023959245437) + 516.4124438673063; temperature = pcap01Value.R_ratio * 61.927 - 259.74; - DOWNLINK_SEND_PCAP01_STATUS(DefaultChannel, + DOWNLINK_SEND_PCAP01_STATUS(DefaultChannel, &pcap01Value.C_ratio, &pcap01Value.R_ratio, &humidity, @@ -255,7 +255,7 @@ void pcap01_event(void) pcap01Value.status = PCAP01_IDLE; break; - default: + default: pcap01_trans.status = I2CTransDone; break; } diff --git a/sw/airborne/modules/meteo/ir_mlx.c b/sw/airborne/modules/meteo/ir_mlx.c index 3515b49673..ac3c9fde2d 100644 --- a/sw/airborne/modules/meteo/ir_mlx.c +++ b/sw/airborne/modules/meteo/ir_mlx.c @@ -89,7 +89,7 @@ void ir_mlx_periodic( void ) { void ir_mlx_event( void ) { if ((mlx_trans.status == I2CTransSuccess)) { switch (ir_mlx_status) { - + case IR_MLX_RD_ID_0: /* read two byte ID 0 */ ir_mlx_id_01 = mlx_trans.buf[0]; @@ -99,7 +99,7 @@ void ir_mlx_event( void ) { I2CTransceive(MLX_I2C_DEV, mlx_trans, MLX90614_ADDR, 1, 2); ir_mlx_status = IR_MLX_RD_ID_1; break; - + case IR_MLX_RD_ID_1: /* read two byte ID 1 */ ir_mlx_id_01 |= mlx_trans.buf[0] << 16; @@ -109,7 +109,7 @@ void ir_mlx_event( void ) { I2CTransceive(MLX_I2C_DEV, mlx_trans, MLX90614_ADDR, 1, 2); ir_mlx_status = IR_MLX_RD_ID_2; break; - + case IR_MLX_RD_ID_2: /* read two byte ID 2 */ ir_mlx_id_23 = mlx_trans.buf[0]; @@ -119,16 +119,16 @@ void ir_mlx_event( void ) { I2CTransceive(MLX_I2C_DEV, mlx_trans, MLX90614_ADDR, 1, 2); ir_mlx_status = IR_MLX_RD_ID_3; break; - + case IR_MLX_RD_ID_3: /* read two byte ID 3 */ ir_mlx_id_23 |= mlx_trans.buf[0] << 16; ir_mlx_id_23 |= mlx_trans.buf[1] << 24; ir_mlx_status = IR_MLX_IDLE; mlx_trans.status = I2CTransDone; - DOWNLINK_SEND_MLX_SERIAL(DefaultChannel, &ir_mlx_id_01, &ir_mlx_id_23); + DOWNLINK_SEND_MLX_SERIAL(DefaultChannel, &ir_mlx_id_01, &ir_mlx_id_23); break; - + case IR_MLX_RD_CASE_TEMP: /* read two byte case temperature */ ir_mlx_itemp_case = mlx_trans.buf[1] << 8; diff --git a/sw/airborne/modules/meteo/light_solar.c b/sw/airborne/modules/meteo/light_solar.c index 38b20450a0..494116d3dc 100644 --- a/sw/airborne/modules/meteo/light_solar.c +++ b/sw/airborne/modules/meteo/light_solar.c @@ -59,18 +59,18 @@ static struct adc_buf buf_light_sol_dn; void light_solar_init( void ) { adc_buf_channel(ADC_CHANNEL_LIGHT_SOLAR_UP, &buf_light_sol_up, ADC_CHANNEL_LIGHT_NB_SAMPLES); adc_buf_channel(ADC_CHANNEL_LIGHT_SOLAR_DN, &buf_light_sol_dn, ADC_CHANNEL_LIGHT_NB_SAMPLES); - + light_cnt = 0; } void light_solar_periodic( void ) { up[light_cnt] = buf_light_sol_up.sum / buf_light_sol_up.av_nb_sample; dn[light_cnt] = buf_light_sol_dn.sum / buf_light_sol_dn.av_nb_sample; - + /* 10k/10k voltage divider, 10 bits adc, 3.3V max */ if (++light_cnt >= LIGHT_NB) { - DOWNLINK_SEND_SOLAR_RADIATION(DefaultChannel, + DOWNLINK_SEND_SOLAR_RADIATION(DefaultChannel, &up[0], &dn[0], &up[1], &dn[1], &up[2], &dn[2], &up[3], &dn[3], &up[4], &dn[4], &up[5], &dn[5], &up[6], &dn[6], &up[7], &dn[7], &up[8], &dn[8], &up[9], &dn[9]); diff --git a/sw/airborne/modules/meteo/temp_tcouple_adc.c b/sw/airborne/modules/meteo/temp_tcouple_adc.c index 048f8ea826..d18f746a13 100644 --- a/sw/airborne/modules/meteo/temp_tcouple_adc.c +++ b/sw/airborne/modules/meteo/temp_tcouple_adc.c @@ -25,7 +25,7 @@ /** \file temp_tcouple_adc.c * \brief Universitaet Tuebingen thermocouple interface * - * This reads the values for reference and measurement temperature + * This reads the values for reference and measurement temperature * from the Universitaet Tuebingen thermocouple sensor. */ @@ -71,7 +71,7 @@ void temp_tcouple_adc_init( void ) { void temp_tcouple_adc_periodic( void ) { val[temp_cnt] = buf_temp_tcouple_val.sum / buf_temp_tcouple_val.av_nb_sample; ref[temp_cnt] = buf_temp_tcouple_ref.sum / buf_temp_tcouple_ref.av_nb_sample; - + /* no voltage divider, 10 bits adc, 3.3V max */ /* T = U * 52.288899706 - 7.977784737996595 */ fval[temp_cnt] = ((float)(val[temp_cnt] * 3.3) / 1023.) @@ -80,7 +80,7 @@ void temp_tcouple_adc_periodic( void ) { * 100. - 13.; if (++temp_cnt >= TCOUPLE_NB) { - DOWNLINK_SEND_TEMP_TCOUPLE(DefaultChannel, + DOWNLINK_SEND_TEMP_TCOUPLE(DefaultChannel, &fval[0], &fval[1], &fval[2], &fval[3], &fref[0], &fref[1], &fref[2], &fref[3], &val[0], &val[1], &val[2], &val[3], diff --git a/sw/airborne/modules/sensors/airspeed_amsys.c b/sw/airborne/modules/sensors/airspeed_amsys.c index 7ed75a25cd..3139f391df 100755 --- a/sw/airborne/modules/sensors/airspeed_amsys.c +++ b/sw/airborne/modules/sensors/airspeed_amsys.c @@ -103,7 +103,7 @@ void airspeed_amsys_read_periodic( void ) { #else I2CReceive(AIRSPEED_AMSYS_I2C_DEV, airspeed_amsys_i2c_trans, AIRSPEED_AMSYS_ADDR, 4); #endif - + #else // SITL extern float sim_air_speed; EstimatorSetAirspeed(sim_air_speed); @@ -111,7 +111,7 @@ void airspeed_amsys_read_periodic( void ) { } void airspeed_amsys_read_event( void ) { - + // Get raw airspeed from buffer airspeed_amsys_raw = 0; airspeed_amsys_raw = (airspeed_amsys_i2c_trans.buf[0]<<8) | airspeed_amsys_i2c_trans.buf[1]; @@ -119,7 +119,7 @@ void airspeed_amsys_read_event( void ) { tempAS_amsys_raw = (airspeed_amsys_i2c_trans.buf[2]<<8) | airspeed_amsys_i2c_trans.buf[3]; airspeed_temperature = (float)((float)(tempAS_amsys_raw-TEMPERATURE_AMSYS_OFFSET_MIN)/((float)(TEMPERATURE_AMSYS_OFFSET_MAX-TEMPERATURE_AMSYS_OFFSET_MIN)/TEMPERATURE_AMSYS_MAX)+TEMPERATURE_AMSYS_MIN);// Tmin=-25, Tmax=85 #endif - + // Check if this is valid airspeed if (airspeed_amsys_raw == 0) airspeed_amsys_valid = FALSE; @@ -128,7 +128,7 @@ void airspeed_amsys_read_event( void ) { // Continue only if a new airspeed value was received if (airspeed_amsys_valid) { - + // raw not under offest min if (airspeed_amsys_raw BARO_AMSYS_OFFSET_MAX) pBaroRaw = BARO_AMSYS_OFFSET_MAX; - + //Convert to pressure baro_amsys_p = (float)(pBaroRaw-BARO_AMSYS_OFFSET_MIN)*BARO_AMSYS_MAX_PRESSURE/(float)(BARO_AMSYS_OFFSET_MAX-BARO_AMSYS_OFFSET_MIN); if (!baro_amsys_offset_init) { @@ -165,14 +165,14 @@ void baro_amsys_read_event( void ) { baro_amsys_offset = (float)(baro_amsys_offset_tmp / BARO_AMSYS_OFFSET_NBSAMPLES_AVRG); ref_alt_init = GROUND_ALT; baro_amsys_offset_init = TRUE; - + // hight over Sea level at init point - //baro_amsys_offset_altitude = 288.15 / 0.0065 * (1 - pow((baro_amsys_p)/1013.25 , 1/5.255)); + //baro_amsys_offset_altitude = 288.15 / 0.0065 * (1 - pow((baro_amsys_p)/1013.25 , 1/5.255)); } // Check if averaging needs to continue else if (baro_amsys_cnt <= BARO_AMSYS_OFFSET_NBSAMPLES_AVRG) baro_amsys_offset_tmp += baro_amsys_p; - + baro_amsys_altitude = 0.0; } @@ -180,8 +180,8 @@ void baro_amsys_read_event( void ) { // Lowpassfiltering and convert pressure to altitude baro_amsys_altitude = baro_filter * baro_old + (1 - baro_filter) * (baro_amsys_offset-baro_amsys_p)/(1.2041*9.81); baro_old = baro_amsys_altitude; - - + + //New value available //EstimatorSetAlt(baro_amsys_abs_altitude); } @@ -189,8 +189,8 @@ void baro_amsys_read_event( void ) { } /*else { baro_amsys_abs_altitude = 0.0; }*/ - - + + // Transaction has been read baro_amsys_i2c_trans.status = I2CTransDone; #ifdef SENSOR_SYNC_SEND @@ -198,5 +198,5 @@ void baro_amsys_read_event( void ) { #else RunOnceEvery(10, DOWNLINK_SEND_AMSYS_BARO(DefaultChannel, &pBaroRaw, &baro_amsys_p, &baro_amsys_offset, &ref_alt_init, &baro_amsys_abs_altitude, &baro_amsys_altitude, &baro_amsys_temp)); #endif - + } diff --git a/sw/airborne/modules/sensors/baro_ms5611_i2c.c b/sw/airborne/modules/sensors/baro_ms5611_i2c.c index a77eeba8b2..af31cf3af2 100644 --- a/sw/airborne/modules/sensors/baro_ms5611_i2c.c +++ b/sw/airborne/modules/sensors/baro_ms5611_i2c.c @@ -150,7 +150,7 @@ void baro_ms5611_event( void ) { else { /* done reading prom */ ms5611_trans.status = I2CTransDone; - /* check prom crc */ + /* check prom crc */ if (baro_ms5611_crc(ms5611_c) == 0) { DOWNLINK_SEND_MS5611_COEFF(DefaultChannel, &ms5611_c[0], &ms5611_c[1], &ms5611_c[2], &ms5611_c[3], @@ -179,7 +179,7 @@ void baro_ms5611_event( void ) { ms5611_trans.buf[0] = MS5611_START_CONV_D2; I2CTransmit(MS5611_I2C_DEV, ms5611_trans, MS5611_SLAVE_ADDR, 1); break; - + case MS5611_CONV_D2: ms5611_status = MS5611_CONV_D2_OK; ms5611_trans.status = I2CTransDone; @@ -225,7 +225,7 @@ void baro_ms5611_event( void ) { #endif break; } - + default: ms5611_trans.status = I2CTransDone; break; diff --git a/sw/airborne/subsystems/ahrs/ahrs_float_cmpl_rmat.c b/sw/airborne/subsystems/ahrs/ahrs_float_cmpl_rmat.c index 6eed92bc4d..71fa6a5af7 100644 --- a/sw/airborne/subsystems/ahrs/ahrs_float_cmpl_rmat.c +++ b/sw/airborne/subsystems/ahrs/ahrs_float_cmpl_rmat.c @@ -53,7 +53,7 @@ void ahrs_init(void) { {IMU_BODY_TO_IMU_PHI, IMU_BODY_TO_IMU_THETA, IMU_BODY_TO_IMU_PSI}; FLOAT_QUAT_OF_EULERS(ahrs_impl.body_to_imu_quat, body_to_imu_euler); FLOAT_RMAT_OF_EULERS(ahrs_impl.body_to_imu_rmat, body_to_imu_euler); - + /* Set ltp_to_body to zero */ FLOAT_QUAT_ZERO(ahrs_float.ltp_to_body_quat); FLOAT_EULERS_ZERO(ahrs_float.ltp_to_body_euler); @@ -97,12 +97,12 @@ void ahrs_propagate(void) { RATES_FLOAT_OF_BFP(gyro_float, imu.gyro_prev); /* unbias measurement */ RATES_SUB(gyro_float, ahrs_impl.gyro_bias); - + #ifdef AHRS_PROPAGATE_LOW_PASS_RATES const float alpha = 0.1; - FLOAT_RATES_LIN_CMB(ahrs_float.imu_rate, ahrs_float.imu_rate, (1.-alpha), gyro_float, alpha); + FLOAT_RATES_LIN_CMB(ahrs_float.imu_rate, ahrs_float.imu_rate, (1.-alpha), gyro_float, alpha); #else - RATES_COPY(ahrs_float.imu_rate,gyro_float); + RATES_COPY(ahrs_float.imu_rate,gyro_float); #endif /* add correction */ @@ -205,8 +205,8 @@ void ahrs_update_mag_2d(void) { MAGS_FLOAT_OF_BFP(measured_imu, imu.mag); struct FloatVect3 measured_ltp; FLOAT_RMAT_VECT3_TRANSP_MUL(measured_ltp, ahrs_float.ltp_to_imu_rmat, measured_imu); - - const struct FloatVect3 residual_ltp = + + const struct FloatVect3 residual_ltp = { 0, 0, measured_ltp.x * expected_ltp.y - measured_ltp.y * expected_ltp.x }; @@ -215,7 +215,7 @@ void ahrs_update_mag_2d(void) { struct FloatVect3 residual_imu; FLOAT_RMAT_VECT3_MUL(residual_imu, ahrs_float.ltp_to_imu_rmat, residual_ltp); - + const float mag_rate_update_gain = 2.5; FLOAT_RATES_ADD_SCALED_VECT(ahrs_impl.rate_correction, residual_imu, mag_rate_update_gain); @@ -264,7 +264,7 @@ static inline void compute_imu_quat_and_euler_from_rmat(void) { static inline void compute_imu_rmat_and_euler_from_quat(void) { FLOAT_RMAT_OF_QUAT(ahrs_float.ltp_to_imu_rmat, ahrs_float.ltp_to_imu_quat); - FLOAT_EULERS_OF_RMAT(ahrs_float.ltp_to_imu_euler, ahrs_float.ltp_to_imu_rmat); + FLOAT_EULERS_OF_RMAT(ahrs_float.ltp_to_imu_euler, ahrs_float.ltp_to_imu_rmat); } diff --git a/sw/airborne/subsystems/ahrs/ahrs_float_dcm.c b/sw/airborne/subsystems/ahrs/ahrs_float_dcm.c index 33f207b9d3..7f88535141 100644 --- a/sw/airborne/subsystems/ahrs/ahrs_float_dcm.c +++ b/sw/airborne/subsystems/ahrs/ahrs_float_dcm.c @@ -95,7 +95,7 @@ float imu_health = 0.; static inline void set_dcm_matrix_from_rmat(struct FloatRMat *rmat) { for (int i=0; i<3; i++) { - for (int j=0; j<3; j++) { + for (int j=0; j<3; j++) { DCM_Matrix[i][j] = RMAT_ELMT(*rmat, j, i); } } diff --git a/sw/airborne/subsystems/gps/gps_mtk.c b/sw/airborne/subsystems/gps/gps_mtk.c index 812521670c..aaa96859e6 100644 --- a/sw/airborne/subsystems/gps/gps_mtk.c +++ b/sw/airborne/subsystems/gps/gps_mtk.c @@ -26,11 +26,11 @@ * DIYDrones V1.4 protocol (AXN1.30_2278) * DIYDrones V1.6 protocol (AXN1.30_2389) * - * documentation is partly incorrect, see mtk.xml for what seems + * documentation is partly incorrect, see mtk.xml for what seems * to be "real" - * + * */ - + #include "subsystems/gps.h" #include "led.h" @@ -104,15 +104,15 @@ static void gps_mtk_time2itow(uint32_t gps_date, uint32_t gps_time, *gps_week = 0; *gps_itow = 0; - + /* sanity checks */ if (gps_month > 12) return; - if (gps_day > (DAYS_MONTH[gps_month] + + if (gps_day > (DAYS_MONTH[gps_month] + ((gps_month == 1) ? isleap(gps_year):0))) return; if (gps_hour > 23) return; if (gps_minute > 59) return; if (gps_second > 59) return; - + /* days since 6-JAN-1980 */ days = -6; for (i = 1980; i < gps_year; i++) days += (365 + isleap(i)); @@ -122,7 +122,7 @@ static void gps_mtk_time2itow(uint32_t gps_date, uint32_t gps_time, days += DAYS_MONTH[i] + ((i == 1) ? isleap(gps_year):0); } days += gps_day; - + /* convert */ *gps_week = (uint16_t) (days / 7); *gps_itow = ((days % 7) * SECS_DAY + @@ -152,9 +152,9 @@ void gps_mtk_read_message(void) { // FIXME: with MTK you do not receive ellipsoid altitude gps.lla_pos.alt = gps.hmsl; gps.gspeed = MTK_DIY14_NAV_GSpeed(gps_mtk.msg_buf); - // FIXME: with MTK you do not receive speed 3D + // FIXME: with MTK you do not receive speed 3D gps.speed_3d = gps.gspeed; - gps.course = (RadOfDeg(MTK_DIY14_NAV_Heading(gps_mtk.msg_buf)))*10; + gps.course = (RadOfDeg(MTK_DIY14_NAV_Heading(gps_mtk.msg_buf)))*10; gps.num_sv = MTK_DIY14_NAV_numSV(gps_mtk.msg_buf); switch (MTK_DIY14_NAV_GPSfix(gps_mtk.msg_buf)) { case MTK_DIY_FIX_3D: @@ -218,7 +218,7 @@ void gps_mtk_read_message(void) { gps.gspeed = MTK_DIY16_NAV_GSpeed(gps_mtk.msg_buf); // FIXME: with MTK you do not receive speed 3D gps.speed_3d = gps.gspeed; - gps.course = (RadOfDeg(MTK_DIY16_NAV_Heading(gps_mtk.msg_buf)*10000)) * 10; + gps.course = (RadOfDeg(MTK_DIY16_NAV_Heading(gps_mtk.msg_buf)*10000)) * 10; gps.num_sv = MTK_DIY16_NAV_numSV(gps_mtk.msg_buf); switch (MTK_DIY16_NAV_GPSfix(gps_mtk.msg_buf)) { case MTK_DIY_FIX_3D: diff --git a/sw/airborne/subsystems/gps/gps_nmea.c b/sw/airborne/subsystems/gps/gps_nmea.c index 252a9b11bf..961a548330 100644 --- a/sw/airborne/subsystems/gps/gps_nmea.c +++ b/sw/airborne/subsystems/gps/gps_nmea.c @@ -1,5 +1,5 @@ /* - * + * * Copyright (C) 2008-2011 The Paparazzi Team * * This file is part of paparazzi. @@ -17,11 +17,11 @@ * 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. + * Boston, MA 02111-1307, USA. * */ -/** +/** * file gps_nmea.c * brief Parser for the NMEA protocol * @@ -43,7 +43,7 @@ #endif #include -#include +#include #include #include #ifdef DEBUG_NMEA @@ -231,7 +231,7 @@ void parse_nmea_GPGGA(void) { return; } } - + // correct latitute for N/S if(gps_nmea.msg_buf[i] == 'S') lat = -lat; @@ -245,7 +245,7 @@ void parse_nmea_GPGGA(void) { gps.lla_pos.lat =lla_f.lat * 1e7; // convert to fixed-point NMEA_PRINT("p_GPGGA() - lat=%d gps_lat=%i\n\r", (lat*1000), lla_f.lat); - + // get longitude [ddmm.mmmmm] double lon = strtod(&gps_nmea.msg_buf[i], &endptr); // convert to pure degrees [dd.dddd] format @@ -257,7 +257,7 @@ void parse_nmea_GPGGA(void) { if (i >= gps_nmea.msg_len) return; } - + // correct latitute for E/W if(gps_nmea.msg_buf[i] == 'W') lon = -lon; @@ -265,7 +265,7 @@ void parse_nmea_GPGGA(void) { if (i >= gps_nmea.msg_len) return; } - + gps.lla_pos.lon = lla_f.lon * 1e7; // convert to fixed-point NMEA_PRINT("p_GPGGA() - lon=%d gps_lon=%i time=%u\n\r", (lon*1000), lla_f.lon, gps.tow); @@ -298,7 +298,7 @@ void parse_nmea_GPGGA(void) { return; } } - + // get number of satellites used in GPS solution gps.num_sv = atoi(&gps_nmea.msg_buf[i]); NMEA_PRINT("p_GPGGA() - gps_numSatlitesUsed=%i\n\r", gps.num_sv); @@ -314,7 +314,7 @@ void parse_nmea_GPGGA(void) { return; } } - + // get altitude (in meters) // FIXME alt above ellipsoid or geoid (MSL) ??? double alt = strtod(&gps_nmea.msg_buf[i], &endptr); @@ -395,7 +395,7 @@ void nmea_parse_char( uint8_t c ) { if (gps_nmea.msg_len < NMEA_MAXLEN - 1) { // messages end with a linefeed - //AD: TRUNK: if (c == '\r' || c == '\n') + //AD: TRUNK: if (c == '\r' || c == '\n') if (c == '\r' || c == '\n') { gps_nmea.msg_available = TRUE; } else { diff --git a/sw/airborne/subsystems/gps/gps_ubx.c b/sw/airborne/subsystems/gps/gps_ubx.c index 2c09d4908a..bf05c01b4e 100644 --- a/sw/airborne/subsystems/gps/gps_ubx.c +++ b/sw/airborne/subsystems/gps/gps_ubx.c @@ -168,10 +168,10 @@ void gps_ubx_read_message(void) { gps.ned_vel.y = UBX_NAV_VELNED_VEL_E(gps_ubx.msg_buf); gps.ned_vel.z = UBX_NAV_VELNED_VEL_D(gps_ubx.msg_buf); // Ublox gives I4 heading in 1e-5 degrees, apparenty from 0 to 360 degrees (not -180 to 180) - // I4 max = 2^31 = 214 * 1e5 * 100 < 360 * 1e7: overflow on angles over 214 deg -> casted to -214 deg + // I4 max = 2^31 = 214 * 1e5 * 100 < 360 * 1e7: overflow on angles over 214 deg -> casted to -214 deg // solution: First to radians, and then scale to 1e-7 radians // First x 10 for loosing less resolution, then to radians, then multiply x 10 again - gps.course = (RadOfDeg(UBX_NAV_VELNED_Heading(gps_ubx.msg_buf)*10)) * 10; + gps.course = (RadOfDeg(UBX_NAV_VELNED_Heading(gps_ubx.msg_buf)*10)) * 10; gps.tow = UBX_NAV_VELNED_ITOW(gps_ubx.msg_buf); gps_ubx.have_velned = 1; } diff --git a/sw/airborne/subsystems/imu/imu_analog.c b/sw/airborne/subsystems/imu/imu_analog.c index 7901d0e86f..ba9f968d22 100644 --- a/sw/airborne/subsystems/imu/imu_analog.c +++ b/sw/airborne/subsystems/imu/imu_analog.c @@ -45,7 +45,7 @@ void imu_impl_init(void) { void imu_periodic(void) { // Actual Nr of ADC measurements per channel per periodic loop static int last_head = 0; - + imu_overrun = analog_imu_adc_buf[0].head - last_head; if (imu_overrun < 0) imu_overrun += ADC_CHANNEL_GYRO_NB_SAMPLES; diff --git a/sw/airborne/test/ahrs/ahrs_on_synth.c b/sw/airborne/test/ahrs/ahrs_on_synth.c index 21d451a307..e3f9e97889 100644 --- a/sw/airborne/test/ahrs/ahrs_on_synth.c +++ b/sw/airborne/test/ahrs/ahrs_on_synth.c @@ -43,21 +43,21 @@ static void traj_stop_stop_x_init(void); static void traj_stop_stop_x_update(void); struct traj traj[] = { - {.name="static", .desc="blaa", + {.name="static", .desc="blaa", .init_fun=traj_static_static_init, .update_fun=traj_static_static_update}, - {.name="sine", .desc="blaa2", + {.name="sine", .desc="blaa2", .init_fun=traj_static_sine_init, .update_fun=traj_static_sine_update}, - {.name="sineX", .desc="blaa2", + {.name="sineX", .desc="blaa2", .init_fun=traj_sineX_quad_init, .update_fun=traj_sineX_quad_update}, - {.name="step_phi", .desc="blaa2", + {.name="step_phi", .desc="blaa2", .init_fun=traj_step_phi_init, .update_fun=traj_step_phi_update}, - {.name="step_phi2", .desc="blaa2", + {.name="step_phi2", .desc="blaa2", .init_fun=traj_step_phi_2nd_order_init, .update_fun=traj_step_phi_2nd_order_update}, - {.name="step_bias", .desc="blaa2", + {.name="step_bias", .desc="blaa2", .init_fun=traj_step_biasp_init, .update_fun=traj_step_biasp_update}, - {.name="coordinated circle", .desc="blaa2", + {.name="coordinated circle", .desc="blaa2", .init_fun=traj_coordinated_circle_init, .update_fun=traj_coordinated_circle_update}, - {.name="stop stop x", .desc="blaa2", + {.name="stop stop x", .desc="blaa2", .init_fun=traj_stop_stop_x_init, .update_fun=traj_stop_stop_x_update} }; @@ -90,11 +90,11 @@ void aos_init(int traj_nb) { #ifdef PERFECT_SENSORS RATES_ASSIGN(aos.gyro_bias, RadOfDeg(0.), RadOfDeg(0.), RadOfDeg(0.)); - RATES_ASSIGN(aos.gyro_noise, RadOfDeg(0.), RadOfDeg(0.), RadOfDeg(0.)); + RATES_ASSIGN(aos.gyro_noise, RadOfDeg(0.), RadOfDeg(0.), RadOfDeg(0.)); VECT3_ASSIGN(aos.accel_noise, 0., 0., 0.); #else RATES_ASSIGN(aos.gyro_bias, RadOfDeg(1.), RadOfDeg(2.), RadOfDeg(3.)); - RATES_ASSIGN(aos.gyro_noise, RadOfDeg(1.), RadOfDeg(1.), RadOfDeg(1.)); + RATES_ASSIGN(aos.gyro_noise, RadOfDeg(1.), RadOfDeg(1.), RadOfDeg(1.)); VECT3_ASSIGN(aos.accel_noise, .5, .5, .5); #endif @@ -170,8 +170,8 @@ void aos_compute_sensors(void) { float_vect3_add_gaussian_noise(&accelero_imu, &aos.accel_noise); ACCELS_BFP_OF_REAL(imu.accel, accelero_imu); - - + + struct FloatVect3 h_earth = {AHRS_H_X, AHRS_H_Y, AHRS_H_Z}; struct FloatVect3 h_imu; FLOAT_QUAT_VMULT(h_imu, aos.ltp_to_imu_quat, h_earth); @@ -193,7 +193,7 @@ void aos_compute_state(void) { aos.time += aos.dt; aos.traj->update_fun(); - + } @@ -201,7 +201,7 @@ void aos_run(void) { aos_compute_state(); aos_compute_sensors(); -#ifndef DISABLE_ALIGNEMENT +#ifndef DISABLE_ALIGNEMENT if (ahrs.status == AHRS_UNINIT) { ahrs_aligner_run(); if (ahrs_aligner.status == AHRS_ALIGNER_LOCKED) @@ -212,7 +212,7 @@ void aos_run(void) { ahrs_propagate(); ahrs_update_accel(); ahrs_update_mag(); -#ifndef DISABLE_ALIGNEMENT +#ifndef DISABLE_ALIGNEMENT } #endif @@ -250,7 +250,7 @@ static void traj_static_sine_init(void) { } static void traj_static_sine_update(void) { - + aos.imu_rates.p = RadOfDeg(200)*cos(aos.time); aos.imu_rates.q = RadOfDeg(200)*cos(0.7*aos.time+2); @@ -279,12 +279,12 @@ static void traj_sineX_quad_update(void) { VECT3_ASSIGN(aos.ltp_accel , -a*om*om *sin(om*aos.time), 0, 0); VECT3_ASSIGN(aos.ltp_vel , a*om *cos(om*aos.time), 0, 0); VECT3_ASSIGN(aos.ltp_pos , a *sin(om*aos.time), 0, 0); - + // this is based on differential flatness of the quad EULERS_ASSIGN(aos.ltp_to_imu_euler, 0., atan2(aos.ltp_accel.x, 9.81), 0.); FLOAT_QUAT_OF_EULERS(aos.ltp_to_imu_quat, aos.ltp_to_imu_euler); const struct FloatEulers e_dot = { - 0., + 0., 9.81*jerk.x / ( (9.81*9.81) + (aos.ltp_accel.x*aos.ltp_accel.x)), 0. }; FLOAT_RATES_OF_EULER_DOT(aos.imu_rates, aos.ltp_to_imu_euler, e_dot); @@ -352,13 +352,13 @@ static void traj_coordinated_circle_update(void) { VECT3_ASSIGN(aos.ltp_pos, R*cos(omega*aos.time), R*sin(omega*aos.time), 0.); VECT3_ASSIGN(aos.ltp_vel, -omega*R*sin(omega*aos.time), omega*R*cos(omega*aos.time), 0.); VECT3_ASSIGN(aos.ltp_accel, -omega*omega*R*cos(omega*aos.time), -omega*omega*R*sin(omega*aos.time), 0.); - - + + // float psi = atan2(aos.ltp_pos.y, aos.ltp_pos.x); float psi = M_PI_2 + omega*aos.time; while (psi>M_PI) psi -= 2.*M_PI; EULERS_ASSIGN(aos.ltp_to_imu_euler, phi, 0, psi); FLOAT_QUAT_OF_EULERS(aos.ltp_to_imu_quat, aos.ltp_to_imu_euler); - + struct FloatEulers e_dot; EULERS_ASSIGN(e_dot, 0., 0., omega); FLOAT_RATES_OF_EULER_DOT(aos.imu_rates, aos.ltp_to_imu_euler, e_dot); @@ -369,7 +369,7 @@ static void traj_coordinated_circle_update(void) { //static char** traj_stop_stop_x_desc(void) { - // static const char** desc = + // static const char** desc = // {"stop top", NULL}; // return desc; //} @@ -399,13 +399,13 @@ static void traj_stop_stop_x_update(void){ VECT3_ASSIGN(aos.ltp_jerk , val_jerk, 0., 0.); } else { VECT3_ASSIGN(aos.ltp_jerk , 0. , 0., 0.); } - - + + // this is based on differential flatness of the quad EULERS_ASSIGN(aos.ltp_to_imu_euler, 0., atan2(aos.ltp_accel.x, 9.81), 0.); FLOAT_QUAT_OF_EULERS(aos.ltp_to_imu_quat, aos.ltp_to_imu_euler); const struct FloatEulers e_dot = { - 0., + 0., 9.81*aos.ltp_jerk.x / ( (9.81*9.81) + (aos.ltp_accel.x*aos.ltp_accel.x)), 0. }; FLOAT_RATES_OF_EULER_DOT(aos.imu_rates, aos.ltp_to_imu_euler, e_dot); diff --git a/sw/airborne/test/ahrs/ahrs_on_synth.h b/sw/airborne/test/ahrs/ahrs_on_synth.h index 20644a59db..9121652309 100644 --- a/sw/airborne/test/ahrs/ahrs_on_synth.h +++ b/sw/airborne/test/ahrs/ahrs_on_synth.h @@ -8,7 +8,7 @@ struct traj { char* desc; void (*init_fun)(void); void (*update_fun)(void); - + double ts; double te; }; @@ -29,7 +29,7 @@ struct AhrsOnSynth { struct FloatEulers ltp_to_imu_euler; struct FloatQuat ltp_to_imu_quat; struct FloatRates imu_rates; - + struct FloatVect3 ltp_jerk; struct FloatVect3 ltp_accel; struct FloatVect3 ltp_vel; diff --git a/sw/airborne/test/ahrs/run_ahrs_on_synth.c b/sw/airborne/test/ahrs/run_ahrs_on_synth.c index ec0e4dc6cb..b15e942d2b 100644 --- a/sw/airborne/test/ahrs/run_ahrs_on_synth.c +++ b/sw/airborne/test/ahrs/run_ahrs_on_synth.c @@ -14,7 +14,7 @@ static void report(void); int main(int argc, char** argv) { - + int traj = 0; if (argc > 1) traj = atoi(argv[1]); @@ -43,42 +43,42 @@ static void report(void) { #endif printf("%f ", aos.time); - printf("%f %f %f ", DegOfRad(aos.ltp_to_imu_euler.phi), + printf("%f %f %f ", DegOfRad(aos.ltp_to_imu_euler.phi), DegOfRad(aos.ltp_to_imu_euler.theta), DegOfRad(aos.ltp_to_imu_euler.psi)); - printf("%f %f %f ", DegOfRad(aos.imu_rates.p), - DegOfRad(aos.imu_rates.q), + printf("%f %f %f ", DegOfRad(aos.imu_rates.p), + DegOfRad(aos.imu_rates.q), DegOfRad(aos.imu_rates.r)); - printf("%f %f %f ", DegOfRad(aos.gyro_bias.p), - DegOfRad(aos.gyro_bias.q), + printf("%f %f %f ", DegOfRad(aos.gyro_bias.p), + DegOfRad(aos.gyro_bias.q), DegOfRad(aos.gyro_bias.r)); printf("%f %f %f ", DegOfRad(ahrs_float.ltp_to_imu_euler.phi), - DegOfRad(ahrs_float.ltp_to_imu_euler.theta), + DegOfRad(ahrs_float.ltp_to_imu_euler.theta), DegOfRad(ahrs_float.ltp_to_imu_euler.psi)); - printf("%f %f %f ", DegOfRad(ahrs_float.imu_rate.p), - DegOfRad(ahrs_float.imu_rate.q), + printf("%f %f %f ", DegOfRad(ahrs_float.imu_rate.p), + DegOfRad(ahrs_float.imu_rate.q), DegOfRad(ahrs_float.imu_rate.r)); #if AHRS_TYPE == AHRS_TYPE_ICQ struct FloatRates bias; RATES_FLOAT_OF_BFP(bias, ahrs_impl.gyro_bias); - printf("%f %f %f ", DegOfRad(bias.p), - DegOfRad(bias.q), + printf("%f %f %f ", DegOfRad(bias.p), + DegOfRad(bias.q), DegOfRad(bias.r)); #endif #if AHRS_TYPE == AHRS_TYPE_FLQ || AHRS_TYPE == AHRS_TYPE_FCR2 || AHRS_TYPE == AHRS_TYPE_FCQ - printf("%f %f %f ", DegOfRad(ahrs_impl.gyro_bias.p), - DegOfRad(ahrs_impl.gyro_bias.q), + printf("%f %f %f ", DegOfRad(ahrs_impl.gyro_bias.p), + DegOfRad(ahrs_impl.gyro_bias.q), DegOfRad(ahrs_impl.gyro_bias.r)); #endif if (output_pos) { - printf("%f %f %f ", aos.ltp_pos.x, + printf("%f %f %f ", aos.ltp_pos.x, aos.ltp_pos.y, aos.ltp_pos.z); } diff --git a/sw/airborne/test/ahrs/run_ahrs_on_synth_ivy.c b/sw/airborne/test/ahrs/run_ahrs_on_synth_ivy.c index f9809717f7..bb04a7bfdf 100644 --- a/sw/airborne/test/ahrs/run_ahrs_on_synth_ivy.c +++ b/sw/airborne/test/ahrs/run_ahrs_on_synth_ivy.c @@ -40,7 +40,7 @@ gboolean timeout_callback(gpointer data) { #endif #if AHRS_TYPE == AHRS_TYPE_ICQ - IvySendMsg("183 BOOZ_AHRS_BIAS %d %d %d", + IvySendMsg("183 BOOZ_AHRS_BIAS %d %d %d", ahrs_impl.gyro_bias.p, ahrs_impl.gyro_bias.q, ahrs_impl.gyro_bias.r); @@ -48,28 +48,28 @@ gboolean timeout_callback(gpointer data) { #if AHRS_TYPE == AHRS_TYPE_FLQ || AHRS_TYPE == AHRS_TYPE_FCR2 struct Int32Rates bias_i; RATES_BFP_OF_REAL(bias_i, ahrs_impl.gyro_bias); - IvySendMsg("183 BOOZ_AHRS_BIAS %d %d %d", + IvySendMsg("183 BOOZ_AHRS_BIAS %d %d %d", bias_i.p, bias_i.q, bias_i.r); #endif - IvySendMsg("183 AHRS_EULER %f %f %f", + IvySendMsg("183 AHRS_EULER %f %f %f", ahrs_float.ltp_to_imu_euler.phi, ahrs_float.ltp_to_imu_euler.theta, ahrs_float.ltp_to_imu_euler.psi); IvySendMsg("183 BOOZ_SIM_RATE_ATTITUDE %f %f %f %f %f %f", - DegOfRad(aos.imu_rates.p), - DegOfRad(aos.imu_rates.q), + DegOfRad(aos.imu_rates.p), + DegOfRad(aos.imu_rates.q), DegOfRad(aos.imu_rates.r), - DegOfRad(aos.ltp_to_imu_euler.phi), + DegOfRad(aos.ltp_to_imu_euler.phi), DegOfRad(aos.ltp_to_imu_euler.theta), DegOfRad(aos.ltp_to_imu_euler.psi)); IvySendMsg("183 BOOZ_SIM_GYRO_BIAS %f %f %f", - DegOfRad(aos.gyro_bias.p), - DegOfRad(aos.gyro_bias.q), + DegOfRad(aos.gyro_bias.p), + DegOfRad(aos.gyro_bias.q), DegOfRad(aos.gyro_bias.r)); return TRUE; @@ -86,7 +86,7 @@ int main ( int argc, char** argv) { g_timeout_add(1000/25, timeout_callback, NULL); GMainLoop *ml = g_main_loop_new(NULL, FALSE); - + IvyInit ("test_ahrs", "test_ahrs READY", NULL, NULL, NULL, NULL); IvyStart("127.255.255.255"); diff --git a/sw/airborne/test/subsystems/test_ahrs.c b/sw/airborne/test/subsystems/test_ahrs.c index ac42d4b344..b8f90776f4 100644 --- a/sw/airborne/test/subsystems/test_ahrs.c +++ b/sw/airborne/test/subsystems/test_ahrs.c @@ -71,7 +71,7 @@ static inline void main_init( void ) { } static inline void main_periodic_task( void ) { - + if (cpu_time_sec > 1) imu_periodic(); RunOnceEvery(10, { LED_PERIODIC();}); main_report(); @@ -121,9 +121,9 @@ static inline void main_report(void) { DOWNLINK_SEND_IMU_ACCEL_RAW(DefaultChannel, &imu.accel_unscaled.x, &imu.accel_unscaled.y, - &imu.accel_unscaled.z); + &imu.accel_unscaled.z); }, - { + { DOWNLINK_SEND_IMU_GYRO_RAW(DefaultChannel, &imu.gyro_unscaled.p, &imu.gyro_unscaled.q, @@ -133,13 +133,13 @@ static inline void main_report(void) { DOWNLINK_SEND_IMU_MAG_RAW(DefaultChannel, &imu.mag_unscaled.x, &imu.mag_unscaled.y, - &imu.mag_unscaled.z); + &imu.mag_unscaled.z); }, { DOWNLINK_SEND_IMU_ACCEL_SCALED(DefaultChannel, &imu.accel.x, &imu.accel.y, - &imu.accel.z); + &imu.accel.z); }, { DOWNLINK_SEND_IMU_GYRO_SCALED(DefaultChannel, @@ -154,7 +154,7 @@ static inline void main_report(void) { &imu.mag.y, &imu.mag.z); }, - + { DOWNLINK_SEND_ALIVE(DefaultChannel, 16, MD5SUM); }, @@ -182,10 +182,10 @@ static inline void main_report(void) { &ahrs.ltp_to_body_euler.psi); }, { - DOWNLINK_SEND_BOOZ_AHRS_BIAS(DefaultChannel, + DOWNLINK_SEND_BOOZ_AHRS_BIAS(DefaultChannel, &ahrs_impl.gyro_bias.p, &ahrs_impl.gyro_bias.q, &ahrs_impl.gyro_bias.r); - + }); } diff --git a/sw/ground_segment/cockpit/compass.ml b/sw/ground_segment/cockpit/compass.ml index 2a0b62f7c8..901855e21d 100644 --- a/sw/ground_segment/cockpit/compass.ml +++ b/sw/ground_segment/cockpit/compass.ml @@ -2,7 +2,7 @@ * $Id$ * * Compass display for a manned vehicle -* +* * Copyright (C) 2004-2009 ENAC, Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. +* Boston, MA 02111-1307, USA. * *) @@ -39,7 +39,7 @@ let arrow = [1,1; 2,1; 0,3; -2,1; -1,1; -1,-3; 1,-3; 1,1] let rot = fun angle -> let angle = (Deg>>Rad)(-. angle) in let ca = cos angle and sa = sin angle in - fun (x,y) -> + fun (x,y) -> let x = float x and y = float y in (truncate (ca*.x-.sa*.y), truncate (sa*.x+.ca*.y)) @@ -51,7 +51,7 @@ let circle = fun (dr:GDraw.pixmap) (x,y) r -> let a = float i /. float n *. 2.*.pi in (x + truncate (r*.cos a), y + truncate (r*.sin a))) in dr#polygon (Array.to_list points) - + let draw = fun (da_object:Gtk_tools.pixmap_in_drawin_area) desired_course course_opt distance -> let da = da_object#drawing_area in let {Gtk.width=width; height=height} = da#misc#allocation in @@ -91,7 +91,7 @@ let draw = fun (da_object:Gtk_tools.pixmap_in_drawin_area) desired_course course circle dr (4*s,4*s) (3*s) else print_string (4*s) (4*s) "STOP"; - + (* Distance and bearing to target, current track *) print_string (7*s) s (sprintf "%.0f m" distance); print_string (7*s) (s/2) "Dist."; @@ -107,13 +107,13 @@ let draw = fun (da_object:Gtk_tools.pixmap_in_drawin_area) desired_course course List.iter (fun (x,y,string)-> let (x,y) = translate (rotation ((x*5*s)/20, (y*5*s)/20)) in print_string x y string) - cards; - + cards; + (new GDraw.drawable da#misc#window)#put_pixmap ~x:0 ~y:0 dr#pixmap (*********************** Main ************************************************) let _ = - let ivy_bus = ref Defivybus.default_ivy_bus in + let ivy_bus = ref Defivybus.default_ivy_bus in Arg.parse [ "-b", Arg.String (fun x -> ivy_bus := x), (sprintf " Default is %s" !ivy_bus)] (fun x -> prerr_endline ("WARNING: don't do anything with "^x)) @@ -153,5 +153,5 @@ let _ = (** Start the main loop *) window#show (); - GMain.main () - + GMain.main () + diff --git a/sw/ground_segment/cockpit/editFP.ml b/sw/ground_segment/cockpit/editFP.ml index e4d5e5b4b2..4d2d4a8c86 100644 --- a/sw/ground_segment/cockpit/editFP.ml +++ b/sw/ground_segment/cockpit/editFP.ml @@ -32,7 +32,7 @@ let if_none = fun f -> let set_window_title = fun geomap -> let title_suffix = - match !current_fp with + match !current_fp with None -> "" | Some (_fp, xml_file) -> sprintf " (%s)" (Filename.basename xml_file) in match GWindow.toplevel geomap#canvas with @@ -48,14 +48,14 @@ let save_fp = fun geomap -> | Some (fp, filename) -> match GToolbox.select_file ~title:"Save Flight Plan" ~filename () with None -> () - | Some file -> + | Some file -> let f = open_out file in fprintf f "\n\n"; fprintf f "%s\n" (ExtXml.to_string_fmt fp#xml); close_out f; current_fp := Some (fp, file); set_window_title geomap - + let close_fp = fun geomap -> match !current_fp with @@ -66,9 +66,9 @@ let close_fp = fun geomap -> current_fp := None in match GToolbox.question_box ~title:"Closing flight plan" ~buttons:["Close"; "Save&Close"; "Cancel"] "Do you want to save/close ?" with 2 -> save_fp geomap; close () - | 1 -> close () + | 1 -> close () | _ -> () - + let load_xml_fp = fun geomap editor_frame _accel_group ?(xml_file=Env.flight_plans_path) xml -> Map2d.set_georef_if_none geomap (MapFP.georef_of_xml xml); let fp = new MapFP.flight_plan ~editable:true ~show_moved:false geomap "red" Env.flight_plan_dtd xml in @@ -76,12 +76,12 @@ let load_xml_fp = fun geomap editor_frame _accel_group ?(xml_file=Env.flight_pla current_fp := Some (fp,xml_file); (** Add waypoints as geo references *) - List.iter + List.iter (fun w -> let (_i, w) = fp#index w in geomap#add_info_georef (sprintf "%s" w#name) (w :> < pos : Latlong.geographic >)) fp#waypoints; - + fp let labelled_entry = fun ?width_chars text value h -> @@ -103,12 +103,12 @@ let new_fp = fun geomap editor_frame accel_group () -> let alt = labelled_entry ~width_chars:4 "Default Alt" "430" h in let qfu = labelled_entry ~width_chars:4 "QFU" "270" h in let mdfh = labelled_entry ~width_chars:4 "Max distance from HOME" "500" h in - + let h = GPack.hbox ~packing:dvbx#pack () in let name = labelled_entry "Name" "Test flight" h in - + let h = GPack.hbox ~packing:dvbx#pack () in - let cancel = GButton.button ~stock:`CANCEL ~packing: h#add () in + let cancel = GButton.button ~stock:`CANCEL ~packing: h#add () in ignore(cancel#connect#clicked ~callback:dialog#destroy); let createfp = GButton.button ~stock:`OK ~packing: h#add () in @@ -147,9 +147,9 @@ let load_xml_file = fun geomap editor_frame accel_group xml_file -> Dtd.Prove_error(e) -> loading_error xml_file (Dtd.prove_error e) | Dtd.Check_error(e) -> loading_error xml_file (Dtd.check_error e) | Xml.Error e -> loading_error xml_file (Xml.error e) - - + + (** Loading a flight plan for edition *) let load_fp = fun geomap editor_frame accel_group () -> if_none (fun () -> @@ -159,11 +159,11 @@ let load_fp = fun geomap editor_frame accel_group () -> let create_wp = fun geomap geo -> match !current_fp with - None -> + None -> GToolbox.message_box "Error" "Load a flight plan first"; failwith "create_wp" | Some (fp,_) -> - let w = fp#add_waypoint geo in + let w = fp#add_waypoint geo in geomap#add_info_georef (sprintf "%s" w#name) (w :> < pos : Latlong.geographic >); w @@ -182,7 +182,7 @@ let calibrate_map = fun (geomap:MapCanvas.widget) editor_frame accel_group () -> | None -> match GToolbox.select_file ~filename:(default_path_maps // "") ~title:"Open Image" () with None -> () - | Some image -> + | Some image -> (** Displaying the image in the NW corner *) let pixbuf = GdkPixbuf.from_file image in let pix = GnoCanvas.pixbuf ~pixbuf ~props:[`ANCHOR `NW] geomap#canvas#root in @@ -197,7 +197,7 @@ let calibrate_map = fun (geomap:MapCanvas.widget) editor_frame accel_group () -> | Some geo -> geo in let fp_xml = dummy_fp dummy_georef in let fp = load_xml_fp geomap editor_frame accel_group fp_xml in - + (** Dialog to finish calibration *) let dialog = GWindow.window ~border_width:10 ~title:"Map calibration" () in let v = GPack.vbox ~packing:dialog#add () in @@ -213,7 +213,7 @@ let calibrate_map = fun (geomap:MapCanvas.widget) editor_frame accel_group () -> ignore(cal#connect#clicked ~callback:(fun _ -> let points = List.map XmlEdit.xml_of_node fp#waypoints in let points = List.map ref_point_of_waypoint points in - let xml = Xml.Element ("map", + let xml = Xml.Element ("map", ["file", Filename.basename image; "projection", geomap#projection], points) in diff --git a/sw/ground_segment/cockpit/gcs.ml b/sw/ground_segment/cockpit/gcs.ml index e5a8cce822..e0b452f8f1 100644 --- a/sw/ground_segment/cockpit/gcs.ml +++ b/sw/ground_segment/cockpit/gcs.ml @@ -322,7 +322,7 @@ let keys_help = fun () -> (***************** MAIN ******************************************************) -let ivy_bus = ref Defivybus.default_ivy_bus +let ivy_bus = ref Defivybus.default_ivy_bus and geo_ref = ref "" and map_files = ref [] and center = ref "" diff --git a/sw/ground_segment/cockpit/live.mli b/sw/ground_segment/cockpit/live.mli index 228d197aff..debcc70748 100644 --- a/sw/ground_segment/cockpit/live.mli +++ b/sw/ground_segment/cockpit/live.mli @@ -2,7 +2,7 @@ * $Id$ * * Real time handling of flying A/Cs -* +* * Copyright (C) 2004-2006 ENAC, Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. +* Boston, MA 02111-1307, USA. * *) diff --git a/sw/ground_segment/cockpit/map2d.ml b/sw/ground_segment/cockpit/map2d.ml index 1acfe70724..07d70ee942 100644 --- a/sw/ground_segment/cockpit/map2d.ml +++ b/sw/ground_segment/cockpit/map2d.ml @@ -18,13 +18,13 @@ * 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. +* Boston, MA 02111-1307, USA. * *) let set_georef_if_none = fun geomap wgs84 -> match geomap#georef with - None -> + None -> geomap#set_georef wgs84; geomap#center wgs84 | Some _ -> () diff --git a/sw/ground_segment/cockpit/map2d.mli b/sw/ground_segment/cockpit/map2d.mli index 97fe40e325..b3271fcd9d 100644 --- a/sw/ground_segment/cockpit/map2d.mli +++ b/sw/ground_segment/cockpit/map2d.mli @@ -18,7 +18,7 @@ * 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. +* Boston, MA 02111-1307, USA. * *) diff --git a/sw/ground_segment/cockpit/page_settings.ml b/sw/ground_segment/cockpit/page_settings.ml index 9a26d0c5a2..d4817d43dd 100644 --- a/sw/ground_segment/cockpit/page_settings.ml +++ b/sw/ground_segment/cockpit/page_settings.ml @@ -2,7 +2,7 @@ * $Id$ * * Widget to pack settings buttons -* +* * Copyright (C) 2004-2009 ENAC, Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. +* Boston, MA 02111-1307, USA. * *) @@ -34,7 +34,7 @@ class setting = fun (i:int) (xml:Xml.xml) (current_value:GMisc.label) set_defaul method index = i method xml = xml method current_value = - let auc = Pprz.alt_unit_coef_of_xml xml in + let auc = Pprz.alt_unit_coef_of_xml xml in let (alt_a, alt_b) = Ocaml_tools.affine_transform auc in (float_of_string current_value#text -. alt_b) /. alt_a method update = fun s -> @@ -46,7 +46,7 @@ class setting = fun (i:int) (xml:Xml.xml) (current_value:GMisc.label) set_defaul let pipe_regexp = Str.regexp "|" let values_of_dl_setting = fun dl_setting -> - try + try Array.of_list (Str.split pipe_regexp (Xml.attrib dl_setting "values")) with _ -> [||] @@ -63,14 +63,14 @@ let add_key = fun xml do_change keys -> let key, modifiers = GtkData.AccelGroup.parse (Xml.attrib xml "key") and value = ExtXml.float_attrib xml "value" in keys := (key, (modifiers, fun () -> do_change value)) :: !keys - + let one_setting = fun (i:int) (do_change:int -> float -> unit) packing dl_setting (tooltips:GData.tooltips) strip keys -> let f = fun a -> float_of_string (ExtXml.attrib dl_setting a) in let lower = f "min" and upper = f "max" - and step_incr = + and step_incr = try f "step" with _ -> fprintf stderr "Warning: 'step' attribute missing in '%s' setting. Default to 1\n%!" (Xml.to_string dl_setting); 1. @@ -80,7 +80,7 @@ let one_setting = fun (i:int) (do_change:int -> float -> unit) packing dl_settin and show_auto = try ExtXml.attrib dl_setting "auto" = "true" with _ -> false in let auc = Pprz.alt_unit_coef_of_xml dl_setting in let (alt_a, alt_b) = Ocaml_tools.affine_transform auc in - + let hbox = GPack.hbox ~packing () in let varname = ExtXml.attrib dl_setting "var" in let text = try ExtXml.attrib dl_setting "shortname" with _ -> varname in @@ -111,7 +111,7 @@ let one_setting = fun (i:int) (do_change:int -> float -> unit) packing dl_settin let update_string = fun string -> try update_value ((search_index string values) + truncate lower) - with + with Not_found -> failwith (sprintf "Internal error: Settings, %s not found" string) in Gtk_tools.combo_connect combo update_string; @@ -124,12 +124,12 @@ let one_setting = fun (i:int) (do_change:int -> float -> unit) packing dl_settin let buttons = Array.init (iupper-ilower+1) (fun j -> (* Build the button *) - let label = - if Array.length values = 0 + let label = + if Array.length values = 0 then Printf.sprintf "%d" (ilower + j) else values.(j) in let b = GButton.radio_button ~group ~label ~packing:hbox#add () in - + (* Connect the event *) ignore (b#connect#pressed (fun () -> update_value (ilower + j))); b) in @@ -151,7 +151,7 @@ let one_setting = fun (i:int) (do_change:int -> float -> unit) packing dl_settin let callback = fun _ -> do_change i infinity; true in ignore (eb#event#connect#button_press ~callback); - + (* Auto check button *) if show_auto then begin hbox#pack auto_but#coerce @@ -196,20 +196,20 @@ let one_setting = fun (i:int) (do_change:int -> float -> unit) packing dl_settin let b = GButton.button () in let pixbuf = GdkPixbuf.from_file (Env.gcs_icons_path // icon) in ignore (GMisc.image ~pixbuf ~packing:b#add ()); - + (* Drag for Drop *) let papget = Papget_common.xml "variable_setting" "button" - ["variable", varname; + ["variable", varname; "value", ExtXml.attrib x "value"; "icon", icon] in Papget_common.dnd_source b#coerce papget; - + (* Associates the label as a tooltip *) tooltips#set_tip b#coerce ~text:label; b with Xml.No_attribute "icon" -> GButton.button ~label () - | exc -> + | exc -> prerr_endline (Printexc.to_string exc); GButton.button ~label () in (strip group b#coerce: unit); @@ -228,7 +228,7 @@ let same_tag_for_all = function let tag_first = Xml.tag x in List.iter (fun y -> assert(ExtXml.tag_is y tag_first)) xs; String.lowercase tag_first - + (** Build the tree of settings *) let rec build_settings = fun do_change i flat_list keys xml_settings packing tooltips strip -> @@ -242,15 +242,15 @@ let rec build_settings = fun do_change i flat_list keys xml_settings packing too xml_settings | "dl_settings" -> let n = GPack.notebook ~packing () in - + List.iter (fun dl_settings -> let text = ExtXml.attrib dl_settings "name" in let _sw = GBin.scrolled_window ~hpolicy:`AUTOMATIC ~vpolicy:`AUTOMATIC () in let vbox = GPack.vbox () in - + let tab_label = (GMisc.label ~text ())#coerce in ignore (n#append_page ~tab_label vbox#coerce); - + let children = Xml.children dl_settings in build_settings do_change i flat_list keys children vbox#pack tooltips strip) xml_settings @@ -267,7 +267,7 @@ class settings = fun ?(visible = fun _ -> true) xml_settings do_change strip -> List.rev !l in let variables = Array.of_list ordered_list in let length = Array.length variables in - let assocs = + let assocs = List.map (fun setting -> (ExtXml.attrib setting#xml "var", setting#index)) ordered_list in object (self) method widget = sw#coerce @@ -282,7 +282,7 @@ class settings = fun ?(visible = fun _ -> true) xml_settings do_change strip -> let s = string_of_float v in if i < 0 || i >= Array.length variables then failwith (sprintf "Pages.settings#set: %d out of bounnds (length=%d)" i (Array.length variables)); - let s = + let s = let values = values_of_dl_setting setting#xml in try let lower = int_of_string (ExtXml.attrib setting#xml "min") in diff --git a/sw/ground_segment/cockpit/page_settings.mli b/sw/ground_segment/cockpit/page_settings.mli index 87462dbf59..5a9dda55ab 100644 --- a/sw/ground_segment/cockpit/page_settings.mli +++ b/sw/ground_segment/cockpit/page_settings.mli @@ -2,7 +2,7 @@ * $Id$ * * Widget to pack settings buttons -* +* * Copyright (C) 2004-2009 ENAC, Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. +* Boston, MA 02111-1307, USA. * *) diff --git a/sw/ground_segment/cockpit/pages.ml b/sw/ground_segment/cockpit/pages.ml index d2525ecf6e..c7dccb6160 100644 --- a/sw/ground_segment/cockpit/pages.ml +++ b/sw/ground_segment/cockpit/pages.ml @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -33,28 +33,28 @@ open Printf (** alert page *) class alert (widget: GBin.frame) = - let scrolled = GBin.scrolled_window - ~hpolicy: `AUTOMATIC - ~vpolicy: `AUTOMATIC + let scrolled = GBin.scrolled_window + ~hpolicy: `AUTOMATIC + ~vpolicy: `AUTOMATIC ~packing: widget#add - () + () in let view = GText.view ~editable:false ~packing: scrolled#add () in (* the object itselft *) object val mutable last = "" - method add text = + method add text = if text <> last then begin let l = Unix.localtime (Unix.gettimeofday ()) in view#buffer#insert (sprintf "%02d:%02d:%02d " l.Unix.tm_hour l.Unix.tm_min l.Unix.tm_sec); view#buffer#insert text; view#buffer#insert "\n"; - + (* Scroll to the bottom line *) let end_iter = view#buffer#end_iter in let end_mark = view#buffer#create_mark end_iter in view#scroll_mark_onscreen (`MARK end_mark); - + last <- text end end @@ -71,16 +71,16 @@ class infrared (widget: GBin.frame) = ~packing: widget#add () in - let contrast_status = + let contrast_status = GMisc.label ~text: "" ~packing: (table#attach ~top:0 ~left: 1) () in - let contrast_value = + let contrast_value = GMisc.label ~text: "" ~packing: (table#attach ~top:1 ~left: 1) () in - let gps_hybrid_mode = + let gps_hybrid_mode = GMisc.label ~text: "" ~packing: (table#attach ~top:2 ~left: 1) () in - let gps_hybrid_factor = + let gps_hybrid_factor = GMisc.label ~text: "" ~packing: (table#attach ~top:3 ~left: 1) () in let _init = @@ -98,11 +98,11 @@ class infrared (widget: GBin.frame) = val gps_hybrid_mode = gps_hybrid_mode val gps_hybrid_factor = gps_hybrid_factor - method set_contrast_status (s:string) = + method set_contrast_status (s:string) = contrast_status#set_label s method set_contrast_value (s:int) = contrast_value#set_label (Printf.sprintf "%d" s) - method set_gps_hybrid_mode (s:string) = + method set_gps_hybrid_mode (s:string) = gps_hybrid_mode#set_label s method set_gps_hybrid_factor (s:float) = gps_hybrid_factor#set_label (Printf.sprintf "%.8f" s) @@ -139,16 +139,16 @@ class gps ?(visible = fun _ -> true) (widget: GBin.frame) = if visible widget then let da = da_object#drawing_area in let {Gtk.width=width; height=height} = da#misc#allocation in - + (* Background *) let dr = da_object#get_pixmap () in dr#set_foreground (`NAME "white"); dr#rectangle ~x:0 ~y:0 ~width ~height ~filled:true (); - + let context = da#misc#create_pango_context in context#set_font_by_name ("sans " ^ string_of_int 10); let layout = context#create_layout in - + let n = Array.length a in let sep_size = 3 in let indic_size = min 25 ((width-(n+1)*sep_size)/n) in @@ -164,11 +164,11 @@ class gps ?(visible = fun _ -> true) (widget: GBin.frame) = let (id, cn0, flags, age) = a.(i) in if age < 60 then let x = sep_size + i * (sep_size+indic_size) in - + (* level *) Pango.Layout.set_text layout (sprintf "% 2d" cn0); dr#put_layout ~x ~y:0 ~fore:`BLACK layout; - + (* bar *) let color = if age > 5 then "grey" else if flags land 0x01 = 1 then "green" else "red" in dr#set_foreground (`NAME color); @@ -187,7 +187,7 @@ class gps ?(visible = fun _ -> true) (widget: GBin.frame) = Pango.Layout.set_text layout (if pacc = 0 then "Pos accuracy: N/A" else sprintf "Pos accuracy: %.1fm" (float pacc/.100.)); let (_, h) = Pango.Layout.get_pixel_size layout in dr#put_layout ~x:((width-w)/2) ~y:(y+h) ~fore:`BLACK layout; - + (new GDraw.drawable da#misc#window)#put_pixmap ~x:0 ~y:0 dr#pixmap end @@ -203,7 +203,7 @@ let index_of = fun label -> failwith (sprintf "Unknown label in Misc.index_of: %s" label) in search 0 - + class misc ~packing (widget: GBin.frame) = let rows = Array.length misc_fields in let table = GPack.table ~rows ~columns:2 ~row_spacings:5 ~col_spacings:40 ~packing () in @@ -249,7 +249,7 @@ let one_rc_mode = fun (table:GPack.table) rc_mode -> ignore (GMisc.label ~text ~packing:(table#attach ~top:(1+2*j+k) ~left:(1+2*i)) ()) ) (Xml.children rc_mode) - + class rc_settings = fun ?(visible = fun _ -> true) xmls -> let sw = GBin.scrolled_window ~hpolicy:`AUTOMATIC ~vpolicy:`AUTOMATIC () in @@ -272,12 +272,12 @@ class rc_settings = fun ?(visible = fun _ -> true) xmls -> object (self) val mutable rc_mode = "N/A" val mutable rc_setting_mode = "N/A" - method set_rc_mode m = + method set_rc_mode m = rc_mode <- m; update_bg auto1 (m="AUTO1"); update_bg auto2 (m="AUTO2") - method set_rc_setting_mode m = + method set_rc_setting_mode m = rc_setting_mode <- m; update_bg up (m="UP"); update_bg down (m="DOWN") @@ -285,12 +285,12 @@ class rc_settings = fun ?(visible = fun _ -> true) xmls -> method widget = sw#coerce method set = fun v1 v2 -> if visible self#widget then - let i = rc_mode_index rc_mode + let i = rc_mode_index rc_mode and j = rc_setting_mode_index rc_setting_mode in if i >= 0 && j >= 0 then let s1 = string_of_float v1 in let s2 = string_of_float v2 in - + values.(i).(j).(0)#set_text s1; values.(i).(j).(1)#set_text s2 end diff --git a/sw/ground_segment/cockpit/pages.mli b/sw/ground_segment/cockpit/pages.mli index 9466459d2c..e20b0d2cbc 100644 --- a/sw/ground_segment/cockpit/pages.mli +++ b/sw/ground_segment/cockpit/pages.mli @@ -2,7 +2,7 @@ * $Id$ * * Widgets of the aircraft notebook -* +* * Copyright (C) 2004-2006 ENAC, Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. +* Boston, MA 02111-1307, USA. * *) @@ -48,7 +48,7 @@ class misc : GBin.frame -> object method set_value : string -> string -> unit - method periodic_send : bool + method periodic_send : bool end type rc_mode = string diff --git a/sw/ground_segment/cockpit/papgets.ml b/sw/ground_segment/cockpit/papgets.ml index 762869fcc9..e44792fc88 100644 --- a/sw/ground_segment/cockpit/papgets.ml +++ b/sw/ground_segment/cockpit/papgets.ml @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -56,7 +56,7 @@ let block_name_of_index = function [ i ] -> let i = sprintf "%.0f" (float_of_string i) in if Hashtbl.length Live.aircrafts = 1 then - Hashtbl.fold + Hashtbl.fold (fun ac_id ac _r -> let blocks = ExtXml.child ac.Live.fp "blocks" in let block = ExtXml.child blocks i in @@ -67,7 +67,7 @@ let block_name_of_index = function "N/A" | _ -> failwith "Papgets.block_name_of_index" -let extra_functions = +let extra_functions = ["BlockName", block_name_of_index ] @@ -77,7 +77,7 @@ let expression_listener = fun papget -> new Papget.expression ~extra_functions expr - + let display_float_papget = fun canvas_group config display x y listener -> let renderer = match display with @@ -90,7 +90,7 @@ let display_float_papget = fun canvas_group config display x y listener -> | "led" -> (new Papget_renderer.canvas_led ~config canvas_group x y :> Papget_renderer.t) | _ -> failwith (sprintf "Unexpected papget display: %s" display) in - + let p = new Papget.canvas_display_float_item ~config listener renderer in let p = (p :> Papget.item) in register_papget p @@ -101,7 +101,7 @@ let locked = fun config -> try [PC.property "locked" (PC.get_property "locked" config)] with _ -> [] - + let create = fun canvas_group papget -> try let type_ = ExtXml.attrib papget "type" @@ -113,13 +113,13 @@ let create = fun canvas_group papget -> "expression" -> let expr_listener = expression_listener papget in display_float_papget canvas_group config display x y expr_listener - + | "message_field" -> let msg_listener = papget_listener papget in display_float_papget canvas_group config display x y msg_listener - + | "goto_block" -> - let renderer = + let renderer = match display with "button" -> (new Papget_renderer.canvas_button canvas_group ~config x y :> Papget_renderer.t) @@ -138,12 +138,12 @@ let create = fun canvas_group papget -> in let properties = [ Papget_common.property "block_name" block_name ] @ locked papget in - + let p = new Papget.canvas_goto_block_item properties clicked renderer in let p = (p :> Papget.item) in register_papget p | "variable_setting" -> - let renderer = + let renderer = match display with "button" -> (new Papget_renderer.canvas_button canvas_group ~config x y :> Papget_renderer.t) @@ -151,7 +151,7 @@ let create = fun canvas_group papget -> let varname = Papget_common.get_property "variable" papget and value = float_of_string (Papget_common.get_property "value" papget) in - + let clicked = fun () -> prerr_endline "Warning: variable_setting papget sending to all active A/C"; Hashtbl.iter @@ -170,25 +170,25 @@ let create = fun canvas_group papget -> let p = new Papget.canvas_variable_setting_item properties clicked renderer in let p = (p :> Papget.item) in register_papget p - + | "video_plugin" -> - let renderer = + let renderer = match display with "mplayer" -> (new Papget_renderer.canvas_mplayer canvas_group ~config x y :> Papget_renderer.t) | "plugin" -> (new Papget_renderer.canvas_plugin canvas_group ~config x y :> Papget_renderer.t) | _ -> failwith (sprintf "Unexpected papget display: %s" display) in - + let properties = locked papget in let p = new Papget.canvas_video_plugin_item properties renderer in let p = (p :> Papget.item) in register_papget p - + | _ -> failwith (sprintf "Unexpected papget type: %s" type_) with exc -> fprintf stderr "Papgets.create: %s\n%!" (Printexc.to_string exc) - + exception Parse_message_dnd of string (* Drag and drop handler for papgets *) @@ -201,7 +201,7 @@ let parse_message_dnd = let dnd_data_received = fun canvas_group _context ~x ~y data ~info ~time -> try (* With the format sent by Messages *) let (_sender, _class_name, msg_name, field_name,scale) = parse_message_dnd data#data in - let attrs = + let attrs = [ "type", "message_field"; "display", "text"; "x", sprintf "%d" x; "y", sprintf "%d" y ] diff --git a/sw/ground_segment/cockpit/papgets.mli b/sw/ground_segment/cockpit/papgets.mli index 327c0f38f7..198798f718 100644 --- a/sw/ground_segment/cockpit/papgets.mli +++ b/sw/ground_segment/cockpit/papgets.mli @@ -20,7 +20,7 @@ * 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. +* Boston, MA 02111-1307, USA. * *) diff --git a/sw/ground_segment/cockpit/particules.ml b/sw/ground_segment/cockpit/particules.ml index 27eaf119ec..13744c7337 100644 --- a/sw/ground_segment/cockpit/particules.ml +++ b/sw/ground_segment/cockpit/particules.ml @@ -26,7 +26,7 @@ let move_particule = fun (geomap:MapCanvas.widget) id geo value -> (* geomap#circle ~group ~fill_color:"red" geo 10. in *) p#raise_to_top (); Hashtbl.add particules id (p:>GnomeCanvas.re_p GnoCanvas.item) - + let list_separator = Str.regexp "," @@ -38,7 +38,7 @@ let listen = fun (geomap:MapCanvas.widget) -> and xs = split_val "lats" and ys = split_val "longs" and vs = split_val "values" in - + let rec loop = fun ids xs ys vs -> match ids, xs, ys, vs with [], [], [], [] -> () @@ -51,5 +51,5 @@ let listen = fun (geomap:MapCanvas.widget) -> in loop ids xs ys vs in - + Live.safe_bind "PLUMES" plumes_msg diff --git a/sw/ground_segment/cockpit/saveSettings.ml b/sw/ground_segment/cockpit/saveSettings.ml index 4f4c2545af..91138dc714 100644 --- a/sw/ground_segment/cockpit/saveSettings.ml +++ b/sw/ground_segment/cockpit/saveSettings.ml @@ -2,7 +2,7 @@ * $Id$ * * GUI to save settings in the airframe file - * + * * Copyright (C) 2008, Cyril Allignol, Pascal Brisset * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -57,7 +57,7 @@ let scale_of_units = fun u1 u2 -> let save_airframe = fun w filename save -> match GToolbox.select_file ~title:"Save Airframe" ~filename () with None -> () - | Some file -> + | Some file -> save file; w#save_settings#destroy () @@ -97,7 +97,7 @@ let display_columns = fun w model -> ignore (save_all#connect#toggled ~callback) - + let write_xml = fun (model:GTree.tree_store) old_file airframe_xml file -> let new_xml = ref airframe_xml in model#foreach (fun _path row -> @@ -137,7 +137,7 @@ let fill_data = fun (model:GTree.tree_store) settings airframe_xml -> let scale = try let unit_setting = attrib "unit" - and unit_airframe = + and unit_airframe = match unit with Some u -> u | None -> raise Exit in scale_of_units unit_setting unit_airframe with @@ -158,7 +158,7 @@ let fill_data = fun (model:GTree.tree_store) settings airframe_xml -> model#set ~row ~column:col_to_save (floats_not_equal scaled_value value) with Xml.No_attribute _ -> () - | EditAirframe.No_param param -> + | EditAirframe.No_param param -> not_in_airframe_file := param :: !not_in_airframe_file ) (* Not savable *) settings; @@ -189,10 +189,10 @@ let popup = fun airframe_filename settings send_value -> (* Parse the airframe file *) let airframe_xml = XmlCom.parse_file airframe_filename in - + (** Insert the row data in the tree *) fill_data model settings airframe_xml; - + (** The Cancel button *) ignore (w#button_cancel#connect#clicked (fun () -> w#save_settings#destroy ())); diff --git a/sw/ground_segment/cockpit/saveSettings.mli b/sw/ground_segment/cockpit/saveSettings.mli index 7449d95c60..eb291b203a 100644 --- a/sw/ground_segment/cockpit/saveSettings.mli +++ b/sw/ground_segment/cockpit/saveSettings.mli @@ -2,7 +2,7 @@ * $Id$ * * GUI to save settings in the airframe file - * + * * Copyright (C) 2008, Cyril Allignol, Pascal Brisset * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) diff --git a/sw/ground_segment/cockpit/sectors.ml b/sw/ground_segment/cockpit/sectors.ml index 653127596a..b8d89c27d1 100644 --- a/sw/ground_segment/cockpit/sectors.ml +++ b/sw/ground_segment/cockpit/sectors.ml @@ -5,7 +5,7 @@ open Printf let (//) = Filename.concat let rec display = fun (geomap:MapCanvas.widget) r -> - + match String.lowercase (Xml.tag r) with "disc" -> let rad = float_of_string (ExtXml.attrib r "radius") @@ -20,13 +20,13 @@ let rec display = fun (geomap:MapCanvas.widget) r -> for i = 0 to n - 1 do ignore (geomap#segment ~width:5 ~fill_color:"red" pts.(i) pts.((i+1)mod n)) done - |x -> fprintf stderr "Sector.display: '%s' not yet\n%!" x - + |x -> fprintf stderr "Sector.display: '%s' not yet\n%!" x + let display_sector = fun (geomap:MapCanvas.widget) sector -> display geomap (ExtXml.child sector "0") - + let load = fun geomap () -> match GToolbox.select_file ~title:"Load sectors" ~filename:(Env.flight_plans_path // "*.xml") () with None -> () @@ -35,7 +35,7 @@ let load = fun geomap () -> let xml = Xml.parse_file f in List.iter (display_sector geomap) (Xml.children xml) with - Dtd.Prove_error(e) -> + Dtd.Prove_error(e) -> let m = sprintf "Error while loading %s:\n%s" f (Dtd.prove_error e) in GToolbox.message_box "Error" m diff --git a/sw/ground_segment/cockpit/speech.ml b/sw/ground_segment/cockpit/speech.ml index ddce7617e6..c73923510e 100644 --- a/sw/ground_segment/cockpit/speech.ml +++ b/sw/ground_segment/cockpit/speech.ml @@ -2,7 +2,7 @@ * $Id$ * * Speech support for GCS alerts - * + * * Copyright (C) 2011 * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) diff --git a/sw/ground_segment/cockpit/strip.ml b/sw/ground_segment/cockpit/strip.ml index c740f79507..b4475c3553 100644 --- a/sw/ground_segment/cockpit/strip.ml +++ b/sw/ground_segment/cockpit/strip.ml @@ -2,7 +2,7 @@ * $Id$ * * Strip handling - * + * * Copyright (C) 2006 ENAC, Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -48,8 +48,8 @@ type t = set_color : string -> string -> unit; set_label : string -> string -> unit; set_rc : int -> string -> unit; - connect : (unit -> unit) -> unit; - hide_buttons : unit -> unit; + connect : (unit -> unit) -> unit; + hide_buttons : unit -> unit; show_buttons : unit -> unit > type strip_param = { @@ -60,7 +60,7 @@ type strip_param = { alt_shift_plus : float; alt_shift_minus : float; } - + let agl_max = 150. (** window for the strip panel *) @@ -71,7 +71,7 @@ let strips_table = GPack.vbox ~spacing:5 ~packing:scrolled#add_with_viewport () (** set a label *) -let set_label labels name value = +let set_label labels name value = try let _eb, l = List.assoc (name^"_value") labels in let value = sprintf "%s" value in @@ -82,7 +82,7 @@ let set_label labels name value = fprintf stderr "Strip.set_label: '%s' unknown\n%!" name (** set a color *) -let set_color labels name color = +let set_color labels name color = let eb, _l = List.assoc (name^"_value") labels in eb#coerce#misc#modify_bg [`NORMAL, `NAME color] @@ -115,11 +115,11 @@ class vgauge = fun ?(color="green") ?(history_len=50) gauge_da v_min v_max -> let dr = self#get_pixmap () in dr#set_foreground (`NAME background); dr#rectangle ~x:0 ~y:0 ~width ~height ~filled:true (); - + let f = (value -. v_min) /. (v_max -. v_min) in let f = max 0. (min 1. f) in let h = truncate (float height *. f) in - + (* First call: fill the array with the given value *) if history_index < 0 then begin for i = 0 to history_len - 1 do @@ -127,13 +127,13 @@ class vgauge = fun ?(color="green") ?(history_len=50) gauge_da v_min v_max -> done; history_index <- 0; end; - + (* Store the value in the history array and update index *) history.(history_index) <- h; history_index <- (history_index+1) mod history_len; - + dr#set_foreground (`NAME color); - + (* From left to right, older to new values *) let polygon = ref [0,height; width,height] in for i = 0 to history_len - 1 do @@ -161,16 +161,16 @@ class vgauge = fun ?(color="green") ?(history_len=50) gauge_da v_min v_max -> and ay' = truncate (sin a' *. al) in let l = [w/10, h/2; w/10+x,h/2+y; w/10+x+ax,h/2+y+ay; w/10+x,h/2+y; w/10+x+ax',h/2+y+ay'] in dr#set_foreground `BLACK; - dr#lines l + dr#lines l end; - + List.iter (fun (vpos, string) -> - let layout = self#layout string in + let layout = self#layout string in let (w,h) = Pango.Layout.get_pixel_size layout in let y = truncate (vpos *. float height) - h / 2 in dr#put_layout ~x:((width-w)/2) ~y ~fore:`BLACK layout) strings; - + (new GDraw.drawable gauge_da#misc#window)#put_pixmap ~x:0 ~y:0 dr#pixmap end @@ -183,18 +183,18 @@ class hgauge = fun ?(color="green") gauge_da v_min v_max -> let dr = self#get_pixmap () in dr#set_foreground (`NAME background); dr#rectangle ~x:0 ~y:0 ~width ~height ~filled:true (); - + let f = (value -. v_min) /. (v_max -. v_min) in let f = max 0. (min 1. f) in let w = truncate (float width *. f) in dr#set_foreground (`NAME color); dr#rectangle ~x:0 ~y:0 ~width:w ~height ~filled:true (); - + let layout = self#layout string in let (w,h) = Pango.Layout.get_pixel_size layout in dr#put_layout ~x:((width-w)/2) ~y:((height-h)/2) ~fore:`BLACK layout; - + (new GDraw.drawable gauge_da#misc#window)#put_pixmap ~x:0 ~y:0 dr#pixmap end @@ -209,7 +209,7 @@ let add = fun config strip_param -> and alt_shift_minus = strip_param.alt_shift_minus in let strip_labels = ref [] in - let add_label = fun name value -> + let add_label = fun name value -> strip_labels := (name, value) :: !strip_labels in let ac_name = Pprz.string_assoc "ac_name" config in @@ -308,11 +308,11 @@ let add = fun config strip_param -> val mutable climb = 0. val mutable button_tbl = Hashtbl.create 10 method set_climb = fun v -> climb <- v - method set_agl value = + method set_agl value = let arrow = max (min 0.5 (climb /. 5.)) (-0.5) in agl#set ~arrow value [0.2, (sprintf "%3.0f" value); 0.8, sprintf "%+.1f" climb] method set_bat value = bat#set value [0.5, (string_of_float value)] - method set_throttle ?(kill=false) value = + method set_throttle ?(kill=false) value = let background = if kill then "red" else "orange" in throttle#set ~background value (sprintf "%.0f%%" value) method set_speed value = speed#set value (sprintf "%.1fm/s" value) @@ -343,8 +343,8 @@ let add = fun config strip_param -> (*let vbox = GPack.vbox ~show:true () in*) vbox#pack ~fill:false w; if pack then strip#hbox_user#pack ~fill:false vbox#coerce else () - - method connect_shift_alt callback = + + method connect_shift_alt callback = let tooltips = GData.tooltips () in let text = Printf.sprintf "Altitude %+.1fm" alt_shift_minus in ignore (tooltips#set_tip strip#button_down#coerce ~text); @@ -356,13 +356,13 @@ let add = fun config strip_param -> [ strip#button_down, alt_shift_minus; strip#button_up, alt_shift_plus; strip#button_up_up, alt_shift_plus_plus] - + method connect_shift_lateral = fun callback -> connect_buttons callback [ strip#button_left, -5.; strip#button_right, 5.; strip#button_center, 0.] - + method connect_kill = fun callback -> let callback = fun x -> if x = 1. then @@ -375,7 +375,7 @@ let add = fun config strip_param -> connect_buttons callback [ strip#button_kill, 1.; strip#button_resurrect, 0.] - + method connect_launch = fun callback -> connect_buttons callback [ strip#button_launch, 1. ] @@ -386,7 +386,7 @@ let add = fun config strip_param -> 1 -> callback 2.; true | _ -> true in ignore(strip#eventbox_mode#event#connect#button_press ~callback) - + (* Reset the flight time *) method connect_flight_time = fun callback -> let callback = fun _ -> (* Reset flight time *) @@ -416,8 +416,8 @@ let add = fun config strip_param -> true in ignore(strip#eventbox_RDV#event#connect#button_press ~callback) - - + + method hide_buttons () = strip#hbox_user#misc#hide (); strip#frame_nav#misc#set_sensitive false method show_buttons () = strip#hbox_user#misc#show (); strip#frame_nav#misc#set_sensitive true method connect = fun (select: unit -> unit) -> diff --git a/sw/ground_segment/cockpit/strip.mli b/sw/ground_segment/cockpit/strip.mli index c47d397116..a5ff6bc7ae 100644 --- a/sw/ground_segment/cockpit/strip.mli +++ b/sw/ground_segment/cockpit/strip.mli @@ -2,7 +2,7 @@ * $Id$ * * Strip handling - * + * * Copyright (C) 2006-2009 ENAC, Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -48,7 +48,7 @@ type t = < set_color : string -> string -> unit; set_label : string -> string -> unit; set_rc : int -> string -> unit; - hide_buttons : unit -> unit; + hide_buttons : unit -> unit; show_buttons : unit -> unit; connect : (unit -> unit) -> unit > diff --git a/sw/ground_segment/joystick/input2ivy.ml b/sw/ground_segment/joystick/input2ivy.ml index a4eeaa9573..dbeafa377a 100644 --- a/sw/ground_segment/joystick/input2ivy.ml +++ b/sw/ground_segment/joystick/input2ivy.ml @@ -117,7 +117,7 @@ let get_message_type = fun class_name -> | "trim_plus" -> "Trim" | "trim_minus" -> "Trim" | "trim_save" -> "Trim" - | _ -> failwith class_name + | _ -> failwith class_name (** Get a message description from its name (and class name) *) (** class_names with entries above as "Message" should be listed here *) @@ -232,7 +232,7 @@ let parse_msg = fun msg -> let fields = match get_message_type msg_class with - "Message" -> + "Message" -> let msg_descr = get_message msg_class msg_name in List.map (parse_msg_field msg_descr) (Xml.children msg) | "Trim" -> [] @@ -304,7 +304,7 @@ let parse_trim_file = fun trim_file_name inputs -> List.iter (trim_set inputs) trim_values; end -(** Parse the complete (input and messages) XML desxription +(** Parse the complete (input and messages) XML desxription Also parses the trim xml file if it exists *) let parse_descr = fun xml_file trim_file -> let xml = Xml.parse_file xml_file in @@ -429,7 +429,7 @@ let first_list (x,_) = x let trim_save_add_leaf = fun x channel_pair -> let chan_name = first_list channel_pair in let channel = second_list channel_pair in - match channel with + match channel with Axis (i, deadband, limit, exponent, trim) -> x := x.contents ^ (Printf.sprintf "" chan_name trim.contents) | Button i -> Printf.printf "%d" i @@ -483,7 +483,7 @@ let execute_action = fun ac_id inputs buttons axis variables message -> "datalink" -> DL.message_send "input2ivy" message.msg_name vs | "ground" -> G.message_send "input2ivy" message.msg_name vs | "trim_plus" -> trim_adjust message.msg_name trim_step inputs - | "trim_minus" -> trim_adjust message.msg_name (-.trim_step) inputs + | "trim_minus" -> trim_adjust message.msg_name (-.trim_step) inputs | "trim_save" -> trim_save inputs | c -> failwith (sprintf "execute_action: unknown class '%s'" c) end; @@ -523,7 +523,7 @@ let execute_actions = fun actions ac_id -> (** used for adjusting trims interactively from the keyboard *) (** this capability is mostly for bench-time trimming when a joystick does not have adequate buttons *) (** it is not a very complete capability *) -let execute_kb_action = fun actions conditions -> +let execute_kb_action = fun actions conditions -> let ch = input_byte Pervasives.stdin in (** esdx for left stick ijkm for right *) @@ -543,7 +543,7 @@ let execute_kb_action = fun actions conditions -> true - + (************************************* MAIN **********************************) let () = diff --git a/sw/ground_segment/multimon/test.ml b/sw/ground_segment/multimon/test.ml index e21797c7ec..83e141c30b 100644 --- a/sw/ground_segment/multimon/test.ml +++ b/sw/ground_segment/multimon/test.ml @@ -5,10 +5,10 @@ let print_hex = fun s -> print_newline () -let _ = +let _ = let dsp = Demod.init "/dev/dsp" in - let cb = fun _ -> + let cb = fun _ -> let l, r = Demod.get_data () in print_hex l; print_hex r; true in diff --git a/sw/ground_segment/multimon/test_gen_hdlc.ml b/sw/ground_segment/multimon/test_gen_hdlc.ml index 2444649959..71d14ae0e2 100644 --- a/sw/ground_segment/multimon/test_gen_hdlc.ml +++ b/sw/ground_segment/multimon/test_gen_hdlc.ml @@ -1,13 +1,13 @@ let my_write = fun fd buf -> let rec loop = fun i -> Printf.printf "i=%d\n%!" i; - let r = String.length buf - i in + let r = String.length buf - i in if r > 0 then loop (i + Unix.write fd buf i (min 8192 r)) in loop 0 -let _ = +let _ = let _fd = Hdlc.init_gen "/dev/dsp" in let i = ref 0 in diff --git a/sw/ground_segment/tmtc/150m.ml b/sw/ground_segment/tmtc/150m.ml index db16831947..02b00e1bc3 100644 --- a/sw/ground_segment/tmtc/150m.ml +++ b/sw/ground_segment/tmtc/150m.ml @@ -57,7 +57,7 @@ let get_gps_message = fun label _sender vs -> (* Check if too high *) if height > 150 then set_to_HOME () - + (********************************* Main *********************************************) let () = @@ -86,7 +86,7 @@ let () = (* Connect the button to its action *) ignore (button#connect#clicked ~callback:set_to_HOME); - + (** Display the window and start the main loop *) window#show (); GMain.main () diff --git a/sw/ground_segment/tmtc/aircraft.ml b/sw/ground_segment/tmtc/aircraft.ml index 34df36bcb2..773637af6c 100644 --- a/sw/ground_segment/tmtc/aircraft.ml +++ b/sw/ground_segment/tmtc/aircraft.ml @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -40,7 +40,7 @@ type fbw = { } let gps_nb_channels = 16 -type svinfo = { +type svinfo = { svid : int; flags : int; qi : int; @@ -51,7 +51,7 @@ type svinfo = { } let svinfo_init = fun () -> - { + { svid = 0 ; flags = 0; qi = 0; @@ -61,7 +61,7 @@ let svinfo_init = fun () -> age = 0 } -type horiz_mode = +type horiz_mode = Circle of Latlong.geographic * int | Segment of Latlong.geographic * Latlong.geographic | UnknownHorizMode @@ -86,7 +86,7 @@ let add_pos_to_nav_ref = fun nav_ref ?(z = 0.) (x, y) -> match nav_ref with Geo geo -> let m_to_rad = 0.0005399568034557235 *. 0.00029088820866572159 in - let lat = lat_of_xy (geo.posn_lat +. asin (y*.m_to_rad)) 0. geo (x*.m_to_rad, y *.m_to_rad) 10 1.e-7 in + let lat = lat_of_xy (geo.posn_lat +. asin (y*.m_to_rad)) 0. geo (x*.m_to_rad, y *.m_to_rad) 10 1.e-7 in Latlong.make_geo lat (geo.posn_long +. asin (x*.m_to_rad /. cos lat)) | Utm utm -> Latlong.of_utm Latlong.WGS84 (Latlong.utm_add utm (x, y)) @@ -97,7 +97,7 @@ let add_pos_to_nav_ref = fun nav_ref ?(z = 0.) (x, y) -> type waypoint = { altitude : float; wp_geo : Latlong.geographic } -type aircraft = { +type aircraft = { mutable vehicle_type : vehicle_type; id : string; name : string; diff --git a/sw/ground_segment/tmtc/aircraft.mli b/sw/ground_segment/tmtc/aircraft.mli index cc743d902c..24a810a3e4 100644 --- a/sw/ground_segment/tmtc/aircraft.mli +++ b/sw/ground_segment/tmtc/aircraft.mli @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) diff --git a/sw/ground_segment/tmtc/airprox.ml b/sw/ground_segment/tmtc/airprox.ml index 77a666ba06..89732fbc4c 100644 --- a/sw/ground_segment/tmtc/airprox.ml +++ b/sw/ground_segment/tmtc/airprox.ml @@ -2,7 +2,7 @@ * $Id$ * * Air Proximity Alert Module - * + * * Copyright (C) ENAC, Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -41,7 +41,7 @@ let distance = fun (x1, y1) (x2, y2) -> let airprox = fun aircraft1 aircraft2 -> let p1 = Latlong.utm_of Latlong.WGS84 aircraft1.pos in let p2 = Latlong.utm_of Latlong.WGS84 aircraft2.pos in - let x1 = p1.utm_x and x2 = p2.utm_x and + let x1 = p1.utm_x and x2 = p2.utm_x and y1 = p1.utm_y and y2 = p2.utm_y and z1 = aircraft1.alt and z2 = aircraft2.alt in let alt_difference = abs_float (z1 -. z2) and @@ -54,19 +54,19 @@ let airprox = fun aircraft1 aircraft2 -> let airprox_level = fun aircraft1 aircraft2 -> let p1 = Latlong.utm_of Latlong.WGS84 aircraft1.pos in let p2 = Latlong.utm_of Latlong.WGS84 aircraft2.pos in - let x1 = p1.utm_x and x2 = p2.utm_x and + let x1 = p1.utm_x and x2 = p2.utm_x and y1 = p1.utm_y and y2 = p2.utm_y in - let d0 = distance (x1, y1) (x2, y2) in + let d0 = distance (x1, y1) (x2, y2) in let course1 = aircraft1.course and course2 = aircraft2.course and speed1 = aircraft1.gspeed and speed2 = aircraft2.gspeed in (** FIXME: must have the real angle and not a course *) let halfpi = Latlong.pi /. 2. in - let vx1 = speed1 *. (cos (halfpi -. course1)) and + let vx1 = speed1 *. (cos (halfpi -. course1)) and vx2 = speed2 *. (cos (halfpi -. course2)) and - vy1 = speed1 *. (sin (halfpi -. course1)) and + vy1 = speed1 *. (sin (halfpi -. course1)) and vy2 = speed2 *. (sin (halfpi -. course2)) in - let d1 = distance - (x1+. vx1 *. 0.2, x2+. vx2 *. 0.2) + let d1 = distance + (x1+. vx1 *. 0.2, x2+. vx2 *. 0.2) (y1+. vy1 *. 0.2, y2+. vy2 *. 0.2) in if d1 < d0 then "CRITICAL" else "WARNING" diff --git a/sw/ground_segment/tmtc/airprox.mli b/sw/ground_segment/tmtc/airprox.mli index 39d9bdfef9..2c9edad075 100644 --- a/sw/ground_segment/tmtc/airprox.mli +++ b/sw/ground_segment/tmtc/airprox.mli @@ -2,7 +2,7 @@ * $Id$ * * Air Proximity Alert Module - * + * * Copyright (C) ENAC, Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) diff --git a/sw/ground_segment/tmtc/broadcaster.ml b/sw/ground_segment/tmtc/broadcaster.ml index 720c1f636c..937451a4f3 100644 --- a/sw/ground_segment/tmtc/broadcaster.ml +++ b/sw/ground_segment/tmtc/broadcaster.ml @@ -2,7 +2,7 @@ open Printf let () = let ivy_bus = ref Defivybus.default_ivy_bus in - + let port = ref 4242 and ivy_from = ref "DL" and ivy_to = ref "TM" in @@ -17,12 +17,12 @@ let () = options (fun x -> fprintf stderr "Warning: Discarding '%s'" x) "Usage: "; - + let handler = fun i o -> Ivy.init "broadcaster" "READY" (fun _ _ -> ()); Ivy.start !ivy_bus; - (* Forward telemetry on Ivy *) + (* Forward telemetry on Ivy *) let buffer_size = 256 in let buffer = String.create buffer_size in let get_tcp = fun _ -> diff --git a/sw/ground_segment/tmtc/dia.ml b/sw/ground_segment/tmtc/dia.ml index 691e7dd189..674573c2ed 100644 --- a/sw/ground_segment/tmtc/dia.ml +++ b/sw/ground_segment/tmtc/dia.ml @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -47,7 +47,7 @@ type state = { mutable cam_pitch : int; } -let state = { +let state = { lat = 0.; long = 0.; alt = 0; course = 0; speed = 0; cam_roll = 0; cam_pitch = 0; @@ -58,14 +58,14 @@ let send_msg = fun () -> let t = (Unix.gettimeofday ()) -. 1e9 in let vs = [ "unix_time", Pprz.Float t; - + "lat", Pprz.Float state.lat; "long", Pprz.Float state.long; "alt", Pprz.Int state.alt; - + "course", Pprz.Int state.course; "speed", Pprz.Int state.speed; - + "cam_roll", Pprz.Int state.cam_roll; "cam_pitch", Pprz.Int state.cam_pitch ] in @@ -85,11 +85,11 @@ let fp_msg = fun _sender vs -> end - + let _ = - let ivy_bus = ref Defivybus.default_ivy_bus + let ivy_bus = ref Defivybus.default_ivy_bus and port = ref "/dev/dsp" in let options = [ "-b", Arg.Set_string ivy_bus, (sprintf " Default is %s" !ivy_bus); @@ -112,7 +112,7 @@ let _ = (* Open the audio output and launch the periodic writings *) let _fd = Hdlc.init_gen "/dev/dsp" in ignore (Glib.Timeout.add Hdlc.write_period (fun _ -> Hdlc.write_to_dsp (); true)); - + (* Periodically send messages *) ignore (Glib.Timeout.add msg_period (fun () -> send_msg (); true)); diff --git a/sw/ground_segment/tmtc/diadec.ml b/sw/ground_segment/tmtc/diadec.ml index 760fbd65fb..b178e52e13 100644 --- a/sw/ground_segment/tmtc/diadec.ml +++ b/sw/ground_segment/tmtc/diadec.ml @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -27,7 +27,7 @@ open Printf module Sub_Pprz = Pprz.Messages(struct let name = "DIA" end) -module PprzTransport = Serial.Transport(Pprz.Transport) +module PprzTransport = Serial.Transport(Pprz.Transport) let use_tele_message = fun buf -> @@ -57,7 +57,7 @@ let _ = let fd = Hdlc.init_dec "/dev/dsp" in ignore (Glib.Io.add_watch [`IN] (fun _ -> use_tele_message (Hdlc.get_data ()); true) (GMain.Io.channel_of_descr fd)); - + (* Main Loop *) let loop = Glib.Main.create true in while Glib.Main.is_running loop do diff --git a/sw/ground_segment/tmtc/fw_server.ml b/sw/ground_segment/tmtc/fw_server.ml index f7301cca35..e03687d8c9 100644 --- a/sw/ground_segment/tmtc/fw_server.ml +++ b/sw/ground_segment/tmtc/fw_server.ml @@ -2,7 +2,7 @@ * $Id$ * * Server part specific to fixed wing vehicles - * + * * Copyright (C) 2004 CENA/ENAC, Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -44,16 +44,16 @@ let rec norm_course = let fvalue = fun x -> match x with - Pprz.Float x -> x - | Pprz.Int32 x -> Int32.to_float x - | Pprz.Int x -> float_of_int x + Pprz.Float x -> x + | Pprz.Int32 x -> Int32.to_float x + | Pprz.Int x -> float_of_int x | _ -> failwith (sprintf "Receive.log_and_parse: float expected, got '%s'" (Pprz.string_of_value x)) - + let ivalue = fun x -> match x with Pprz.Int x -> x - | Pprz.Int32 x -> Int32.to_int x + | Pprz.Int32 x -> Int32.to_int x | _ -> failwith "Receive.log_and_parse: int expected" let format_string_field = fun s -> @@ -90,13 +90,13 @@ let heading_from_course = ref false let log_and_parse = fun ac_name (a:Aircraft.aircraft) msg values -> let value = fun x -> try Pprz.assoc x values with Not_found -> failwith (sprintf "Error: field '%s' not found\n" x) in - let fvalue = fun x -> + let fvalue = fun x -> let f = fvalue (value x) in match classify_float f with FP_infinite | FP_nan -> let msg = sprintf "Non normal number: %f in '%s %s %s'" f ac_name msg.Pprz.name (string_of_values values) in raise (Telemetry_error (ac_name, format_string_field msg)) - + | _ -> f and ivalue = fun x -> ivalue (value x) in if not (msg.Pprz.name = "DOWNLINK_STATUS") then @@ -170,7 +170,7 @@ let log_and_parse = fun ac_name (a:Aircraft.aircraft) msg values -> a.pitch <- pitch; a.heading <- norm_course (fvalue "psi") end - | "NAVIGATION" -> + | "NAVIGATION" -> a.cur_block <- ivalue "cur_block"; a.cur_stage <- ivalue "cur_stage"; a.dist_to_wp <- sqrt (fvalue "dist2_wp") @@ -212,7 +212,7 @@ let log_and_parse = fun ac_name (a:Aircraft.aircraft) msg values -> a.fbw.pprz_mode_msgs_since_last_fbw_status_msg <- a.fbw.pprz_mode_msgs_since_last_fbw_status_msg + 1; (* If we have recent direct information from the FBW, and it says FAILSAFE: then do not thrust the AP message PPRZ_MODE *) if ((a.fbw.pprz_mode_msgs_since_last_fbw_status_msg >= 10) && (a.fbw.rc_status <> "FAILSAFE")) then begin - a.fbw.rc_status <- + a.fbw.rc_status <- if mcu1_status land 0b1 > 0 then "OK" else if mcu1_status land 0b10 > 0 @@ -236,7 +236,7 @@ let log_and_parse = fun ac_name (a:Aircraft.aircraft) msg values -> | "SVINFO" -> let i = ivalue "chn" in assert(i < Array.length a.svinfo); - a.svinfo.(i) <- { + a.svinfo.(i) <- { svid = ivalue "SVID"; flags = ivalue "Flags"; qi = ivalue "QI"; diff --git a/sw/ground_segment/tmtc/fw_server.mli b/sw/ground_segment/tmtc/fw_server.mli index e9fda496b1..f2744979e2 100644 --- a/sw/ground_segment/tmtc/fw_server.mli +++ b/sw/ground_segment/tmtc/fw_server.mli @@ -2,7 +2,7 @@ * $Id$ * * Server part specific to fixed wing vehicles - * + * * Copyright (C) 2004 CENA/ENAC, Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) diff --git a/sw/ground_segment/tmtc/ihm.ml b/sw/ground_segment/tmtc/ihm.ml index 2b3a9c10f2..349dae2072 100644 --- a/sw/ground_segment/tmtc/ihm.ml +++ b/sw/ground_segment/tmtc/ihm.ml @@ -61,16 +61,16 @@ let send_circle = fun ac_id p r -> "lat", Pprz.Float ((Rad>>Deg)wgs84.posn_lat); "long", Pprz.Float ((Rad>>Deg)wgs84.posn_long)] in GroundPprz.message_send "ihm" "MOVE_WAYPOINT" vs; - + let vs = [ "ac_id", Pprz.String ac_id; "index", Pprz.Int nav_radius_id; "value", Pprz.Float (float r) ] in GroundPprz.message_send "ihm" "DL_SETTING" vs; - + let vs = [ "ac_id", Pprz.String ac_id; "block_id", Pprz.Int circle_block ] in GroundPprz.message_send "ihm" "JUMP_TO_BLOCK" vs - + let send_line = fun ac_id p1 p2 -> let wgs84_1 = geo_of p1 @@ -88,11 +88,11 @@ let send_line = fun ac_id p1 p2 -> "lat", Pprz.Float ((Rad>>Deg)wgs84_2.posn_lat); "long", Pprz.Float ((Rad>>Deg)wgs84_2.posn_long)] in GroundPprz.message_send "ihm" "MOVE_WAYPOINT" vs; - + let vs = [ "ac_id", Pprz.String ac_id; "block_id", Pprz.Int glide_block ] in GroundPprz.message_send "ihm" "JUMP_TO_BLOCK" vs - + let send_eight = fun ac_id p1 p2 r -> let wgs84_1 = geo_of p1 @@ -110,16 +110,16 @@ let send_eight = fun ac_id p1 p2 r -> "lat", Pprz.Float ((Rad>>Deg)wgs84_2.posn_lat); "long", Pprz.Float ((Rad>>Deg)wgs84_2.posn_long)] in GroundPprz.message_send "ihm" "MOVE_WAYPOINT" vs; - + let vs = [ "ac_id", Pprz.String ac_id; "index", Pprz.Int nav_radius_id; "value", Pprz.Float (float r) ] in GroundPprz.message_send "ihm" "DL_SETTING" vs; - + let vs = [ "ac_id", Pprz.String ac_id; "block_id", Pprz.Int eight_block ] in GroundPprz.message_send "ihm" "JUMP_TO_BLOCK" vs - + let send_pattern_up = fun ac_id -> try @@ -156,7 +156,7 @@ let insert_in_timeline values idx action = let newt = iter t idx in (***)print_patterns newt; - + let ac_id = Pprz.string_assoc "ac_id" values in Hashtbl.replace timelines ac_id newt @@ -272,14 +272,14 @@ let listen = fun () -> (*** Options ***) -let ivy_bus = Defivybus.default_ivy_bus +let ivy_bus = Defivybus.default_ivy_bus let options = [ "-b", Arg.String (fun x -> ivy_bus := x), (Printf.sprintf "Bus\tDefault is %s" !ivy_bus)] (************** Main ****************) -let () = +let () = Arg.parse options (fun x -> Printf.fprintf stderr "%s: Warning: Don't do anything with '%s' argument\n" Sys.argv.(0) x) "Usage: "; diff --git a/sw/ground_segment/tmtc/ivy2udp.ml b/sw/ground_segment/tmtc/ivy2udp.ml index e54b41a663..a8e7d61efc 100644 --- a/sw/ground_segment/tmtc/ivy2udp.ml +++ b/sw/ground_segment/tmtc/ivy2udp.ml @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -50,7 +50,7 @@ let () = options (fun x -> fprintf stderr "Warning: Discarding '%s'" x) "Usage: "; - + let addr = Unix.inet_addr_of_string !host in let sockaddr = Unix.ADDR_INET (addr, !port) in let socket = Unix.socket Unix.PF_INET Unix.SOCK_DGRAM 0 in @@ -73,7 +73,7 @@ let () = (* Receiving a datalink message over UDP, on the same port *) let sockaddr = Unix.ADDR_INET (Unix.inet_addr_any, !datalink_port) and socket = Unix.socket Unix.PF_INET Unix.SOCK_DGRAM 0 in - Unix.bind socket sockaddr; + Unix.bind socket sockaddr; let buffer_size = 256 in let buffer = String.create buffer_size in @@ -89,16 +89,16 @@ let () = let (msg_id, ac_id, values) = Dl_Pprz.values_of_payload payload in let msg = Dl_Pprz.message_of_id msg_id in Dl_Pprz.message_send "ground_dl" msg.Pprz.name values in - + assert (PprzTransport.parse use_dl_message b = n) with exc -> prerr_endline (Printexc.to_string exc) end; true in - + let ginput = GMain.Io.channel_of_descr socket in ignore (Glib.Io.add_watch [`IN] get_datalink_message ginput); - + (* Main Loop *) - GMain.main () + GMain.main () diff --git a/sw/ground_segment/tmtc/ivy_tcp_aircraft.ml b/sw/ground_segment/tmtc/ivy_tcp_aircraft.ml index 083902273b..61c2e40b4a 100644 --- a/sw/ground_segment/tmtc/ivy_tcp_aircraft.ml +++ b/sw/ground_segment/tmtc/ivy_tcp_aircraft.ml @@ -20,7 +20,7 @@ let () = options (fun x -> fprintf stderr "Warning: Discarding '%s'" x) "Usage: "; - + Ivy.init "ivy_tcp" "READY" (fun _ _ -> ()); Ivy.start !ivy_bus; @@ -53,14 +53,14 @@ let () = let (msg_id, ac_id, values) = Dl_Pprz.values_of_payload payload in let msg = Dl_Pprz.message_of_id msg_id in Dl_Pprz.message_send "ground_dl" msg.Pprz.name values in - + assert (PprzTransport.parse use_dl_message b = n) with exc -> prerr_endline (Printexc.to_string exc) end; true in - + let ginput = GMain.Io.channel_of_descr (Unix.descr_of_in_channel i) in ignore (Glib.Io.add_watch [`IN] get_datalink_message ginput); @@ -68,4 +68,4 @@ let () = ignore (Glib.Io.add_watch [`HUP] hangup ginput); (* Main Loop *) - GMain.main () + GMain.main () diff --git a/sw/ground_segment/tmtc/ivy_tcp_controller.ml b/sw/ground_segment/tmtc/ivy_tcp_controller.ml index 9b346beaea..5d80a5a220 100644 --- a/sw/ground_segment/tmtc/ivy_tcp_controller.ml +++ b/sw/ground_segment/tmtc/ivy_tcp_controller.ml @@ -21,7 +21,7 @@ let () = Ivy.init "tcp_ivy" "READY" (fun _ _ -> ()); Ivy.start !ivy_bus; - + let addr = Unix.inet_addr_of_string !host in let sockaddr = Unix.ADDR_INET (addr, !port) in @@ -35,23 +35,23 @@ let () = let n = input i buffer 0 buffer_size in let b = String.sub buffer 0 n in Debug.trace 'x' (Debug.xprint b); - + let use_tele_message = fun payload -> Debug.trace 'x' (Debug.xprint (Serial.string_of_payload payload)); let (msg_id, ac_id, values) = Tm_Pprz.values_of_payload payload in let msg = Tm_Pprz.message_of_id msg_id in Tm_Pprz.message_send (string_of_int ac_id) msg.Pprz.name values in - + ignore (PprzTransport.parse use_tele_message b) with exc -> prerr_endline (Printexc.to_string exc) end; true in - + let ginput = GMain.Io.channel_of_descr (Unix.descr_of_in_channel i) in ignore (Glib.Io.add_watch [`IN] get_message ginput); - + (* Forward datalink messages *) let get_ivy_message = fun _ args -> try @@ -65,6 +65,6 @@ let () = let hangup = fun _ -> prerr_endline "hangup"; exit 1 in ignore (Glib.Io.add_watch [`HUP] hangup ginput); - + (* Main Loop *) GMain.main () diff --git a/sw/ground_segment/tmtc/kml.ml b/sw/ground_segment/tmtc/kml.ml index 8b0fc9aeef..b6627e92a2 100644 --- a/sw/ground_segment/tmtc/kml.ml +++ b/sw/ground_segment/tmtc/kml.ml @@ -2,7 +2,7 @@ * $Id$ * * KML export for Google Earth display - * + * * Copyright (C) 2004 CENA/ENAC, Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -136,7 +136,7 @@ let flight_plan = fun ac_name fp -> let waypoints = List.map (waypoint utm0 alt0) xml_waypoints in let home = List.find (fun x -> Xml.attrib x "id" = "HOME") waypoints in let home_point = ExtXml.child home "Point" in - let ac = + let ac = el "Placemark" ["id", ac_name] [data "name" ac_name; icon_style ~heading:45 "ac_style" "pal2/icon56.png"; @@ -176,14 +176,14 @@ let change_placemark = fun ?(description="") id wgs84 alt -> el "Point" [] [data "altitudeMode" "absolute"; data "coordinates" (coordinates wgs84 alt)]]] - + let link_update = fun target_href changes -> kml [el "NetworkLinkControl" [] [el "Update" [] (data "targetHref" target_href :: changes)]] - + let change_waypoint = fun ac_name wp_id wgs84 alt -> let wp_name = Hashtbl.find waypoints (ac_name, wp_id) in @@ -198,8 +198,8 @@ let update_linear_ring = fun target_href id coordinates -> [el "Placemark" ["targetId", id] [el "LineString" [] [data "coordinates" coordinates]]]]]] - - + + let print_xml = fun ac_name file xml -> let f = open_out (sprintf "%s/var/%s/%s" Env.paparazzi_home ac_name file) in fprintf f "%s\n" (Xml.to_string_fmt xml); @@ -212,7 +212,7 @@ let update_waypoints = Hashtbl.iter (fun wp_id wp -> if wp_id > 0 then l := (wp_id, wp) :: !l) ac.waypoints; if !l <> !last_state then begin last_state := !l; - let url_flight_plan = + let url_flight_plan = if !no_http then sprintf "%s/var/%s/flight_plan.kml" Env.paparazzi_home ac.name else @@ -222,7 +222,7 @@ let update_waypoints = let kml_update = link_update url_flight_plan changes in print_xml ac.name "wp_changes.kml" kml_update end - + let update_horiz_mode = let last_horiz_mode = ref UnknownHorizMode in @@ -230,7 +230,7 @@ let update_horiz_mode = if ac.horiz_mode <> !last_horiz_mode then begin last_horiz_mode := ac.horiz_mode; (*let url_flight_plan = sprintf "http://%s:%d/var/%s/flight_plan.kml" !hostname !port ac.name in*) - let url_flight_plan = + let url_flight_plan = if !no_http then sprintf "%s/var/%s/flight_plan.kml" Env.paparazzi_home ac.name else @@ -238,7 +238,7 @@ let update_horiz_mode = in let alt = ac.desired_altitude in match ac.horiz_mode with - Segment (p1, p2) -> + Segment (p1, p2) -> let coordinates = String.concat " " (List.map (fun p -> coordinates p alt) [p1; p2]) in let kml_changes = update_linear_ring url_flight_plan "horiz_mode" coordinates in print_xml ac.name "route_changes.kml" kml_changes @@ -253,7 +253,7 @@ let update_horiz_mode = let update_ac = fun ac -> try (*let url_flight_plan = sprintf "http://%s:%d/var/%s/flight_plan.kml" !hostname !port ac.name in*) - let url_flight_plan = + let url_flight_plan = if !no_http then sprintf "%s/var/%s/flight_plan.kml" Env.paparazzi_home ac.name else @@ -279,7 +279,7 @@ let build_files = fun a -> let xml_fp = a.flight_plan in let kml_fp = flight_plan a.name xml_fp in print_xml a.name "flight_plan.kml" kml_fp; - + if !no_http then begin let url_flight_plan = sprintf "%s/var/%s/flight_plan.kml" Env.paparazzi_home a.name in let url_ac_changes = sprintf "%s/var/%s/ac_changes.kml" Env.paparazzi_home a.name in diff --git a/sw/ground_segment/tmtc/kml.mli b/sw/ground_segment/tmtc/kml.mli index 96ba68bbd9..39b7386045 100644 --- a/sw/ground_segment/tmtc/kml.mli +++ b/sw/ground_segment/tmtc/kml.mli @@ -2,7 +2,7 @@ * $Id$ * * KML export for Google Earth display - * + * * Copyright (C) 2004 CENA/ENAC, Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) diff --git a/sw/ground_segment/tmtc/link.ml b/sw/ground_segment/tmtc/link.ml index e6689f1740..f99f70f5a7 100644 --- a/sw/ground_segment/tmtc/link.ml +++ b/sw/ground_segment/tmtc/link.ml @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -102,7 +102,7 @@ let initial_status = { let update_status = fun ?udp_peername ac_id buf_size is_pong -> if !gen_stat_trafic then Printf.printf "%.3f %d\n%!" (Unix.gettimeofday ()) buf_size; - let status = + let status = try Hashtbl.find statuss ac_id with Not_found -> let s = { initial_status with udp_peername = udp_peername } in Hashtbl.add statuss ac_id s; @@ -113,7 +113,7 @@ let update_status = fun ?udp_peername ac_id buf_size is_pong -> status.ms_since_last_msg <- 0; if is_pong then status.last_pong <- Unix.gettimeofday ();; - + let status_msg_period = 1000 (** ms *) let ping_msg_period = 5000 (** ms *) let status_ping_diff = 500 (* ms *) @@ -149,7 +149,7 @@ let send_status_msg = status.last_rx_byte <- status.rx_byte; status.ms_since_last_msg <- status.ms_since_last_msg + status_msg_period; let vs = ["run_time", Pprz.Int t; - "rx_bytes_rate", Pprz.Float byte_rate; + "rx_bytes_rate", Pprz.Float byte_rate; "rx_msgs_rate", Pprz.Float msg_rate; "rx_err", Pprz.Int status.rx_err; "rx_bytes", Pprz.Int status.rx_byte; @@ -157,7 +157,7 @@ let send_status_msg = "ping_time", Pprz.Float (1000. *. (status.last_pong -. status.last_ping)) ] in send_message_over_ivy (string_of_int ac_id) "DOWNLINK_STATUS" vs) - statuss + statuss let use_tele_message = fun ?udp_peername ?raw_data_size payload -> @@ -199,7 +199,7 @@ end module XB = struct (** XBee module *) let nb_retries = ref 10 - let retry_delay = 200 (* ms *) + let retry_delay = 200 (* ms *) let at_init_period = 2000 (* ms *) @@ -216,7 +216,7 @@ module XB = struct (** XBee module *) let init = fun device -> Debug.trace 'x' "init xbee"; let o = Unix.out_channel_of_descr device.fd in - ignore (Glib.Timeout.add at_init_period (fun () -> + ignore (Glib.Timeout.add at_init_period (fun () -> fprintf o "%s%!" Xbee.at_command_sequence; ignore (Glib.Timeout.add at_init_period (fun () -> switch_to_api device; false)); false)) @@ -225,9 +225,9 @@ module XB = struct (** XBee module *) let packets = Array.create 256 ("", -1) (* Frame id generation > 0 and < 256 *) - let gen_frame_id = + let gen_frame_id = let x = ref 0 in - fun () -> + fun () -> incr x; if !x >= 256 then x := 1; @@ -251,12 +251,12 @@ module XB = struct (** XBee module *) packets.(frame_id) <- (packet, nb_prev_retries+1); let o = Unix.out_channel_of_descr device.fd in ignore (GMain.Timeout.add (10 + Random.int retry_delay) - (fun _ -> + (fun _ -> fprintf o "%s%!" packet; Debug.call 'y' (fun f -> fprintf f "Resending (%d) %s\n" (nb_prev_retries+1) (Debug.xprint packet)); false)); end - + | Xbee.RX_Packet_64 (addr64, rssi, options, data) -> Debug.trace 'x' (sprintf "getting XBee RX64: %Lx %d %d %s" addr64 rssi options (Debug.xprint data)); use_tele_message ~raw_data_size:(String.length frame_data + oversize_packet) (Serial.payload_of_string data) @@ -272,7 +272,7 @@ module XB = struct (** XBee module *) let ac_id = match ac_id with None -> 0xffff | Some a -> a in let rf_data = Serial.string_of_payload rf_data in let frame_id = gen_frame_id () in - let frame_data = + let frame_data = if !Xbee.mode868 then Xbee.api_tx64 ~frame_id (Int64.of_int ac_id) rf_data else @@ -342,7 +342,7 @@ let broadcast = fun device payload _priority -> module Audio = struct let use_data = let buffer = ref "" in - fun data -> + fun data -> let b = !buffer ^ data in let n = PprzTransport.parse use_tele_message b in buffer := String.sub b n (String.length b - n) @@ -419,7 +419,7 @@ let send_ping_msg = fun device -> status.last_ping <- Unix.gettimeofday () ) statuss - + (** Main *********************************************************************) let () = @@ -431,7 +431,7 @@ let () = and audio = ref false and aerocomm = ref false and udp_port = ref 4242 in - + (* Parse command line options *) let options = [ "-aerocomm", Arg.Set aerocomm, "Set serial Aerocomm data mode"; @@ -460,23 +460,23 @@ let () = Ivy.init "Link" "READY" (fun _ _ -> ()); Ivy.start !ivy_bus; - try + try let transport = transport_of_string !transport in - + (** Listen on audio input or on a serial device or on multimon pipe *) - let on_serial_device = + let on_serial_device = String.length !port >= 4 && String.sub !port 0 4 = "/dev" in (* FIXME *) let fd = if !udp then begin let sockaddr = Unix.ADDR_INET (Unix.inet_addr_any, !udp_port) and socket = Unix.socket Unix.PF_INET Unix.SOCK_DGRAM 0 in - Unix.bind socket sockaddr; + Unix.bind socket sockaddr; socket end else if !audio then Demod.init !port else if on_serial_device then Serial.opendev !port (Serial.speed_of_baudrate !baudrate) - else + else Unix.openfile !port [Unix.O_RDWR] 0o640 in @@ -485,7 +485,7 @@ let () = let device = { fd=fd; transport=transport; baud_rate=baudrate } in (* The function to be called when data is available *) - let read_fd = + let read_fd = if !audio then fun _io_event -> (* Demodulation *) let (data_left, _data_right) = Demod.get_data () in diff --git a/sw/ground_segment/tmtc/messages.ml b/sw/ground_segment/tmtc/messages.ml index 8d657693db..920afe7423 100644 --- a/sw/ground_segment/tmtc/messages.ml +++ b/sw/ground_segment/tmtc/messages.ml @@ -2,7 +2,7 @@ * $Id$ * * Multi aircrafts receiver, logger and broadcaster - * + * * Copyright (C) 2005 CENA/ENAC, Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -35,7 +35,7 @@ let dnd_targets = [ { Gtk.target = "STRING"; flags = []; info = 0} ] let pipe_regexp = Str.regexp "|" let values_of_field = fun field -> - try + try Array.of_list (Str.split pipe_regexp (Xml.attrib field "values")) with _ -> [||] @@ -51,7 +51,7 @@ let one_page = fun sender class_name (notebook:GPack.notebook) bind m -> let eb = GBin.event_box ~packing:h#pack () in let time = GMisc.label ~width:40 ~packing:eb#add () in eb#coerce#misc#modify_bg [`SELECTED, `NAME "green"]; - let fields = + let fields = List.fold_left (fun rest f -> try @@ -72,17 +72,17 @@ let one_page = fun sender class_name (notebook:GPack.notebook) bind m -> fun value -> sprintf "%s (%f%s)" value (coeff*.float_of_string value) unit with _ -> fun value -> value in - let update = fun (_a, x) -> - value := - try + let update = fun (_a, x) -> + value := + try let i = Pprz.int_of_value x in sprintf "%s (%d)" literal_values.(i) i - with _ -> + with _ -> alt_value (Pprz.string_of_value x) and display_value = fun () -> if notebook#page_num v#coerce = notebook#current_page then if l#label <> !value then l#set_text !value in - + (* box dragger *) field_label#drag#source_set dnd_targets ~modi:[`BUTTON1] ~actions:[`COPY]; let data_get = fun _ (sel:GObj.selection_context) ~info ~time -> @@ -99,7 +99,7 @@ let one_page = fun sender class_name (notebook:GPack.notebook) bind m -> (update, display_value)::rest with - _ -> + _ -> fprintf stderr "Warning: Ignoring '%s'\n%!" (Xml.to_string f); rest ) @@ -143,7 +143,7 @@ let one_page = fun sender class_name (notebook:GPack.notebook) bind m -> time_since_last := 0; try List.iter2 (fun f x -> f x) update_values (List.rev values); - + eb#coerce#misc#set_state `SELECTED; ignore (GMain.Timeout.add led_delay (fun () -> eb#coerce#misc#set_state `NORMAL; false)) with @@ -166,10 +166,10 @@ let rec one_class = fun (notebook:GPack.notebook) (ident, xml_class, sender) -> Hashtbl.add senders sender (); one_class notebook (ident, xml_class, Some sender) end in - List.iter + List.iter (fun m -> ignore (P.message_bind (Xml.attrib m "name") get_one)) messages - | _ -> + | _ -> let class_notebook = GPack.notebook ~tab_border:0 ~tab_pos:`LEFT () in let l = match sender with None -> "" | Some s -> ":"^s in let label = GMisc.label ~text:(ident^l) () in @@ -214,8 +214,8 @@ let _ = try List.find (fun x -> ExtXml.attrib x "name" = n) (Xml.children xml) with Not_found -> failwith (sprintf "Unknown messages class: %s" n) in - - List.map (fun x -> + + List.map (fun x -> match Str.split (Str.regexp ":") x with [cl; s] -> (cl, class_of cl, Some s) | [cl] -> (x, class_of cl, None) diff --git a/sw/ground_segment/tmtc/modem.ml b/sw/ground_segment/tmtc/modem.ml index 8d7cfb5eb6..64deccd430 100644 --- a/sw/ground_segment/tmtc/modem.ml +++ b/sw/ground_segment/tmtc/modem.ml @@ -2,7 +2,7 @@ * $Id$ * * Ground harware modem handling - * + * * Copyright (C) 2004-2006 CENA/ENAC, Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -79,7 +79,7 @@ type status = { mutable nb_err : int; mutable detected : int } - + let status = { valim = 0.; cd = 0; @@ -105,7 +105,7 @@ let parse_payload = fun payload -> Some (String.sub payload 1 (len-1)) else begin begin - match id with + match id with | x when x = msg_error -> status.error <- (Char.code payload.[1]) | x when x = msg_cd -> diff --git a/sw/ground_segment/tmtc/modem.mli b/sw/ground_segment/tmtc/modem.mli index a20bde9605..f1669fbf1c 100644 --- a/sw/ground_segment/tmtc/modem.mli +++ b/sw/ground_segment/tmtc/modem.mli @@ -2,7 +2,7 @@ * $Id$ * * Ground harware modem handling - * + * * Copyright (C) 2004 CENA/ENAC, Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) diff --git a/sw/ground_segment/tmtc/rotorcraft_server.mli b/sw/ground_segment/tmtc/rotorcraft_server.mli index 9cbf3fdc0f..06978f4b24 100644 --- a/sw/ground_segment/tmtc/rotorcraft_server.mli +++ b/sw/ground_segment/tmtc/rotorcraft_server.mli @@ -1,6 +1,6 @@ (* * Server part specific to rotorcraft vehicles - * + * * Copyright (C) ENAC * * This file is part of paparazzi. @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) diff --git a/sw/ground_segment/tmtc/server.ml b/sw/ground_segment/tmtc/server.ml index 84f2520dda..339dafe9f5 100644 --- a/sw/ground_segment/tmtc/server.ml +++ b/sw/ground_segment/tmtc/server.ml @@ -2,7 +2,7 @@ * $Id$ * * Multi aircrafts receiver, logger and broadcaster - * + * * Copyright (C) 2004 CENA/ENAC, Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -50,7 +50,7 @@ let conf_xml = Xml.parse_file (Env.paparazzi_home // "conf" // "conf.xml") let srtm_path = Env.paparazzi_home // "data" // "srtm" let get_indexed_value = fun t i -> - if i >= 0 then t.(i) else "UNK" + if i >= 0 then t.(i) else "UNK" let modes_of_type = fun vt -> match vt with @@ -86,17 +86,17 @@ let expand_aicraft x = let make_element = fun t a c -> Xml.Element (t,a,c) let log_xml = fun timeofday data_file -> - let conf_children = + let conf_children = List.map (fun x -> if Xml.tag x = "aircraft" then expand_aicraft x else x) (Xml.children conf_xml) in let expanded_conf = make_element (Xml.tag conf_xml) (Xml.attribs conf_xml) conf_children in - make_element + make_element "configuration" ["time_of_day", string_of_float timeofday; "data_file", data_file] [expanded_conf; Pprz.messages_xml ()] - - + + let start_time = U.gettimeofday () (* Opens the log files *) @@ -123,7 +123,7 @@ let log = fun ?timestamp logging ac_name msg_name values -> match logging with Some log -> let s = string_of_values values in - let t = + let t = match timestamp with Some x -> x | None -> U.gettimeofday () -. start_time in @@ -172,9 +172,9 @@ let send_cam_status = fun a -> and north = dx *. sin alpha +. dy *. cos alpha in let wgs84 = Aircraft.add_pos_to_nav_ref (Geo a.pos) (east, north) in let twgs84 = Aircraft.add_pos_to_nav_ref nav_ref a.cam.target in - let values = ["ac_id", Pprz.String a.id; + let values = ["ac_id", Pprz.String a.id; "cam_lat", Pprz.Float ((Rad>>Deg)wgs84.posn_lat); - "cam_long", Pprz.Float ((Rad>>Deg)wgs84.posn_long); + "cam_long", Pprz.Float ((Rad>>Deg)wgs84.posn_long); "cam_target_lat", Pprz.Float ((Rad>>Deg)twgs84.posn_lat); "cam_target_long", Pprz.Float ((Rad>>Deg)twgs84.posn_long)] in Ground_Pprz.message_send my_id "CAM_STATUS" values @@ -215,22 +215,22 @@ let send_svsinfo = fun a -> concat age a.svinfo.(i).age done; let f = fun s r -> (s, Pprz.String !r) in - let vs = ["ac_id", Pprz.String a.id; + let vs = ["ac_id", Pprz.String a.id; "pacc", Pprz.Int a.gps_Pacc; - f "svid" svid; f "flags" flags; f "qi" qi; f "msg_age" age; + f "svid" svid; f "flags" flags; f "qi" qi; f "msg_age" age; f "cno" cno; f "elev" elev; f "azim" azim] in Ground_Pprz.message_send my_id "SVSINFO" vs let send_horiz_status = fun a -> match a.horiz_mode with Circle (geo, r) -> - let vs = [ "ac_id", Pprz.String a.id; + let vs = [ "ac_id", Pprz.String a.id; "circle_lat", Pprz.Float ((Rad>>Deg)geo.posn_lat); "circle_long", Pprz.Float ((Rad>>Deg)geo.posn_long); "radius", Pprz.Int r ] in Ground_Pprz.message_send my_id "CIRCLE_STATUS" vs | Segment (geo1, geo2) -> - let vs = [ "ac_id", Pprz.String a.id; + let vs = [ "ac_id", Pprz.String a.id; "segment1_lat", Pprz.Float ((Rad>>Deg)geo1.posn_lat); "segment1_long", Pprz.Float ((Rad>>Deg)geo1.posn_long); "segment2_lat", Pprz.Float ((Rad>>Deg)geo2.posn_lat); @@ -240,16 +240,16 @@ let send_horiz_status = fun a -> let send_survey_status = fun a -> match a.survey with - None -> + None -> Ground_Pprz.message_send my_id "SURVEY_STATUS" ["ac_id", Pprz.String a.id] | Some (geo1, geo2) -> - let vs = [ "ac_id", Pprz.String a.id; + let vs = [ "ac_id", Pprz.String a.id; "south_lat", Pprz.Float ((Rad>>Deg)geo1.posn_lat); "west_long", Pprz.Float ((Rad>>Deg)geo1.posn_long); "north_lat", Pprz.Float ((Rad>>Deg)geo2.posn_lat); "east_long", Pprz.Float ((Rad>>Deg)geo2.posn_long) ] in Ground_Pprz.message_send my_id "SURVEY_STATUS" vs - + let send_wind = fun a -> @@ -291,7 +291,7 @@ let send_moved_waypoints = fun a -> - + let send_aircraft_msg = fun ac -> try @@ -335,7 +335,7 @@ let send_aircraft_msg = fun ac -> begin match a.nav_ref with Some nav_ref -> - let values = ["ac_id", Pprz.String ac; + let values = ["ac_id", Pprz.String ac; "cur_block", Pprz.Int a.cur_block; "cur_stage", Pprz.Int a.cur_stage; "stage_time", Pprz.Int a.stage_time; @@ -351,7 +351,7 @@ let send_aircraft_msg = fun ac -> | None -> () (* No nav_ref yet *) end; - let values = ["ac_id", Pprz.String ac; + let values = ["ac_id", Pprz.String ac; "throttle", f a.throttle; "throttle_accu", f a.throttle_accu; "rpm", f a.rpm; @@ -360,7 +360,7 @@ let send_aircraft_msg = fun ac -> "amp", f a.amp; "energy", Pprz.Int a.energy] in Ground_Pprz.message_send my_id "ENGINE_STATUS" values; - + let ap_mode = get_indexed_value (modes_of_type a.vehicle_type) a.ap_mode in let gaz_mode = get_indexed_value gaz_modes a.gaz_mode in let lat_mode = get_indexed_value lat_modes a.lateral_mode in @@ -368,9 +368,9 @@ let send_aircraft_msg = fun ac -> let gps_mode = get_indexed_value gps_modes a.gps_mode in let state_filter_mode = get_indexed_value state_filter_modes a.state_filter_mode and kill_mode = if a.kill_mode then "ON" else "OFF" in - let values = ["ac_id", Pprz.String ac; + let values = ["ac_id", Pprz.String ac; "flight_time", Pprz.Int a.flight_time; - "ap_mode", Pprz.String ap_mode; + "ap_mode", Pprz.String ap_mode; "gaz_mode", Pprz.String gaz_mode; "lat_mode", Pprz.String lat_mode; "horiz_mode", Pprz.String horiz_mode; @@ -384,7 +384,7 @@ let send_aircraft_msg = fun ac -> send_fbw a; send_svsinfo a; send_horiz_status a; - + a.time_since_last_survey_msg <- a.time_since_last_survey_msg +. float aircraft_msg_period /. 1000.; if a.time_since_last_survey_msg > 5. then (* FIXME Two missed messages *) a.survey <- None; @@ -411,7 +411,7 @@ let replayed = fun ac_id -> let unknown_aircrafts = Hashtbl.create 5 let get_conf = fun real_id id conf_xml -> - try + try ExtXml.child conf_xml "aircraft" ~select:(fun x -> ExtXml.attrib x "ac_id" = id) with Not_found -> @@ -441,7 +441,7 @@ let check_md5sum = fun ac_name alive_md5sum aircraft_conf_dir -> else failwith error_message - + let new_aircraft = fun get_alive_md5sum real_id -> let is_replayed, id, root_dir, conf_xml = replayed real_id in let conf = get_conf real_id id conf_xml in @@ -461,18 +461,18 @@ let new_aircraft = fun get_alive_md5sum real_id -> if not is_replayed then check_md5sum real_id (get_alive_md5sum ()) aircraft_conf_dir; - + let ac = Aircraft.new_aircraft real_id ac_name xml_fp airframe_xml in let update = fun () -> for i = 0 to Array.length ac.svinfo - 1 do ac.svinfo.(i).age <- ac.svinfo.(i).age + 1; done in - + ignore (Glib.Timeout.add 1000 (fun _ -> update (); true)); - + let messages_xml = Xml.parse_file (Env.paparazzi_home // root_dir // "conf" // "messages.xml") in ac, messages_xml - + let check_alerts = fun a -> let bat_section = ExtXml.child a.airframe ~select:(fun x -> Xml.attrib x "name" = "BAT") "section" in let fvalue = fun name default -> @@ -483,8 +483,8 @@ let check_alerts = fun a -> and warning_level = fvalue "LOW_BAT_LEVEL" 10.5 in let send = fun level -> - let vs = [ "ac_id", Pprz.String a.id; - "level", Pprz.String level; + let vs = [ "ac_id", Pprz.String a.id; + "level", Pprz.String level; "value", Pprz.Float a.bat] in Alerts_Pprz.message_send my_id "BAT_LOW" vs in if a.bat < catastrophic_level then send "CATASTROPHIC" @@ -524,8 +524,8 @@ let periodic_airprox_check = fun name -> x -> fprintf stderr "check_airprox: %s\n%!" (Printexc.to_string x) in - - List.iter + + List.iter (fun ac -> register_periodic thisac (periodic aircraft_alerts_period (fun () -> check_airprox ac)) ) list_ac @@ -547,7 +547,7 @@ let register_aircraft = fun name a -> (** Identifying message from an A/C *) let ident_msg = fun log name vs -> try - if not (Hashtbl.mem aircrafts name) && + if not (Hashtbl.mem aircrafts name) && not (Hashtbl.mem unknown_aircrafts name) then let get_md5sum = fun () -> Pprz.assoc "md5sum" vs in let ac, messages_xml = new_aircraft get_md5sum name in @@ -557,7 +557,7 @@ let ident_msg = fun log name vs -> Ground_Pprz.message_send my_id "NEW_AIRCRAFT" ["ac_id", Pprz.String name] with exc -> prerr_endline (Printexc.to_string exc) - + let new_color = fun () -> sprintf "#%02x%02x%02x" (Random.int 256) (Random.int 256) (Random.int 256) @@ -600,7 +600,7 @@ let send_config = fun http _asker args -> with Not_found -> failwith (sprintf "ground UNKNOWN %s" ac_id') - + let ivy_server = fun http -> ignore (Ground_Pprz.message_answerer my_id "AIRCRAFTS" send_aircrafts_msg); ignore (Ground_Pprz.message_answerer my_id "CONFIG" (send_config http)) @@ -626,7 +626,7 @@ let move_wp = fun logging _sender vs -> let setting = fun logging _sender vs -> let ac_id = Pprz.string_assoc "ac_id" vs in let vs = ["ac_id", Pprz.String ac_id; - "index", List.assoc "index" vs; + "index", List.assoc "index" vs; "value", List.assoc "value" vs] in Dl_Pprz.message_send dl_id "SETTING" vs; log logging ac_id "SETTING" vs @@ -673,7 +673,7 @@ let ground_to_uplink = fun logging -> (* main loop *) let () = - let ivy_bus = ref Defivybus.default_ivy_bus + let ivy_bus = ref Defivybus.default_ivy_bus and logging = ref true and http = ref false in @@ -698,7 +698,7 @@ let () = Ivy.init "Paparazzi server" "READY" (fun _ _ -> ()); Ivy.start !ivy_bus; - let logging = + let logging = if !logging then (* Opens the log file *) Some (logger ()) @@ -713,6 +713,6 @@ let () = (* Waits for client configurations requests on the Ivy bus *) ivy_server !http; - + let loop = Glib.Main.create true in while Glib.Main.is_running loop do ignore (Glib.Main.iteration true) done diff --git a/sw/ground_segment/tmtc/settings.ml b/sw/ground_segment/tmtc/settings.ml index f7725daa01..5d6d464dfc 100644 --- a/sw/ground_segment/tmtc/settings.ml +++ b/sw/ground_segment/tmtc/settings.ml @@ -2,7 +2,7 @@ * $Id$ * * Multi aircraft settings handler - * + * * Copyright (C) 2007 ENAC, Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) open Printf @@ -46,7 +46,7 @@ let one_ac = fun (notebook:GPack.notebook) ac_name -> (* Call to ivy to set a value *) let callback = fun idx value -> - + let vs = ["ac_id", Pprz.String ac_id; "index", Pprz.Int idx] in if classify_float value = FP_normal || classify_float value =FP_zero then let vs' = ("value", Pprz.Float value) :: vs in @@ -79,7 +79,7 @@ let one_ac = fun (notebook:GPack.notebook) ac_name -> let _ = - + let ivy_bus = ref Defivybus.default_ivy_bus in let acs = ref [] in Arg.parse @@ -99,7 +99,7 @@ let _ = let notebook = GPack.notebook ~packing:window#add ~tab_pos:`TOP () in List.iter (one_ac notebook) !acs; - + (** Start the main loop *) window#show (); let loop = Glib.Main.create true in diff --git a/sw/ground_segment/tmtc/stereo_demod.ml b/sw/ground_segment/tmtc/stereo_demod.ml index 740fc66bd7..0b8877ba4e 100644 --- a/sw/ground_segment/tmtc/stereo_demod.ml +++ b/sw/ground_segment/tmtc/stereo_demod.ml @@ -2,7 +2,7 @@ * $Id$ * * Hardware modem receiver - * + * * Copyright (C) 2004 CENA/ENAC, Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -91,8 +91,8 @@ let listen_pprz_modem = fun pprz_message_cb devdsp -> (** Modem monitoring messages *) let send_modem_msg = fun status -> - let rx_msg = ref 0 - and rx_byte = ref 0 + let rx_msg = ref 0 + and rx_byte = ref 0 and start = Unix.gettimeofday () in fun () -> let dt = float modem_msg_period /. 1000. in @@ -102,7 +102,7 @@ let send_modem_msg = fun status -> rx_msg := status.rx_msg; rx_byte := status.rx_byte; let vs = ["run_time", Pprz.Int t; - "rx_bytes_rate", Pprz.Float byte_rate; + "rx_bytes_rate", Pprz.Float byte_rate; "rx_msgs_rate", Pprz.Float msg_rate; "rx_err", Pprz.Int status.rx_err; "rx_bytes", Pprz.Int status.rx_byte; @@ -121,7 +121,7 @@ let _ = options (fun x -> fprintf stderr "Warning:ignoring %s\n" x) "Usage: "; - + Ivy.init "Paparazzi stereo demod" "READY" (fun _ _ -> ()); Ivy.start !ivy_bus; @@ -130,9 +130,9 @@ let _ = (** Sending periodically modem and downlink status messages *) let send_left = send_modem_msg status_left - and send_right = send_modem_msg status_right in + and send_right = send_modem_msg status_right in ignore (Glib.Timeout.add modem_msg_period (fun () -> send_left (); send_right (); true)); - + let loop = Glib.Main.create true in while Glib.Main.is_running loop do ignore (Glib.Main.iteration true) diff --git a/sw/ground_segment/tmtc/wind.ml b/sw/ground_segment/tmtc/wind.ml index 5df7c98109..a08d15846f 100644 --- a/sw/ground_segment/tmtc/wind.ml +++ b/sw/ground_segment/tmtc/wind.ml @@ -2,7 +2,7 @@ * $Id$ * * Wind estimation by analysing aircrafts trajectories - * + * * Copyright (C) 2004 ENAC, Nicolas Barnier, Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -135,7 +135,7 @@ let isotropic_wind wind_init speeds precision = !sum /. (float (n-1))) air_speeds in let sum_weights = Array.fold_left (+.) 0. weights in - + let mean = ref 0. in for i = 0 to n-1 do mean := !mean +. vect_norm (vect_sub speeds.(i) wind) *. weights.(i) done; @@ -166,7 +166,7 @@ let wind wind_init speeds precision = let sum = Array.fold_left (fun acc speed -> acc +. vect_norm (vect_sub speed wind)) 0. speeds in sum /. float (Array.length speeds) in - + let nb_calls = ref 0 in let cost wind = incr nb_calls; @@ -233,7 +233,7 @@ let compute = fun compute_wind id -> failwith (Printf.sprintf "Wind.on_wind_compute: ac %s not enough data\n%!" id) with Not_found -> failwith (Printf.sprintf "Wind.on_wind_compute: ac %s unknown\n%!" id) - + let get = fun id -> compute wind id let get_iso = fun id -> compute isotropic_wind id diff --git a/sw/ground_segment/tmtc/wind.mli b/sw/ground_segment/tmtc/wind.mli index 6c43437801..f4d4a790c1 100644 --- a/sw/ground_segment/tmtc/wind.mli +++ b/sw/ground_segment/tmtc/wind.mli @@ -1,5 +1,5 @@ (** Aircraft id type *) -type id = string +type id = string val new_ac : id -> int -> unit (** [new_ac id max_nb_sample] *) diff --git a/sw/ground_segment/visu3d/mapGL.ml b/sw/ground_segment/visu3d/mapGL.ml index 4ecfd04286..37057b1333 100644 --- a/sw/ground_segment/visu3d/mapGL.ml +++ b/sw/ground_segment/visu3d/mapGL.ml @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -31,7 +31,7 @@ module G3d = Geometry_3d open Latlong -let fos = fun x -> +let fos = fun x -> try float_of_string x with @@ -79,7 +79,7 @@ let track_filter = fun points -> [] -> [] | (t,x,y,a)::ps -> if minx < x && x < maxx && miny < y && y < maxy - then + then match last_alt with None -> (t,x,y,a)::loop (Some a) ps | (Some a') when abs_float (a-.a') < tolerance_alti -> @@ -103,7 +103,7 @@ let gtk_to_gl_color color = (float_of_int (Gdk.Color.blue t))/.65535.0) let gl_color_of_string = fun s -> gtk_to_gl_color (`NAME s) - + (* ========================================================================= *) (* = Passage de couleur GL vers GTK = *) @@ -120,11 +120,11 @@ let read_traj_file filename = let add_point = fun id p -> let track = try Hashtbl.find h id with - Not_found -> + Not_found -> let empty_track = ref [] in Hashtbl.add h id empty_track; empty_track in - track := p :: !track in + track := p :: !track in let match_func l error_func = match l with @@ -172,7 +172,7 @@ let add_surface view3d texture_file (min_x, min_y) (max_x, max_y) utm_zone = done ; y:=!y-dy done ; - + (* Ajout de cette matrice a la vue 3D *) view3d#add_object_surface_with_texture tab texture_id with @@ -198,7 +198,7 @@ let create_ac = fun ac config -> let color = Pprz.string_assoc "default_gui_color" config in let gl_color = gl_color_of_string color in Hashtbl.add live_aircrafts ac { color = gl_color; last_point = None } - + let one_new_ac = fun ac -> if not (Hashtbl.mem live_aircrafts ac) then begin let get_config = fun _sender values -> create_ac ac values in @@ -226,15 +226,15 @@ let add_point (view3d:Gtk_3d.widget_3d) (point, id) = ac.last_point <- Some p with Not_found -> () - - + + (* ========================================================================= *) (* = Load a map. Use SRTM elevation data to produce a 3d surface = *) -(* ========================================================================= *) +(* ========================================================================= *) let load_surface view3d id_sol xml_map_file = let min_x = ref max_int and min_y = ref max_int - and max_x = ref min_int and max_y = ref min_int - and _texture_file = ref "" in + and max_x = ref min_int and max_y = ref min_int + and _texture_file = ref "" in let xml = Xml.parse_file xml_map_file in let texture_file = Xml.attrib xml "file" in let texture_file = Filename.concat (Filename.dirname xml_map_file) texture_file in @@ -283,7 +283,7 @@ let load_mission = fun (view3d:Gtk_3d.widget_3d) xml -> (* ========================================================================= *) let on_load_surface win view3d id_sol () = let priv_load_surf xml_map_file = - load_surface view3d id_sol xml_map_file + load_surface view3d id_sol xml_map_file in try Gtk_tools.open_file_dlg "Map calibration file" priv_load_surf None default_path_maps false @@ -388,7 +388,7 @@ let build_lst_traj tooltips view3d lst_ids_trajs () = view3d#object_set_color !current_selection (gtk_to_gl_color color) ; view3d#display_func ; fill_list ()) ; - end + end in let delete_traj () = if !current_selection<>(-1) then begin @@ -477,7 +477,7 @@ let build_interface = fun map_file mission_file -> window#show () ; ignore (Ground_Pprz.message_bind "NEW_AIRCRAFT" (fun _sender vs -> one_new_ac (Pprz.string_assoc "ac_id" vs))); - + ignore (Glib.Timeout.add 5000 (fun () -> Ground_Pprz.message_req "map3d" "AIRCRAFTS" [] (fun _sender vs -> live_aircrafts_msg vs); false)); let use_fp = fun _sender vs -> @@ -505,7 +505,7 @@ let build_interface = fun map_file mission_file -> window#add_accel_group accel_group; (* Lancement de la mainloop *) - Gtk_tools.main_loop () + Gtk_tools.main_loop () (* ========================================================================= *) (* = Programme principal = *) diff --git a/sw/lib/ocaml/base64.ml b/sw/lib/ocaml/base64.ml index a2531c0207..2a173efd9e 100644 --- a/sw/lib/ocaml/base64.ml +++ b/sw/lib/ocaml/base64.ml @@ -2,8 +2,8 @@ * $Id$ * * Downlink protocol (handling messages.xml) - * - * Copyright (c) 2003 Dustin Sallings + * + * Copyright (c) 2003 Dustin Sallings * Copyright (C) 2007 ENAC, Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -21,7 +21,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) diff --git a/sw/lib/ocaml/base64.mli b/sw/lib/ocaml/base64.mli index 5b901c40c0..bc92d3ba5c 100644 --- a/sw/lib/ocaml/base64.mli +++ b/sw/lib/ocaml/base64.mli @@ -2,8 +2,8 @@ * $Id$ * * Downlink protocol (handling messages.xml) - * - * Copyright (c) 2003 Dustin Sallings + * + * Copyright (c) 2003 Dustin Sallings * Copyright (C) 2007 ENAC, Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -21,7 +21,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) diff --git a/sw/lib/ocaml/debug.ml b/sw/lib/ocaml/debug.ml index 2190cd9b39..d70606c9c6 100644 --- a/sw/lib/ocaml/debug.ml +++ b/sw/lib/ocaml/debug.ml @@ -2,7 +2,7 @@ * $Id$ * * Debugging facilities - * + * * Copyright (C) 2004 CENA/ENAC, Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -36,7 +36,7 @@ let call lev f = true) let trace lev s = call lev (fun f -> Printf.fprintf f "%s\n" s) - + let xprint = fun s -> let n = String.length s in let a = String.make (3*n) ' ' in diff --git a/sw/lib/ocaml/debug.mli b/sw/lib/ocaml/debug.mli index 183169b845..771505b6a3 100644 --- a/sw/lib/ocaml/debug.mli +++ b/sw/lib/ocaml/debug.mli @@ -2,7 +2,7 @@ * $Id$ * * Debugging facilities - * + * * Copyright (C) 2004 CENA/ENAC, Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) diff --git a/sw/lib/ocaml/defivybus.ml b/sw/lib/ocaml/defivybus.ml index 86fe47a8cb..9769391017 100644 --- a/sw/lib/ocaml/defivybus.ml +++ b/sw/lib/ocaml/defivybus.ml @@ -2,7 +2,7 @@ * $Id$ * * Default ivy bus address selection - * + * * Copyright (C) 2011 Eric Parsonage * * This file is part of paparazzi. @@ -20,13 +20,13 @@ * 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. + * Boston, MA 02111-1307, USA. * *) let default_ivy_bus = String.copy ( try (Sys.getenv "IVY_BUS" ) - with Not_found -> - (if Os_calls.contains (Os_calls.os_name) "Darwin" then - "224.255.255.255:2010" - else + with Not_found -> + (if Os_calls.contains (Os_calls.os_name) "Darwin" then + "224.255.255.255:2010" + else "127.255.255.255:2010")) diff --git a/sw/lib/ocaml/editAirframe.ml b/sw/lib/ocaml/editAirframe.ml index a9183702e7..08c885343e 100644 --- a/sw/lib/ocaml/editAirframe.ml +++ b/sw/lib/ocaml/editAirframe.ml @@ -2,7 +2,7 @@ * $Id$ * * Handling of an XML airframe file - * + * * Copyright (C) 2008, Cyril Allignol, Pascal Brisset * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) diff --git a/sw/lib/ocaml/editAirframe.mli b/sw/lib/ocaml/editAirframe.mli index 66ed933ab5..0da259a7a4 100644 --- a/sw/lib/ocaml/editAirframe.mli +++ b/sw/lib/ocaml/editAirframe.mli @@ -2,7 +2,7 @@ * $Id$ * * Handling of an XML airframe file - * + * * Copyright (C) 2008, Cyril Allignol, Pascal Brisset * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) diff --git a/sw/lib/ocaml/egm96.ml b/sw/lib/ocaml/egm96.ml index 91aec35049..f089859ae2 100644 --- a/sw/lib/ocaml/egm96.ml +++ b/sw/lib/ocaml/egm96.ml @@ -2,7 +2,7 @@ * $Id$ * * EGM96 geoid model - * + * * Copyright (C) 2009 ENAC, Pascal Brisset * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) diff --git a/sw/lib/ocaml/egm96.mli b/sw/lib/ocaml/egm96.mli index 37daa1520f..19aebc31b5 100644 --- a/sw/lib/ocaml/egm96.mli +++ b/sw/lib/ocaml/egm96.mli @@ -2,7 +2,7 @@ * $Id$ * * EGM96 geoid model - * + * * Copyright (C) 2009 ENAC, Pascal Brisset * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) diff --git a/sw/lib/ocaml/env.ml b/sw/lib/ocaml/env.ml index d3dab1195a..3437a2d145 100644 --- a/sw/lib/ocaml/env.ml +++ b/sw/lib/ocaml/env.ml @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) diff --git a/sw/lib/ocaml/env.mli b/sw/lib/ocaml/env.mli index 8674b57365..016b0f60db 100644 --- a/sw/lib/ocaml/env.mli +++ b/sw/lib/ocaml/env.mli @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) diff --git a/sw/lib/ocaml/expr_syntax.ml b/sw/lib/ocaml/expr_syntax.ml index 5f8f5034b5..e553008ba1 100644 --- a/sw/lib/ocaml/expr_syntax.ml +++ b/sw/lib/ocaml/expr_syntax.ml @@ -2,7 +2,7 @@ * $Id$ * * Syntax of expressions à la C - * + * * Copyright (C) 2003-2010 Antoine Drouin, Pascal Brisset, ENAC * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) diff --git a/sw/lib/ocaml/expr_syntax.mli b/sw/lib/ocaml/expr_syntax.mli index 7cb9619094..cac24c457a 100644 --- a/sw/lib/ocaml/expr_syntax.mli +++ b/sw/lib/ocaml/expr_syntax.mli @@ -2,7 +2,7 @@ * $Id$ * * Syntax of expressions à la C - * + * * Copyright (C) 2003-2010 CENA/ENAC, Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) diff --git a/sw/lib/ocaml/extXml.ml b/sw/lib/ocaml/extXml.ml index 246d72a160..99829c5b36 100644 --- a/sw/lib/ocaml/extXml.ml +++ b/sw/lib/ocaml/extXml.ml @@ -2,7 +2,7 @@ * $Id$ * * Xml-Light extension - * + * * Copyright (C) 2004 CENA/ENAC, Pascal Brisset * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -76,7 +76,7 @@ let attrib = fun x a -> let tag_is = fun x v -> String.lowercase (Xml.tag x) = String.lowercase v - + let attrib_or_default = fun x a default -> @@ -169,7 +169,7 @@ let subst_attrib = fun attrib value xml -> [] -> [(attrib, value)] | (a,_v) as c::ats -> if u a = uattrib then loop ats else c::loop ats in - Xml.Element (tag, + Xml.Element (tag, loop attrs, children) | Xml.PCData _ -> xml @@ -179,7 +179,7 @@ let subst_child = fun ?(select= fun _ -> true) t x xml -> match xml with Xml.Element (tag, attrs, children) -> let found = ref false in - let new_children = + let new_children = List.map (fun xml -> if tag_is xml t && select xml then (found := true; x) else xml) children in @@ -244,7 +244,7 @@ let parse_file = fun ?(noprovedtd = false) file -> -let digest = fun xml -> +let digest = fun xml -> Digest.string (Xml.to_string xml) let predefined_general_entities = @@ -256,18 +256,18 @@ let display_entities = fun s -> (fun (regexp, displayed_as) r -> Str.global_replace regexp displayed_as r) predefined_general_entities s - + module Gconf = struct let get_value = fun xml name -> let e = child ~select:(fun x -> Xml.attrib x "name" = name) xml "entry" in Xml.attrib e "value" - + let entry = fun application name value -> Xml.Element ("entry", ["name", name; "value", value; "application", application], []) - + let add_entry = fun xml appli name value -> let entry = entry appli name value in let select = fun x -> Xml.attrib x "name" = name in diff --git a/sw/lib/ocaml/extXml.mli b/sw/lib/ocaml/extXml.mli index 51baa6150d..f9edc132e3 100644 --- a/sw/lib/ocaml/extXml.mli +++ b/sw/lib/ocaml/extXml.mli @@ -2,7 +2,7 @@ * $Id$ * * Xml-Light extension - * + * * Copyright (C) 2004 CENA/ENAC, Pascal Brisset * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) diff --git a/sw/lib/ocaml/fig.ml b/sw/lib/ocaml/fig.ml index 2e912fd3be..03e2057c17 100644 --- a/sw/lib/ocaml/fig.ml +++ b/sw/lib/ocaml/fig.ml @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -48,7 +48,7 @@ let int_of_cap_style = Obj.magic let cap_style_of_int = Obj.magic -type polyline = +type polyline = Polyline | Box | Polygon | ArcBox | PictureBB of int*string let int_of_polyline = function Polyline -> 1 | Box -> 2 | Polygon -> 3 | ArcBox -> 4 | PictureBB _ -> 5 @@ -69,7 +69,7 @@ type spline = Approximated | Interpolated | XSpline let int_of_spline = function (Open, Approximated) -> 0 | (Closed, Approximated) -> 1 - | (Open, Interpolated) -> 2 + | (Open, Interpolated) -> 2 | (Closed, Interpolated) -> 3 | (Open, XSpline) -> 4 | (Closed, XSpline) -> 5 @@ -77,9 +77,9 @@ let spline_of_int = function 0 -> (Open, Approximated) | 1 -> (Closed, Approximated) | 2 -> (Open, Interpolated) - | 3-> (Closed, Interpolated) + | 3-> (Closed, Interpolated) | 4 -> (Open, XSpline) - | 5-> (Closed, XSpline) + | 5-> (Closed, XSpline) | _ -> invalid_arg "spline_of_int" type ellipse = EllipseRadius | EllipseDiameter | CircleRadius | CircleDiameter @@ -125,7 +125,7 @@ type graphic_object = type justification = LeftJustified | CenterJustified | RightJustified let justification_of_int = Obj.magic let int_of_justification = Obj.magic -type postscript_font = +type postscript_font = | TimesRoman | TimesItalic | TimesBold @@ -183,7 +183,7 @@ type font_size = int type font_flags = int type comments = string list - + type fig_object = (comments * raw_object) and raw_object = UserColor of color * (int * int * int) @@ -224,7 +224,7 @@ type t = { papersize : papersize; magnification : float; multiple_page : multiple_page; - transparent_color : int; + transparent_color : int; comments : string list; resolution : units * int; body : fig_object list @@ -241,13 +241,13 @@ let white = 7 let user_color = ref 31 let color = fun ?number r g b -> - let short = fun x -> - if x < 0 || x > 255 then + let short = fun x -> + if x < 0 || x > 255 then invalid_arg "Fig.color: color composite out of bound" in short r; short g; short b; - let n = + let n = match number with None -> incr user_color; !user_color | Some x -> x in @@ -268,7 +268,7 @@ let close = fun (f, _) -> close_out f;; let one = fun x -> if x = None then 0 else 1 -let arrow = fun f x -> +let arrow = fun f x -> match x with None -> () | Some t -> fprintf f "\t%d %d %.2f %.2f %.2f\n" t.arrow_type t.arrow_style t.arrow_thickness t.arrow_width t.arrow_height @@ -296,7 +296,7 @@ let create = fun papersize = papersize; magnification = magnification; multiple_page = multiple_page; - transparent_color = transparent_color; + transparent_color = transparent_color; comments = comments; resolution = resolution; body = objects } @@ -306,22 +306,22 @@ let create = fun let polyline = fun ?(sub_type = Polyline) ?(line_style = Solid) - ?(thickness = 1) - ?(pen_color = black) - ?(fill_color = white) - ?(depth = 50) - ?(area_fill = -1) + ?(thickness = 1) + ?(pen_color = black) + ?(fill_color = white) + ?(depth = 50) + ?(area_fill = -1) ?(style_val = 4.0) ?(join_style = Miter) ?(cap_style = Butt) ?(radius = 7) - ?forward_arrow + ?forward_arrow ?backward_arrow list -> let list = (* Checking and fixing nb of points *) match sub_type, list with Polyline, _::_ -> list - | Polygon, first::rest -> + | Polygon, first::rest -> if List.hd (List.rev list) <> first then begin prerr_endline "Fig.polyline: closing Polygon"; list @ [first] @@ -329,7 +329,7 @@ let polyline = fun list | _box, [(x0,y0);(x1, y1)] -> (* Opposed corners *) [(x0,y0);(x1, y0);(x1,y1);(x0,y1);(x0,y0)] - | _ -> invalid_arg "Fig.polyline" + | _ -> invalid_arg "Fig.polyline" in let attributes = { line_style = line_style; @@ -351,14 +351,14 @@ let polyline = fun let arc = fun ?(sub_type = Open) ?(line_style = Solid) - ?(thickness = 1) - ?(pen_color = black) - ?(fill_color = white) - ?(depth = 50) - ?(area_fill = -1) + ?(thickness = 1) + ?(pen_color = black) + ?(fill_color = white) + ?(depth = 50) + ?(area_fill = -1) ?(style_val = 0.0) ?(cap_style = Butt) - ?forward_arrow + ?forward_arrow ?backward_arrow (center_x, center_y) radius alpha1 alpha2 -> let attributes = { @@ -385,11 +385,11 @@ let arc = fun (* Ellipse *) let ellipse = fun ?(line_style = Solid) - ?(thickness = 1) - ?(pen_color = black) - ?(fill_color = white) - ?(depth = 50) - ?(area_fill = -1) + ?(thickness = 1) + ?(pen_color = black) + ?(fill_color = white) + ?(depth = 50) + ?(area_fill = -1) ?(style_val = 0.0) ?(direction = Clockwise) ?(angle = 0.0) @@ -423,20 +423,20 @@ let factors = fun points spline -> let spline = fun ?(sub_type = Open, Approximated) ?(line_style = Solid) - ?(thickness = 1) - ?(pen_color = black) - ?(fill_color = white) - ?(depth = 50) - ?(area_fill = -1) + ?(thickness = 1) + ?(pen_color = black) + ?(fill_color = white) + ?(depth = 50) + ?(area_fill = -1) ?(style_val = 0.0) ?(cap_style = Butt) - ?forward_arrow + ?forward_arrow ?backward_arrow list -> let list = (* Checking and fixing nb of points *) match fst sub_type, list with Open, _::_ -> list - | Closed, first::rest -> + | Closed, first::rest -> if List.hd (List.rev list) <> first then begin prerr_endline "Fig.spline: closing spline"; list @ [first] @@ -477,9 +477,9 @@ let code_string = fun f s -> let text = fun ?(sub_type = LeftJustified) - ?(color = black) - ?(depth = 50) - ?(font = Postscript TimesRoman) + ?(color = black) + ?(depth = 50) + ?(font = Postscript TimesRoman) ?(font_size = 12) ?(angle = 0.0) ?(rigid = true) @@ -537,7 +537,7 @@ let read_arrow = fun s flag -> if flag = 0 then None else bscanf s " %d %d %f %f %f" (fun at s thick w h -> Some { arrow_type = at; - arrow_style= s; + arrow_style= s; arrow_thickness= thick; arrow_width = w; arrow_height= h @@ -550,11 +550,11 @@ let rec read_points s n = if n = 0 then [] else let p = read_point s in p :: read_points s (n-1) - + let rec read_floats s n = if n = 0 then [] else bscanf s " %f" (fun f -> f :: read_floats s (n-1)) - + let read_polyline = fun s -> bscanf s " %d %d %d %d %d %d %d %d %f %d %d %d %d %d %d" (fun st ls thick pc fc depth _ps af sv js cs rad faf baf n -> @@ -573,7 +573,7 @@ let read_polyline = fun s -> forward_arrow = fa; backward_arrow = ba} in GrObj (com, Polylines (st, join_style_of_int js, rad, points))) - + let read_spline = fun s -> bscanf s " %d %d %d %d %d %d %d %d %f %d %d %d %d" (fun st ls thick pc fc depth _ps af sv cs faf baf n -> @@ -600,7 +600,7 @@ let read_arc = fun s -> let p3 = read_point s in let fa = read_arrow s faf in let ba = read_arrow s baf in - + let com = { line_style = line_style_of_int ls; line_thickness = thick; pen_color = pc; @@ -614,8 +614,8 @@ let read_arc = fun s -> GrObj(com, Arc (arc_of_int st, direction_of_int dirct, (cx, cy), p1, p2, p3))) - - + + let bit2 ff = (ff lor 2) land 1 = 1 @@ -644,7 +644,7 @@ let rec read_objects = fun s -> and read_compound = fun s -> bscanf s " %d %d %d %d" (fun x1 y1 x2 y2 -> Compound ((x1,y1), (x2,y2), read_objects s)) - + let read = fun file -> let s = Scanning.from_file file in @@ -654,10 +654,10 @@ let read = fun file -> failwith ("Unknown FIG format version: "^v); let comments = read_comments s in - + bscanf s "%d %d" (fun resolution coord_system -> let os = read_objects s in - + { version = v; orientation = orientation_of_string o; @@ -666,12 +666,12 @@ let read = fun file -> papersize = p; magnification = m; multiple_page = multiple_page_of_string multi; - transparent_color = t; + transparent_color = t; comments = comments; resolution = (resolution, coord_system); body = os })) - + let fprint_point f (x, y) = fprintf f " %d %d" x y let arrow_flag = function @@ -753,7 +753,7 @@ let write_out f { version = v; papersize = p; magnification = m; multiple_page = multi; - transparent_color = t; + transparent_color = t; comments = comments; resolution = (resolution, coord_system); body = os @@ -765,7 +765,7 @@ let write_out f { version = v; let (colors, others) = List.partition (function (_, UserColor _) -> true | _ -> false) os in List.iter (write_object f) colors; List.iter (write_object f) others - + let write f fig = diff --git a/sw/lib/ocaml/fig.mli b/sw/lib/ocaml/fig.mli index c8b7103e03..baa3d7387b 100644 --- a/sw/lib/ocaml/fig.mli +++ b/sw/lib/ocaml/fig.mli @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -87,7 +87,7 @@ type line_style = type join_style = Miter| Round | Bevel type cap_style = Butt | Round | Projecting -type polyline = +type polyline = Polyline | Box | Polygon | ArcBox | PictureBB of int * string type ellipse = EllipseRadius | EllipseDiameter | CircleRadius | CircleDiameter @@ -122,7 +122,7 @@ type graphic_attributes = { type justification = LeftJustified | CenterJustified | RightJustified -type postscript_font = +type postscript_font = | TimesRoman | TimesItalic | TimesBold @@ -194,7 +194,7 @@ type t = { papersize : papersize; magnification : float; multiple_page : multiple_page; - transparent_color : int; + transparent_color : int; comments : string list; resolution : units * int; body : fig_object list @@ -238,7 +238,7 @@ val arc : ?forward_arrow:arrow -> (** None *) ?backward_arrow:arrow -> (** None *) float * float -> float -> float -> float -> fig_object -(** [arc ?... centre radius alpha1 alpha2] +(** [arc ?... centre radius alpha1 alpha2] alpha1 is the angle between the X axis and the line centre->First point alpha2 is the angle between the line centre->First point and centre->Last point alpha1 and alpha2 are in radian diff --git a/sw/lib/ocaml/geometry_2d.ml b/sw/lib/ocaml/geometry_2d.ml index 17aad9479a..dbdfefcd3b 100644 --- a/sw/lib/ocaml/geometry_2d.ml +++ b/sw/lib/ocaml/geometry_2d.ml @@ -2,7 +2,7 @@ * $Id$ * * 2D Geometry - * + * * Copyright (C) 2004 CENA/ENAC, Yann Le Fablec * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -284,7 +284,7 @@ let crossing_point a u c v = and pt_intersection = vect_add_mul_scal r a u in Some (type_intersection_seg1, type_intersection_seg2, pt_intersection) - end + end (* ============================================================================= *) (* = Test du type d'intersection = *) @@ -337,7 +337,7 @@ let crossing_lines a u c v = (* = = *) (* ============================================================================= *) - + (* ============================================================================= *) (* = Teste si un polygone est ferme = *) (* ============================================================================= *) @@ -380,7 +380,7 @@ let point_in_poly pt poly = (* = Indique si un point est dans un cercle = *) (* ============================================================================= *) let point_in_circle pt (center, r) = distance pt center <= r - + (* ============================================================================= *) (* = Calcul de l'enveloppe convexe d'un polygone = *) (* ============================================================================= *) @@ -404,12 +404,12 @@ let convex_hull poly = let extract_mini p l = let rec aux reste vu mini = - match reste with + match reste with t::q -> if (try(p mini t) with _ -> false) then aux q (t::vu) mini else aux q (mini::vu) t | [] -> mini,vu - in match l with + in match l with t::q -> aux q [] t | [] -> raise Exit in @@ -818,7 +818,7 @@ let m_pi_two = m_pi /. 2. let wind_dir_from_angle_rad rad = let w = ref (3. *. m_pi_two -. rad) in - while !w > two_m_pi do + while !w > two_m_pi do w := !w -. two_m_pi done; !w @@ -838,7 +838,7 @@ let norm_heading_rad a = while !a < 0. do a := !a +. two_m_pi done; while !a > two_m_pi do a := !a -. two_m_pi done; !a - + let oposite_heading_rad rad = norm_heading_rad (rad +. m_pi) @@ -853,18 +853,18 @@ let arc_segment = fun p0 p1 p2 radius -> let v = vect_rotate_90 u in let s = sign (cross_product p0p1 p0p2) in let c = vect_add p1 (vect_mul_scal v (s*.radius)) in - + (* F first point of the segment *) let d_c2 = distance c p2 in if radius > d_c2 then (** Arc is empty *) (c, p1, s) else - let alpha_2cf = -. s *. acos (radius /. d_c2) + let alpha_2cf = -. s *. acos (radius /. d_c2) and alpha_c2 = (cart2polar (vect_make c p2)).theta2D in let alpha_cf = alpha_c2 +. alpha_2cf in let f = vect_add c (polar2cart {theta2D=alpha_cf;r2D=radius}) in - + (c, f, s) @@ -887,7 +887,7 @@ let slice_polygon = fun poly -> let bottom = ref 0 in for i = 1 to n -1 do - if poly.(i).y2D < poly.(!bottom).y2D then + if poly.(i).y2D < poly.(!bottom).y2D then bottom := i done; let l = ref [] in diff --git a/sw/lib/ocaml/geometry_2d.mli b/sw/lib/ocaml/geometry_2d.mli index cb2a9ce117..96bc6757cc 100644 --- a/sw/lib/ocaml/geometry_2d.mli +++ b/sw/lib/ocaml/geometry_2d.mli @@ -2,7 +2,7 @@ * $Id$ * * 2D Geometry - * + * * Copyright (C) 2004 CENA/ENAC, Yann Le Fablec * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -34,7 +34,7 @@ (** {6 Types} *) (** Type point/vecteur 2D en coordonnees cartesiennes *) -type pt_2D = { x2D : float; y2D : float; } +type pt_2D = { x2D : float; y2D : float; } (** Type point/vecteur 2D en coordonnees polaires *) type pt_2D_polar = { r2D : float; theta2D : float; } diff --git a/sw/lib/ocaml/geometry_3d.ml b/sw/lib/ocaml/geometry_3d.ml index 19729cfe59..8fe6595686 100644 --- a/sw/lib/ocaml/geometry_3d.ml +++ b/sw/lib/ocaml/geometry_3d.ml @@ -2,7 +2,7 @@ * $Id$ * * 3D Geometry - * + * * Copyright (C) 2004 CENA/ENAC, Yann Le Fablec * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -408,7 +408,7 @@ let poly_normal poly = and c = List.hd (List.tl (List.tl poly)) in (* Normale unitaire au plan contenant le polygone *) normal (vect_make a b) (vect_make b c) - end else null_vector + end else null_vector (* ============================================================================= *) (* = Test d'un point dans un polygone 3D = *) diff --git a/sw/lib/ocaml/geometry_3d.mli b/sw/lib/ocaml/geometry_3d.mli index 6e712eff4e..da34ac4bfa 100644 --- a/sw/lib/ocaml/geometry_3d.mli +++ b/sw/lib/ocaml/geometry_3d.mli @@ -2,7 +2,7 @@ * $Id$ * * 3D Geometry - * + * * Copyright (C) 2004 CENA/ENAC, Yann Le Fablec * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -43,7 +43,7 @@ type t_crossing3d = T_IN_SEG1 | T_IN_SEG2 | T_ON_PT1 | T_ON_PT2 | T_ON_PT3 | T_ON_PT4 | T_OUT_SEG_PT1 | T_OUT_SEG_PT2 | T_OUT_SEG_PT3 | T_OUT_SEG_PT4 (** Type point/vecteur 3D *) -type pt_3D = { x3D : float; y3D : float; z3D : float; } +type pt_3D = { x3D : float; y3D : float; z3D : float; } (** Vecteur nul en 3D *) val null_vector : pt_3D diff --git a/sw/lib/ocaml/gtk_3d.ml b/sw/lib/ocaml/gtk_3d.ml index 89ab568bb9..f47a6b380a 100644 --- a/sw/lib/ocaml/gtk_3d.ml +++ b/sw/lib/ocaml/gtk_3d.ml @@ -2,7 +2,7 @@ * $Id$ * * 3D display widget - * + * * Copyright (C) 2004 CENA/ENAC, Yann Le Fablec * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -209,7 +209,7 @@ let make_image filename = let img = GdkPixbuf.from_file filename in let w = GdkPixbuf.get_width img and h = GdkPixbuf.get_height img - and region = GdkPixbuf.get_pixels img in + and region = GdkPixbuf.get_pixels img in let n_channels = GdkPixbuf.get_n_channels img in let row = GdkPixbuf.get_rowstride img in @@ -219,7 +219,7 @@ let make_image filename = let image = GlPix.create `ubyte ~format:`rgb ~width:w ~height:h in for i = 0 to h - 1 do for j = 0 to w - 1 do - let pos = i*row + j*n_channels in + let pos = i*row + j*n_channels in let red = Gpointer.get_byte region ~pos in let green = Gpointer.get_byte region ~pos:(pos+1) in let blue = Gpointer.get_byte region ~pos:(pos+2) in @@ -747,29 +747,29 @@ class widget_3d pack with_status_bar n = normal_up () ; self#draw_triangulation v.vol3d_up ; normal_down () ; self#draw_triangulation v.vol3d_down end - | ENVELOPPE_3D e -> + | ENVELOPPE_3D e -> (* Faces tjs visibles: Gl.disable `cull_face ; *) if e.env3d_filled then set_gl_fillpoly () else begin GlDraw.line_width 2. ; unset_gl_fillpoly () end ; - + (* Faces verticales *) GlLight.color_material ~face:`front `ambient_and_diffuse ; set_color e.env3d_color ; set_3d_points_quad_strip_with_normal (self#scale_points e.env3d_contour); (*si faces env tjs visibles: Gl.enable `cull_face *) - | ENVELOPPE_3D_DOUBLE e -> + | ENVELOPPE_3D_DOUBLE e -> (* Faces tjs visibles: Gl.disable `cull_face ; *) if e.env3d_double_filled then set_gl_fillpoly () else begin GlDraw.line_width 2. ; unset_gl_fillpoly () end ; - + (* Faces verticales externes *) GlLight.color_material ~face:`front `ambient_and_diffuse ; set_color e.env3d_double_color_out ; set_3d_points_quad_strip_with_normal (self#scale_points e.env3d_double_contour_out); - + (* Faces verticales internes *) GlLight.color_material ~face:`front `ambient_and_diffuse ; set_color e.env3d_double_color_in ; @@ -984,7 +984,7 @@ class widget_3d pack with_status_bar n = in let cw_poly c = let contour_2d = List.map (pt_3d_to_pt_2d T_Z3D) c in - if (poly_test_ccw contour_2d = CW) then c else List.rev c + if (poly_test_ccw contour_2d = CW) then c else List.rev c in let l_bas = geom_close_poly (cw_poly contour_bas) in let l_haut = geom_close_poly (cw_poly contour_haut) in @@ -992,11 +992,11 @@ class widget_3d pack with_status_bar n = try List.fold_right2 add_p l_bas l_haut [] with x-> Printf.printf "\nadd_object_enveloppe.fold... : "; raise x in - try + try self#add_object (ENVELOPPE_3D {env3d_contour = l0; env3d_color = color; env3d_filled = filled}) - with x -> + with x -> Printf.printf "\nadd_object_enveloppe. self#add_object "; raise x (* Enveloppe 3D : faces laterales liant un contour_haut et un contour_bas *) @@ -1006,9 +1006,9 @@ class widget_3d pack with_status_bar n = let add_p p_bas p_haut res = (glpoint3d_of_pt_3d p_bas)::(glpoint3d_of_pt_3d p_haut)::res in - let cw_poly c = + let cw_poly c = let contour_2d = List.map (pt_3d_to_pt_2d T_Z3D) c in - if (poly_test_ccw contour_2d = CW) then c else List.rev c + if (poly_test_ccw contour_2d = CW) then c else List.rev c in let l_bas = geom_close_poly (cw_poly contour_bas) in let l_haut = geom_close_poly (cw_poly contour_haut) in @@ -1280,14 +1280,14 @@ class widget_3d pack with_status_bar n = | `DOWN -> self#incr_dist dist_incr ; true | `LEFT -> false | `RIGHT -> false - + method private start_stop_animation = match animation_timer with None -> let timeout _ = self#incr_rotz rot_anim; true in animation_timer <- Some (Timeout.add ~ms:tps_anim ~callback:timeout) | Some t -> Timeout.remove t ; animation_timer <- None - + (* [key_pressed key] teste la touche pressee dans la zone de dessin et effectue l'action associee le cas echeant *) method private key_pressed key = @@ -1321,7 +1321,7 @@ class widget_3d pack with_status_bar n = | [] -> false in check_keys keys_list - + (* Modification de la position de l'utilisateur et des angles de vue *) method incr_dist d = self#move_view (add_coord depl Z_AXIS d) method incr_rotx d = self#rotate_view (add_coord_360 rot X_AXIS d) @@ -1419,7 +1419,7 @@ class widget_3d pack with_status_bar n = (* Reactions aux mouvements de la molette souris *) ignore(area#event#connect#any ~callback:scroll_cb) ; - + (* Attachement des callbacks pour les evenements clavier *) Gtk_tools_GL.glarea_key_connect area self#key_pressed (fun _k -> (); false) end diff --git a/sw/lib/ocaml/gtk_3d.mli b/sw/lib/ocaml/gtk_3d.mli index 4cd6c3f062..3d80735eb7 100644 --- a/sw/lib/ocaml/gtk_3d.mli +++ b/sw/lib/ocaml/gtk_3d.mli @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) diff --git a/sw/lib/ocaml/gtk_draw.ml b/sw/lib/ocaml/gtk_draw.ml index 487954600d..5782b56158 100644 --- a/sw/lib/ocaml/gtk_draw.ml +++ b/sw/lib/ocaml/gtk_draw.ml @@ -2,7 +2,7 @@ * $Id$ * * GTK drawing in a pixmap - * + * * Copyright (C) 2004 CENA/ENAC, Yann Le Fablec * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) diff --git a/sw/lib/ocaml/gtk_image.ml b/sw/lib/ocaml/gtk_image.ml index b2581fcbe6..cbaf50d016 100644 --- a/sw/lib/ocaml/gtk_image.ml +++ b/sw/lib/ocaml/gtk_image.ml @@ -2,7 +2,7 @@ * $Id$ * * Images utils - * + * * Copyright (C) 2004 CENA/ENAC, Yann Le Fablec * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) diff --git a/sw/lib/ocaml/gtk_image.mli b/sw/lib/ocaml/gtk_image.mli index 07274abaaa..cd3e96640e 100644 --- a/sw/lib/ocaml/gtk_image.mli +++ b/sw/lib/ocaml/gtk_image.mli @@ -2,7 +2,7 @@ * $Id$ * * Images utils - * + * * Copyright (C) 2004 CENA/ENAC, Yann Le Fablec * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) diff --git a/sw/lib/ocaml/gtk_tools.ml b/sw/lib/ocaml/gtk_tools.ml index f3a0fe0ddf..49a51b9646 100644 --- a/sw/lib/ocaml/gtk_tools.ml +++ b/sw/lib/ocaml/gtk_tools.ml @@ -2,7 +2,7 @@ * $Id$ * * Lablgtk2 utils - * + * * Copyright (C) 2009 ENAC, Pascal Brisset * * This file is part of paparazzi. @@ -20,14 +20,14 @@ * 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. + * Boston, MA 02111-1307, USA. * *) (** GTK utilities *) -class pixmap_in_drawin_area = fun ?drawing_area ?width ?height ?packing () -> +class pixmap_in_drawin_area = fun ?drawing_area ?width ?height ?packing () -> let da = match drawing_area with None -> @@ -43,7 +43,7 @@ class pixmap_in_drawin_area = fun ?drawing_area ?width ?height ?packing () -> None -> () | Some pm -> (new GDraw.drawable da#misc#window)#put_pixmap ~x:0 ~y:0 pm#pixmap - + method get_pixmap = fun () -> let {Gtk.width=width; height=height} = da#misc#allocation in let create = fun () -> GDraw.pixmap ~width ~height ~window:da () in @@ -53,7 +53,7 @@ class pixmap_in_drawin_area = fun ?drawing_area ?width ?height ?packing () -> | Some pm -> if pm#size = (width, height) then pm - else begin + else begin Gdk.Pixmap.destroy pm#pixmap; create () end in @@ -71,7 +71,7 @@ let combo_value = fun ((combo: #GEdit.combo_box), (_,column)) -> | Some row -> combo#model#get ~row ~column let combo_separator = "--" - + let combo = fun strings vbox -> let (combo, (tree, column)) = GEdit.combo_box_text ~packing:vbox#add ~strings () in @@ -89,7 +89,7 @@ let add_to_combo = fun (combo : combo) string -> let select_in_combo = fun (combo : combo) string -> let (store, column) = combo_model combo in - store#foreach + store#foreach (fun _path row -> if store#get ~row ~column = string then begin (combo_widget combo)#set_active_iter (Some row); @@ -105,7 +105,7 @@ let combo_connect = fun ((combo: #GEdit.combo_box), (_,column)) cb -> | Some row -> let data = combo#model#get ~row ~column in cb data)) - + type tree = GTree.view * (GTree.list_store * string GTree.column) let tree_widget = fst diff --git a/sw/lib/ocaml/gtk_tools.mli b/sw/lib/ocaml/gtk_tools.mli index 678be6a30a..2b1b09cc52 100644 --- a/sw/lib/ocaml/gtk_tools.mli +++ b/sw/lib/ocaml/gtk_tools.mli @@ -2,7 +2,7 @@ * $Id$ * * Lablgtk2 utils - * + * * Copyright (C) 2009 ENAC, Pascal Brisset * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) (** GTK utilities @@ -28,7 +28,7 @@ (** Allocate a drawing area and filling pixmap on request. if ~drawing_area is provided, width, heigh and packing are ignored *) -class pixmap_in_drawin_area : +class pixmap_in_drawin_area : ?drawing_area:GMisc.drawing_area -> ?width:int -> ?height:int -> @@ -46,7 +46,7 @@ class pixmap_in_drawin_area : (*** Utilities for a combo box widget ***) -type combo +type combo val combo_widget : combo -> GEdit.combo_box val combo_model : combo -> (GTree.list_store * string GTree.column) diff --git a/sw/lib/ocaml/gtk_tools_GL.ml b/sw/lib/ocaml/gtk_tools_GL.ml index e7e4080e15..a3ff5665ea 100644 --- a/sw/lib/ocaml/gtk_tools_GL.ml +++ b/sw/lib/ocaml/gtk_tools_GL.ml @@ -2,7 +2,7 @@ * $Id$ * * OpenGL utils - * + * * Copyright (C) 2004 CENA/ENAC, Yann Le Fablec * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) (* = YLF 28/10/2001 = *) diff --git a/sw/lib/ocaml/gtk_tools_GL.mli b/sw/lib/ocaml/gtk_tools_GL.mli index b7448efc22..882dcb7c06 100644 --- a/sw/lib/ocaml/gtk_tools_GL.mli +++ b/sw/lib/ocaml/gtk_tools_GL.mli @@ -2,7 +2,7 @@ * $Id$ * * OpenGL utils - * + * * Copyright (C) 2004 CENA/ENAC, Yann Le Fablec * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) diff --git a/sw/lib/ocaml/gtk_tools_icons.ml b/sw/lib/ocaml/gtk_tools_icons.ml index 794ee1c41d..97624b4c0e 100644 --- a/sw/lib/ocaml/gtk_tools_icons.ml +++ b/sw/lib/ocaml/gtk_tools_icons.ml @@ -2,7 +2,7 @@ * $Id$ * * Icons library - * + * * Copyright (C) 2004 CENA/ENAC, Yann Le Fablec * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) diff --git a/sw/lib/ocaml/gtk_tools_icons.mli b/sw/lib/ocaml/gtk_tools_icons.mli index f753496e74..66c7fdf162 100644 --- a/sw/lib/ocaml/gtk_tools_icons.mli +++ b/sw/lib/ocaml/gtk_tools_icons.mli @@ -2,7 +2,7 @@ * $Id$ * * Icons library - * + * * Copyright (C) 2004 CENA/ENAC, Yann Le Fablec * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) diff --git a/sw/lib/ocaml/gtkgl_Hack.ml b/sw/lib/ocaml/gtkgl_Hack.ml index 6cff47cea8..366acbdc10 100644 --- a/sw/lib/ocaml/gtkgl_Hack.ml +++ b/sw/lib/ocaml/gtkgl_Hack.ml @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) diff --git a/sw/lib/ocaml/gtkgl_Hack.mli b/sw/lib/ocaml/gtkgl_Hack.mli index 9bbd618f52..a598b836b9 100644 --- a/sw/lib/ocaml/gtkgl_Hack.mli +++ b/sw/lib/ocaml/gtkgl_Hack.mli @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) diff --git a/sw/lib/ocaml/http.ml b/sw/lib/ocaml/http.ml index 3013f8bb05..5dfb56361a 100644 --- a/sw/lib/ocaml/http.ml +++ b/sw/lib/ocaml/http.ml @@ -6,7 +6,7 @@ let file_of_url = fun ?dest url -> String.sub url 7 (String.length url - 7) else let tmp_file = - match dest with + match dest with Some s -> s | None -> Filename.temp_file "fp" ".wget" in let c = Printf.sprintf "wget -nv --cache=off -O %s '%s'" tmp_file url in diff --git a/sw/lib/ocaml/iGN.ml b/sw/lib/ocaml/iGN.ml index 957da15c61..12f33b6be8 100644 --- a/sw/lib/ocaml/iGN.ml +++ b/sw/lib/ocaml/iGN.ml @@ -2,7 +2,7 @@ * $Id$ * * Handling IGN tiles - * + * * Copyright (C) 2004-2006 ENAC, Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -53,7 +53,7 @@ let tile_of_geo = fun wgs84 -> { key = (kx, ky); sw_corner = sw_corner; ne_corner = ne_corner } - + let get_tile = fun tile -> let (kx, ky) = tile.key in let dalle_x = (kx * size_m) / 10000 @@ -74,5 +74,5 @@ let get_tile = fun tile -> let x = Sys.command sub_tile in if x <> 0 then failwith sub_tile; png_file - - + + diff --git a/sw/lib/ocaml/iGN.mli b/sw/lib/ocaml/iGN.mli index 3804393165..2f3dfde7b8 100644 --- a/sw/lib/ocaml/iGN.mli +++ b/sw/lib/ocaml/iGN.mli @@ -2,7 +2,7 @@ * $Id$ * * Handling IGN tiles - * + * * Copyright (C) 2004-2006 ENAC, Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) diff --git a/sw/lib/ocaml/ivy/examples/ivyprobe.ml b/sw/lib/ocaml/ivy/examples/ivyprobe.ml index 4831ef58b6..d8fe4cea4f 100644 --- a/sw/lib/ocaml/ivy/examples/ivyprobe.ml +++ b/sw/lib/ocaml/ivy/examples/ivyprobe.ml @@ -18,11 +18,11 @@ let watch_clients c e = flush stdout let init = fun () -> - let regexp = ref "" + let regexp = ref "" and name = ref "MLIVYPROBE" - and port = ref 2010 + and port = ref 2010 and domain = ref "127.255.255.255" in - Arg.parse + Arg.parse [ "-b", Arg.Int (fun x -> port := x), "\tDefault is 2010, unused if IVYBUS is set"; "-domain", Arg.String (fun x -> domain := x), "\tDefault is 127.255.255.255, unused if IVYBUS is set"; "-n", Arg.String (fun s -> name := s), "\tDefault is MLIVYPROBE"] diff --git a/sw/lib/ocaml/ivy/glibIvy.ml b/sw/lib/ocaml/ivy/glibIvy.ml index 17919c5735..42b0991af8 100644 --- a/sw/lib/ocaml/ivy/glibIvy.ml +++ b/sw/lib/ocaml/ivy/glibIvy.ml @@ -1,7 +1,7 @@ type channel external main : unit -> unit = "ivy_GtkmainLoop" -external ext_channelSetUp : Unix.file_descr -> string -> channel = "ivy_GtkchannelSetUp" +external ext_channelSetUp : Unix.file_descr -> string -> channel = "ivy_GtkchannelSetUp" let set_up_channel fd delete read = ext_channelSetUp fd (Ivy.cb_register read) external close_channel : channel -> unit = "ivy_GtkchannelClose" diff --git a/sw/lib/ocaml/ivy/glibIvy.mli b/sw/lib/ocaml/ivy/glibIvy.mli index 3df31b6bcb..aec0a80445 100644 --- a/sw/lib/ocaml/ivy/glibIvy.mli +++ b/sw/lib/ocaml/ivy/glibIvy.mli @@ -6,7 +6,7 @@ type channel val set_up_channel : Unix.file_descr -> (unit -> unit) -> (channel -> unit) -> channel (** [set_up_channel fd delete read] gives the opportunity to the main loop -to call [read] when data is available on [fd] and [delete] when [fd] is +to call [read] when data is available on [fd] and [delete] when [fd] is closed *) val close_channel : channel -> unit diff --git a/sw/lib/ocaml/ivy/ivy.ml b/sw/lib/ocaml/ivy/ivy.ml index 8bc1c6becb..0d5b33cb0c 100644 --- a/sw/lib/ocaml/ivy/ivy.ml +++ b/sw/lib/ocaml/ivy/ivy.ml @@ -51,7 +51,7 @@ let hexa_code = fun c -> else if 'A' <= c && c <= 'F' then Char.code c - Char.code 'A' + 10 else failwith (Printf.sprintf "hexa_code: %c" c) - + let hexa_of_string = fun s -> let n = String.length s in diff --git a/sw/lib/ocaml/ivy/ivyLoop.mli b/sw/lib/ocaml/ivy/ivyLoop.mli index 5c84843c53..1313dc9202 100644 --- a/sw/lib/ocaml/ivy/ivyLoop.mli +++ b/sw/lib/ocaml/ivy/ivyLoop.mli @@ -7,7 +7,7 @@ type channel val set_up_channel : Unix.file_descr -> (unit -> unit) -> (channel -> unit) -> channel (** [set_up_channel fd delete read] gives the opportunity to the main loop -to call [read] when data is available on [fd] and [delete] when [fd] is +to call [read] when data is available on [fd] and [delete] when [fd] is closed *) val close_channel : channel -> unit diff --git a/sw/lib/ocaml/ivy/tkIvy.ml b/sw/lib/ocaml/ivy/tkIvy.ml index 907baa944a..357576b272 100644 --- a/sw/lib/ocaml/ivy/tkIvy.ml +++ b/sw/lib/ocaml/ivy/tkIvy.ml @@ -1,7 +1,7 @@ type channel external main : unit -> unit = "ivy_TclmainLoop" -external ext_channelSetUp : Unix.file_descr -> string -> channel = "ivy_TclchannelSetUp" +external ext_channelSetUp : Unix.file_descr -> string -> channel = "ivy_TclchannelSetUp" let set_up_channel fd delete read = ext_channelSetUp fd (Ivy.cb_register read) external close_channel : channel -> unit = "ivy_TclchannelClose" diff --git a/sw/lib/ocaml/ivy/tkIvy.mli b/sw/lib/ocaml/ivy/tkIvy.mli index 9d56a4de0a..e477d8ecdd 100644 --- a/sw/lib/ocaml/ivy/tkIvy.mli +++ b/sw/lib/ocaml/ivy/tkIvy.mli @@ -6,7 +6,7 @@ type channel val set_up_channel : Unix.file_descr -> (unit -> unit) -> (channel -> unit) -> channel (** [set_up_channel fd delete read] gives the opportunity to the main loop -to call [read] when data is available on [fd] and [delete] when [fd] is +to call [read] when data is available on [fd] and [delete] when [fd] is closed *) val close_channel : channel -> unit diff --git a/sw/lib/ocaml/latlong.ml b/sw/lib/ocaml/latlong.ml index 53b6796803..baa7b778cd 100644 --- a/sw/lib/ocaml/latlong.ml +++ b/sw/lib/ocaml/latlong.ml @@ -2,7 +2,7 @@ * $Id$ * * Geographic conversion utilities - * + * * Copyright (C) 2004-2006 ENAC, Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -49,7 +49,7 @@ type semicircle = { lat : semi; long : semi } type geographic = { posn_lat : radian ; posn_long : radian } let norm_angle = fun long -> - if long >= pi then long -. 2.*.pi + if long >= pi then long -. 2.*.pi else if long < -. pi then long +. 2.*.pi else long @@ -125,7 +125,7 @@ let inverse_latitude_isometrique lat e epsilon = let exp_l = exp lat in let pi_2 = pi /. 2. in let phi0 = 2. *. atan exp_l -. pi_2 in - let rec loop phi = + let rec loop phi = let sin_phi = e *. sin phi in let phi' = 2. *. atan (((1. +. sin_phi) /. (1. -. sin_phi))**(e/.2.) *. exp_l) -. pi_2 in if abs_float (phi' -. phi) < epsilon then phi' else loop phi' in @@ -164,10 +164,10 @@ let lambertI = y0 = 200000; ys = 5657617; c = 11603796.98; - n = sin phi0 (* tangent projection *) + n = sin phi0 (* tangent projection *) };; -let lambertII = +let lambertII = let phi0 = (Deg>>Rad) (decimal 46 48 0.) in { ellipsoid = ntf; lambda0 = (Deg>>Rad) (decimal 2 20 14.025); @@ -176,7 +176,7 @@ let lambertII = y0 = 2200000; ys = 6199696; c = 11745793.39; - n = sin phi0 (* tangent projection *) + n = sin phi0 (* tangent projection *) };; let lambertIIe = { lambertII with ys = 8199696 };; @@ -190,7 +190,7 @@ let lambertIII = y0 = 3200000; ys = 6791905; c = 11947992.52; - n = sin phi0 (* tangent projection *) + n = sin phi0 (* tangent projection *) };; let lambertIV = @@ -203,7 +203,7 @@ let lambertIV = y0 = 4185861; ys = 7239162; c = 12136281.99; - n = sin phi0; (* tangent projection *) + n = sin phi0; (* tangent projection *) };; let lambert93 = { @@ -242,12 +242,12 @@ let lambert_of l ({posn_long = lambda; posn_lat = phi} as pos) = let r = lambert_c l *. exp (-. ll *. n) in let gamma = (lambda -. l.lambda0) *. n in - let x = l.x0 + truncate (r *. sin gamma) + let x = l.x0 + truncate (r *. sin gamma) and y = l.ys - truncate (r *. cos gamma) in { lbt_x = x; lbt_y = y };; -let serie5 cc e = +let serie5 cc e = let ee = Array.init (Array.length cc.(0)) (fun i -> e ** (float (2*i))) in Array.init (Array.length cc) (fun i -> @@ -279,7 +279,7 @@ let utm_of' = fun geo -> let e = ellipsoid.e and n = k0 *. ellipsoid.a in let c = serie5 coeff_proj_mercator e in - + fun ({posn_long = lambda; posn_lat = phi} as pos) -> if not (valid_geo pos) then invalid_arg "Latlong.utm_of"; @@ -327,14 +327,14 @@ let of_utm' geo = let k0 = 0.9996 and xs = 500000. and ys = 0. in - let e = ellipsoid.e + let e = ellipsoid.e and n = k0 *. ellipsoid.a in let c = serie5 coeff_proj_mercator_inverse e in fun { utm_zone = f; utm_x = x; utm_y = y } -> if x < 0. || x > 1e7 || y < -1e7 || y > 1e7 || f < 0 || f > 60 then invalid_arg "Latlong.of_utm"; - + let lambda_c = (Deg>>Rad) (float (6 * f - 183)) in let z' = C.scal (1./.n/.c.(0)) (C.make (y-.ys) (x-.xs)) in let z = ref z' in @@ -368,7 +368,7 @@ let (<<) geo1 geo2 ({posn_long = lambda; posn_lat = phi} as pos) = let elps1 = ellipsoid_of geo1 and elps2 = ellipsoid_of geo2 in let d12 = sin phi - and d13 = cos phi + and d13 = cos phi and d14 = sin lambda and d15 = cos lambda in @@ -395,13 +395,13 @@ let utm_distance = fun utm1 utm2 -> let utm_add = fun u (x, y) -> {utm_x = u.utm_x +. x; utm_y = u.utm_y +. y; utm_zone = u.utm_zone } - + let utm_sub = fun u1 u2 -> if u1.utm_zone <> u2.utm_zone then invalid_arg (Printf.sprintf "utm_sub: %d %d" u1.utm_zone u2.utm_zone); (u1.utm_x -. u2.utm_x, u1.utm_y -. u2.utm_y) - + let of_lambertIIe = fun lbt -> (WGS84< @@ -474,7 +474,7 @@ let bearing = fun geo1 geo2 -> let leap_seconds = 15 (* http://www.leapsecond.com/java/gpsclock.htm *) let gps_epoch = 315964800. (* In seconds, in the unix reference *) - + let gps_tow_of_utc = fun ?wday hour min sec -> let wday = match wday with @@ -493,14 +493,14 @@ let unix_time_of_tow = fun ?week tow -> let host_tow = get_gps_tow () and unix_now = Unix.gettimeofday () in unix_now +. float (tow - host_tow) - | Some w -> + | Some w -> gps_epoch +. float w *. 60. *. 60. *. 24. *. 7. +. float (tow - leap_seconds) -type coordinates_kind = +type coordinates_kind = WGS84_dec | WGS84_dms | LBT2e @@ -524,9 +524,9 @@ let string_of_coordinates = fun kind geo -> let geographic_of_coordinates = fun kind s -> match kind with - WGS84_dec -> + WGS84_dec -> of_string ("WGS84 " ^ s) - | WGS84_dms -> + | WGS84_dms -> of_string ("WGS84_dms " ^ s) | LBT2e -> of_string ("LBT2e " ^ s) @@ -589,11 +589,11 @@ let geo_of_ecef = fun geo -> let _U = sqrt (tmp +. z2) and _V = sqrt (tmp +. (1.-.e2)*.z2) in let z0 = (b**2.*.z)/.(elps.a *. _V) in - + let h = _U*.(1. -. b**2./.(elps.a *. _V)) and phi = atan ((z +. ep2*.z0)/.r ) and lambda = atan2 y x in - + ({posn_lat = phi; posn_long = lambda}, h) (* http://en.wikipedia.org/wiki/Geodetic_system @@ -607,14 +607,14 @@ let ned_of_ecef = fun r -> fun p -> let x_xr = p.(0) -. r.(0) - and y_yr = p.(1) -. r.(1) - and z_zr = p.(2) -. r.(2) in - + and y_yr = p.(1) -. r.(1) + and z_zr = p.(2) -. r.(2) in + let e = -.sin_lambda*.x_xr +. cos_lambda*.y_yr and n = -.sin_phiP*.cos_lambda*.x_xr -. sin_phiP*.sin_lambda*.y_yr +. cos_phiP*.z_zr and u = cos_phiP*.cos_lambda*.x_xr +. cos_phiP*.sin_lambda*.y_yr +. sin_phiP*.z_zr in [|n; e; -.u|] - + let ecef_of_ned = fun r -> let wgs84, _h = geo_of_ecef WGS84 r in let sin_lambda = sin wgs84.posn_long @@ -644,7 +644,7 @@ let bilinear = fun x1 y1 x2 y2 x y z11 z12 z21 z22 -> (** From gpsd geoid.c return geoid separtion (MSL-WGS84) in meters,given geographic coordinates*) -let geoid_data = +let geoid_data = [| (* 90S *) [|-30;-30;-30;-30;-30;-30;-30;-30;-30;-30;-30;-30;-30;-30;-30;-30;-30;-30;-30;-30;-30;-30;-30;-30;-30;-30; -30;-30;-30;-30;-30;-30;-30;-30;-30;-30;-30|]; (* 80S *) [|-53;-54;-55;-52;-48;-42;-38;-38;-29;-26;-26;-24;-23;-21;-19;-16;-12; -8; -4; -1; 1; 4; 4; 6; 5; 4; 2; -6;-15;-24;-33;-40;-48;-50;-53;-52;-53|]; (* 70S *) [|-61;-60;-61;-55;-49;-44;-38;-31;-25;-16; -6; 1; 4; 5; 4; 2; 6; 12; 16; 16; 17; 21; 20; 26; 26; 22; 16; 10; -1;-16;-29;-36;-46;-55;-54;-59;-61|]; @@ -668,7 +668,7 @@ let geoid_data = (* Online geoid calculator : http://earth-info.nga.mil/GandG/wgs84/gravitymod/egm96/intpt.html - + lat lon EGM96 this function 41. 1. 49.83 51.15 35 -140 -32.53 -29.5 @@ -698,11 +698,11 @@ let wgs84_hmsl = fun geo -> (float lon) (float lat) (float geoid_data.(ilat1).(ilon1)) (float geoid_data.(ilat1).(ilon2)) - (float geoid_data.(ilat2).(ilon1)) + (float geoid_data.(ilat2).(ilon1)) (float geoid_data.(ilat2).(ilon2)) let wgs84_distance = fun geo1 geo2 -> let e1 = ecef_of_geo WGS84 geo1 0. and e2 = ecef_of_geo WGS84 geo1 0. in ecef_distance e1 e2 - + diff --git a/sw/lib/ocaml/latlong.mli b/sw/lib/ocaml/latlong.mli index fdbdaed2fa..012d540ac0 100644 --- a/sw/lib/ocaml/latlong.mli +++ b/sw/lib/ocaml/latlong.mli @@ -2,7 +2,7 @@ * $Id$ * * Geographic conversion utilities - * + * * Copyright (C) 2004 CENA/ENAC, Pascal Brisset * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -107,7 +107,7 @@ val utm_of : geodesic -> geographic -> utm val of_utm : geodesic -> utm -> geographic (** Conversions between geographic and UTM. May raise Invalid_argument. *) -val utm_distance : utm -> utm -> fmeter +val utm_distance : utm -> utm -> fmeter val utm_add : utm -> (fmeter * fmeter) -> utm (** [add_utm utm (east,north)] *) @@ -126,7 +126,7 @@ val lbt_sub : lambert -> lambert -> (fmeter * fmeter) val of_string : string -> geographic -(** [of_string pos] Parses [pos] as "WGS84 45.678 1.2345", "UTM 500123 4500300 31" or "LBT2e 544945 1755355" *) +(** [of_string pos] Parses [pos] as "WGS84 45.678 1.2345", "UTM 500123 4500300 31" or "LBT2e 544945 1755355" *) val string_of : geographic -> string (** Returns a "WGS84" annotated string *) val deg_of_string : string -> float @@ -152,7 +152,7 @@ val get_gps_tow : unit -> int val unix_time_of_tow : ?week:int -> int -> float (** If week if not supplied, current one is assumed *) -type coordinates_kind = +type coordinates_kind = WGS84_dec | WGS84_dms | LBT2e diff --git a/sw/lib/ocaml/logpprz.ml b/sw/lib/ocaml/logpprz.ml index 0649ae5f67..d4d9052d5e 100644 --- a/sw/lib/ocaml/logpprz.ml +++ b/sw/lib/ocaml/logpprz.ml @@ -2,7 +2,7 @@ * $Id$ * * Reading logged timestamped messages - * + * * Copyright (C) 2003 Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) diff --git a/sw/lib/ocaml/mapCanvas.ml b/sw/lib/ocaml/mapCanvas.ml index f55da32fdd..e36af37747 100644 --- a/sw/lib/ocaml/mapCanvas.ml +++ b/sw/lib/ocaml/mapCanvas.ml @@ -2,7 +2,7 @@ * $Id$ * * Geographic display - * + * * Copyright (C) 2004-2006 ENAC, Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -45,7 +45,7 @@ let align = fun x a -> type meter = float let distance = fun (x1,y1) (x2,y2) -> sqrt ((x1-.x2)**2.+.(y1-.y2)**2.) - + let _ = Srtm.add_path "SRTM" let affine_pos_and_angle ?(z = 1.) xw yw angle = @@ -53,12 +53,12 @@ let affine_pos_and_angle ?(z = 1.) xw yw angle = let sin_a = sin angle in [| cos_a /. z; sin_a /. z; ~-. sin_a /. z; cos_a /. z; xw ; yw |] -type projection = +type projection = Mercator (* 1e-6 = 1 world unit, y axis reversed *) | UTM (* 1m = 1 world unit, y axis reversed *) | LambertIIe (* 1m = 1 world unit, y axis reversed *) -let string_of_projection = function +let string_of_projection = function UTM -> "UTM" | Mercator -> "Mercator" | LambertIIe -> "LBT2e" @@ -85,7 +85,7 @@ let set_opacity = fun pixbuf opacity -> assert(n_channels = 4); for i = 0 to h - 1 do for j = 0 to w - 1 do - let pos = n_channels* (i*w + j) + 3 in + let pos = n_channels* (i*w + j) + 3 in Gpointer.set_byte region ~pos opacity done done; @@ -93,7 +93,7 @@ let set_opacity = fun pixbuf opacity -> type drawing = - NotDrawing + NotDrawing | Rectangle of float*float | Panning of float*float @@ -129,12 +129,12 @@ let convex = fun l -> class type geographic = object method pos : Latlong.geographic end - + (** basic canvas with menubar ************************************************) - + (* world_unit: m:pixel at scale 1. *) -class basic_widget = fun ?(height=800) ?width ?(projection = Mercator) ?georef () -> +class basic_widget = fun ?(height=800) ?width ?(projection = Mercator) ?georef () -> let frame = GPack.vbox ~height ?width () in let top_bar = GPack.hbox ~packing:frame#pack () in @@ -162,7 +162,7 @@ class basic_widget = fun ?(height=800) ?width ?(projection = Mercator) ?georef ( let s2 = s/.2. and s4=s/.4. in let points = [|0.;0.; s2;s2; s4;s2; s4;s; -.s4;s; -.s4;s2; -.s2;s2|] in let props = [`FILL_COLOR "#a0a0ff"; `FILL_STIPPLE (Gdk.Bitmap.create_from_data ~width:2 ~height:2 "\002\001")] in - let arrow = fun x y angle -> + let arrow = fun x y angle -> let a = GnoCanvas.polygon still ~points ~props in a#affine_relative (affine_pos_and_angle x y angle); a in @@ -178,7 +178,7 @@ class basic_widget = fun ?(height=800) ?width ?(projection = Mercator) ?georef ( let utc_time = GnoCanvas.text ~x:0. ~y:0. ~props:[`TEXT "00:00:00"; `FILL_COLOR "green"; `ANCHOR `NW] still in object (self) - + (** GUI attributes *) val background = background @@ -197,16 +197,16 @@ class basic_widget = fun ?(height=800) ?width ?(projection = Mercator) ?georef ( let angle_rad = (Deg>>Rad) (90. +. angle_deg) in wind_sock#item#affine_absolute (affine_pos_and_angle 60. 60. angle_rad); wind_sock#label#set [`TEXT string] - - val adj = GData.adjustment - ~value:1. ~lower:0.005 ~upper:10. + + val adj = GData.adjustment + ~value:1. ~lower:0.005 ~upper:10. ~step_incr:0.25 ~page_incr:1.0 ~page_size:0. () - + method info = info (** other attributes *) - val mutable projection = projection + val mutable projection = projection val mutable georef = georef val mutable dragging = None val mutable drawing = NotDrawing @@ -228,13 +228,13 @@ class basic_widget = fun ?(height=800) ?width ?(projection = Mercator) ?georef ( and long = pos.LL.posn_long in (* Processing over positive longitudes *) let long = if long < 0. then long +. 2. *. pi else long in - (min min_lat lat, max max_lat lat, + (min min_lat lat, max max_lat lat, min min_long long, max max_long long)) fitted_objects (max_float, -.max_float, max_float, -. max_float) in (* Over 0° ? *) - let min_long, max_long = + let min_long, max_long = if max_long -. min_long > pi then (max_long -. 2. *. pi, min_long) else (min_long, max_long) in @@ -249,7 +249,7 @@ class basic_widget = fun ?(height=800) ?width ?(projection = Mercator) ?georef ( let zoom = min (float width/.(se_xw-.nw_xw)) (float height/.(se_yw-.nw_yw)) in self#zoom zoom; self#center c - + (** initialization of instance attributes *) initializer ( @@ -276,12 +276,12 @@ class basic_widget = fun ?(height=800) ?width ?(projection = Mercator) ?georef ( (* ignore (GnoCanvas.rect ~props:[`X1 (-25000000.); `Y1 (-25000000.); `X2 25000000.; `Y2 25000000.; `FILL_COLOR "black"] background); *) ) - + (** methods *) -(** accessors to instance variables *) +(** accessors to instance variables *) method current_zoom = adj#value method canvas = canvas method frame = frame @@ -291,7 +291,7 @@ class basic_widget = fun ?(height=800) ?width ?(projection = Mercator) ?georef ( method window_to_world = canvas#window_to_world method root = canvas#root method zoom_adj = adj - + (** following display functions can be redefined by subclasses. they do nothing in the basic_widget *) method display_geo = fun _s -> () @@ -302,8 +302,8 @@ class basic_widget = fun ?(height=800) ?width ?(projection = Mercator) ?georef ( method set_georef = fun wgs84 -> georef <- Some wgs84 method projection = string_of_projection projection - - + + method world_of = fun wgs84 -> assert (LL.valid_geo wgs84); match georef with @@ -350,12 +350,12 @@ class basic_widget = fun ?(height=800) ?width ?(projection = Mercator) ?georef ( and long = wx /. mercator_coeff +. georef.LL.posn_long in LL.make_geo lat long end - | None -> failwith "#of_world : no georef" + | None -> failwith "#of_world : no georef" method move_item = fun (item:GnomeCanvas.re_p GnoCanvas.item) wgs84 -> let (xw,yw) = self#world_of wgs84 in item#affine_absolute (affine_pos_and_angle xw yw 0.); - + method moveto = fun wgs84 -> let (xw, yw) = self#world_of wgs84 in let (xc, yc) = canvas#world_to_window xw yw in @@ -373,12 +373,12 @@ class basic_widget = fun ?(height=800) ?width ?(projection = Mercator) ?georef ( let xc = x + sx_w/2 and yc = y + sy_w/2 in let (xw, yw) = canvas#window_to_world (float xc) (float yc) in self#of_world (xw, yw) - - + + method display_pixbuf = fun ?opacity ((x1,y1), geo1) ((x2,y2), geo2) image -> let x1 = float x1 and x2 = float x2 and y1 = float y1 and y2 = float y2 in - let image = + let image = match opacity with None -> image | Some o -> set_opacity image o in @@ -396,7 +396,7 @@ class basic_widget = fun ?(height=800) ?width ?(projection = Mercator) ?georef ( method fix_bg_coords (xw, yw) = (** FIXME: how to do it properly ? *) let z = self#current_zoom in ((xw +. 25000000.) *. z, (yw +. 25000000.) *. z) - + method zoom = fun value -> adj#set_value value @@ -417,14 +417,14 @@ class basic_widget = fun ?(height=800) ?width ?(projection = Mercator) ?georef ( end else begin (* panning *) drawing <- Panning (xc, yc); let curs = Gdk.Cursor.create `FLEUR in - background#grab [`POINTER_MOTION; `BUTTON_RELEASE] curs + background#grab [`POINTER_MOTION; `BUTTON_RELEASE] curs (GdkEvent.Button.time ev) end; true end | `MOTION_NOTIFY ev -> begin - let xc = GdkEvent.Motion.x ev + let xc = GdkEvent.Motion.x ev and yc = GdkEvent.Motion.y ev in let (xw, yw) = self#window_to_world xc yc in let (xw, yw) = self#fix_bg_coords (xw, yw) in @@ -439,7 +439,7 @@ class basic_widget = fun ?(height=800) ?width ?(projection = Mercator) ?georef ( | Panning (x0, y0) -> let xc = GdkEvent.Motion.x ev and yc = GdkEvent.Motion.y ev in - let dx = self#current_zoom *. (xc -. x0) + let dx = self#current_zoom *. (xc -. x0) and dy = self#current_zoom *. (yc -. y0) in let (x, y) = canvas#get_scroll_offsets in canvas#scroll_to (x-truncate dx) (y-truncate dy) @@ -465,11 +465,11 @@ class basic_widget = fun ?(height=800) ?width ?(projection = Mercator) ?georef ( | _ -> false end | _ -> false - - + + method mouse_motion = fun ev -> if georef <> None then begin - let xc = GdkEvent.Motion.x ev + let xc = GdkEvent.Motion.x ev and yc = GdkEvent.Motion.y ev in let (xw, yw) = self#window_to_world xc yc in self#display_geo (self#of_world (xw,yw)); @@ -481,8 +481,8 @@ class basic_widget = fun ?(height=800) ?width ?(projection = Mercator) ?georef ( false method switch_background = fun x -> if x then background#show () else background#hide () - - + + method key_press = fun ev -> let (x, y) = canvas#get_scroll_offsets in match GdkEvent.Key.keyval ev with @@ -491,10 +491,10 @@ class basic_widget = fun ?(height=800) ?width ?(projection = Mercator) ?georef ( | k when k = GdkKeysyms._Left -> canvas#scroll_to (x-pan_step) y ; true | k when k = GdkKeysyms._Right -> canvas#scroll_to (x+pan_step) y ; true | k when k = GdkKeysyms._f -> self#fit_to_window () ; true - | k when k = GdkKeysyms._Page_Up -> + | k when k = GdkKeysyms._Page_Up -> self#zoom_up (); true - | k when k = GdkKeysyms._Page_Down -> + | k when k = GdkKeysyms._Page_Down -> self#zoom_down (); true | _ -> false @@ -505,7 +505,7 @@ class basic_widget = fun ?(height=800) ?width ?(projection = Mercator) ?georef ( method zoom_in_place = fun z -> let (x, y) = canvas#get_scroll_offsets in canvas#scroll_to (x+last_mouse_x) (y+last_mouse_y); - + adj#set_value z; let (x, y) = canvas#get_scroll_offsets in @@ -515,7 +515,7 @@ class basic_widget = fun ?(height=800) ?width ?(projection = Mercator) ?georef ( self#zoom_in_place (adj#value*.zoom_factor); method zoom_down () = self#zoom_in_place (adj#value/.zoom_factor); - + method any_event = let rec last_view = ref (0,0,0,0) in fun ev -> @@ -541,8 +541,8 @@ class basic_widget = fun ?(height=800) ?width ?(projection = Mercator) ?georef ( Invalid_argument "ml_lookup_from_c" -> (* Raised GdkEvent.get_type *) false - - + + method segment = fun ?(group = canvas#root) ?(width=1) ?fill_color geo1 geo2 -> let (x1, y1) = self#world_of geo1 and (x2, y2) = self#world_of geo2 in @@ -553,7 +553,7 @@ class basic_widget = fun ?(height=800) ?width ?(projection = Mercator) ?georef ( method arc = fun ?(nb_points=5) ?(width=1) ?fill_color (xw,yw) r a1 a2 -> let c = {G2D.x2D = xw; y2D = yw } in let pts = G2D.arc ~nb_points c r a1 a2 in - let points = Array.init (2*nb_points) + let points = Array.init (2*nb_points) (fun j -> let i = j / 2 in if j = i * 2 then pts.(i).G2D.x2D else pts.(i).G2D.y2D) in @@ -562,7 +562,7 @@ class basic_widget = fun ?(height=800) ?width ?(projection = Mercator) ?georef ( l#show (); l - + method circle = fun ?(group = canvas#root) ?(width=1) ?fill_color ?(color="black") geo radius -> let (x, y) = self#world_of geo in @@ -570,7 +570,7 @@ class basic_widget = fun ?(height=800) ?width ?(projection = Mercator) ?georef ( let utm = LL.utm_of LL.WGS84 geo in let geo_east = LL.of_utm LL.WGS84 (LL.utm_add utm (radius, 0.)) in let (xe, _) = self#world_of geo_east in - let rad = xe -. x in + let rad = xe -. x in let l = GnoCanvas.ellipse ?fill_color ~props:[`WIDTH_PIXELS width; `OUTLINE_COLOR color] ~x1:(x-.rad) ~y1:(y -.rad) ~x2:(x +.rad) ~y2:(y+.rad) group in l#show (); l @@ -610,14 +610,14 @@ class basic_widget = fun ?(height=800) ?width ?(projection = Mercator) ?georef ( ignore (west_arrow#connect#event left); ignore (east_arrow#connect#event right) end - + (** canvas which inherits from basic_widget ******************** * - labels for displaying mouse coordinates on the map * * - background switching * ****************************************************************) - + class widget = fun ?(height=800) ?(srtm=false) ?width ?projection ?georef () -> let srtm = GMenu.check_menu_item ~label:"SRTM" ~active:srtm () in let lbl_xy = GMisc.label () @@ -650,7 +650,7 @@ class widget = fun ?(height=800) ?(srtm=false) ?width ?projection ?georef () -> let bg_menu = my_check_menu_item "Background" ~active:true ~callback:self#switch_background ~packing:self#file_menu#append () in let tooltips = GData.tooltips () in - + let b = GButton.button ~packing:toolbar#add () in ignore (b#connect#clicked (fun _ -> bg_menu#activate ())); let pixbuf = GdkPixbuf.from_file (Env.gcs_icons_path // "switch_background.png") in @@ -685,7 +685,7 @@ class widget = fun ?(height=800) ?(srtm=false) ?width ?projection ?georef () -> if flag then (** Create and show *) let g = GnoCanvas.group self#canvas#root in let u0 = LL.utm_of LL.WGS84 (self#get_center ()) in - let u0 = { LL.utm_x = align u0.LL.utm_x 1000; + let u0 = { LL.utm_x = align u0.LL.utm_x 1000; LL.utm_zone = u0.LL.utm_zone; LL.utm_y = align u0.LL.utm_y 1000 } in for i = -size_utm_grid to size_utm_grid do @@ -708,7 +708,7 @@ class widget = fun ?(height=800) ?(srtm=false) ?width ?projection ?georef () -> done; utm_grid_group <- Some g | Some g -> if flag then g#show () else g#hide () - + (** ground altitude extraction from srtm data *) method altitude = fun wgs84 -> try @@ -730,14 +730,14 @@ class widget = fun ?(height=800) ?(srtm=false) ?width ?projection ?georef () -> method display_xy = fun s -> lbl_xy#set_text s method display_geo = fun geo -> lbl_geo#set_text (LL.string_of_coordinates selected_georef geo) - + method display_alt = fun wgs84 -> if srtm#active then lbl_alt#set_text (sprintf " SRTM:%dm"(self#altitude wgs84)) - + method display_group = fun s -> lbl_group#set_text s - + method goto = fun () -> match GToolbox.input_string ~title:"Geo ref" ~text:"WGS84 " "Geo ref" with Some s -> @@ -746,5 +746,5 @@ class widget = fun ?(height=800) ?(srtm=false) ?width ?projection ?georef () -> self#set_georef wgs84; self#moveto wgs84 | None -> () - + end diff --git a/sw/lib/ocaml/mapCanvas.mli b/sw/lib/ocaml/mapCanvas.mli index 61462f102b..5e98422b42 100644 --- a/sw/lib/ocaml/mapCanvas.mli +++ b/sw/lib/ocaml/mapCanvas.mli @@ -2,7 +2,7 @@ * $Id$ * * Geographic display - * + * * Copyright (C) 2004-2008 ENAC, Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) diff --git a/sw/lib/ocaml/mapFP.ml b/sw/lib/ocaml/mapFP.ml index 87c019ff8f..f16be928de 100644 --- a/sw/lib/ocaml/mapFP.ml +++ b/sw/lib/ocaml/mapFP.ml @@ -2,7 +2,7 @@ * $Id$ * * Displaying and editing a flight plan on a MapCanvas - * + * * Copyright (C) 2004-2006 ENAC, Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -113,7 +113,7 @@ let is_relative_waypoint = fun node -> let absolute_coords = fun wp -> let wgs84 = wp#pos in - [ "lat", sof6 ((Rad>>Deg) wgs84.posn_lat); + [ "lat", sof6 ((Rad>>Deg) wgs84.posn_lat); "lon", sof6 ((Rad>>Deg) wgs84.posn_long) ] @@ -144,7 +144,7 @@ let update_xml = fun xml_tree utm0 wp id -> - + let new_wp = fun ?(editable = false) (geomap:MapCanvas.widget) xml_tree waypoints utm_ref ?(alt = 0.) node -> let float_attrib = fun a -> float_of_string (XmlEdit.attrib node a) in @@ -156,7 +156,7 @@ let new_wp = fun ?(editable = false) (geomap:MapCanvas.widget) xml_tree waypoint let wp = MapWaypoints.waypoint ~show waypoints ~name ~alt wgs84 in geomap#register_to_fit (wp:>MapCanvas.geographic); XmlEdit.connect node (update_wp utm_ref wp); - XmlEdit.connect node (update_wp_refs (ref name) xml_tree); + XmlEdit.connect node (update_wp_refs (ref name) xml_tree); let id = XmlEdit.id node in if editable then wp#connect (fun () -> update_xml xml_tree utm_ref wp id); @@ -191,7 +191,7 @@ let wgs84_of_kml_point = fun s -> and long = float_of_string long in {posn_lat = (Deg>>Rad) lat; posn_long = (Deg>>Rad) long} | _ -> failwith (Printf.sprintf "wgs84_of_kml_point: %s" s) - + (** It should be somewhere else ! *) let display_kml = fun ?group color geomap xml -> @@ -210,16 +210,16 @@ let display_kml = fun ?group color geomap xml -> display_lines ?group color geomap (Array.of_list points) | _ -> failwith "coordinates expected" end - - | "folder" -> + + | "folder" -> List.iter loop (Xml.children child) | _ -> () in List.iter loop (Xml.children document) with Xml.Not_element xml -> failwith (Xml.to_string xml) - - - + + + class flight_plan = fun ?format_attribs ?editable ~show_moved geomap color fp_dtd xml -> (** Xml Editor *) let xml_tree_view, xml_window = XmlEdit.create ?format_attribs ?editable (Dtd.parse_file fp_dtd) xml in @@ -307,7 +307,7 @@ class flight_plan = fun ?format_attribs ?editable ~show_moved geomap color fp_dt object method georef = ref_wgs84 method window = xml_window - method destroy () = + method destroy () = wpts_group#group#destroy (); xml_window#destroy () method show () = wpts_group#group#show () @@ -341,7 +341,7 @@ class flight_plan = fun ?format_attribs ?editable ~show_moved geomap color fp_dt end else XmlEdit.set_background ~all:true b "white") (XmlEdit.children blocks) - + method add_waypoint (geo:geographic) = let wpt_names = List.map (fun n -> XmlEdit.attrib n "name") (XmlEdit.children xml_wpts) in let name = new_gensym "wp" wpt_names in @@ -364,7 +364,7 @@ class flight_plan = fun ?format_attribs ?editable ~show_moved geomap color fp_dt ) path - method connect_activated = fun cb -> XmlEdit.connect_activated xml_tree_view cb + method connect_activated = fun cb -> XmlEdit.connect_activated xml_tree_view cb initializer ( (** Create a graphic waypoint when it is created from the xml editor *) diff --git a/sw/lib/ocaml/mapFP.mli b/sw/lib/ocaml/mapFP.mli index bc16517cff..8778b5789a 100644 --- a/sw/lib/ocaml/mapFP.mli +++ b/sw/lib/ocaml/mapFP.mli @@ -2,7 +2,7 @@ * $Id$ * * Displaying and editing a flight plan on a MapCanvas - * + * * Copyright (C) 2004-2006 ENAC, Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) diff --git a/sw/lib/ocaml/mapGoogle.ml b/sw/lib/ocaml/mapGoogle.ml index e02584f303..8bfc4fbbed 100644 --- a/sw/lib/ocaml/mapGoogle.ml +++ b/sw/lib/ocaml/mapGoogle.ml @@ -2,7 +2,7 @@ * $Id$ * * Displaying Google Maps on a MapCanvas object - * + * * Copyright (C) 2004-2006 ENAC, Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -32,7 +32,7 @@ open Printf module LL = Latlong (** Quadtreee of displayed tiles *) -type tiles_tree = +type tiles_tree = Empty | Tile | Node of tiles_tree array @@ -62,12 +62,12 @@ let add_tile = fun tile_key -> let rec loop = fun i tree j -> if i < String.length tile_key then match tree.(j) with - Empty -> + Empty -> let sons = Array.create 4 Empty in tree.(j) <- Node sons; loop (i+1) sons (index_of tile_key.[i]) | Tile -> () (* Already there *) - | Node sons -> + | Node sons -> loop (i+1) sons (index_of tile_key.[i]) else tree.(j) <- Tile in @@ -80,11 +80,11 @@ let display_the_tile = fun (geomap:MapCanvas.widget) tile jpg_file -> let north_lat = south_lat +. tile.Gm.height and east_long = west_long +. tile.Gm.width in let ne = LL.make_geo north_lat east_long in - + let (tx, ty) = Gm.tile_size in try let pixbuf = GdkPixbuf.from_file jpg_file in - ignore (GMain.Idle.add (fun () -> + ignore (GMain.Idle.add (fun () -> let map = geomap#display_pixbuf ((0,tx), tile.Gm.sw_corner) ((ty,0),ne) pixbuf in map#raise 1; false)); @@ -96,7 +96,7 @@ let display_the_tile = fun (geomap:MapCanvas.widget) tile jpg_file -> Sys.remove jpg_file | _ -> () - + (** Displaying the tile around the given point *) let display_tile = fun (geomap:MapCanvas.widget) wgs84 -> @@ -106,7 +106,7 @@ let display_tile = fun (geomap:MapCanvas.widget) wgs84 -> if not (mem_tile key) then let (tile, jpg_file) = Gm.get_tile wgs84 1 in display_the_tile geomap tile jpg_file - + exception New_displayed of int (** [New_displayed zoom] Raised when a new is loadded *) @@ -146,7 +146,7 @@ let fill_window = fun (geomap:MapCanvas.widget) -> | Node sons -> let continue = fun j tw ts -> loop tw ts tsize2 sons j (zoom-1) (key^String.make 1 (char_of j)) in - + continue 0 twest (tsouth+.tsize2); continue 1 (twest+.tsize2) (tsouth+.tsize2); continue 2 (twest+.tsize2) tsouth; @@ -196,7 +196,7 @@ let pixbuf = fun sw ne -> raise (To_copy (19-String.length tile.Gm.key, image)) else begin let continue = fun j tw ts -> - loop tw ts tsize2 (zoom-1) (key^String.make 1 (char_of j)) in + loop tw ts tsize2 (zoom-1) (key^String.make 1 (char_of j)) in continue 0 twest (tsouth+.tsize2); continue 1 (twest+.tsize2) (tsouth+.tsize2); continue 2 (twest+.tsize2) tsouth; diff --git a/sw/lib/ocaml/mapGoogle.mli b/sw/lib/ocaml/mapGoogle.mli index 6bd4f26ea5..1b7f1095ca 100644 --- a/sw/lib/ocaml/mapGoogle.mli +++ b/sw/lib/ocaml/mapGoogle.mli @@ -2,7 +2,7 @@ * $Id$ * * Displaying Google Maps on a MapCanvas object - * + * * Copyright (C) 2004-2006 ENAC, Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) diff --git a/sw/lib/ocaml/mapIGN.ml b/sw/lib/ocaml/mapIGN.ml index 079523ea3d..539cb51522 100644 --- a/sw/lib/ocaml/mapIGN.ml +++ b/sw/lib/ocaml/mapIGN.ml @@ -2,7 +2,7 @@ * $Id$ * * Displaying IGN Maps on a MapCanvas object - * + * * Copyright (C) 2004-2006 ENAC, Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -39,7 +39,7 @@ let display_tile = fun (geomap:MapCanvas.widget) wgs84 -> if not (mem_tile tile) then let jpg_file = IGN.get_tile tile in - + let (sx,sy) = IGN.tile_size in let pixbuf = GdkPixbuf.from_file jpg_file in diff --git a/sw/lib/ocaml/mapIGN.mli b/sw/lib/ocaml/mapIGN.mli index e6fc88fe97..0a816cf568 100644 --- a/sw/lib/ocaml/mapIGN.mli +++ b/sw/lib/ocaml/mapIGN.mli @@ -2,7 +2,7 @@ * $Id$ * * Displaying IGN Maps on a MapCanvas object - * + * * Copyright (C) 2004-2006 ENAC, Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) diff --git a/sw/lib/ocaml/mapTrack.ml b/sw/lib/ocaml/mapTrack.ml index 1967697524..2bdbc979c0 100644 --- a/sw/lib/ocaml/mapTrack.ml +++ b/sw/lib/ocaml/mapTrack.ml @@ -2,7 +2,7 @@ * $Id$ * * Track objects - * + * * Copyright (C) 2004 CENA/ENAC, Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -69,20 +69,20 @@ class track = fun ?(name="Noname") ?(size = 500) ?(color="red") (geomap:MapCanva let carrot = GnoCanvas.group group in let _ac_carrot = ignore (GnoCanvas.polygon ~points:[|0.;0.;-5.;-10.;5.;-10.|] ~props:[`WIDTH_UNITS 1.;`FILL_COLOR "orange"; `OUTLINE_COLOR "orange"; `FILL_STIPPLE (Gdk.Bitmap.create_from_data ~width:2 ~height:2 "\002\001")] carrot) in - + let cam = GnoCanvas.group group in - + (** rectangle representing the field covered by the cam *) let _ac_cam_targeted = ignore ( GnoCanvas.ellipse ~x1: (-. 2.5) ~y1: (-. 2.5 ) ~x2: 2.5 ~y2: 2.5 ~fill_color:color ~props:[`WIDTH_UNITS 1.; `OUTLINE_COLOR color; `FILL_STIPPLE (Gdk.Bitmap.create_from_data ~width:2 ~height:2 "\002\001")] cam) in - + let mission_target = GnoCanvas.group group in - + (** red circle : target of the mission *) let ac_mission_target = GnoCanvas.ellipse ~x1: (-5.) ~y1: (-5.) ~x2: 5. ~y2: 5. ~fill_color:"red" ~props:[`WIDTH_UNITS 1.; `OUTLINE_COLOR "red"; `FILL_STIPPLE (Gdk.Bitmap.create_from_data ~width:2 ~height:2 "\002\001")] mission_target in let _ = ac_mission_target#hide () in - + (** data at map scale *) let max_cam_half_height_scaled = 10000.0 in let max_oblic_distance_scaled = 10000.0 in @@ -91,7 +91,7 @@ class track = fun ?(name="Noname") ?(size = 500) ?(color="red") (geomap:MapCanva let _desired_circle = GnoCanvas.ellipse group and _desired_segment = GnoCanvas.line group in - + object (self) val mutable top = 0 val mutable color = color @@ -144,9 +144,9 @@ class track = fun ?(name="Noname") ?(size = 500) ?(color="red") (geomap:MapCanva mission_target#hide () end - method update_ap_status = fun time -> + method update_ap_status = fun time -> last_flight_time <- time - method set_params_state = fun b -> + method set_params_state = fun b -> params_on <- b; if not b then (* Reset to the default simple label *) ac_label#set [`TEXT name; `Y 25.] @@ -194,7 +194,7 @@ class track = fun ?(name="Noname") ?(size = 500) ?(color="red") (geomap:MapCanva let last_height = self#height () in ac_label#set [`TEXT (sprintf "%s\n%+.0f m\n%.1f m/s" name last_height last_speed); `Y 70. ] end; - + ac_label#affine_absolute (affine_pos_and_angle geomap#zoom_adj#value xw yw 0.); self#add_point wgs84 altitude; @@ -250,7 +250,7 @@ class track = fun ?(name="Noname") ?(size = 500) ?(color="red") (geomap:MapCanva let (x1, y1) = geomap#world_of geo1 and (x2, y2) = geomap#world_of geo2 in zone#set [`X1 x1; `Y1 y1; `X2 x2; `Y2 y2; `OUTLINE_COLOR "#ffc0c0"; `WIDTH_PIXELS 2] - + (** moves the rectangle representing the field covered by the camera *) method move_cam = fun cam_wgs84 mission_target_wgs84 -> match last, cam_on with @@ -258,22 +258,22 @@ class track = fun ?(name="Noname") ?(size = 500) ?(color="red") (geomap:MapCanva let (cam_xw, cam_yw) = geomap#world_of cam_wgs84 and (last_xw, last_yw) = geomap#world_of last_ac and last_height_scaled = self#height () in - + let pt1 = { G2d.x2D = last_xw; y2D = last_yw} in let pt2 = { G2d.x2D = cam_xw ; y2D = cam_yw } in - + (** y axis is downwards so North vector is as follows: *) let vect_north = { G2d.x2D = 0.0 ; y2D = -1.0 } in let d = G2d.distance pt1 pt2 in - let cam_heading = + let cam_heading = if d > min_distance_scaled then let cam_vect_normalized = (G2d.vect_normalize (G2d.vect_make pt1 pt2)) in if (G2d.dot_product vect_north cam_vect_normalized) > 0.0 then norm_angle_360 ( G2d.rad2deg (asin (G2d.cross_product vect_north cam_vect_normalized))) else norm_angle_360 ( G2d.rad2deg (G2d.m_pi -. asin (G2d.cross_product vect_north cam_vect_normalized))) else last_heading in - let (angle_of_view, oblic_distance) = - if last_height_scaled < min_height_scaled then + let (angle_of_view, oblic_distance) = + if last_height_scaled < min_height_scaled then (half_pi, max_oblic_distance_scaled) else let oav = atan ( d /. last_height_scaled) in @@ -290,12 +290,12 @@ class track = fun ?(name="Noname") ?(size = 500) ?(color="red") (geomap:MapCanva `Y1 (-. cam_field_half_height_1); `X2 (cam_field_half_width); `Y2(cam_field_half_height_2); - `OUTLINE_COLOR color]; + `OUTLINE_COLOR color]; cam#affine_absolute (affine_pos_and_angle 1.0 cam_xw cam_yw cam_heading); let (mission_target_xw, mission_target_yw) = geomap#world_of mission_target_wgs84 in mission_target#affine_absolute (affine_pos_and_angle geomap#zoom_adj#value mission_target_xw mission_target_yw 0.0) | _ -> () - + method zoom = fun z -> let a = aircraft#i2w_affine in let z' = sqrt (a.(0)*.a.(0)+.a.(1)*.a.(1)) in @@ -304,7 +304,7 @@ class track = fun ?(name="Noname") ?(size = 500) ?(color="red") (geomap:MapCanva method resize = fun new_size -> let a = Array.create new_size empty in - let size = Array.length segments in + let size = Array.length segments in let m = min new_size size in let j = ref ((top - m + size) mod size) in for i = 0 to m - 1 do @@ -320,7 +320,7 @@ class track = fun ?(name="Noname") ?(size = 500) ?(color="red") (geomap:MapCanva method size = Array.length segments - initializer - ignore(geomap#zoom_adj#connect#value_changed + initializer + ignore(geomap#zoom_adj#connect#value_changed (fun () -> self#zoom geomap#zoom_adj#value)) end diff --git a/sw/lib/ocaml/mapTrack.mli b/sw/lib/ocaml/mapTrack.mli index 7b36163b9f..0d9a7720f9 100644 --- a/sw/lib/ocaml/mapTrack.mli +++ b/sw/lib/ocaml/mapTrack.mli @@ -2,7 +2,7 @@ * $Id$ * * Track objects - * + * * Copyright (C) 2004-2010 CENA/ENAC, Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) diff --git a/sw/lib/ocaml/mapWaypoints.ml b/sw/lib/ocaml/mapWaypoints.ml index e6c874de84..399b134858 100644 --- a/sw/lib/ocaml/mapWaypoints.ml +++ b/sw/lib/ocaml/mapWaypoints.ml @@ -2,7 +2,7 @@ * $Id$ * * Waypoints objects - * + * * Copyright (C) 2004 CENA/ENAC, Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -55,14 +55,14 @@ class waypoint = fun ?(show = true) (wpts_group:group) (name :string) ?(alt=0.) let wpt_group = GnoCanvas.group wpts_group#group in - let item = + let item = GnoCanvas.rect wpt_group ~x1:(-.s) ~y1:(-.s) ~x2:s ~y2:s ~props:[`FILL_COLOR color; `OUTLINE_COLOR "black"] in let anim = function None -> Some (Glib.Timeout.add 500 (fun () -> Gdk.X.beep (); item#affine_relative rotation_45; true)) | Some x -> Some x in - + object (self) val mutable x0 = 0. @@ -91,7 +91,7 @@ class waypoint = fun ?(show = true) (wpts_group:group) (name :string) ?(alt=0.) method alt = alt method label = label method xy = let a = wpt_group#i2w_affine in (a.(4), a.(5)) - method move dx dy = + method move dx dy = wpt_group#move dx dy; wpt_group#raise_to_top () method edit = @@ -136,7 +136,7 @@ class waypoint = fun ?(show = true) (wpts_group:group) (name :string) ?(alt=0.) let minus10= GButton.button ~label:"-10" ~packing:ha#add () in (* let ea = GEdit.entry ~text:(string_of_float alt) ~packing:ha#add () in *) let ea = GEdit.spin_button ~rate:0. ~digits:2 ~width:50 ~packing:ha#add () - and adj = GData.adjustment + and adj = GData.adjustment ~value:alt ~lower:(-100.) ~upper:10000. ~step_incr:1. ~page_incr:10.0 ~page_size:0. () in ea#set_adjustment adj; @@ -176,7 +176,7 @@ class waypoint = fun ?(show = true) (wpts_group:group) (name :string) ?(alt=0.) (** Delete button for editable waypoints *) if editable then begin - let delete = GButton.button ~stock:`DELETE ~packing: dhbx#add () in + let delete = GButton.button ~stock:`DELETE ~packing: dhbx#add () in let delete_callback = fun () -> dialog#destroy (); self#delete (); @@ -219,7 +219,7 @@ class waypoint = fun ?(show = true) (wpts_group:group) (name :string) ?(alt=0.) and y = GdkEvent.Button.y ev in x0 <- x; y0 <- y; let curs = Gdk.Cursor.create `FLEUR in - item#grab [`POINTER_MOTION; `BUTTON_RELEASE] curs + item#grab [`POINTER_MOTION; `BUTTON_RELEASE] curs (GdkEvent.Button.time ev) | _ -> () end @@ -229,7 +229,7 @@ class waypoint = fun ?(show = true) (wpts_group:group) (name :string) ?(alt=0.) motion <- true; let x = GdkEvent.Motion.x ev and y = GdkEvent.Motion.y ev in - let dx = geomap#current_zoom *. (x-. x0) + let dx = geomap#current_zoom *. (x-. x0) and dy = geomap#current_zoom *. (y -. y0) in self#move dx dy ; updated (); @@ -247,18 +247,18 @@ class waypoint = fun ?(show = true) (wpts_group:group) (name :string) ?(alt=0.) true initializer ignore(item#connect#event self#event) method moved = moved <> None - method reset_moved () = + method reset_moved () = match moved with None -> () | Some x -> Glib.Timeout.remove x; item#affine_absolute rotation_45; moved <- None - + method deleted = deleted method item = item method pos = geomap#of_world self#xy - method set ?altitude ?(update=false) wgs84 = + method set ?altitude ?(update=false) wgs84 = let (xw, yw) = geomap#world_of wgs84 and (xw0, yw0) = self#xy and z = geomap#zoom_adj#value in diff --git a/sw/lib/ocaml/mapWaypoints.mli b/sw/lib/ocaml/mapWaypoints.mli index 81d0b18825..8e4bb6b5f2 100644 --- a/sw/lib/ocaml/mapWaypoints.mli +++ b/sw/lib/ocaml/mapWaypoints.mli @@ -2,7 +2,7 @@ * $Id$ * * Waypoints objects - * + * * Copyright (C) 2004 CENA/ENAC, Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) diff --git a/sw/lib/ocaml/maps_support.ml b/sw/lib/ocaml/maps_support.ml index 9e1dbc5652..e9e109f600 100644 --- a/sw/lib/ocaml/maps_support.ml +++ b/sw/lib/ocaml/maps_support.ml @@ -2,7 +2,7 @@ * $Id$ * * Support for obtaining google maps api information at runtime - * + * * Copyright (C) 2011 Stephen Dwyer * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) let google_ver = ref 0 diff --git a/sw/lib/ocaml/ocaml_tools.ml b/sw/lib/ocaml/ocaml_tools.ml index 7d98f49a1d..95a9428553 100644 --- a/sw/lib/ocaml/ocaml_tools.ml +++ b/sw/lib/ocaml/ocaml_tools.ml @@ -20,13 +20,13 @@ * 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. + * Boston, MA 02111-1307, USA. * *) let pi = 3.14159265358979323846;; -let open_compress file = +let open_compress file = if Filename.check_suffix file "gz" or Filename.check_suffix file "Z" or Filename.check_suffix file "zip" or Filename.check_suffix file "ZIP" then Unix.open_process_in ("gunzip -c "^file) @@ -48,7 +48,7 @@ let find_file = fun path file -> loop_ext extensions in loop_path path -let regexp_plus_less = Str.regexp "[+-]" +let regexp_plus_less = Str.regexp "[+-]" let affine_transform = fun format -> (* Split after removing blank spaces *) let split = Str.full_split regexp_plus_less (Str.global_replace (Str.regexp "[ \t]+") "" format) in diff --git a/sw/lib/ocaml/ocaml_tools.mli b/sw/lib/ocaml/ocaml_tools.mli index dcf391c5ae..26fe595b9b 100644 --- a/sw/lib/ocaml/ocaml_tools.mli +++ b/sw/lib/ocaml/ocaml_tools.mli @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -30,7 +30,7 @@ val open_compress : string -> in_channel val find_file : string list -> string -> string (** [find_file path file] Search for [file] or a compressed extension of it in - [path]. Returns the first occurence found. Checked extensions are + [path]. Returns the first occurence found. Checked extensions are gz, Z, bz2, zip and ZIP. Raises [Not_found] if none is found *) diff --git a/sw/lib/ocaml/os_calls.ml b/sw/lib/ocaml/os_calls.ml index 5255d96ba4..99139cb1e8 100644 --- a/sw/lib/ocaml/os_calls.ml +++ b/sw/lib/ocaml/os_calls.ml @@ -2,7 +2,7 @@ * $Id$ * * Support for obtaining os specific information at runtime - * + * * Copyright (C) 2011 Eric Parsonage and Stephen Dwyer * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) let current_os = ref "not_set" diff --git a/sw/lib/ocaml/papget.ml b/sw/lib/ocaml/papget.ml index 586f428724..3aea2c8d53 100644 --- a/sw/lib/ocaml/papget.ml +++ b/sw/lib/ocaml/papget.ml @@ -2,7 +2,7 @@ * $Id$ * * Paparazzi widgets - * + * * Copyright (C) 2008 ENAC * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -71,7 +71,7 @@ class message_field = fun ?sender ?(class_name="telemetry") msg_name field_descr initializer let module P = Pprz.Messages (struct let name = class_name end) in - let process_message = fun _sender values -> + let process_message = fun _sender values -> let (field_name, index) = base_and_index field_descr in let value = match Pprz.assoc field_name values with @@ -161,7 +161,7 @@ class expression = fun ?(extra_functions=[]) expr -> -class type canvas_item_type = +class type canvas_item_type = object method connect : unit -> unit method deleted : bool @@ -171,7 +171,7 @@ class type canvas_item_type = method update : string -> unit method xy : float * float end - + class canvas_item = fun ~config canvas_renderer -> let canvas_renderer = (canvas_renderer :> PR.t) in @@ -182,10 +182,10 @@ class canvas_item = fun ~config canvas_renderer -> val mutable y_press = 0. val mutable deleted = false val mutable dialog_widget = None - + method renderer = renderer - method xy = + method xy = let (x0, y0) = renderer#item#i2w 0. 0. in renderer#item#parent#w2i x0 y0 @@ -211,7 +211,7 @@ class canvas_item = fun ~config canvas_renderer -> let (xi, yi) = renderer#item#parent#w2i x0 y0 in x_press <- xm -. xi; y_press <- ym -. yi; let curs = Gdk.Cursor.create `FLEUR in - item#grab [`POINTER_MOTION; `BUTTON_RELEASE] curs + item#grab [`POINTER_MOTION; `BUTTON_RELEASE] curs (GdkEvent.Button.time ev) | _ -> () end; @@ -246,14 +246,14 @@ class canvas_item = fun ~config canvas_renderer -> let strings = List.map fst tagged_renderers in let (combo, (tree, column)) = GEdit.combo_box_text ~packing:dialog#box_item_chooser#add ~strings () in - tree#foreach + tree#foreach (fun _path row -> if tree#get ~row ~column = renderer#tag then begin combo#set_active_iter (Some row); true end else false); - + let connect_item_editor = fun () -> begin (* Remove the current child ? *) try @@ -285,7 +285,7 @@ class canvas_item = fun ~config canvas_renderer -> (* Connect the buttons *) ignore (dialog#button_delete#connect#clicked - (fun () -> + (fun () -> dialog#papget_editor#destroy (); renderer#item#destroy (); deleted <- true)); @@ -309,7 +309,7 @@ class canvas_float_item = fun ~config canvas_renderer -> inherit canvas_item ~config canvas_renderer as super val mutable affine = "1" - + method update = fun value -> let scaled_value = try @@ -367,7 +367,7 @@ class canvas_display_float_item = fun ~config (msg_obj:value) (canvas_renderer:P class canvas_clickable_item = fun type_ properties callback canvas_renderer -> object inherit canvas_item ~config:properties canvas_renderer as item - method edit = fun () -> callback () + method edit = fun () -> callback () method config = fun () -> let props = renderer#config () in diff --git a/sw/lib/ocaml/papget.mli b/sw/lib/ocaml/papget.mli index d939ff64ea..e957066cb5 100644 --- a/sw/lib/ocaml/papget.mli +++ b/sw/lib/ocaml/papget.mli @@ -2,7 +2,7 @@ * $Id$ * * Paparazzi widgets - * + * * Copyright (C) 2008 ENAC * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -50,7 +50,7 @@ class expression : Expr_syntax.expression -> value -class type canvas_item_type = +class type canvas_item_type = object method connect : unit -> unit method deleted : bool diff --git a/sw/lib/ocaml/papget_common.ml b/sw/lib/ocaml/papget_common.ml index c3a3995e3d..9840a24d10 100644 --- a/sw/lib/ocaml/papget_common.ml +++ b/sw/lib/ocaml/papget_common.ml @@ -2,7 +2,7 @@ * $Id$ * * Commons for papgets - * + * * Copyright (C) 2008 ENAC * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -37,7 +37,7 @@ let property = fun name value -> Xml.Element("property", [ "name", name; "value", value ], []) let xml = fun type_ display_ properties -> - Xml.Element ("papget", ["type", type_; "display", display_], + Xml.Element ("papget", ["type", type_; "display", display_], List.map (fun (x, y) -> property x y) properties) let float_property = fun name value -> diff --git a/sw/lib/ocaml/papget_common.mli b/sw/lib/ocaml/papget_common.mli index 70af0a41ac..f4df16377a 100644 --- a/sw/lib/ocaml/papget_common.mli +++ b/sw/lib/ocaml/papget_common.mli @@ -2,7 +2,7 @@ * $Id$ * * Commons for papgets - * + * * Copyright (C) 2008 ENAC * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) diff --git a/sw/lib/ocaml/papget_renderer.ml b/sw/lib/ocaml/papget_renderer.ml index 9f8b64aeca..2c9af22248 100644 --- a/sw/lib/ocaml/papget_renderer.ml +++ b/sw/lib/ocaml/papget_renderer.ml @@ -2,7 +2,7 @@ * $Id$ * * Paparazzi widget renderers - * + * * Copyright (C) 2008-2009 ENAC, Pascal Brisset * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -52,7 +52,7 @@ class canvas_text = fun ?(config=[]) canvas_group x y -> val mutable format = PC.get_prop "format" config "%.2f" val mutable size = float_of_string (PC.get_prop "size" config "15.") val mutable color = PC.get_prop "color" config "green" - + method tag = "Text" method item = (group :> movable_item) method config = fun () -> @@ -73,7 +73,7 @@ class canvas_text = fun ?(config=[]) canvas_group x y -> (* Initialize the entries *) text_editor#entry_format#set_text format; text_editor#spinbutton_size#set_value size; - + (* Connect the entries *) let callback = fun () -> format <- text_editor#entry_format#text in @@ -103,9 +103,9 @@ class canvas_ruler = fun ?(config=[]) canvas_group x y -> let root = GnoCanvas.group ~x ~y canvas_group in let r = GnoCanvas.group root in - + let props = (text_props@[`ANCHOR `EAST]) in - + (* One step drawer *) let draw = fun i value -> let i = i * step in @@ -119,7 +119,7 @@ class canvas_ruler = fun ?(config=[]) canvas_group x y -> if y >= -. h && y <= h then ignore(GnoCanvas.line ~points:[|w*.0.8;y;w-.1.;y|] ~fill_color:"white" r) in - + let drawer = fun value -> (* Remove previous items *) List.iter (fun i -> i#destroy ()) r#get_items; @@ -129,15 +129,15 @@ class canvas_ruler = fun ?(config=[]) canvas_group x y -> draw i value done in - + (** Yellow index *) let _ = GnoCanvas.line ~points:[|0.;0.;w-.1.;0.|] ~fill_color:"yellow" root in let s = index_width in let idx = GnoCanvas.polygon ~points:[|0.;0.;-.s;s/.2.;-.s;-.s/.2.|] ~fill_color:"yellow" root in - let () = + let () = if index_on_right then idx#affine_absolute (affine_pos_and_angle w 0. Latlong.pi) in - + object method tag = "Ruler" method edit = fun (pack:GObj.widget -> unit) -> () @@ -166,7 +166,7 @@ class canvas_gauge = fun ?(config=[]) canvas_group x y -> let root = GnoCanvas.group ~x ~y canvas_group in (*let gauge = GnoCanvas.group root in*) - + (*let props = (text_props@[`ANCHOR `EAST]) in*) let _ = GnoCanvas.ellipse ~x1:r2 ~y1:r2 ~x2:(-.r2) ~y2:(-.r2) @@ -183,7 +183,7 @@ class canvas_gauge = fun ?(config=[]) canvas_group x y -> let irr = GnoCanvas.line ~points ~props root in let () = irr#affine_absolute (affine_pos_and_angle 0. 0. (2. *. Latlong.pi /. 3.)) in - let idx = GnoCanvas.polygon ~points:[|r3-.0.2;0.;0.;-.r1;-.(r3-.0.2);0.|] + let idx = GnoCanvas.polygon ~points:[|r3-.0.2;0.;0.;-.r1;-.(r3-.0.2);0.|] ~props:[`FILL_COLOR "red"; `OUTLINE_COLOR "white"] root in let _ = GnoCanvas.ellipse ~x1:r3 ~y1:r3 ~x2:(-.r3) ~y2:(-.r3) ~props:[`OUTLINE_COLOR "grey"] ~fill_color:"red" root in let text_min = GnoCanvas.text ~x:(-.r1) ~y:(r1/.2.) ~props:[`ANCHOR `NE; `FILL_COLOR "green"] root in @@ -246,7 +246,7 @@ class canvas_led = fun ?(config=[]) canvas_group x y -> let text = PC.get_prop "text" config "" in let root = GnoCanvas.group ~x ~y canvas_group in - + let r = (Pervasives.max 2. (size /. 2.)) +. 1. in let led = GnoCanvas.ellipse ~x1:r ~y1:r ~x2:(-.r) ~y2:(-.r) ~props:[`NO_FILL_COLOR; `OUTLINE_COLOR "grey"; `WIDTH_UNITS 2.] root in @@ -375,7 +375,7 @@ let renderers = [ (new canvas_text :> ?config:Xml.xml list -> #GnoCanvas.group -> float -> float -> t); (new canvas_ruler :> ?config:Xml.xml list -> #GnoCanvas.group -> float -> float -> t); (new canvas_gauge :> ?config:Xml.xml list -> #GnoCanvas.group -> float -> float -> t); - (new canvas_led :> ?config:Xml.xml list -> #GnoCanvas.group -> float -> float -> t) ] + (new canvas_led :> ?config:Xml.xml list -> #GnoCanvas.group -> float -> float -> t) ] let lazy_tagged_renderers = lazy (let x = 0. and y = 0. diff --git a/sw/lib/ocaml/papget_renderer.mli b/sw/lib/ocaml/papget_renderer.mli index 4c576167ea..2459f87ec3 100644 --- a/sw/lib/ocaml/papget_renderer.mli +++ b/sw/lib/ocaml/papget_renderer.mli @@ -2,7 +2,7 @@ * $Id$ * * Paparazzi widget renderers - * + * * Copyright (C) 2008 ENAC * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) diff --git a/sw/lib/ocaml/platform.ml b/sw/lib/ocaml/platform.ml index 1f3f03d7c4..f1047329a8 100644 --- a/sw/lib/ocaml/platform.ml +++ b/sw/lib/ocaml/platform.ml @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) diff --git a/sw/lib/ocaml/platform.mli b/sw/lib/ocaml/platform.mli index 3d9cdf015a..c5b50b34ae 100644 --- a/sw/lib/ocaml/platform.mli +++ b/sw/lib/ocaml/platform.mli @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) diff --git a/sw/lib/ocaml/pprz.ml b/sw/lib/ocaml/pprz.ml index ba2c64c93a..0caeb8d63e 100644 --- a/sw/lib/ocaml/pprz.ml +++ b/sw/lib/ocaml/pprz.ml @@ -2,7 +2,7 @@ * $Id$ * * Downlink protocol (handling messages.xml) - * + * * Copyright (C) 2003 Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -31,7 +31,7 @@ type message_id = int type ac_id = int type class_name = string type format = string -type _type = +type _type = Scalar of string | ArrayType of string type value = @@ -97,7 +97,7 @@ let types = [ ("string", { format = "%s" ; glib_type = "gchar*"; inttype = "char*"; size = max_int; value=String "42" }) ] -let is_array_type = fun s -> +let is_array_type = fun s -> let n = String.length s in n >= 2 && String.sub s (n-2) 2 = "[]" @@ -110,7 +110,7 @@ let int_of_string = fun x -> _ -> failwith (sprintf "Pprz.int_of_string: %s" x) let rec value = fun t v -> - match t with + match t with Scalar ("uint8" | "uint16" | "int8" | "int16") -> Int (int_of_string v) | Scalar ("uint32" | "int32") -> Int32 (Int32.of_string v) | Scalar ("float" | "double") -> Float (float_of_string v) @@ -157,7 +157,7 @@ let payload_size_of_message = fun message -> message.fields 2 (** + message id + aircraft id *) - + let alt_unit_coef_of_xml = function xml -> try Xml.attrib xml "alt_unit_coef" with _ -> @@ -181,17 +181,17 @@ let field_of_xml = fun xml -> let auc = alt_unit_coef_of_xml xml in let values = try Str.split pipe_regexp (Xml.attrib xml "values") with _ -> [] in - ( String.lowercase (ExtXml.attrib xml "name"), + ( String.lowercase (ExtXml.attrib xml "name"), { _type = t; fformat = f; alt_unit_coef = auc; enum=values }) let string_of_values = fun vs -> String.concat " " (List.map (fun (a,v) -> sprintf "%s=%s" a (string_of_value v)) vs) -let assoc = fun a vs -> - try List.assoc (String.lowercase a) vs with Not_found -> +let assoc = fun a vs -> + try List.assoc (String.lowercase a) vs with Not_found -> failwith (sprintf "Attribute '%s' not found in '%s'" a (string_of_values vs)) -let float_assoc = fun (a:string) vs -> +let float_assoc = fun (a:string) vs -> match assoc a vs with Float x -> x | _ -> invalid_arg "Pprz.float_assoc" @@ -209,7 +209,7 @@ let int_of_value = fun value -> let int_assoc = fun (a:string) vs -> int_of_value (assoc a vs) -let int32_assoc = fun (a:string) vs -> +let int32_assoc = fun (a:string) vs -> match assoc a vs with Int32 x -> x | _ -> invalid_arg "Pprz.int_assoc" @@ -227,8 +227,8 @@ let parse_class = fun xml_class -> List.iter (fun xml_msg -> let name = ExtXml.attrib xml_msg "name" - and link = - try + and link = + try Some (link_mode_of_string (Xml.attrib xml_msg "link")) with Xml.No_attribute("link") -> None @@ -246,7 +246,7 @@ let parse_class = fun xml_class -> (Xml.children xml_class); (by_id, by_name) - + (** Returns a value and its length *) let rec value_of_bin = fun buffer index _type -> match _type with @@ -263,7 +263,7 @@ let rec value_of_bin = fun buffer index _type -> let type_of_elt = Scalar t in let s = sizeof type_of_elt in let size = 1 + n * s in - (Array (Array.init n + (Array (Array.init n (fun i -> fst (value_of_bin buffer (index+1+i*s) type_of_elt))), size) | Scalar "string" -> let n = Char.code buffer.[index] in @@ -337,7 +337,7 @@ let hex_of_int_array = function let hex = sprintf "%02x" x in String.blit hex 0 s (2*i) 2) array; - s + s | value -> failwith (sprintf "Error: expecting array in Pprz.hex_of_int_array, found %s" (string_of_value value)) @@ -470,7 +470,7 @@ end module MessagesOfXml(Class:CLASS_Xml) = struct let max_length = 256 - let messages_by_id, messages_by_name = + let messages_by_id, messages_by_name = try let select = fun x -> Xml.attrib x "name" = Class.name in parse_class (ExtXml.child Class.xml ~select "class") @@ -499,7 +499,7 @@ module MessagesOfXml(Class:CLASS_Xml) = struct [] else failwith (sprintf "Pprz.values_of_payload, too many bytes: %s" (Debug.xprint buffer)) - | (field_name, field_descr)::fs -> + | (field_name, field_descr)::fs -> let (value, n) = value_field buffer index field_descr in (field_name, value) :: loop (index+n) fs in (id, ac_id, loop offset_fields message.fields) @@ -526,11 +526,11 @@ module MessagesOfXml(Class:CLASS_Xml) = struct i := !i + size ) message.fields; - + (** Cut to the actual length *) let p = String.sub p 0 !i in Serial.payload_of_string p - + let space = Str.regexp "[ \t]+" let values_of_string = fun s -> @@ -548,15 +548,15 @@ module MessagesOfXml(Class:CLASS_Xml) = struct let string_of_message = fun ?(sep=" ") msg values -> (** Check that the values are compatible with this message *) - List.iter + List.iter (fun (k, _) -> - if not (List.mem_assoc k msg.fields) + if not (List.mem_assoc k msg.fields) then invalid_arg (sprintf "Pprz.string_of_message: unknown field '%s' in message '%s'" k msg.name)) values; String.concat sep (msg.name:: - List.map + List.map (fun (field_name, field) -> let v = try List.assoc field_name values with @@ -582,14 +582,14 @@ module MessagesOfXml(Class:CLASS_Xml) = struct let message_bind = fun ?sender msg_name cb -> match sender with None -> - Ivy.bind - (fun _ args -> + Ivy.bind + (fun _ args -> let values = try snd (values_of_string args.(2)) with exc -> prerr_endline (Printexc.to_string exc); [] in - cb args.(1) values) + cb args.(1) values) (sprintf "^([0-9]+\\.[0-9]+ )?([^ ]*) +(%s( .*|$))" msg_name) | Some s -> Ivy.bind - (fun _ args -> + (fun _ args -> let values = try snd (values_of_string args.(1)) with exc -> prerr_endline (Printexc.to_string exc); [] in cb s values) (sprintf "^([0-9]+\\.[0-9]+ )?%s +(%s( .*|$))" s msg_name) diff --git a/sw/lib/ocaml/pprz.mli b/sw/lib/ocaml/pprz.mli index b52124d3d5..3ab239c9ca 100644 --- a/sw/lib/ocaml/pprz.mli +++ b/sw/lib/ocaml/pprz.mli @@ -2,7 +2,7 @@ * $Id$ * * Downlink protocol (handling messages.xml) - * + * * Copyright (C) 2003 Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -30,10 +30,10 @@ type class_name = string type message_id = int type ac_id = int type format = string -type _type = +type _type = Scalar of string | ArrayType of string -type value = +type value = Int of int | Float of float | String of string | Int32 of int32 | Array of value array type field = { @@ -43,8 +43,8 @@ type field = { enum : string list (* 'values' attribute *) } type link_mode = Forwarded | Broadcasted -type message = { - name : string; +type message = { + name : string; fields : (string * field) list; link : link_mode option } diff --git a/sw/lib/ocaml/serial.ml b/sw/lib/ocaml/serial.ml index a29685c48a..6e11af4988 100644 --- a/sw/lib/ocaml/serial.ml +++ b/sw/lib/ocaml/serial.ml @@ -2,7 +2,7 @@ * $Id$ * * Serial Port handling - * + * * Copyright (C) 2004 CENA/ENAC, Pascal Brisset * * This file is part of paparazzi. @@ -20,13 +20,13 @@ * 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. + * Boston, MA 02111-1307, USA. * *) open Printf -type speed = +type speed = B0 | B50 | B75 @@ -108,7 +108,7 @@ let input = fun ?(read = Unix.read) f -> raise End_of_file; let n = !index + nread in Debug.call 'T' (fun f -> fprintf f "input: %d %d\n" !index n); - let rec parse = fun start n -> + let rec parse = fun start n -> Debug.call 'T' (fun f -> fprintf f "input parse: %d %d\n" start n); let nb_used = f (String.sub buffer start n) in (* Printf.fprintf stderr "n'=%d\n" nb_used; flush stderr; *) @@ -158,7 +158,7 @@ module Transport(Protocol:PROTOCOL) = struct (* Extracts the complete frame *) let msg = String.sub buf !start length in - + (* Checks sum *) if Protocol.checksum msg then begin (* Calls the handler with the message *) diff --git a/sw/lib/ocaml/serial.mli b/sw/lib/ocaml/serial.mli index 532787c587..375559631d 100644 --- a/sw/lib/ocaml/serial.mli +++ b/sw/lib/ocaml/serial.mli @@ -2,7 +2,7 @@ * $Id$ * * Serial Port handling - * + * * Copyright (C) 2004 CENA/ENAC, Pascal Brisset * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -54,7 +54,7 @@ val close : Unix.file_descr -> unit val set_dtr : Unix.file_descr -> bool -> unit val set_speed : Unix.file_descr -> speed -> unit -val input : +val input : ?read:(Unix.file_descr -> string -> int -> int -> int) -> (string -> int) -> (Unix.file_descr -> unit) closure (** Buffered input. [input ?read f] Returns a closure which must be called when @@ -88,7 +88,7 @@ module type PROTOCOL = (** Builds a parser module from a [PROTOCOL] description *) module Transport : functor (Protocol : PROTOCOL) -> - sig + sig val nb_err : int ref (* Errors on checksum *) val discarded_bytes : int ref val parse : (payload -> unit) -> string -> int diff --git a/sw/lib/ocaml/srtm.ml b/sw/lib/ocaml/srtm.ml index c9b95f5cf2..606433a460 100644 --- a/sw/lib/ocaml/srtm.ml +++ b/sw/lib/ocaml/srtm.ml @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -46,7 +46,7 @@ let add_path = fun p -> path := p :: !path let open_compressed = fun f -> Ocaml_tools.open_compress (Ocaml_tools.find_file !path f) - + let find = fun tile -> try Hashtbl.find htiles tile with Not_found -> @@ -63,7 +63,7 @@ let find = fun tile -> with Not_found -> raise (Tile_not_found tile_name) - + let get = fun tile y x -> let tile = find tile in let pos = (2*((tile_size-y)*tile_size+x)) in @@ -83,7 +83,7 @@ let of_utm = fun utm -> (* field size in bytes *) let field_size = 2 -(* srtm file line size in bytes *) +(* srtm file line size in bytes *) let line_size = 1201 * field_size let byte_shift_factor = 256 let sec3_steps_number = 1200 @@ -92,8 +92,8 @@ let delta_srtm3_meters = 90.0 let safety_height_meters = 20 -let altitude_min_meters = -30000 - +let altitude_min_meters = -30000 + let step_d = 100. let step_alpha = Latlong.pi /. 10. @@ -104,7 +104,7 @@ let horizon_slope = fun geo r psi alpha d -> let alpha2 = 2.0 *. alpha in let heading_psi_2alpha = pi /. 2.0 -. psi -. alpha in - + let rec calc_horizon = fun sum_cos_alpha_i_slope_alpha_i sum_cos_alpha_i alpha_i -> if alpha_i > alpha2 then atan ( sum_cos_alpha_i_slope_alpha_i /. sum_cos_alpha_i ) else @@ -116,7 +116,7 @@ let horizon_slope = fun geo r psi alpha d -> let t_utm = utm_p +. !dj *. sin( heading_psi_2alpha +. alpha_i) in let h = of_utm { utm_zone = z; utm_x = s_utm; utm_y = t_utm} in begin - begin + begin let slope = float_of_int (h-r ) /. !dj in if slope > !max_slope then max_slope := slope; (* Printf.printf " h %d dj %.2f \n" h !dj; *) @@ -127,7 +127,7 @@ let horizon_slope = fun geo r psi alpha d -> (* Printf.printf "alpha_i %.2f max_slope %.2f \n" alpha_i !max_slope; *) calc_horizon (sum_cos_alpha_i_slope_alpha_i +. !max_slope *. (cos (alpha_i -. alpha))) (sum_cos_alpha_i +. (cos (alpha_i -. alpha))) (alpha_i +. step_alpha) end - in + in begin (* Printf.printf "debut calcul \n"; *) calc_horizon 0.0 0.0 0.0; diff --git a/sw/lib/ocaml/srtm.mli b/sw/lib/ocaml/srtm.mli index f742508127..c292e01106 100644 --- a/sw/lib/ocaml/srtm.mli +++ b/sw/lib/ocaml/srtm.mli @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) diff --git a/sw/lib/ocaml/test/test_latlong.ml b/sw/lib/ocaml/test/test_latlong.ml index cce6f8fc5d..6975ac9534 100644 --- a/sw/lib/ocaml/test/test_latlong.ml +++ b/sw/lib/ocaml/test/test_latlong.ml @@ -18,7 +18,7 @@ let llh_eq = fun (ll, h) (ll', h') -> feq8 ll.posn_long ll'.posn_long && feq2 h h' -let () = +let () = let muret_geo = make_geo_deg 43.46223 1.27289 and muret_h = 185. in @@ -51,22 +51,22 @@ let () = for d = 0 to 1 do let d = float (-100 * d) in let plane_ned = make_ned [| n; e; d|] in - + printf " Plane NED: %a\n%!" fprint_ned plane_ned; let plane_ecef = ecef_of_ned_muret plane_ned in (* printf "Plane ECEF: %a\n%!" fprint_ecef plane_ecef; *) - + let plane_ned' = ned_of_ecef_muret plane_ecef in (* printf "Plane NED': %a\n%!" fprint_ned plane_ned'; *) assert (ned_eq plane_ned plane_ned'); - + (* Angles in UTM and NED *) let plane_geo, plane_h = geo_of_ecef WGS84 plane_ecef in printf " Plane LLH: %s %.2f\n%!" (string_degrees_of_geographic plane_geo) plane_h; - + let plane_utm = utm_of WGS84 plane_geo in - - + + printf " Plane UTM: %a\n%!" fprint_utm plane_utm; printf "Delta UTM [%.2f %.2f]\n%!" (plane_utm.utm_x -. muret_utm.utm_x -. e) (plane_utm.utm_y -. muret_utm.utm_y -. n); printf "Delta alt: %.2fm\n" (plane_h -. muret_h +. d) diff --git a/sw/lib/ocaml/test/test_logpprz.ml b/sw/lib/ocaml/test/test_logpprz.ml index a058afec33..a25374dfc7 100644 --- a/sw/lib/ocaml/test/test_logpprz.ml +++ b/sw/lib/ocaml/test/test_logpprz.ml @@ -1,11 +1,11 @@ module Tm_Pprz = Pprz.Messages (struct let name = "telemetry" end) module Parser = Serial.Transport(Logpprz.Transport) - + let convert_file = fun file -> let use_payload = fun payload -> let log_msg = Logpprz.parse payload in - let (msg_id, ac_id, vs) = + let (msg_id, ac_id, vs) = Tm_Pprz.values_of_payload log_msg.Logpprz.pprz_data in let msg_descr = Tm_Pprz.message_of_id msg_id in Printf.printf "%.3f %d %s\n" (Int32.to_float log_msg.Logpprz.timestamp /. 1e4) ac_id (Tm_Pprz.string_of_message msg_descr vs) in diff --git a/sw/lib/ocaml/ubx.ml b/sw/lib/ocaml/ubx.ml index 96f9b01d71..a04bea3502 100644 --- a/sw/lib/ocaml/ubx.ml +++ b/sw/lib/ocaml/ubx.ml @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -173,8 +173,8 @@ let message = fun class_name msg_name -> let msg = ubx_get_msg _class msg_name in let msg_id = int_of_string (ExtXml.attrib msg "ID") in class_id, msg_id, msg - - + + let payload = fun class_name msg_name values -> let class_id, msg_id, msg = message class_name msg_name in let u_payload = ubx_payload msg values in diff --git a/sw/lib/ocaml/ubx.mli b/sw/lib/ocaml/ubx.mli index 3cd0029857..9fd23a6b75 100644 --- a/sw/lib/ocaml/ubx.mli +++ b/sw/lib/ocaml/ubx.mli @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) diff --git a/sw/lib/ocaml/wind_sock.ml b/sw/lib/ocaml/wind_sock.ml index 035ad0a172..6f693cbbd4 100644 --- a/sw/lib/ocaml/wind_sock.ml +++ b/sw/lib/ocaml/wind_sock.ml @@ -2,7 +2,7 @@ * $Id$ * * Wind sock - * + * * Copyright (C) 2007 ENAC * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -62,7 +62,7 @@ class item = fun ?(show = false) size_unit group -> object method item = group method label = t - initializer + initializer t#raise_to_top (); if not show then group#hide () method set_color = fun color -> contour#set [`OUTLINE_COLOR color] diff --git a/sw/lib/ocaml/wind_sock.mli b/sw/lib/ocaml/wind_sock.mli index ad24de34f5..be8db0e5d9 100644 --- a/sw/lib/ocaml/wind_sock.mli +++ b/sw/lib/ocaml/wind_sock.mli @@ -2,7 +2,7 @@ * $Id$ * * Wind sock - * + * * Copyright (C) 2007 ENAC * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -32,4 +32,4 @@ class item : ?show:bool -> float -> #GnoCanvas.group -> method label : GnoCanvas.text method set_color : string -> unit end - + diff --git a/sw/lib/ocaml/xbee.ml b/sw/lib/ocaml/xbee.ml index 7321a8c59e..e437eaa051 100644 --- a/sw/lib/ocaml/xbee.ml +++ b/sw/lib/ocaml/xbee.ml @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -80,12 +80,12 @@ type frame = | RX_Packet_64 of addr64 * int * int * string | RX868_Packet of addr64 * byte * string | RX_Packet_16 of addr16 * int * int * string - + let mode868 = ref false let check_not_in_868 = fun s -> - if !mode868 then + if !mode868 then failwith (Printf.sprintf "Xbee.%s not available in mode868" s) @@ -139,7 +139,7 @@ let api_tx64 = fun ?(frame_id = 0) dest data -> s.[10+optional868] <- Char.chr 0; String.blit data 0 s (11+ optional868) n; s - + let api_tx16 = fun ?(frame_id = 0) dest data -> check_not_in_868 "api_tx16"; assert (frame_id >=0 && frame_id < 0x100); @@ -154,13 +154,13 @@ let api_tx16 = fun ?(frame_id = 0) dest data -> s.[4] <- Char.chr 0; String.blit data 0 s 5 n; s - + let at_command_sequence = "+++" let at_set_my = fun addr -> assert (addr >= 0 && addr < 0x10000); Printf.sprintf "ATMY%04x\r" addr -let baud_rates = [1200, 0; 2400, 1; 4800, 2; 9600, 3; 19200, 4; +let baud_rates = [1200, 0; 2400, 1; 4800, 2; 9600, 3; 19200, 4; 38400, 5; 57600, 6; 115200, 7] let at_set_baud_rate = fun baud -> try @@ -172,12 +172,12 @@ let at_exit = "ATCN\r" let at_api_enable = "ATAP1\r" let api_parse_frame = fun s -> - let n = String.length s in + let n = String.length s in assert(n>0); match s.[0] with x when x = api_at_command_response_id -> assert(n >= 5); - AT_Command_Response (Char.code s.[1], String.sub s 2 2, + AT_Command_Response (Char.code s.[1], String.sub s 2 2, Char.code s.[4], String.sub s 5 (n-5)) | x when not !mode868 && x = api_tx_status_id -> assert(n = 3); @@ -185,7 +185,7 @@ let api_parse_frame = fun s -> | x when !mode868 && x = api868_tx_status_id -> assert(n = 7); TX868_Status (Char.code s.[1], Char.code s.[5], Char.code s.[4]) - | x when x = api_modem_status_id -> + | x when x = api_modem_status_id -> Modem_Status (Char.code s.[1]) | x when not !mode868 && x = api_rx64_id -> assert(n >= 11); diff --git a/sw/lib/ocaml/xbee.mli b/sw/lib/ocaml/xbee.mli index 4a39cc4565..0d31974a37 100644 --- a/sw/lib/ocaml/xbee.mli +++ b/sw/lib/ocaml/xbee.mli @@ -18,7 +18,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) diff --git a/sw/lib/ocaml/xml2h.ml b/sw/lib/ocaml/xml2h.ml index 1e8b897acc..0aca62a239 100644 --- a/sw/lib/ocaml/xml2h.ml +++ b/sw/lib/ocaml/xml2h.ml @@ -2,7 +2,7 @@ * $Id$ * * XML preprocessing tools - * + * * Copyright (C) 2003 Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -79,4 +79,4 @@ let warning s = Printf.fprintf stderr "##################################################\n"; Printf.fprintf stderr "\n %s\n" s; Printf.fprintf stderr "\n##################################################\n" - + diff --git a/sw/lib/ocaml/xml2h.mli b/sw/lib/ocaml/xml2h.mli index 708f992c64..5a21fb4d6c 100644 --- a/sw/lib/ocaml/xml2h.mli +++ b/sw/lib/ocaml/xml2h.mli @@ -2,7 +2,7 @@ * $Id$ * * XML preprocessing tools - * + * * Copyright (C) 2003 Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) diff --git a/sw/lib/ocaml/xmlCom.ml b/sw/lib/ocaml/xmlCom.ml index 320842cf61..3f17cb0ec9 100644 --- a/sw/lib/ocaml/xmlCom.ml +++ b/sw/lib/ocaml/xmlCom.ml @@ -2,7 +2,7 @@ * $Id$ * * XML parsing keeping everything (comments and declarations) - * + * * Copyright (C) 2008, Cyril Allignol, Pascal Brisset * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -91,7 +91,7 @@ let parse_file = fun file -> let buff = Buffer.contents buff in let lexbuf = Lexing.from_string buff in Nethtml.Element ("root", [], Nethtml.parse_document ~return_comments:true ~return_declarations:true lexbuf) - + (** Translate to *) let ugly2nice = fun file -> diff --git a/sw/lib/ocaml/xmlCom.mli b/sw/lib/ocaml/xmlCom.mli index 1fab96ebda..dcd4178a06 100644 --- a/sw/lib/ocaml/xmlCom.mli +++ b/sw/lib/ocaml/xmlCom.mli @@ -2,7 +2,7 @@ * $Id$ * * XML parsing keeping everything (comments and declarations) - * + * * Copyright (C) 2008, Cyril Allignol, Pascal Brisset * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) diff --git a/sw/lib/ocaml/xmlEdit.ml b/sw/lib/ocaml/xmlEdit.ml index a61ba5d524..c74c6814cf 100644 --- a/sw/lib/ocaml/xmlEdit.ml +++ b/sw/lib/ocaml/xmlEdit.ml @@ -2,7 +2,7 @@ * $Id$ * * XML editor - * + * * Copyright (C) 2004 CENA/ENAC, Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -54,8 +54,8 @@ let set_attr_value = fun (store:GTree.tree_store) row (a, v) -> store#set ~row ~column:value v let set_attributes = fun (store:GTree.tree_store) attribs -> - List.iter - (fun (a, v) -> + List.iter + (fun (a, v) -> let row = store#append () in set_attr_value store row (a,v)) attribs @@ -67,7 +67,7 @@ let attribs_of_model = fun (store:GTree.tree_store) -> l := (store#get ~row ~column:attribute, store#get ~row ~column:value):: !l; false); List.rev !l - + let editable_renderer = fun (model:GTree.tree_store) column -> let r = GTree.cell_renderer_text [`EDITABLE true] in @@ -83,7 +83,7 @@ let attribs_view = fun model -> let r = editable_renderer model attribute in let col = GTree.view_column ~title:"Attribute" () ~renderer:(r, ["text",attribute]) in - + ignore (view#append_column col); col#set_max_width 100; @@ -109,8 +109,8 @@ let string_of_attribs = fun attribs -> String.concat " " (List.map (fun (a,v) -> sprintf "%s=\"%s\"" a v) attribs) type id = int -let gen_id = - let x = ref 0 in +let gen_id = + let x = ref 0 in fun () -> incr x; !x let set_xml = fun (store:GTree.tree_store) row xml -> @@ -126,7 +126,7 @@ let encode_crs = Str.global_replace r "\\n" s (** Doesn' work. OCaml bug ? -let recode_crs = +let recode_crs = let r = Str.regexp "\\n" in fun s -> Str.global_replace r "\n" s @@ -145,7 +145,7 @@ let recode_crs = fun s -> incr i; incr j done; String.sub s' 0 !j - + @@ -225,7 +225,7 @@ let dtd_children = fun tag dtd -> which argument is the selected label *) let submenu = fun ?(filter = fun _ -> true) menuitem ss connect -> let submenu = GMenu.menu () in - List.iter + List.iter (fun tag -> if filter tag then let menuitem = GMenu.menu_item ~label:tag ~packing:submenu#append () in @@ -242,24 +242,24 @@ let required_attributes = fun tag dtd -> | _::dis -> filter dis | [] -> [] in filter dtd - + let allowed_attributes = fun tag dtd -> let rec filter = function | Dtd.DTDAttribute (t, a, _, _)::dis when t = tag -> a::filter dis | _::dis -> filter dis | [] -> [] in filter dtd - + let attr_submenu = fun ?filter menuitem tag dtd connect -> submenu ?filter menuitem (allowed_attributes tag dtd) connect - + let selection = fun (tree_store, tree_view) -> match tree_view#selection#get_selected_rows with path::_ -> tree_store, path - | _ -> raise Not_found - + | _ -> raise Not_found + let attribs_menu_popup = fun dtd (tree_view:GTree.view) (model:GTree.tree_store) (attrib_row:Gtk.tree_iter) -> let menu = GMenu.menu () in begin @@ -305,7 +305,7 @@ let add_one_menu = fun dtd (tree_view:GTree.view) (model:GTree.tree_store) -> menu#popup ~button:1 ~time:(GtkMain.Main.get_current_event_time ()) | _ -> () - + let add_context_menu = fun model view ?noselection_menu menu -> @@ -329,7 +329,7 @@ let add_delete_key = fun (model:GTree.tree_store) (view:GTree.view) -> match view#selection#get_selected_rows with path::_ -> let row = model#get_iter path in - model#get ~row ~column:event Deleted; + model#get ~row ~column:event Deleted; ignore (model#remove row); true | _ -> false @@ -341,7 +341,7 @@ let root = fun ((model:GTree.tree_store), _) -> None -> invalid_arg "XmlEdit.root" | Some i -> (model, model#get_path i) - + let attribs = fun ((model, path):node) -> let row = model#get_iter path in model#get ~row ~column:attributes @@ -353,7 +353,7 @@ let set_attribs = fun ((model, path):node) attribs -> let rec replace_assoc a v = function [] -> [(a, v)] | (a', v')::l -> - if a = String.uppercase a' + if a = String.uppercase a' then (a, v)::l else (a', v')::replace_assoc a v l @@ -379,14 +379,14 @@ let children = fun ((model, path):node) -> if model#iter_has_child row then let i = model#iter_children (Some row) in let l = ref [model, model#get_path i] in - while model#iter_next i do + while model#iter_next i do l := (model, model#get_path i):: !l; done; List.rev !l else [] -let rec xml_of_node = fun (node:node) -> +let rec xml_of_node = fun (node:node) -> let attrs = attribs node and tag = tag node in if tag = "PCData" then @@ -399,7 +399,7 @@ let rec xml_of_node = fun (node:node) -> let xml_of_view = fun (tree:t) -> xml_of_node (root tree) - + let child = fun ((model, path):node) (t:string) -> let row = model#get_iter path in if model#iter_has_child row then @@ -424,7 +424,7 @@ let rec parent = fun ((model, path):node) (t:string) -> None -> failwith (sprintf "XmlEdit.parent: %s" t) | Some p -> parent (model, model#get_path p) t - + let delete = fun (model, path) -> let row = model#get_iter path in @@ -461,8 +461,8 @@ let rec set_background = fun ?(all=false) ((model, path):node) color -> model#set ~row ~column:background color; if all then List.iter (fun x -> set_background ~all x color) (children (model,path)) - - + + let tree_menu_popup = fun dtd (model:GTree.tree_store) (row:Gtk.tree_iter) -> let menu = GMenu.menu () in @@ -505,13 +505,13 @@ let tree_menu_popup = fun dtd (model:GTree.tree_store) (row:Gtk.tree_iter) -> in let tags = dtd_children parent_tag dtd in submenu menuitem tags connect - | _ -> () + | _ -> () end; menu#popup ~button:1 ~time:(GtkMain.Main.get_current_event_time ()) - + let create = fun ?(format_attribs = string_of_attribs) ?(editable=true) ?(width = 400) dtd xml -> let tree_model = tree_model_of_xml xml in let attribs_model = model_of_attribs () in @@ -563,7 +563,7 @@ let create = fun ?(format_attribs = string_of_attribs) ?(editable=true) ?(width if editable then begin let _c = add_context_menu tree_model tree_view (tree_menu_popup dtd) in let _c = add_context_menu attribs_model attribs_view ~noselection_menu:(add_one_menu dtd tree_view) (attribs_menu_popup dtd tree_view) in - + ignore (add_delete_key tree_model tree_view); ignore (add_delete_key attribs_model attribs_view) end; diff --git a/sw/lib/ocaml/xmlEdit.mli b/sw/lib/ocaml/xmlEdit.mli index 14940e1f62..219866e260 100644 --- a/sw/lib/ocaml/xmlEdit.mli +++ b/sw/lib/ocaml/xmlEdit.mli @@ -2,7 +2,7 @@ * $Id$ * * XML graphics editor - * + * * Copyright (C) 2004 CENA/ENAC, Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) diff --git a/sw/lib/ocaml/xml_get.ml b/sw/lib/ocaml/xml_get.ml index 4b19004c74..50dedbca39 100644 --- a/sw/lib/ocaml/xml_get.ml +++ b/sw/lib/ocaml/xml_get.ml @@ -7,7 +7,7 @@ let _ = and attribute = Sys.argv.(3) in let xml = try - Xml.parse_file xml_file + Xml.parse_file xml_file with Xml.Error e -> Printf.fprintf stderr "\nError in \"%s\": %s\n\n" xml_file (Xml.error e); diff --git a/sw/logalizer/export.ml b/sw/logalizer/export.ml index 7707590f2b..2b97f0ee53 100644 --- a/sw/logalizer/export.ml +++ b/sw/logalizer/export.ml @@ -2,7 +2,7 @@ * $Id$ * * GUI to export some values of a log - * + * * Copyright (C) 2008, ENAC * * This file is part of paparazzi. @@ -20,13 +20,13 @@ * 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. + * Boston, MA 02111-1307, USA. * *) open Printf open Latlong - + let (//) = Filename.concat let class_name="telemetry" @@ -58,7 +58,7 @@ let display_columns = fun treeview model -> vc#set_clickable true; ignore (renderer#connect#toggled ~callback:(item_toggled ~model ~column:col_to_export)); ignore (treeview#append_column vc) - + (****************************************************************************) (** Fill the tree model from the message_xml data structure *) @@ -120,7 +120,7 @@ let date_of_log_filename = fun filename -> exc -> fprintf stderr "Error parsing filename to get date (%s) : %s\nUsing current time\n%!" filename (Printexc.to_string exc); Unix.gettimeofday () - + let format_time = fun t -> let tm = Unix.gmtime t in let sec = float tm.Unix.tm_sec +. fst (modf t) in @@ -146,8 +146,8 @@ let export_values = fun ?(sep="tab") ?(export_geo_pos=true) (model:GTree.tree_st let xml = ExtXml.Gconf.add_entry xml "log plotter" "to_export" value in let f = open_out Env.gconf_file in Printf.fprintf f "%s\n" (ExtXml.to_string_fmt xml); - close_out f; - + close_out f; + let f = open_out filename in (* Print the header *) fprintf f "Time%sUTC" sep; @@ -165,7 +165,7 @@ let export_values = fun ?(sep="tab") ?(export_geo_pos=true) (model:GTree.tree_st let print_last_values = fun t -> let all_values = ref true in - let lookup = fun m field -> + let lookup = fun m field -> try Pprz.string_of_value (Hashtbl.find last_values (m,String.lowercase field)) with @@ -193,7 +193,7 @@ let export_values = fun ?(sep="tab") ?(export_geo_pos=true) (model:GTree.tree_st if s = "" then all_values := false; s in - List.iter + List.iter (fun (m,field) -> let v = lookup m field in bprintf buf "%s%s" sep v) @@ -226,7 +226,7 @@ let export_values = fun ?(sep="tab") ?(export_geo_pos=true) (model:GTree.tree_st print_last_values t | _ -> ()) data; - + close_out f;; @@ -237,7 +237,7 @@ let read_preferences = fun () -> let xml = Xml.parse_file Env.gconf_file in let to_export = ExtXml.Gconf.get_value xml "to_export" in let pairs = Str.split (Str.regexp ";") to_export in - List.map + List.map (fun s -> match Str.split (Str.regexp ":") s with [m; f] -> (m, f) @@ -253,7 +253,7 @@ let read_preferences = fun () -> let save_values = fun w filename save -> match GToolbox.select_file ~title:"Save Values" ~filename () with None -> () - | Some file -> + | Some file -> save file; w#export#destroy () @@ -298,7 +298,7 @@ let popup = fun ?(no_gui = false) xml log_filename data -> let data = get_timestamp () in w#entry_period#misc#set_sensitive (data = "Periodic"))); - + (* The combo box for the separator *) let strings = ["tab"; ";"; ","] in @@ -323,7 +323,7 @@ let popup = fun ?(no_gui = false) xml log_filename data -> let sep = get_separator () in let do_export = fun x -> export_values ~sep ~export_geo_pos:w#checkbutton_LL#active model data timestamp x in - + let default_filename = Env.paparazzi_home // "var" // "logs" // log_filename ^ ".csv" in if no_gui then diff --git a/sw/logalizer/log_file.ml b/sw/logalizer/log_file.ml index d976c15053..af74be8b52 100644 --- a/sw/logalizer/log_file.ml +++ b/sw/logalizer/log_file.ml @@ -2,7 +2,7 @@ * $Id$ * * Log files utilities - * + * * Copyright (C) 2007 ENAC * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -68,7 +68,7 @@ let chooser = fun ~callback () -> Not_found -> "No associated data file found" in info_label#set_text (sprintf "Log %s: %s" basename info) | _ -> info_label#set_text "" in - + ignore(dialog#connect#update_preview ~callback:preview_cb); begin match dialog#run (), dialog#filename with diff --git a/sw/logalizer/play-nox.ml b/sw/logalizer/play-nox.ml index 2a38c3d42f..ab066adef6 100644 --- a/sw/logalizer/play-nox.ml +++ b/sw/logalizer/play-nox.ml @@ -2,7 +2,7 @@ * $Id$ * * Log player - * + * * Copyright (C) 2004-2009 ENAC, Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,13 +20,13 @@ * 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. + * Boston, MA 02111-1307, USA. * *) let () = let (serial_port, adj, speed) = Play_core.init () in - + Play_core.play ~no_gui:true serial_port adj speed; Play_core.main () diff --git a/sw/logalizer/play.ml b/sw/logalizer/play.ml index d59539079b..0d9cf69bf0 100644 --- a/sw/logalizer/play.ml +++ b/sw/logalizer/play.ml @@ -2,7 +2,7 @@ * $Id$ * * Log player - * + * * Copyright (C) 2004-2009 ENAC, Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -45,7 +45,7 @@ let () = let window = GWindow.dialog ~icon ~title:"Replay" ~width:300 () in let quit = fun () -> GMain.Main.quit (); exit 0 in ignore (window#connect#destroy ~callback:quit); - + let menubar = GMenu.menu_bar ~packing:window#vbox#pack () in let factory = new GMenu.factory menubar in let accel_group = factory#accel_group in @@ -53,12 +53,12 @@ let () = let file_menu_fact = new GMenu.factory file_menu ~accel_group in let timescale = GRange.scale `HORIZONTAL ~adjustment:adj ~packing:window#vbox#pack () in - - ignore (file_menu_fact#add_item "Open Log" ~key:GdkKeysyms._O ~callback:(open_log window adj)); - ignore (file_menu_fact#add_item "Play" ~key:GdkKeysyms._X ~callback:(fun () -> timescale#misc#set_sensitive false; Play_core.play serial_port adj speed)); - ignore (file_menu_fact#add_item "Stop" ~key:GdkKeysyms._S ~callback:(fun () -> timescale#misc#set_sensitive true; Play_core.stop ())); - ignore (file_menu_fact#add_item "Quit" ~key:GdkKeysyms._Q ~callback:quit); - + + ignore (file_menu_fact#add_item "Open Log" ~key:GdkKeysyms._O ~callback:(open_log window adj)); + ignore (file_menu_fact#add_item "Play" ~key:GdkKeysyms._X ~callback:(fun () -> timescale#misc#set_sensitive false; Play_core.play serial_port adj speed)); + ignore (file_menu_fact#add_item "Stop" ~key:GdkKeysyms._S ~callback:(fun () -> timescale#misc#set_sensitive true; Play_core.stop ())); + ignore (file_menu_fact#add_item "Quit" ~key:GdkKeysyms._Q ~callback:quit); + window#add_accel_group accel_group; window#show (); diff --git a/sw/logalizer/play_core.ml b/sw/logalizer/play_core.ml index 132e42c1ae..d910eda6eb 100644 --- a/sw/logalizer/play_core.ml +++ b/sw/logalizer/play_core.ml @@ -2,7 +2,7 @@ * $Id$ * * Log player - * + * * Copyright (C) 2004 CENA/ENAC, Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -44,7 +44,7 @@ let write_xml = fun f xml -> let store_conf = fun conf acs -> - let l = + let l = List.fold_right (fun x r -> if ExtXml.tag_is x "aircraft" then if List.mem (ExtXml.attrib x "ac_id") acs then @@ -101,7 +101,7 @@ let load_log = fun xml_file -> let l = input_line f in try Scanf.sscanf l "%f %s %[^\n]" - (fun t ac m -> + (fun t ac m -> lines := (t,ac,m):: !lines; if not (List.mem ac !acs) then acs := ac :: !acs ) @@ -119,7 +119,7 @@ let load_log = fun xml_file -> let timer = ref None let was_running = ref false -let bus = ref Defivybus.default_ivy_bus +let bus = ref Defivybus.default_ivy_bus let port = ref "/dev/ttyUSB0" let baudrate = ref "9600" let file_to_load = ref "" @@ -165,7 +165,7 @@ let run = fun serial_port log adj i0 speed no_gui -> in loop i0 - + let play = fun ?(no_gui=false) serial_port adj speed -> stop (); if Array.length !log > 1 then @@ -173,7 +173,7 @@ let play = fun ?(no_gui=false) serial_port adj speed -> let init = fun () -> - Arg.parse + Arg.parse [ "-b", Arg.String (fun x -> bus := x), (sprintf " Default is %s" !bus); "-d", Arg.Set_string port, (sprintf " Default is %s" !port); "-o", Arg.Set output_on_serial, "Output binary messages on serial port"; @@ -185,14 +185,14 @@ let init = fun () -> load_log !file_to_load; - let serial_port = + let serial_port = if !output_on_serial then Some (Unix.out_channel_of_descr (Serial.opendev !port (Serial.speed_of_baudrate !baudrate))) - else + else None in - let adj = GData.adjustment - ~value:0. ~lower:0. ~upper:1000. + let adj = GData.adjustment + ~value:0. ~lower:0. ~upper:1000. ~step_incr:0.5 ~page_incr:1.0 ~page_size:1.0 () in let speed = object @@ -204,7 +204,7 @@ let init = fun () -> in ignore (Ground_Pprz.message_bind "WORLD_ENV" world_update_time); - + (serial_port, adj, speed) diff --git a/sw/logalizer/plot.ml b/sw/logalizer/plot.ml index f7cf032f95..ebd5008995 100644 --- a/sw/logalizer/plot.ml +++ b/sw/logalizer/plot.ml @@ -2,7 +2,7 @@ * $Id$ * * Basic log plotter - * + * * Copyright (C) 2007- ENAC, Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -35,7 +35,7 @@ let verbose = ref false class type text_value = object method text : string end -let double__ = +let double__ = let underscore = Str.regexp "_" in fun s -> Str.global_replace underscore "__" s @@ -60,16 +60,16 @@ let rec remove_newer t0 = function let compute_ticks = fun min_y max_y -> let delta = max_y -. min_y in - + let scale = log delta /. log 10. in let d = 10. ** floor scale in - let u = - if delta < 2.*.d then d/.5. + let u = + if delta < 2.*.d then d/.5. else if delta < 5.*.d then d/.2. else d in let tick_min = min_y -. mod_float min_y u in (delta, scale, u, tick_min) - + let colors = [|(255,0,0);(0,255,0); (0,0,255); (245,215,20); (245,20,245); (30,225,225); (110,30,230)|] @@ -81,10 +81,10 @@ let labelled_entry = fun ?width_chars text value (h:GPack.box) -> let logs_menus = ref [] -let screenshot_hint_name = +let screenshot_hint_name = let n = ref 0 in fun extension -> - let basename = + let basename = match !logs_menus with (_, menu_name, _, _)::_ -> begin match Str.split (Str.regexp ":") menu_name with @@ -123,18 +123,18 @@ let fig_renderer = fun (width, height) -> method unit = fun x -> scale * x method size = (width, height) - + method init = fun () -> self#rectangle 0 0 width height () - + method set_color = fun (r, g, b) -> let (id, obj) = Fig.color r g b in pen_color <- id; objects <- obj :: objects - + method lines = fun points -> objects <- Fig.polyline ~pen_color points :: objects - + method rectangle = fun x y width height ?(filled=false) () -> let area_fill = if filled then Fig.filled else -1 and p1 = (x,y) @@ -143,21 +143,21 @@ let fig_renderer = fun (width, height) -> objects <- Fig.polyline ~pen_color ~fill_color:pen_color ~sub_type:Fig.Box ~area_fill points :: objects val font_size = 10 - - method create_text = fun s -> + + method create_text = fun s -> text <- s; ((3*font_size*scale)/4*String.length s, font_size*scale) - + method put_text = fun x y -> let font = Fig.Postscript Fig.Helvetica in let obj = Fig.text ~font ~font_size ~color:pen_color (x,y+font_size*scale) text in objects <- obj :: objects - + method draw = fun () -> let fig = Fig.create objects in save_dialog "fig" (fun name -> Fig.write name fig) end - + class plot = fun ~width ~height ~packing () -> @@ -258,7 +258,7 @@ class plot = fun ~width ~height ~packing () -> self#wake (); self#recompute (); curve - + method delete_curve = fun (name:string) -> Hashtbl.remove curves name; self#reset_scale (); @@ -282,9 +282,9 @@ class plot = fun ~width ~height ~packing () -> method set_color = fun (r, g, b) -> dr#set_foreground (`RGB (256*r, 256*g, 256*b)) - + method lines = dr#lines - + method rectangle = fun x y width height ?(filled=false) () -> dr#rectangle ~x ~y ~width ~height ~filled () @@ -318,7 +318,7 @@ class plot = fun ~width ~height ~packing () -> let black = (0,0,0) in let graph_height = height - bottom_margin - top_margin in - + let scale_x = fun x -> left_margin + truncate ((x-.min_x)*. float (width-left_margin) /. (max_x -. min_x)) and scale_y = fun y -> top_margin+graph_height - truncate ((y-.min_y)*. float graph_height /. (max_y -. min_y)) in @@ -353,7 +353,7 @@ class plot = fun ~width ~height ~packing () -> renderer#set_color black; (* Y *) - let (min_y, max_y) = + let (min_y, max_y) = if max_y > min_y then (min_y, max_y) else let d = abs_float max_y /. 10. in (max_y -. d, max_y +. d) in @@ -366,10 +366,10 @@ class plot = fun ~width ~height ~packing () -> let s = Printf.sprintf "%.*f" (Pervasives.max 0 (2-truncate scale)) tick in let (w, h) = renderer#create_text s in renderer#put_text (left_margin-margin-w) (y-h/2); - + renderer#lines [(left_margin,y);(left_margin+tick_len,y)] done; - + (* Time *) let delta, scale, u, tick_min = compute_ticks min_x max_x in let y = height in @@ -381,7 +381,7 @@ class plot = fun ~width ~height ~packing () -> let (w, h) = renderer#create_text s in let y = y-margin-h in renderer#put_text (x-w/2) y; - + renderer#lines [(x,y);(x,y-tick_len)] done end; @@ -399,7 +399,7 @@ class plot = fun ~width ~height ~packing () -> renderer#rectangle x y width height (); | _ -> () end; - + (* Actually draw *) renderer#draw () @@ -468,7 +468,7 @@ class plot = fun ~width ~height ~packing () -> method zoom = fun ev -> let {Gtk.width=width;height=height}= self#drawing_area#misc#allocation and dx = (max_x -. min_x) and dy = (max_y -. min_y) in - let alpha_x = + let alpha_x = (GdkEvent.Scroll.x ev -. float left_margin) /. float (width-left_margin) and alpha_y = @@ -503,7 +503,7 @@ class plot = fun ~width ~height ~packing () -> self#recompute (); true | _ -> false - + initializer ignore (self#drawing_area#event#connect#expose ~callback:(fun _ -> self#recompute (); false)) @@ -518,7 +518,7 @@ class plot = fun ~width ~height ~packing () -> let pprz_float = function Pprz.Int i -> float i - | Pprz.Float f -> f + | Pprz.Float f -> f | Pprz.Int32 i -> Int32.to_float i | Pprz.String s -> float_of_string s | Pprz.Array _ -> 0. @@ -529,7 +529,7 @@ let rec select_gps_values = function | (m, values)::_ when m.Pprz.name = "GPS" -> let xs = List.assoc "utm_east" values and ys = List.assoc "utm_north" values - and zs = List.assoc "utm_zone" values + and zs = List.assoc "utm_zone" values and alts = List.assoc "alt" values in let l = ref [] in for i = 0 to Array.length xs - 1 do @@ -558,11 +558,11 @@ let rec select_gps_values = function l := (t, wgs84, a) :: !l done; List.rev !l - - + + | _ :: rest -> select_gps_values rest - + let write_kml = fun plot log_name values -> let t_min = plot#min_x () @@ -614,9 +614,9 @@ let add_ac_submenu = fun ?(export=false) protocol ?(factor=object method text="1 let menuitem = GMenu.menu_item ~label:menu_name () in menuitem#set_submenu menu; menubar#menu#append menuitem; - + let menu_fact = new GMenu.factory menu in - + (* Build the msg menus *) List.iter (fun (msg, l) -> @@ -641,7 +641,7 @@ let add_ac_submenu = fun ?(export=false) protocol ?(factor=object method text="1 let (r, g, b) = curve.color in eb#coerce#misc#modify_bg [`NORMAL, `RGB (256*r,256*g,256*b)]; let item = curves_menu_fact#add_image_item ~image:eb#coerce ~label:name () in - + let delete = fun () -> plot#delete_curve name; curves_menu_fact#menu#remove (item :> GMenu.menu_item) in @@ -659,8 +659,8 @@ let add_ac_submenu = fun ?(export=false) protocol ?(factor=object method text="1 Export.popup ?no_gui protocol menu_name raw_msgs in ignore (menu_fact#add_item ~callback "Export CSV"); if export then - callback ~no_gui:true () - + callback ~no_gui:true () + let load_log = fun ?export ?factor (plot:plot) (menubar:GMenu.menu_shell GMenu.factory) curves_fact xml_file -> Debug.call 'p' (fun f -> fprintf f "load_log: %s\n" xml_file); @@ -684,8 +684,8 @@ let load_log = fun ?export ?factor (plot:plot) (menubar:GMenu.menu_shell GMenu.f let module M = struct let name = class_name let xml = protocol end in let module P = Pprz.MessagesOfXml(M) in - let f = - try + let f = + try Ocaml_tools.find_file [Filename.dirname xml_file] data_file with Not_found -> @@ -717,7 +717,7 @@ let load_log = fun ?export ?factor (plot:plot) (menubar:GMenu.menu_shell GMenu.f (* Elements of [fields] are values indexed by field name *) List.iter - (fun (f, value) -> + (fun (f, value) -> match value with Pprz.Array array -> Array.iteri @@ -747,19 +747,19 @@ let load_log = fun ?export ?factor (plot:plot) (menubar:GMenu.menu_shell GMenu.f let menu_name = sprintf "%s:%s" (Filename.chop_extension (Filename.basename xml_file)) ac in (* First sort by message id *) - let l = ref [] in + let l = ref [] in Hashtbl.iter (fun msg fields -> l := (P.message_of_id msg, fields):: !l) msgs; let msgs = List.sort (fun (a,_) (b,_) -> compare a b) !l in let msgs = List.map (fun (msg, fields) -> - let l = ref [] in + let l = ref [] in Hashtbl.iter (fun f v -> if not (List.mem f !l) then l := f :: !l) fields; let sorted_fields = List.sort compare !l in - let field_values_assoc = + let field_values_assoc = List.map (fun f -> let values = Hashtbl.find_all fields f in @@ -770,10 +770,10 @@ let load_log = fun ?export ?factor (plot:plot) (menubar:GMenu.menu_shell GMenu.f sorted_fields in (msg, field_values_assoc)) msgs in - + (* Store data for other windows *) logs_menus := !logs_menus @ [(ac, menu_name, (msgs, raw_msgs), protocol)]; - + add_ac_submenu ?export protocol ?factor plot menubar curves_fact ac menu_name msgs raw_msgs; ) acs @@ -792,7 +792,7 @@ let screenshot = fun frame -> "png" (fun name -> GdkPixbuf.save name "png" dest) - + (** Table of current windows, to be able to quit when the last one is closed FIXME: should be shared with plotter.ml *) @@ -806,10 +806,10 @@ let rec plot_window = fun ?export init -> let oid = plotter#get_oid in Hashtbl.add windows oid (); - plotter#set_icon (Some (GdkPixbuf.from_file Env.icon_file)); + plotter#set_icon (Some (GdkPixbuf.from_file Env.icon_file)); let vbox = GPack.vbox ~packing:plotter#add () in let quit = fun () -> GMain.Main.quit (); exit 0 in - let close = fun () -> + let close = fun () -> plotter#destroy (); Hashtbl.remove windows oid; if Hashtbl.length windows = 0 then @@ -828,7 +828,7 @@ let rec plot_window = fun ?export init -> let plot = new plot ~width ~height ~packing:(vbox#pack ~expand:true) () in let open_log_item = file_menu_fact#add_item "Open Log" ~key:GdkKeysyms._O in - + ignore (file_menu_fact#add_item "New" ~key:GdkKeysyms._N ~callback:(fun () -> plot_window [])); let delayed_screenshot = fun () -> @@ -857,7 +857,7 @@ let rec plot_window = fun ?export init -> ("Ymin", plot#min_y, plot#set_min_y); ("Ymax", plot#max_y, plot#set_max_y)] in - let entries = + let entries = List.map (fun (label, value, action) -> let _, entry= labelled_entry ~width_chars:8 label "" h in plot#scale_event (fun () -> entry#set_text (string_of_float (value ()))); @@ -880,7 +880,7 @@ let rec plot_window = fun ?export init -> let eb = GBin.event_box ~width:10 ~height:10 () in eb#coerce#misc#modify_bg [`NORMAL, `NAME "black"]; let item = curves_menu_fact#add_image_item ~image:eb#coerce ~label:s () in - + let delete = fun () -> plot#delete_cst v; curves_menu#remove (item :> GMenu.menu_item) in @@ -895,7 +895,7 @@ let rec plot_window = fun ?export init -> List.iter (fun (ac, menu_name, (msgs, raw_msgs), protocol) -> - add_ac_submenu protocol ~factor:(factor:>text_value) plot factory curves_menu_fact ac menu_name msgs raw_msgs) + add_ac_submenu protocol ~factor:(factor:>text_value) plot factory curves_menu_fact ac menu_name msgs raw_msgs) !logs_menus; ignore(open_log_item#connect#activate ~callback:(fun () -> let factor = (factor:>text_value) in open_log ~factor plot factory curves_menu_fact ())); @@ -922,6 +922,6 @@ let () = if not !export then let loop = Glib.Main.create true in - while Glib.Main.is_running loop do - ignore (Glib.Main.iteration true) + while Glib.Main.is_running loop do + ignore (Glib.Main.iteration true) done diff --git a/sw/logalizer/plotter.ml b/sw/logalizer/plotter.ml index ab796a1405..d925600091 100644 --- a/sw/logalizer/plotter.ml +++ b/sw/logalizer/plotter.ml @@ -2,7 +2,7 @@ * $Id$ * * Real time plotter - * + * * Copyright (C) 2007- ENAC, Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -37,7 +37,7 @@ let set_float_value = fun (a:GData.adjustment) v -> let pprz_float = function Pprz.Int i -> float i - | Pprz.Float f -> f + | Pprz.Float f -> f | Pprz.Int32 i -> Int32.to_float i | Pprz.String s -> float_of_string s | Pprz.Array _ -> 0. @@ -59,9 +59,9 @@ let labelled_entry = fun ?width_chars text value (h:GPack.box) -> let label = GMisc.label ~text ~packing:h#pack () in label, GEdit.entry ?width_chars ~text:value ~packing:h#pack () -type values = { +type values = { mutable array: float option array; - mutable index: int; + mutable index: int; mutable discrete : bool; color : string; average : GData.adjustment; @@ -73,8 +73,8 @@ let create_values = fun size color -> average = GData.adjustment ~value:0. (); discrete = false; stdev = GData.adjustment ~value:0. ()} -type status = - Run +type status = + Run | Suspend (* Display is freezed, data are updated *) | Stop (* Display is active, data are not updated *) @@ -148,7 +148,7 @@ class plot = fun ~size ~width ~height ~packing () -> color_index <- (color_index+1) mod Array.length colors; Hashtbl.add curves name values; values - + method delete_curve = fun name -> Hashtbl.remove curves name @@ -174,7 +174,7 @@ class plot = fun ~size ~width ~height ~packing () -> max <- Pervasives.max max v) a.array) curves - + method shift = fun () -> Hashtbl.iter (fun _ a -> @@ -182,7 +182,7 @@ class plot = fun ~size ~width ~height ~packing () -> a.index <- (a.index + 1) mod (Array.length a.array); a.array.(a.index) <- None) curves - + method update_curves = fun () -> if Hashtbl.length curves > 0 then try @@ -208,26 +208,26 @@ class plot = fun ~size ~width ~height ~packing () -> Pango.Layout.set_text layout s; let (w, h) = Pango.Layout.get_pixel_size layout in dr#put_layout ~x ~y:(y-h/2) ~fore:`BLACK layout in - + let t = dt *. float size in f (width-width/size) (height-h/2) "0"; f (width/2) (height-h/2) (Printf.sprintf "-%.1fs" (t/.2.)); f 0 (height-h/2) (Printf.sprintf "-%.1fs" t); (* Y graduations *) - let (min, max) = + let (min, max) = if max > min then (min, max) else let d = abs_float max /. 10. in (max -. d, max +. d) in let delta = max -. min in - + let dy = float (height-2*margin) /. delta in let y = fun v -> height - margin - truncate ((v-.min)*.dy) in let scale = log delta /. log 10. in let d = 10. ** floor scale in - let u = - if delta < 2.*.d then d/.5. + let u = + if delta < 2.*.d then d/.5. else if delta < 5.*.d then d/.2. else d in let tick_min = min -. mod_float min u in @@ -284,7 +284,7 @@ class plot = fun ~size ~width ~height ~packing () -> Pango.Layout.set_text layout title; let (w, h) = Pango.Layout.get_pixel_size layout in dr#rectangle ~x:(width-h-margin) ~y:!title_y ~width:h ~height:h ~filled:true (); - + dr#set_foreground `BLACK; dr#put_layout ~x:(width-2*margin-w-h) ~y:(!title_y) layout; title_y := !title_y + h + margin) @@ -298,7 +298,7 @@ class plot = fun ~size ~width ~height ~packing () -> match timer with None -> () | Some t -> GMain.Timeout.remove t - + method set_update_time = fun delay -> self#stop_timer (); dt <- delay; @@ -346,7 +346,7 @@ let rec plot_window = fun window -> let vbox = GPack.vbox ~packing:plotter#add () in let quit = fun () -> GMain.Main.quit (); exit 0 in - let close = fun () -> + let close = fun () -> plotter#destroy (); Hashtbl.remove windows oid; if Hashtbl.length windows = 0 then @@ -359,7 +359,7 @@ let rec plot_window = fun window -> let accel_group = factory#accel_group in let file_menu = factory#add_submenu "Plot" in let file_menu_fact = new GMenu.factory file_menu ~accel_group in - + ignore (file_menu_fact#add_item "New" ~key:GdkKeysyms._N ~callback:(fun () -> plot_window {window with curves=[]})); let reset_item = file_menu_fact#add_item "Reset" ~key:GdkKeysyms._L in @@ -416,7 +416,7 @@ let rec plot_window = fun window -> let eb = GBin.event_box ~width:10 ~height:10 () in eb#coerce#misc#modify_bg [`NORMAL, `NAME "black"]; let item = curves_menu_fact#add_image_item ~image:eb#coerce ~label:s () in - + let delete = fun () -> plot#delete_cst v; curves_menu#remove (item :> GMenu.menu_item) in @@ -489,14 +489,14 @@ let rec plot_window = fun window -> let float = pprz_float value in let v = float *. a +. b in plot#add_value name v in - + let module P = Pprz.Messages (struct let name = class_name end) in - let binding = + let binding = if sender = "*" then P.message_bind msg_name cb else P.message_bind ~sender msg_name cb in - + let curve = plot#create_curve name in insert_in_menu curve name binding in @@ -511,10 +511,10 @@ let rec plot_window = fun window -> in plotter#drag#dest_set dnd_targets ~actions:[`COPY]; ignore (plotter#drag#connect#data_received ~callback:(data_received)); - + (* Init curves *) List.iter add_curve window.curves; - + plotter#add_accel_group accel_group; plotter#show () @@ -522,7 +522,7 @@ let rec plot_window = fun window -> let _ = - let ivy_bus = ref Defivybus.default_ivy_bus + let ivy_bus = ref Defivybus.default_ivy_bus and init = ref [default_window] in let add_init = fun s -> diff --git a/sw/logalizer/sd2log.ml b/sw/logalizer/sd2log.ml index b13e93758d..347929698c 100644 --- a/sw/logalizer/sd2log.ml +++ b/sw/logalizer/sd2log.ml @@ -2,7 +2,7 @@ * $Id$ * * Extraction of .log and .data file from a .TLM airborne SD file - * + * * Copyright (C) 2009 ENAC, Pascal Brisset * * This file is part of paparazzi. @@ -20,14 +20,14 @@ * 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. + * Boston, MA 02111-1307, USA. * *) open Printf module U = Unix let (//) = Filename.concat -let var_path = Env.paparazzi_home // "var" +let var_path = Env.paparazzi_home // "var" let logs_path = var_path // "logs" let conf_xml = Xml.parse_file (Env.paparazzi_home // "conf" // "conf.xml") @@ -58,7 +58,7 @@ let log_xml = fun ac_id -> let expanded_conf_ac = Env.expand_ac_xml ~raise_exception:false conf_ac in let expanded_conf = make_element (Xml.tag conf_xml) (Xml.attribs conf_xml) [expanded_conf_ac] in - make_element + make_element "configuration" [] [expanded_conf; Pprz.messages_xml ()] @@ -93,7 +93,7 @@ let hex_of_array = function let hex = sprintf "%02x" (Pprz.int_of_value array.(i)) in String.blit hex 0 s (2*i) 2) array; - s + s | value -> failwith (sprintf "Error: expecting array, found %s" (Pprz.string_of_value value)) @@ -120,7 +120,7 @@ let search_conf = fun md5 -> raise Not_found in loop 0 - + let convert_file = fun file -> let tmp_file = Filename.temp_file "tlm_from_sd" "data" in @@ -144,12 +144,12 @@ let convert_file = fun file -> let msg_descr = message_of_id log_msg msg_id in let timestamp = Int32.to_float log_msg.Logpprz.timestamp /. 1e4 in fprintf f_out "%.4f %d %s\n" timestamp ac_id (string_of_message log_msg msg_descr vs); - + (** Looking for a date from a GPS message and a md5 from an ALIVE *) if log_msg.Logpprz.source = 0 then match msg_descr.Pprz.name with "GPS" when !start_unix_time = None - && ( Pprz.int_assoc "mode" vs = 3 + && ( Pprz.int_assoc "mode" vs = 3 || Pprz.int_assoc "week" vs > 0) -> let itow = Pprz.int_assoc "itow" vs / 1000 and week = Pprz.int_assoc "week" vs in @@ -159,7 +159,7 @@ let convert_file = fun file -> md5 := hex_of_array (Pprz.assoc "md5sum" vs) | _ -> () in - + let parser = Parser.parse use_payload in let Serial.Closure reader = Serial.input parser in @@ -177,7 +177,7 @@ let convert_file = fun file -> (* Rename the file according to the GPS time *) let start_time, mark = match !start_unix_time with - None -> + None -> fprintf stderr "Warning: not time found in GPS messages; using current date\n"; U.gettimeofday (), "_no_GPS" (* Not found, use now *) | Some u -> u, "" in @@ -195,7 +195,7 @@ let convert_file = fun file -> (** Save the corresponding .log file *) fprintf stderr "Looking for %s conf...\n%!" !md5; - let configuration = + let configuration = try xml_parse_compressed_file (search_conf !md5) with Not_found -> fprintf stderr "Not found...\n%!"; @@ -207,9 +207,9 @@ let convert_file = fun file -> Xml.PCData "" end else Xml.PCData "" in - + if configuration <> Xml.PCData "" then - let log = + let log = ExtXml.subst_attrib "time_of_day" (string_of_float start_time) (ExtXml.subst_attrib "data_file" data_name configuration) in diff --git a/sw/simulator/data.mli b/sw/simulator/data.mli index d293ff2cbd..530f7734a6 100644 --- a/sw/simulator/data.mli +++ b/sw/simulator/data.mli @@ -2,7 +2,7 @@ * $Id$ * * Usefull data for simulation - * + * * Copyright (C) 2004 Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) diff --git a/sw/simulator/diffusion.ml b/sw/simulator/diffusion.ml index 47c4d829e7..1718345d97 100644 --- a/sw/simulator/diffusion.ml +++ b/sw/simulator/diffusion.ml @@ -28,7 +28,7 @@ let wind_x = ref 0. let wind_y = ref 0. -let ivy_bus = Defivybus.default_ivy_bus +let ivy_bus = Defivybus.default_ivy_bus let plumes = Hashtbl.create 97 let t = ref 0 diff --git a/sw/simulator/flightModel.mli b/sw/simulator/flightModel.mli index 30e0a9033f..64af6686c1 100644 --- a/sw/simulator/flightModel.mli +++ b/sw/simulator/flightModel.mli @@ -2,7 +2,7 @@ * $Id$ * * Basic flight model for simulation - * + * * Copyright (C) 2004-2006 Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) diff --git a/sw/simulator/gaia.ml b/sw/simulator/gaia.ml index 6ccc2b99a8..6a69c227bb 100644 --- a/sw/simulator/gaia.ml +++ b/sw/simulator/gaia.ml @@ -32,7 +32,7 @@ let sending_period = 5000 (* ms *) module Ground_Pprz = Pprz.Messages(struct let name = "ground" end) -let ivy_bus = ref Defivybus.default_ivy_bus +let ivy_bus = ref Defivybus.default_ivy_bus let parse_args = fun () -> let options = diff --git a/sw/simulator/gps.mli b/sw/simulator/gps.mli index 1152478dcc..386118aabe 100644 --- a/sw/simulator/gps.mli +++ b/sw/simulator/gps.mli @@ -2,7 +2,7 @@ * $Id$ * * Basic GPS parameters simulation - * + * * Copyright (C) 2004 Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) diff --git a/sw/simulator/hitl.mli b/sw/simulator/hitl.mli index d560ed7c83..e5cc9037af 100644 --- a/sw/simulator/hitl.mli +++ b/sw/simulator/hitl.mli @@ -2,7 +2,7 @@ * $Id$ * * Hardware In The Loop - * + * * Copyright (C) 2004 Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) diff --git a/sw/simulator/sim.ml b/sw/simulator/sim.ml index d19f4ae9a5..cf1f41b364 100644 --- a/sw/simulator/sim.ml +++ b/sw/simulator/sim.ml @@ -77,7 +77,7 @@ external fg_msg : string -> float -> float -> float -> float -> float -> float - let ac_name = ref "A/C not set" -let ivy_bus = ref Defivybus.default_ivy_bus +let ivy_bus = ref Defivybus.default_ivy_bus let fg_client = ref "" diff --git a/sw/simulator/sim.mli b/sw/simulator/sim.mli index 810e2217e2..24062562cc 100644 --- a/sw/simulator/sim.mli +++ b/sw/simulator/sim.mli @@ -14,7 +14,7 @@ module type AIRCRAFT = end (** A simulated aircraft, without its conf *) -module type AIRCRAFT_ITL = +module type AIRCRAFT_ITL = functor (A : Data.MISSION) -> functor (FM: FlightModel.SIG) -> AIRCRAFT (** Functor to build the simulator *) diff --git a/sw/simulator/stdlib.mli b/sw/simulator/stdlib.mli index bbd00a8803..b63cf833f7 100644 --- a/sw/simulator/stdlib.mli +++ b/sw/simulator/stdlib.mli @@ -2,7 +2,7 @@ * $Id$ * * Utilities for the simulators - * + * * Copyright (C) 2004 Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) diff --git a/sw/supervision/paparazzicenter.ml b/sw/supervision/paparazzicenter.ml index c6a42eb9bb..6a174620ae 100644 --- a/sw/supervision/paparazzicenter.ml +++ b/sw/supervision/paparazzicenter.ml @@ -2,7 +2,7 @@ * $Id$ * * Paparazzi center main module - * + * * Copyright (C) 2007 ENAC, Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -44,7 +44,7 @@ let read_preferences = fun (gui:Gtk_pc.window) file (ac_combo:Gtk_tools.combo) ( let xml = Xml.parse_file file in let read_one = fun name use -> - try + try let ac_name = get_entry_value xml name in use ac_name with Not_found -> () in @@ -66,7 +66,7 @@ let read_preferences = fun (gui:Gtk_pc.window) file (ac_combo:Gtk_tools.combo) ( (*********** Left pane size *) read_one "left_pane_width" (fun width -> gui#vbox_left_pane#misc#set_size_request ~width:(ios width) ()) - + let gconf_entry = fun name value -> @@ -84,19 +84,19 @@ let add_entry = fun xml name value -> let write_preferences = fun (gui:Gtk_pc.window) file (ac_combo:Gtk_tools.combo) (session_combo:Gtk_tools.combo) (target_combo:Gtk_tools.combo) -> let xml = if Sys.file_exists file then Xml.parse_file file else Xml.Element ("gconf", [], []) in - + (* Save A/C name *) - let xml = + let xml = try let ac_name = Gtk_tools.combo_value ac_combo in - add_entry xml "last A/C" ac_name + add_entry xml "last A/C" ac_name with Not_found -> xml in - + (* Save session *) - let xml = + let xml = let session_name = Gtk_tools.combo_value session_combo in add_entry xml "last session" session_name in - + (* Save target *) let xml = ( try @@ -110,16 +110,16 @@ let write_preferences = fun (gui:Gtk_pc.window) file (ac_combo:Gtk_tools.combo) let width, height = Gdk.Drawable.get_size gui#window#misc#window in let xml = add_entry xml "width" (soi width) in let xml = add_entry xml "height" (soi height) in - + (* Save left pane width *) let width = gui#hpaned#position in let xml = add_entry xml "left_pane_width" (soi width) in xml with - Gpointer.Null -> + Gpointer.Null -> prerr_endline "Please properly quit to save layout preferences"; xml in - + let f = open_out file in Printf.fprintf f "%s\n" (ExtXml.to_string_fmt xml); close_out f @@ -133,13 +133,13 @@ let quit_button_callback = fun gui ac_combo session_combo target_combo () -> if Sys.file_exists Utils.backup_xml_file then begin let rec question_box = fun () -> match GToolbox.question_box ~title:"Quit" ~buttons:["Save changes"; "Discard changes"; "View changes"; "Cancel"] ~default:1 "Configuration changes have not been saved" with - | 2 -> + | 2 -> Sys.rename Utils.backup_xml_file Utils.conf_xml_file; quit_callback gui ac_combo session_combo target_combo () - | 3 -> + | 3 -> ignore (Sys.command (sprintf "tkdiff %s %s" Utils.backup_xml_file Utils.conf_xml_file)); question_box () - | 1 -> + | 1 -> Sys.remove Utils.backup_xml_file; quit_callback gui ac_combo session_combo target_combo () | _ -> () in @@ -194,7 +194,7 @@ let () = AC.ac_combo_handler gui ac_combo target_combo; (* Change the buffer of the text view to attach a tag_table *) - let background_tags = + let background_tags = List.map (fun color -> let tag = GText.tag ~name:color () in tag#set_property (`BACKGROUND color); @@ -208,7 +208,7 @@ let () = let errors = "red", ["error"; "no such file"; "undefined reference"; "failure"] and warnings = "orange", ["warning"] in - let color_regexps = + let color_regexps = List.map (fun (color, strings) -> let s = List.map (fun s -> "\\("^s^"\\)") strings in let s = String.concat "\\|" s in @@ -216,7 +216,7 @@ let () = color, Str.regexp_case_fold s) [errors; warnings] in let compute_tags = fun s -> - let rec loop = function + let rec loop = function (color, regexp)::rs -> if Str.string_match regexp s 0 then [List.assoc color background_tags] @@ -224,7 +224,7 @@ let () = loop rs | [] -> [] in loop color_regexps in - + let log = fun s -> let iter = gui#console#buffer#end_iter in let tags = compute_tags s in diff --git a/sw/supervision/pc_aircraft.ml b/sw/supervision/pc_aircraft.ml index 585af46b47..6d9d308675 100644 --- a/sw/supervision/pc_aircraft.ml +++ b/sw/supervision/pc_aircraft.ml @@ -2,7 +2,7 @@ * $Id$ * * Paparazzi center aircraft handling - * + * * Copyright (C) 2007 ENAC, Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -48,7 +48,7 @@ let aircraft_sample = fun name ac_id -> "gui_color", "blue"], []) - + let write_conf_xml = fun ?(user_save = false) () -> let l = Hashtbl.fold (fun _ a r -> a::r) Utils.aircrafts [] in let l = List.sort (fun ac1 ac2 -> compare (Xml.attrib ac1 "name") (Xml.attrib ac2 "name")) l in @@ -100,7 +100,7 @@ let gcs_or_edit = fun file -> 1 -> edit file | 2 -> ignore (Sys.command (sprintf "%s -edit '%s'&" gcs file)) | _ -> failwith "Internal error: gcs_or_edit" - + type ac_data = Label of GMisc.label | Tree of Gtk_tools.tree @@ -180,7 +180,7 @@ let parse_ac_targets = fun target_combo ac_file -> let count = ref 0 in let (store, column) = Gtk_tools.combo_model target_combo in store#clear (); - (** Clear ComboBox + (** Clear ComboBox **) (try let af_xml = Xml.parse_file (Env.paparazzi_src // "conf" // ac_file) in @@ -213,7 +213,7 @@ let parse_ac_targets = fun target_combo ac_file -> end; let combo_box = Gtk_tools.combo_widget target_combo in combo_box#set_active 0 -(** +(** Gtk_tools.combo (!strings) target_combo **) with _ -> ()) @@ -311,7 +311,7 @@ let ac_combo_handler = fun gui (ac_combo:Gtk_tools.combo) target_combo -> (* A/C id *) ignore(gui#entry_ac_id#connect#changed ~callback:(fun () -> save_callback gui ac_combo model ())); - + (* Conf *) List.iter (fun (name, subdir, label, button_browse, button_edit, editor, remove) -> let callback = fun _ -> @@ -379,7 +379,7 @@ let build_handler = fun ~file gui ac_combo (target_combo:Gtk_tools.combo) (log:s let callback = fun () -> Utils.command ~file gui log (Gtk_tools.combo_value ac_combo) "clean_ac" in ignore (gui#button_clean#connect#clicked ~callback); - + (* Build button *) let callback = fun () -> try ( diff --git a/sw/supervision/pc_control_panel.ml b/sw/supervision/pc_control_panel.ml index 74e71d6360..ca08a6ea7f 100644 --- a/sw/supervision/pc_control_panel.ml +++ b/sw/supervision/pc_control_panel.ml @@ -2,7 +2,7 @@ * $Id$ * * Paparazzi center processes handling - * + * * Copyright (C) 2007 ENAC, Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -34,7 +34,7 @@ let control_panel_xml = ExtXml.parse_file control_panel_xml_file let programs = let h = Hashtbl.create 7 in let s = ExtXml.child ~select:(fun x -> Xml.attrib x "name" = "programs") control_panel_xml "section" in - List.iter + List.iter (fun p -> Hashtbl.add h (ExtXml.attrib p "name") p) (Xml.children s); h @@ -48,7 +48,7 @@ let program_command = fun x -> let sessions = let h = Hashtbl.create 7 in let s = ExtXml.child ~select:(fun x -> Xml.attrib x "name" = "sessions") control_panel_xml "section" in - List.iter + List.iter (fun p -> Hashtbl.add h (ExtXml.attrib p "name") p) (Xml.children s); h @@ -72,9 +72,9 @@ let run_and_monitor = fun ?file gui log com_name args -> Utils.run_and_monitor ?file gui log com_name (program_command com_name) args let close_programs = fun gui -> - List.iter (fun w -> + List.iter (fun w -> gui#vbox_programs#remove w; - w#destroy ()) + w#destroy ()) gui#vbox_programs#children let parse_process_args = fun (name, args) -> @@ -128,7 +128,7 @@ let save_session = fun gui session_combo -> let label = new GMisc.label (Gobject.unsafe_cast label#as_widget) and entry = new GEdit.entry (Gobject.unsafe_cast entry#as_widget) in (label#text, entry#text) - | _ -> failwith "Internal error: save session") + | _ -> failwith "Internal error: save session") gui#vbox_programs#children in let current_programs = List.map parse_process_args current_processes in let session = Xml.Element("session", ["name", name], current_programs) in @@ -182,7 +182,7 @@ let supervision = fun ?file gui log (ac_combo : Gtk_tools.combo) -> let p = ref "" in List.iter (fun arg -> - let constant = + let constant = try double_quote (Xml.attrib arg "constant") with _ -> "" in p := sprintf "%s %s %s" !p (ExtXml.attrib arg "flag") constant) (Xml.children program); @@ -195,7 +195,7 @@ let supervision = fun ?file gui log (ac_combo : Gtk_tools.combo) -> run_and_monitor ?file gui log "Log File Player" ""; run_server "-n"; run_gcs () in - + (* Simulations *) let simulation = fun () -> run_gcs (); @@ -207,9 +207,9 @@ let supervision = fun ?file gui log (ac_combo : Gtk_tools.combo) -> match Gtk_tools.combo_value session_combo with "Simulation" -> simulation () | "Replay" -> replay () - | custom -> execute_custom custom in + | custom -> execute_custom custom in ignore (gui#button_execute#connect#clicked ~callback); - + (* Close session *) let callback = fun () -> close_programs gui in diff --git a/sw/tools/find_free_msg_id.ml b/sw/tools/find_free_msg_id.ml index cae865f1c3..8266ab1d4c 100644 --- a/sw/tools/find_free_msg_id.ml +++ b/sw/tools/find_free_msg_id.ml @@ -2,7 +2,7 @@ * $Id: gen_aircraft.ml 4198 2009-09-23 19:15:40Z hecto $ * * Call to Makefile.ac with the appropriate attributes from conf.xml - * + * * Copyright (C) 2003-2010 ENAC * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -42,15 +42,15 @@ let nb_msg = 255 let used_messages_id = fun xml -> let class_xmls = Xml.children xml in let id_of_message = fun xml -> - int_of_string (Xml.attrib xml "id") + int_of_string (Xml.attrib xml "id") in let rec find_message_ids = fun xml ids -> if Xml.tag xml = "message" - then (id_of_message xml) ::ids - else List.fold_right + then (id_of_message xml) ::ids + else List.fold_right (fun c l -> find_message_ids c l) (Xml.children xml) ids in - List.map + List.map (fun c -> ((Xml.attrib c "name"), find_message_ids c [])) class_xmls (* useful to display grouped ids *) @@ -64,15 +64,15 @@ let group = fun l -> li1= List.nth l (i-1) in if (li - li1 > 1) then begin - gl := + gl := ( - if !s = li1 + if !s = li1 then Printf.sprintf "%d" !s else Printf.sprintf "%d-%d" !s li1) :: !gl; s := li; end else if i = n -1 - then + then gl := (Printf.sprintf "%d-%d" !s li) :: !gl; done; List.rev !gl @@ -82,18 +82,18 @@ let group = fun l -> let () = (* reading files *) let xml = Xml.parse_file messages_xml in - let messages = + let messages = List.map (fun c -> ((Xml.attrib c "name"), Xml.children c)) (Xml.children xml) in - + let id_list = Array.to_list (Array.init nb_msg (fun i -> i+1)) in - + (* finding free IDs *) - let free_msg_id = + let free_msg_id = let umi = used_messages_id xml in - List.map (fun (c,_) -> + List.map (fun (c,_) -> if List.mem_assoc c umi - then let used = List.assoc c umi in + then let used = List.assoc c umi in (c,List.filter (fun i -> not (List.mem i used)) id_list) else (c,id_list) ) messages in @@ -106,6 +106,6 @@ let () = Printf.printf "\n\n" ) free_msg_id - - + + diff --git a/sw/tools/fp_proc.ml b/sw/tools/fp_proc.ml index 93f37bab4c..c22a4c1ca1 100644 --- a/sw/tools/fp_proc.ml +++ b/sw/tools/fp_proc.ml @@ -2,7 +2,7 @@ * $Id$ * * Flight plan preprocessing (procedure including) - * + * * Copyright (C) 2004-2009 CENA/ENAC, Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -67,7 +67,7 @@ let subst_expression = fun env e -> let transform_expression = fun env e -> let e' = subst_expression env e in Expr_syntax.sprint e' - + let transform_values = fun attribs_not_modified env attribs -> List.map @@ -100,7 +100,7 @@ let transform_exception = fun prefix reroutes env xml -> let attribs = transform_values [] env attribs in Xml.Element (tag, attribs, children) | _ -> failwith "transform_exception" - + let transform_stage = fun prefix reroutes env xml -> @@ -159,9 +159,9 @@ let transform_block = fun prefix reroutes env xml -> let build_assocs = fun tag key_attr val_attr xml -> - let xmls = - List.filter - (fun x -> ExtXml.tag_is x tag) + let xmls = + List.filter + (fun x -> ExtXml.tag_is x tag) (Xml.children xml) in List.map @@ -178,7 +178,7 @@ let get_pc_data = fun tag xml -> Xml.pcdata (ExtXml.child (ExtXml.child xml tag) "0") with Not_found -> "" - + let append_children = fun (tag, new_children) xml -> let children = get_children tag xml @ new_children in @@ -193,7 +193,7 @@ let append_pc_data = fun tag new_data xml -> let parse_include = fun dir flight_plan include_xml -> - let f = + let f = let procedure = ExtXml.attrib include_xml "procedure" in try Ocaml_tools.find_file [dir; Env.flight_plans_path] procedure with Not_found -> @@ -203,10 +203,10 @@ let parse_include = fun dir flight_plan include_xml -> let reroutes = build_assocs "with" "from" "to" include_xml and args_assocs = build_assocs "arg" "name" "value" include_xml in - + try let proc = ExtXml.parse_file ~noprovedtd:true f in - let params = List.filter + let params = List.filter (fun x -> ExtXml.tag_is x "param") (Xml.children proc) in @@ -242,7 +242,7 @@ let parse_include = fun dir flight_plan include_xml -> with Failure msg -> fprintf stderr "Error: %s\n" msg; exit 1 - + let replace_children = fun xml new_children_assoc -> Xml.Element (Xml.tag xml, Xml.attribs xml, @@ -255,7 +255,7 @@ let replace_children = fun xml new_children_assoc -> Not_found -> x ) (Xml.children xml)) - + let process_includes = fun dir xml -> let includes = @@ -293,9 +293,9 @@ let replace_wp = fun stage waypoints -> let qdr = ExtXml.float_attrib stage "wp_qdr" and dist = ExtXml.float_attrib stage "wp_dist" in let wp = ExtXml.attrib stage "wp" in - + let name = new_waypoint wp qdr dist waypoints in - + let other_attribs = remove_attribs stage ["wp";"wp_qdr";"wp_dist"] in Xml.Element (Xml.tag stage, ("wp", name)::other_attribs, []) with @@ -307,9 +307,9 @@ let replace_from = fun stage waypoints -> let qdr = ExtXml.float_attrib stage "from_qdr" and dist = ExtXml.float_attrib stage "from_dist" in let wp = ExtXml.attrib stage "from" in - + let name = new_waypoint wp qdr dist waypoints in - + let other_attribs = remove_attribs stage ["from";"from_qdr";"from_dist"] in Xml.Element (Xml.tag stage, ("from", name)::other_attribs, []) with @@ -321,13 +321,13 @@ let process_stage = fun stage waypoints -> match String.lowercase (Xml.tag stage) with "go" | "stay" | "circle" -> replace_from (replace_wp stage waypoints) waypoints - + | "while" -> Xml.Element("while", Xml.attribs stage, List.map do_it (Xml.children stage)) | _ -> stage in do_it stage - - + + let process_relative_waypoints = fun xml -> let waypoints = ExtXml.child xml "waypoints" and blocks = ExtXml.child xml "blocks" in @@ -354,7 +354,7 @@ let process_relative_waypoints = fun xml -> let regexp_path = Str.regexp "[ \t,]+" - + let stage_process_path = fun stage rest -> if Xml.tag stage = "path" then @@ -364,7 +364,7 @@ let stage_process_path = fun stage rest -> [] -> failwith "Waypoint expected in path stage" | [wp] -> (* Just go to this single point *) Xml.Element("go", ("wp", wp)::attribs, [])::rest - | wp1::wp2::ps -> + | wp1::wp2::ps -> Xml.Element("go", ["from", wp1; "hmode","route"; "wp", wp2]@attribs, []):: @@ -377,7 +377,7 @@ let block_process_path = fun block -> let stages = Xml.children block in let new_stages = List.fold_right stage_process_path stages [] in Xml.Element (Xml.tag block, Xml.attribs block, new_stages) - + let process_paths = fun xml -> let blocks = ExtXml.child xml "blocks" in diff --git a/sw/tools/fp_proc.mli b/sw/tools/fp_proc.mli index 120afc5c2d..7146a96f09 100644 --- a/sw/tools/fp_proc.mli +++ b/sw/tools/fp_proc.mli @@ -2,7 +2,7 @@ * $Id$ * * Flight plan preprocessing (from XML to XML) - * + * * Copyright (C) 2009 ENAC, Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) diff --git a/sw/tools/gen_messages.ml b/sw/tools/gen_messages.ml index e3ca6b1450..86dde60a4f 100644 --- a/sw/tools/gen_messages.ml +++ b/sw/tools/gen_messages.ml @@ -2,7 +2,7 @@ * $Id$ * * XML preprocessing of messages.xml for downlink protocol - * + * * Copyright (C) 2003-2008 ENAC, Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,29 +20,29 @@ * 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. + * Boston, MA 02111-1307, USA. * *) open Printf type format = string - -type _type = + +type _type = Basic of string | Array of string * string - + type field = _type * string * format option - + type fields = field list - -type message = { - name : string; - id : int; + +type message = { + name : string; + id : int; period : float option; fields : fields } - + module Syntax = struct (** Parse a type name and returns a _type value *) let parse_type = fun t varname -> @@ -58,7 +58,7 @@ module Syntax = struct try List.assoc t Pprz.types with - Not_found -> + Not_found -> failwith (sprintf "Error: '%s' unknown type" t) let rec sizeof = function @@ -82,7 +82,7 @@ module Syntax = struct and fmt = try Some (Xml.attrib field "format") with _ -> None in let _type = parse_type type_name id in (_type, id, fmt)) - (Xml.children xml) in + (Xml.children xml) in { id=id; name = name; period = period; fields = fields } let check_single_ids = fun msgs -> @@ -96,7 +96,7 @@ module Syntax = struct last_id := msg.id; tab.(msg.id) <- true) msgs - + (** Translates one class of a XML message file into a list of messages *) let read = fun filename class_ -> let xml = Xml.parse_file filename in @@ -113,7 +113,7 @@ end (* module Suntax *) (** Pretty printer of C macros for sending and parsing messages *) module Gen_onboard = struct let print_field = fun h (t, name, (_f: format option)) -> - match t with + match t with Basic _ -> fprintf h "\t DownlinkPut%sByAddr(_chan, (%s)); \\\n" (Syntax.nameof t) name | Array (t, varname) -> @@ -123,7 +123,7 @@ module Gen_onboard = struct let print_parameter h = function (Array _, s, _) -> fprintf h "%s, %s" (Syntax.length_name s) s | (_, s, _) -> fprintf h "%s" s - + let print_macro_parameters h = function [] -> () | f::fields -> @@ -136,7 +136,7 @@ module Gen_onboard = struct | (t, _, _)::fields -> size_fields fields (size ^"+"^Syntax.sizeof t) let size_of_message = fun m -> size_fields m.fields "0" - + let estimated_size_of_message = fun m -> try List.fold_right @@ -145,7 +145,7 @@ module Gen_onboard = struct 0 with Failure "int_of_string" -> 0 - + let print_downlink_macro = fun h {name=s; fields = fields} -> if List.length fields > 0 then begin fprintf h "#define DOWNLINK_SEND_%s(_chan, " s; @@ -174,7 +174,7 @@ module Gen_onboard = struct (** Prints the messages ids *) let print_enum = fun h class_ messages -> List.iter (fun m -> - if m.id < 0 || m.id > 255 then begin + if m.id < 0 || m.id > 255 then begin fprintf stderr "Error: message %s has id %d but should be between 0 and 255\n" m.name m.id; exit 1; end else fprintf h "#define DL_%s %d\n" m.name m.id @@ -211,7 +211,7 @@ module Gen_onboard = struct print_enum h class_ messages; print_lengths_array h class_ messages; List.iter (print_downlink_macro h) messages - + let print_null_downlink_macros = fun h messages -> List.iter (print_null_downlink_macro h) messages @@ -219,7 +219,7 @@ module Gen_onboard = struct let print_get_macros = fun h check_alignment message -> let msg_name = message.name in let offset = ref Pprz.offset_fields in - + (** Prints the macro for one field, using the global [offset] ref *) let parse_field = fun (_type, field_name, _format) -> if !offset < 0 then @@ -229,11 +229,11 @@ module Gen_onboard = struct let size = pprz_type.Pprz.size in if check_alignment && o mod (min size 4) <> 0 then failwith (sprintf "Wrong alignment of field '%s' in message '%s" field_name msg_name); - + match size with 1 -> sprintf "(%s)(*((uint8_t*)_payload+%d))" pprz_type.Pprz.inttype o | 2 -> sprintf "(%s)(*((uint8_t*)_payload+%d)|*((uint8_t*)_payload+%d+1)<<8)" pprz_type.Pprz.inttype o o - | 4 when pprz_type.Pprz.inttype = "float" -> + | 4 when pprz_type.Pprz.inttype = "float" -> sprintf "({ union { uint32_t u; float f; } _f; _f.u = (uint32_t)(*((uint8_t*)_payload+%d)|*((uint8_t*)_payload+%d+1)<<8|((uint32_t)*((uint8_t*)_payload+%d+2))<<16|((uint32_t)*((uint8_t*)_payload+%d+3))<<24); _f.f; })" o o o o | 8 when pprz_type.Pprz.inttype = "double" -> let s = ref (sprintf "*((uint8_t*)_payload+%d)" o) in @@ -242,12 +242,12 @@ module Gen_onboard = struct done; sprintf "({ union { uint64_t u; double f; } _f; _f.u = (uint64_t)(%s); Swap32IfBigEndian(_f.u); _f.f; })" !s - | 4 -> + | 4 -> sprintf "(%s)(*((uint8_t*)_payload+%d)|*((uint8_t*)_payload+%d+1)<<8|((uint32_t)*((uint8_t*)_payload+%d+2))<<16|((uint32_t)*((uint8_t*)_payload+%d+3))<<24)" pprz_type.Pprz.inttype o o o o | _ -> failwith "unexpected size in Gen_messages.print_get_macros" in (** To be an array or not to be an array: *) - match _type with + match _type with Basic t -> let pprz_type = Syntax.assoc_types t in fprintf h "#define DL_%s_%s(_payload) (%s)\n" msg_name field_name (typed !offset pprz_type); @@ -262,11 +262,11 @@ module Gen_onboard = struct let pprz_type = Syntax.assoc_types t in if check_alignment && !offset mod (min pprz_type.Pprz.size 4) <> 0 then failwith (sprintf "Wrong alignment of field '%s' in message '%s" field_name msg_name); - + fprintf h "#define DL_%s_%s(_payload) ((%s*)(_payload+%d))\n" msg_name field_name pprz_type.Pprz.inttype !offset; offset := -1 (** Mark for no more fields *) in - + fprintf h "\n"; (** Do it for all the fields of the message *) List.iter parse_field message.fields @@ -277,7 +277,7 @@ end (* module Gen_onboard *) (********************* Main **************************************************) let () = if Array.length Sys.argv <> 3 then begin - failwith (sprintf "Usage: %s <.xml file> " Sys.argv.(0)) + failwith (sprintf "Usage: %s <.xml file> " Sys.argv.(0)) end; let filename = Sys.argv.(1) @@ -285,14 +285,14 @@ let () = try let messages = Syntax.read filename class_name in - + let h = stdout in - + Printf.fprintf h "/* Automatically generated from %s */\n" filename; Printf.fprintf h "/* Please DO NOT EDIT */\n"; - + Printf.fprintf h "/* Macros to send and receive messages of class %s */\n" class_name; - + (** Macros for airborne downlink (sending) *) if class_name = "telemetry" then begin (** FIXME *) Printf.fprintf h "#ifdef DOWNLINK\n" @@ -303,7 +303,7 @@ let () = Gen_onboard.print_null_downlink_macros h messages; Printf.fprintf h "#endif // DOWNLINK\n" end; - + (** Macros for airborne datalink (receiving) *) let check_alignment = class_name <> "telemetry" in List.iter (Gen_onboard.print_get_macros h check_alignment) messages diff --git a/sw/tools/gen_messages2.ml b/sw/tools/gen_messages2.ml index 79e92fdb60..c8b17de62e 100644 --- a/sw/tools/gen_messages2.ml +++ b/sw/tools/gen_messages2.ml @@ -2,7 +2,7 @@ * $Id: gen_messages2.ml 4783 2010-04-02 11:23:40Z hecto $ * * XML preprocessing of messages.xml for downlink protocol - * + * * Copyright (C) 2003-2008 ENAC, Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,15 +20,15 @@ * 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. + * Boston, MA 02111-1307, USA. * *) open Printf type format = string - -type _type = + +type _type = Basic of string | Array of string * string @@ -55,18 +55,18 @@ let dl_type = fun format -> | "Uint16" -> "DL_TYPE_UINT16" | "Uint8" -> "DL_TYPE_UINT8" | _ -> failwith (sprintf "gen_messages.c_type: unknown format '%s'" format) - + type field = _type * string * format option - + type fields = field list - -type message = { - name : string; - id : int; + +type message = { + name : string; + id : int; period : float option; fields : fields } - + module Syntax = struct (** Parse a type name and returns a _type value *) let parse_type = fun t varname -> @@ -82,7 +82,7 @@ module Syntax = struct try List.assoc t Pprz.types with - Not_found -> + Not_found -> failwith (sprintf "Error: '%s' unknown type" t) let rec sizeof = function @@ -106,7 +106,7 @@ module Syntax = struct and fmt = try Some (Xml.attrib field "format") with _ -> None in let _type = parse_type type_name id in (_type, id, fmt)) - (Xml.children xml) in + (Xml.children xml) in { id=id; name = name; period = period; fields = fields } let check_single_ids = fun msgs -> @@ -120,7 +120,7 @@ module Syntax = struct last_id := msg.id; tab.(msg.id) <- true) msgs - + (** Translates one class of a XML message file into a list of messages *) let read = fun filename class_ -> let xml = Xml.parse_file filename in @@ -137,7 +137,7 @@ end (* module Suntax *) (** Pretty printer of C macros for sending and parsing messages *) module Gen_onboard = struct let print_field = fun h (t, name, (_f: format option)) -> - match t with + match t with Basic _ -> fprintf h "\t tp->PutBytes(tp->impl, %s, %s, (void *) _%s); \n" (dl_type (Syntax.nameof t)) (Syntax.sizeof t) name | Array (t, varname) -> @@ -148,7 +148,7 @@ module Gen_onboard = struct let print_parameter h = function (Array (t, varname), s, _) -> fprintf h "uint8_t %s, %s *_%s" (Syntax.length_name s) (c_type (Syntax.nameof (Basic t))) s | (t, s, _) -> fprintf h "%s *_%s" (c_type (Syntax.nameof t)) s - + let print_macro_parameters h = function [] -> () | f::fields -> @@ -161,7 +161,7 @@ module Gen_onboard = struct | (t, _, _)::fields -> size_fields fields (size ^"+"^Syntax.sizeof t) let size_of_message = fun m -> size_fields m.fields "0" - + let estimated_size_of_message = fun m -> try List.fold_right @@ -170,7 +170,7 @@ module Gen_onboard = struct 0 with Failure "int_of_string" -> 0 - + let print_downlink_macro = fun h {name=s; fields = fields} -> if List.length fields > 0 then begin fprintf h "static inline void DOWNLINK_SEND_%s(struct DownlinkTransport *tp, " s; @@ -199,7 +199,7 @@ module Gen_onboard = struct (** Prints the messages ids *) let print_enum = fun h class_ messages -> List.iter (fun m -> - if m.id < 0 || m.id > 255 then begin + if m.id < 0 || m.id > 255 then begin fprintf stderr "Error: message %s has id %d but should be between 0 and 255\n" m.name m.id; exit 1; end else fprintf h "#define DL_%s %d\n" m.name m.id @@ -236,7 +236,7 @@ module Gen_onboard = struct print_enum h class_ messages; print_lengths_array h class_ messages; List.iter (print_downlink_macro h) messages - + let print_null_downlink_macros = fun h messages -> List.iter (print_null_downlink_macro h) messages @@ -244,7 +244,7 @@ module Gen_onboard = struct let print_get_macros = fun h check_alignment message -> let msg_name = message.name in let offset = ref Pprz.offset_fields in - + (** Prints the macro for one field, using the global [offset] ref *) let parse_field = fun (_type, field_name, _format) -> if !offset < 0 then @@ -254,11 +254,11 @@ module Gen_onboard = struct let size = pprz_type.Pprz.size in if check_alignment && o mod (min size 4) <> 0 then failwith (sprintf "Wrong alignment of field '%s' in message '%s" field_name msg_name); - + match size with 1 -> sprintf "(%s)(*((uint8_t*)_payload+%d))" pprz_type.Pprz.inttype o | 2 -> sprintf "(%s)(*((uint8_t*)_payload+%d)|*((uint8_t*)_payload+%d+1)<<8)" pprz_type.Pprz.inttype o o - | 4 when pprz_type.Pprz.inttype = "float" -> + | 4 when pprz_type.Pprz.inttype = "float" -> sprintf "({ union { uint32_t u; float f; } _f; _f.u = (uint32_t)(*((uint8_t*)_payload+%d)|*((uint8_t*)_payload+%d+1)<<8|((uint32_t)*((uint8_t*)_payload+%d+2))<<16|((uint32_t)*((uint8_t*)_payload+%d+3))<<24); _f.f; })" o o o o | 8 when pprz_type.Pprz.inttype = "double" -> let s = ref (sprintf "*((uint8_t*)_payload+%d)" o) in @@ -267,12 +267,12 @@ module Gen_onboard = struct done; sprintf "({ union { uint64_t u; double f; } _f; _f.u = (uint64_t)(%s); Swap32IfBigEndian(_f.u); _f.f; })" !s - | 4 -> + | 4 -> sprintf "(%s)(*((uint8_t*)_payload+%d)|*((uint8_t*)_payload+%d+1)<<8|((uint32_t)*((uint8_t*)_payload+%d+2))<<16|((uint32_t)*((uint8_t*)_payload+%d+3))<<24)" pprz_type.Pprz.inttype o o o o | _ -> failwith "unexpected size in Gen_messages.print_get_macros" in (** To be an array or not to be an array: *) - match _type with + match _type with Basic t -> let pprz_type = Syntax.assoc_types t in fprintf h "#define DL_%s_%s(_payload) (%s)\n" msg_name field_name (typed !offset pprz_type); @@ -287,11 +287,11 @@ module Gen_onboard = struct let pprz_type = Syntax.assoc_types t in if check_alignment && !offset mod (min pprz_type.Pprz.size 4) <> 0 then failwith (sprintf "Wrong alignment of field '%s' in message '%s" field_name msg_name); - + fprintf h "#define DL_%s_%s(_payload) ((%s*)(_payload+%d))\n" msg_name field_name pprz_type.Pprz.inttype !offset; offset := -1 (** Mark for no more fields *) in - + fprintf h "\n"; (** Do it for all the fields of the message *) List.iter parse_field message.fields @@ -302,7 +302,7 @@ end (* module Gen_onboard *) (********************* Main **************************************************) let () = if Array.length Sys.argv <> 3 then begin - failwith (sprintf "Usage: %s <.xml file> " Sys.argv.(0)) + failwith (sprintf "Usage: %s <.xml file> " Sys.argv.(0)) end; let filename = Sys.argv.(1) @@ -310,17 +310,17 @@ let () = try let messages = Syntax.read filename class_name in - + let h = stdout in - + Printf.fprintf h "/* Automatically generated from %s */\n" filename; Printf.fprintf h "/* Please DO NOT EDIT */\n"; - + Printf.fprintf h "/* Macros to send and receive messages of class %s */\n" class_name; Printf.fprintf h "#ifndef _VAR_MESSAGES2_%s_H_\n" class_name; Printf.fprintf h "#define _VAR_MESSAGES2_%s_H_\n" class_name; Printf.fprintf h "#include \"downlink_transport.h\"\n"; - + (** Macros for airborne downlink (sending) *) if class_name = "telemetry" then begin (** FIXME *) Printf.fprintf h "#ifdef DOWNLINK\n" @@ -331,7 +331,7 @@ let () = Gen_onboard.print_null_downlink_macros h messages; Printf.fprintf h "#endif // DOWNLINK\n" end; - + (** Macros for airborne datalink (receiving) *) let check_alignment = class_name <> "telemetry" in List.iter (Gen_onboard.print_get_macros h check_alignment) messages; diff --git a/sw/tools/gen_mtk.ml b/sw/tools/gen_mtk.ml index 692745152d..4eb248f55d 100644 --- a/sw/tools/gen_mtk.ml +++ b/sw/tools/gen_mtk.ml @@ -2,7 +2,7 @@ * $Id$ * * XML preprocessing for Mediatek (DIYDrones 1.4/1.6) protocol - * + * * Copyright (C) 2003 Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -69,8 +69,8 @@ let define = fun x y -> exception Length_error of Xml.xml*int*int - - + + let parse_message = fun class_name m -> let msg_name = Xml.attrib m "name" in @@ -108,10 +108,10 @@ let parse_message = fun class_name m -> with Xml.No_attribute("length") -> () (** Undefined length authorized *) end; - + (** Generating send function *) let param_name = fun f -> String.lowercase (field_name f) in - let rec param_names = fun f r -> + let rec param_names = fun f r -> if Xml.tag f = "field" then param_name f :: r else @@ -123,7 +123,7 @@ let parse_message = fun class_name m -> fprintf out " MtkHeader(MTK_%s_ID, %s, %d);\\\n" class_name msg_id !offset; let rec send_one_field = fun f -> match Xml.tag f with - "field" -> + "field" -> let s = sizeof (format f) in let p = param_name f in let t = param_type f in @@ -134,8 +134,8 @@ let parse_message = fun class_name m -> List.iter send_one_field (Xml.children m); fprintf out " MtkTrailer();\\\n"; fprintf out "}\n\n#define MTK_%s_%s_LENGTH %d\n" class_name msg_name !offset - - + + let parse_class = fun c -> let _class_id = int_of_string (Xml.attrib c "id") and class_name = Xml.attrib c "name" in @@ -144,21 +144,21 @@ let parse_class = fun c -> define (sprintf "MTK_%s_ID" class_name) (Xml.attrib c "ID"); List.iter (parse_message class_name) (Xml.children c) - + let _ = if Array.length Sys.argv <> 2 then begin - failwith (sprintf "Usage: %s <.xml mtk protocol file>" Sys.argv.(0)) + failwith (sprintf "Usage: %s <.xml mtk protocol file>" Sys.argv.(0)) end; let xml_file = Sys.argv.(1) in try let xml = Xml.parse_file xml_file in fprintf out "/* Generated from %s */\n" xml_file; fprintf out "/* Please DO NOT EDIT */\n\n"; - + define "MTK_DIY14_SYNC1" "0xB5"; define "MTK_DIY14_SYNC2" "0x62"; - + List.iter parse_class (Xml.children xml) with Xml.Error (em, ep) -> diff --git a/sw/tools/gen_periodic.ml b/sw/tools/gen_periodic.ml index 4729a82173..b0fe980800 100644 --- a/sw/tools/gen_periodic.ml +++ b/sw/tools/gen_periodic.ml @@ -2,7 +2,7 @@ * $Id$ * * XML preprocessing for periodic messages - * + * * Copyright (C) 2003 Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -47,14 +47,14 @@ let output_modes = fun avr_h process_name channel_name modes freq modules -> (fun mode -> let mode_name = ExtXml.attrib mode "name" in lprintf avr_h "if (telemetry_mode_%s_%s == TELEMETRY_MODE_%s_%s_%s) {\\\n" process_name channel_name process_name channel_name mode_name; - right (); + right (); (** Filter message list to remove messages linked to unloaded modules *) let filtered_msg = List.filter (fun msg -> try let att = Xml.attrib msg "module" in List.exists (fun name -> String.compare name att = 0) modules with _ -> true ) (Xml.children mode) in (** Computes the required modulos *) - let messages = List.map (fun x -> + let messages = List.map (fun x -> let p = float_of_string (ExtXml.attrib x "period") in if p < min_period || p > max_period then fprintf stderr "Warning: period is bound between %.3fs and %.3fs for message %s\n%!" min_period max_period (ExtXml.attrib x "name"); @@ -66,7 +66,7 @@ let output_modes = fun avr_h process_name channel_name modes freq modules -> let _type = if m >= 256 then "uint16_t" else "uint8_t" in lprintf avr_h "static %s %s = 0; %s++; if (%s>=%d) %s=0;\\\n" _type v v v m v; ) modulos; - + (** For each message in this mode *) let messages = List.sort (fun (_,p) (_,p') -> compare p p') messages in let i = ref 0 in (** Basic balancing:1 message every 10Hz *) @@ -96,15 +96,15 @@ let output_modes = fun avr_h process_name channel_name modes freq modules -> let _ = if Array.length Sys.argv <> 5 then begin - failwith (sprintf "Usage: %s frequency_in_hz" Sys.argv.(0)) + failwith (sprintf "Usage: %s frequency_in_hz" Sys.argv.(0)) end; let freq = int_of_string(Sys.argv.(4)) in - let telemetry_xml = + let telemetry_xml = try Xml.parse_file Sys.argv.(3) with Dtd.Check_error e -> failwith (Dtd.check_error e) - + in let modules_name = GC.get_modules_name (ExtXml.parse_file Sys.argv.(1)) in @@ -114,7 +114,7 @@ let _ = fprintf avr_h "/* Please DO NOT EDIT */\n\n"; fprintf avr_h "#ifndef _VAR_PERIODIC_H_\n"; fprintf avr_h "#define _VAR_PERIODIC_H_\n"; - + (** For each process *) List.iter (fun process -> @@ -124,7 +124,7 @@ let _ = fprintf avr_h "\n/* Macros for %s process channel %s */\n" process_name channel_name; let modes = Xml.children process in - + let i = ref 0 in (** For each mode of this process *) List.iter (fun mode -> @@ -132,7 +132,7 @@ let _ = Xml2h.define (sprintf "TELEMETRY_MODE_%s_%s_%s" process_name channel_name name) (string_of_int !i); (* Output the periods of the messages *) List.iter - (fun x -> + (fun x -> let p = ExtXml.attrib x "period" and n = ExtXml.attrib x "name" in Xml2h.define (sprintf "PERIOD_%s_%s_%s_%d" n process_name channel_name !i) (sprintf "(%s)" p)) diff --git a/sw/tools/gen_radio.ml b/sw/tools/gen_radio.ml index bd483b1968..da86ba33a1 100644 --- a/sw/tools/gen_radio.ml +++ b/sw/tools/gen_radio.ml @@ -2,7 +2,7 @@ * $Id$ * * XML preprocessing for radio-control parameters - * + * * Copyright (C) 2003 Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -32,11 +32,11 @@ let h_name = "RADIO_H" let fos = float_of_string type us = int -type channel = { +type channel = { name : string; - min : us; - max : us; - neutral : us; + min : us; + max : us; + neutral : us; averaged : bool } @@ -73,7 +73,7 @@ let norm1_ppm = fun c -> sprintf "tmp_radio * (MAX_PPRZ / (float)(RC_PPM_SIGNED_TICS_OF_USEC(%d-%d)))" c.max c.min, "0" else sprintf "tmp_radio * (tmp_radio >=0 ? (MAX_PPRZ/(float)(RC_PPM_SIGNED_TICS_OF_USEC(%d-%d))) : (MIN_PPRZ/(float)(RC_PPM_SIGNED_TICS_OF_USEC(%d-%d))))" c.max c.neutral c.min c.neutral, "MIN_PPRZ" - + let gen_normalize_ppm_fir = fun channels -> printf "#define NormalizePpmFIR(_ppm, _rc) {\\\n"; printf " static uint8_t avg_cpt = 0; /* Counter for averaging */\\\n"; @@ -155,10 +155,10 @@ let _ = nl (); define "RADIO_FILTER" "7"; nl (); - - let channels_params = List.map parse_channel channels in + + let channels_params = List.map parse_channel channels in nl (); - + List.iter (fun c -> begin @@ -187,6 +187,6 @@ let _ = nl (); gen_normalize_ppm_iir channels_params; nl (); - + printf "\n#endif // %s\n" h_name - + diff --git a/sw/tools/gen_settings.ml b/sw/tools/gen_settings.ml index 0fc95e35ff..4be08f1bd6 100644 --- a/sw/tools/gen_settings.ml +++ b/sw/tools/gen_settings.ml @@ -142,7 +142,7 @@ let print_dl_settings = fun settings -> *) let print_persistent_settings = fun settings -> let settings = flatten settings [] in - let pers_settings = + let pers_settings = List.filter (fun x -> try let _ = Xml.attrib x "persistent" in true with _ -> false) settings in (* structure declaration *) (* if List.length pers_settings > 0 then begin *) diff --git a/sw/tools/gen_tuning.ml b/sw/tools/gen_tuning.ml index b536f067c7..e8640c32f6 100644 --- a/sw/tools/gen_tuning.ml +++ b/sw/tools/gen_tuning.ml @@ -2,7 +2,7 @@ * $Id$ * * XML preprocessing for dynamic tuning - * + * * Copyright (C) 2006 Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -43,8 +43,8 @@ let join_xml_files = fun xml_files -> let dl_settings = ref [] in List.iter (fun xml_file -> let xml = Xml.parse_file xml_file in - let these_dl_settings = - try Xml.children (ExtXml.child xml "dl_settings") with + let these_dl_settings = + try Xml.children (ExtXml.child xml "dl_settings") with Not_found -> [] in dl_settings := these_dl_settings @ !dl_settings) xml_files; @@ -60,11 +60,11 @@ let _ = xml_files := Sys.argv.(i) :: !xml_files; done; (*let xml_file = Sys.argv.(1) in*) - + try printf "/* This file has been generated from %s */\n" (String.concat " " !xml_files); printf "/* Please DO NOT EDIT */\n\n"; - + printf "#ifndef %s\n" h_name; printf "#define %s\n\n" h_name; @@ -72,14 +72,14 @@ let _ = let xml = Xml.Element ("settings", [], [dl_settings]) in (*let xml = Xml.parse_file xml_file in*) let settings = flatten xml [] in - + (** Macro to define variables id *) let idx = ref 0 in List.iter (fun s -> let v = ExtXml.attrib s "var" in let up = String.uppercase v in begin printf "#define PPRZ_%s %d \n" up !idx end; - incr idx) + incr idx) settings; finish h_name diff --git a/sw/tools/gen_ubx.ml b/sw/tools/gen_ubx.ml index 117df23265..882757a108 100644 --- a/sw/tools/gen_ubx.ml +++ b/sw/tools/gen_ubx.ml @@ -2,7 +2,7 @@ * $Id$ * * XML preprocessing for UBX protocol - * + * * Copyright (C) 2003 Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -61,8 +61,8 @@ let define = fun x y -> exception Length_error of Xml.xml*int*int - - + + let parse_message = fun class_name m -> let msg_name = Xml.attrib m "name" in @@ -100,10 +100,10 @@ let parse_message = fun class_name m -> with Xml.No_attribute("length") -> () (** Undefined length authorized *) end; - + (** Generating send function *) let param_name = fun f -> String.lowercase (field_name f) in - let rec param_names = fun f r -> + let rec param_names = fun f r -> if Xml.tag f = "field" then param_name f :: r else @@ -115,7 +115,7 @@ let parse_message = fun class_name m -> fprintf out " UbxHeader(UBX_%s_ID, %s, %d);\\\n" class_name msg_id !offset; let rec send_one_field = fun f -> match Xml.tag f with - "field" -> + "field" -> let s = sizeof (format f) in let p = param_name f in let t = param_type f in @@ -126,8 +126,8 @@ let parse_message = fun class_name m -> List.iter send_one_field (Xml.children m); fprintf out " UbxTrailer();\\\n"; fprintf out "}\n" - - + + let parse_class = fun c -> let _class_id = int_of_string (Xml.attrib c "id") and class_name = Xml.attrib c "name" in @@ -136,21 +136,21 @@ let parse_class = fun c -> define (sprintf "UBX_%s_ID" class_name) (Xml.attrib c "ID"); List.iter (parse_message class_name) (Xml.children c) - + let _ = if Array.length Sys.argv <> 2 then begin - failwith (sprintf "Usage: %s <.xml ubx protocol file>" Sys.argv.(0)) + failwith (sprintf "Usage: %s <.xml ubx protocol file>" Sys.argv.(0)) end; let xml_file = Sys.argv.(1) in try let xml = Xml.parse_file xml_file in fprintf out "/* Generated from %s */\n" xml_file; fprintf out "/* Please DO NOT EDIT */\n\n"; - + define "UBX_SYNC1" "0xB5"; define "UBX_SYNC2" "0x62"; - + List.iter parse_class (Xml.children xml) with Xml.Error (em, ep) -> diff --git a/sw/tools/gen_xsens.ml b/sw/tools/gen_xsens.ml index 5ab4773cbf..a66c9fd344 100644 --- a/sw/tools/gen_xsens.ml +++ b/sw/tools/gen_xsens.ml @@ -2,7 +2,7 @@ * $Id$ * * XML preprocessing for UBX protocol - * + * * Copyright (C) 2003 Pascal Brisset, Antoine Drouin * * This file is part of paparazzi. @@ -20,7 +20,7 @@ * 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. + * Boston, MA 02111-1307, USA. * *) @@ -73,9 +73,9 @@ let define = fun x y -> exception Length_error of Xml.xml*int*int - - -let parse_message = fun m -> + + +let parse_message = fun m -> let msg_name = Xml.attrib m "name" in fprintf out "\n"; @@ -130,7 +130,7 @@ let parse_message = fun m -> fprintf out " XsensHeader(%s, %s);\\\n" msg_id (get_msg_length m); let rec send_one_field = fun f -> match Xml.tag f with - "field" -> + "field" -> let s = sizeof (format f) in let p = param_name f in let t = param_type f in @@ -161,7 +161,7 @@ let parse_message = fun m -> end - + let parse_data = fun d -> let data_name = Xml.attrib d "name" in @@ -222,18 +222,18 @@ let parse_all = fun m -> let _ = if Array.length Sys.argv <> 2 then begin - failwith (sprintf "Usage: %s <.xml xsens protocol file>" Sys.argv.(0)) + failwith (sprintf "Usage: %s <.xml xsens protocol file>" Sys.argv.(0)) end; let xml_file = Sys.argv.(1) in try let xml = Xml.parse_file xml_file in fprintf out "/* Generated from %s */\n" xml_file; fprintf out "/* Please DO NOT EDIT */\n\n"; - + define "XSENS_START" "0xFA"; define "XSENS_BID" "0xFF"; fprintf out "\n"; - + List.iter parse_all (Xml.children xml) with Xml.Error (em, ep) -> diff --git a/sw/tools/wiki_gen/wiki_gen.ml b/sw/tools/wiki_gen/wiki_gen.ml index 9b719146b7..8ed1f4c3f0 100644 --- a/sw/tools/wiki_gen/wiki_gen.ml +++ b/sw/tools/wiki_gen/wiki_gen.ml @@ -23,7 +23,7 @@ let print_subsystems = fun outfile xml -> end) (Xml.children xml) - + let print_targets = fun outfile xml -> List.iter (fun tag -> if ExtXml.tag_is tag "target" then begin