diff --git a/Makefile.ac b/Makefile.ac
index 16d5b18b43..a2bef0cdc1 100644
--- a/Makefile.ac
+++ b/Makefile.ac
@@ -42,6 +42,7 @@ FLIGHT_PLAN_H=$(AC_GENERATED)/flight_plan.h
FLIGHT_PLAN_XML=$(AIRCRAFT_BUILD_DIR)/flight_plan.xml
SETTINGS_H=$(AC_GENERATED)/settings.h
SETTINGS_XMLS=$(patsubst %,$(CONF)/%,$(SETTINGS))
+SETTINGS_XMLS_DEP=$(filter-out %~,$(SETTINGS_XMLS))
SETTINGS_XML=$(AIRCRAFT_BUILD_DIR)/settings.xml
SETTINGS_MODULES=$(AIRCRAFT_BUILD_DIR)/settings_modules.xml
SETTINGS_TELEMETRY=$(AIRCRAFT_BUILD_DIR)/settings_telemetry.xml
@@ -164,14 +165,14 @@ $(FLIGHT_PLAN_XML) : $(CONF)/$(FLIGHT_PLAN) $(CONF_XML) $(GENERATORS)/gen_flight
$(Q)mv $($@_TMP) $@
$(Q)chmod a+r $@
-$(SETTINGS_H) : $(SETTINGS_XMLS) $(CONF_XML) $(SETTINGS_MODULES) $(SETTINGS_TELEMETRY) $(GENERATORS)/gen_settings.out
+$(SETTINGS_H) : $(SETTINGS_XMLS_DEP) $(CONF_XML) $(SETTINGS_MODULES) $(SETTINGS_TELEMETRY) $(GENERATORS)/gen_settings.out
$(Q)test -d $(AC_GENERATED) || mkdir -p $(AC_GENERATED)
@echo GENERATE $@
$(eval $@_TMP := $(shell $(MKTEMP)))
$(Q)$(GENERATORS)/gen_settings.out $(SETTINGS_XML) $(SETTINGS_TELEMETRY) $(SETTINGS_XMLS) $(SETTINGS_MODULES) > $($@_TMP)
$(Q)mv $($@_TMP) $@
$(Q)chmod a+r $@
- $(Q)cp $(SETTINGS_XMLS) $(AIRCRAFT_CONF_DIR)/settings
+ $(Q)cp $(SETTINGS_XMLS_DEP) $(AIRCRAFT_CONF_DIR)/settings
$(MODULES_H) : $(CONF)/$(AIRFRAME_XML) $(GENERATORS)/gen_modules.out $(CONF)/modules/*.xml
$(Q)test -d $(AC_GENERATED) || mkdir -p $(AC_GENERATED)
diff --git a/conf/conf_example.xml b/conf/conf_example.xml
index 8d47b151a0..fcf01f2dd9 100644
--- a/conf/conf_example.xml
+++ b/conf/conf_example.xml
@@ -6,7 +6,8 @@
radio="radios/cockpitSX.xml"
telemetry="telemetry/default_rotorcraft.xml"
flight_plan="flight_plans/dummy.xml"
- settings=" settings/rotorcraft_basic.xml"
+ settings="settings/rotorcraft_basic.xml"
+ settings_modules=""
gui_color="white"
/>
diff --git a/conf/conf_tests.xml b/conf/conf_tests.xml
index 74dbba176f..912f52aaf0 100644
--- a/conf/conf_tests.xml
+++ b/conf/conf_tests.xml
@@ -7,6 +7,7 @@
telemetry="telemetry/default_rotorcraft.xml"
flight_plan="flight_plans/dummy.xml"
settings="settings/rotorcraft_basic.xml"
+ settings_modules=""
gui_color="white"
/>
diff --git a/conf/modules/AOA_adc.xml b/conf/modules/AOA_adc.xml
index b9338b2f67..e7f7dad811 100644
--- a/conf/modules/AOA_adc.xml
+++ b/conf/modules/AOA_adc.xml
@@ -8,6 +8,15 @@
+
+
+
+
+
+
+
+
+
diff --git a/conf/modules/MPPT.xml b/conf/modules/MPPT.xml
index 912c5e6d2d..7c8c043f7c 100644
--- a/conf/modules/MPPT.xml
+++ b/conf/modules/MPPT.xml
@@ -7,6 +7,13 @@
Solar Cells control board by Michel
+
+
+
+
+
+
+
diff --git a/conf/modules/airspeed_amsys.xml b/conf/modules/airspeed_amsys.xml
index 88c3faf9de..85cb9cbcb0 100644
--- a/conf/modules/airspeed_amsys.xml
+++ b/conf/modules/airspeed_amsys.xml
@@ -14,6 +14,16 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/conf/modules/baro_amsys.xml b/conf/modules/baro_amsys.xml
index 7b7f72f3d4..6118f779d3 100644
--- a/conf/modules/baro_amsys.xml
+++ b/conf/modules/baro_amsys.xml
@@ -12,6 +12,15 @@
+
+
+
+
+
+
+
+
+
diff --git a/conf/modules/cam_point.xml b/conf/modules/cam_point.xml
index 8a84132269..2216315031 100644
--- a/conf/modules/cam_point.xml
+++ b/conf/modules/cam_point.xml
@@ -4,6 +4,42 @@
Camera control for fixedwing
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/conf/modules/cam_roll.xml b/conf/modules/cam_roll.xml
index 0980825489..6b803aa812 100644
--- a/conf/modules/cam_roll.xml
+++ b/conf/modules/cam_roll.xml
@@ -4,6 +4,16 @@
Camera control on roll axis only
+
+
+
+
+
+
+
+
+
+
diff --git a/conf/modules/deploy_sonar_buoy.xml b/conf/modules/deploy_sonar_buoy.xml
index 3a58c3c19b..c3fa12f462 100644
--- a/conf/modules/deploy_sonar_buoy.xml
+++ b/conf/modules/deploy_sonar_buoy.xml
@@ -7,6 +7,20 @@
The application in this was written for drops two sonar buoys.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/conf/modules/digital_cam.xml b/conf/modules/digital_cam.xml
index ca2e908b5f..018525ada0 100644
--- a/conf/modules/digital_cam.xml
+++ b/conf/modules/digital_cam.xml
@@ -15,6 +15,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/conf/modules/direct_memory_logger.xml b/conf/modules/direct_memory_logger.xml
index f6f9163571..4f59643617 100644
--- a/conf/modules/direct_memory_logger.xml
+++ b/conf/modules/direct_memory_logger.xml
@@ -9,6 +9,15 @@
+
+
+
+
+
+
+
+
+
diff --git a/conf/modules/enose.xml b/conf/modules/enose.xml
index b7cee734ee..550fab9e35 100644
--- a/conf/modules/enose.xml
+++ b/conf/modules/enose.xml
@@ -8,6 +8,15 @@
+
+
+
+
+
+
+
+
+
diff --git a/conf/modules/formation_flight.xml b/conf/modules/formation_flight.xml
index fec891ccf2..e59708e110 100644
--- a/conf/modules/formation_flight.xml
+++ b/conf/modules/formation_flight.xml
@@ -4,6 +4,18 @@
Formation flight control
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/conf/modules/gas_engine_idle.xml b/conf/modules/gas_engine_idle.xml
index 578e93a320..a656c217f2 100644
--- a/conf/modules/gas_engine_idle.xml
+++ b/conf/modules/gas_engine_idle.xml
@@ -4,6 +4,14 @@
Gas Engine Idle
+
+
+
+
+
+
+
+
diff --git a/conf/modules/gps_ubx_ucenter.xml b/conf/modules/gps_ubx_ucenter.xml
index d1b802a52a..243aa0d745 100644
--- a/conf/modules/gps_ubx_ucenter.xml
+++ b/conf/modules/gps_ubx_ucenter.xml
@@ -18,6 +18,18 @@ Warning: you still need to tell the driver, which paparazzi port you use.
description="Dynamic model used by ublox GPS filter. Default:NAV5_DYN_AIRBORNE_2G"/>
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/conf/modules/hackhd.xml b/conf/modules/hackhd.xml
index c252d919ce..ca80101150 100644
--- a/conf/modules/hackhd.xml
+++ b/conf/modules/hackhd.xml
@@ -6,6 +6,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/conf/modules/high_speed_logger_direct_memory.xml b/conf/modules/high_speed_logger_direct_memory.xml
index 1bead7755a..6cc431e689 100644
--- a/conf/modules/high_speed_logger_direct_memory.xml
+++ b/conf/modules/high_speed_logger_direct_memory.xml
@@ -25,6 +25,13 @@ For more informations on how to use this module you can refer to the wiki : http
+
+
+
+
+
+
+
diff --git a/conf/modules/imu_quality_assessment.xml b/conf/modules/imu_quality_assessment.xml
index 0fc188f789..ea7bf3ab38 100644
--- a/conf/modules/imu_quality_assessment.xml
+++ b/conf/modules/imu_quality_assessment.xml
@@ -9,6 +9,16 @@
- magnetic field hard iron offset
+
+
+
+
+
+
+
+
+
+
diff --git a/conf/modules/infrared_adc.xml b/conf/modules/infrared_adc.xml
index 372b754093..1149cc8193 100644
--- a/conf/modules/infrared_adc.xml
+++ b/conf/modules/infrared_adc.xml
@@ -8,6 +8,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/conf/modules/infrared_i2c.xml b/conf/modules/infrared_i2c.xml
index 85a83d10b0..eccda07ba6 100644
--- a/conf/modules/infrared_i2c.xml
+++ b/conf/modules/infrared_i2c.xml
@@ -5,6 +5,24 @@
I2C Infrared sensor
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/conf/modules/ins_arduimu_basic.xml b/conf/modules/ins_arduimu_basic.xml
index 1f34078724..fc199a5fa3 100644
--- a/conf/modules/ins_arduimu_basic.xml
+++ b/conf/modules/ins_arduimu_basic.xml
@@ -6,6 +6,15 @@
+
+
+
+
+
+
+
+
+
diff --git a/conf/modules/light.xml b/conf/modules/light.xml
index 5761db11f1..50efcca634 100644
--- a/conf/modules/light.xml
+++ b/conf/modules/light.xml
@@ -10,6 +10,17 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/conf/modules/meteo_france_DAQ.xml b/conf/modules/meteo_france_DAQ.xml
index 388e638589..1b2e838ed7 100644
--- a/conf/modules/meteo_france_DAQ.xml
+++ b/conf/modules/meteo_france_DAQ.xml
@@ -4,6 +4,16 @@
Data acquisition board used by Meteo France
+
+
+
+
+
+
+
+
+
+
diff --git a/conf/modules/module.dtd b/conf/modules/module.dtd
index c40c761964..609b04f5d7 100644
--- a/conf/modules/module.dtd
+++ b/conf/modules/module.dtd
@@ -1,7 +1,9 @@
-
+
+
+
@@ -18,6 +20,10 @@
+
+
+
+
name CDATA #REQUIRED
dir CDATA #IMPLIED>
+
+
+
+
+
+
+
+
+
+
+
diff --git a/conf/modules/nav_catapult.xml b/conf/modules/nav_catapult.xml
index c0948f261e..b6c405573f 100644
--- a/conf/modules/nav_catapult.xml
+++ b/conf/modules/nav_catapult.xml
@@ -1,6 +1,6 @@
-
+
Catapult.
@@ -18,6 +18,17 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/conf/modules/nav_cube.xml b/conf/modules/nav_cube.xml
index 1b4b450745..a4a2dd2212 100644
--- a/conf/modules/nav_cube.xml
+++ b/conf/modules/nav_cube.xml
@@ -6,6 +6,24 @@
Fixedwing Navigation in a cube towards a center.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/conf/modules/nav_smooth.xml b/conf/modules/nav_smooth.xml
index 249496bca1..2ef2657b93 100644
--- a/conf/modules/nav_smooth.xml
+++ b/conf/modules/nav_smooth.xml
@@ -6,6 +6,13 @@
Smooth navigation to wp_a along an arc (around wp_cd), a segment (from wp_rd to wp_ta) and a second arc (around wp_ca).
+
+
+
+
+
+
+
diff --git a/conf/modules/pbn.xml b/conf/modules/pbn.xml
index 17ab7eda6d..60c038e401 100644
--- a/conf/modules/pbn.xml
+++ b/conf/modules/pbn.xml
@@ -12,6 +12,13 @@
return scaled values over I2C
+
+
+
+
+
+
+
diff --git a/conf/modules/photogrammetry_calculator.xml b/conf/modules/photogrammetry_calculator.xml
index 7e539c0e18..8d785c4617 100644
--- a/conf/modules/photogrammetry_calculator.xml
+++ b/conf/modules/photogrammetry_calculator.xml
@@ -4,6 +4,28 @@
Photogrammetry navigation functions
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/conf/modules/poles.xml b/conf/modules/poles.xml
index 3babb8e161..f599d055e3 100644
--- a/conf/modules/poles.xml
+++ b/conf/modules/poles.xml
@@ -4,6 +4,15 @@
Navigate around two poles
+
+
+
+
+
+
+
+
+
diff --git a/conf/modules/rotorcraft_cam.xml b/conf/modules/rotorcraft_cam.xml
index fd734808ec..84b1f8fc45 100644
--- a/conf/modules/rotorcraft_cam.xml
+++ b/conf/modules/rotorcraft_cam.xml
@@ -31,6 +31,26 @@ On boards with CAM_SWITCH, ROTORCRAFT_CAM_SWITCH_GPIO can be defined to CAM_SWIT
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/conf/modules/servo_switch.xml b/conf/modules/servo_switch.xml
index 567247cdf0..ed30a4dff6 100644
--- a/conf/modules/servo_switch.xml
+++ b/conf/modules/servo_switch.xml
@@ -7,6 +7,16 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/conf/modules/vehicle_interface_datalink.xml b/conf/modules/vehicle_interface_datalink.xml
index 9f43c2de34..c9a11ce607 100644
--- a/conf/modules/vehicle_interface_datalink.xml
+++ b/conf/modules/vehicle_interface_datalink.xml
@@ -4,6 +4,16 @@
Vehicule Interface over Datalink
+
+
+
+
+
+
+
+
+
+
diff --git a/conf/settings/control/nav_catapult.xml b/conf/settings/control/nav_catapult.xml
deleted file mode 100644
index 82d9eae0f2..0000000000
--- a/conf/settings/control/nav_catapult.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/conf/settings/control/nav_cube.xml b/conf/settings/control/nav_cube.xml
deleted file mode 100644
index 1836d9073c..0000000000
--- a/conf/settings/control/nav_cube.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/conf/settings/control/snav.xml b/conf/settings/control/snav.xml
deleted file mode 100644
index 6e0a545916..0000000000
--- a/conf/settings/control/snav.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/conf/settings/estimation/infrared.xml b/conf/settings/estimation/infrared.xml
deleted file mode 100644
index 629ea2419d..0000000000
--- a/conf/settings/estimation/infrared.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/conf/settings/modules/AOA_adc.xml b/conf/settings/modules/AOA_adc.xml
deleted file mode 100644
index dd0b643777..0000000000
--- a/conf/settings/modules/AOA_adc.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
diff --git a/conf/settings/modules/MPPT.xml b/conf/settings/modules/MPPT.xml
deleted file mode 100644
index 9fe2ec66f8..0000000000
--- a/conf/settings/modules/MPPT.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/conf/settings/modules/airspeed_amsys.xml b/conf/settings/modules/airspeed_amsys.xml
deleted file mode 100644
index 0d4f1a66e1..0000000000
--- a/conf/settings/modules/airspeed_amsys.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/conf/settings/modules/baro_amsys.xml b/conf/settings/modules/baro_amsys.xml
deleted file mode 100644
index 9c738a05d4..0000000000
--- a/conf/settings/modules/baro_amsys.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
diff --git a/conf/settings/modules/cam.xml b/conf/settings/modules/cam.xml
deleted file mode 100644
index 3dcb0ac2b5..0000000000
--- a/conf/settings/modules/cam.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/conf/settings/modules/cam_pitch.xml b/conf/settings/modules/cam_pitch.xml
deleted file mode 100644
index a57c2bbe37..0000000000
--- a/conf/settings/modules/cam_pitch.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/conf/settings/modules/cam_roll.xml b/conf/settings/modules/cam_roll.xml
deleted file mode 100644
index d33d02e320..0000000000
--- a/conf/settings/modules/cam_roll.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/conf/settings/modules/dc.xml b/conf/settings/modules/dc.xml
deleted file mode 100644
index a32aa51664..0000000000
--- a/conf/settings/modules/dc.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/conf/settings/modules/deploy_sonar_buoy.xml b/conf/settings/modules/deploy_sonar_buoy.xml
deleted file mode 100644
index 76c307b640..0000000000
--- a/conf/settings/modules/deploy_sonar_buoy.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/conf/settings/modules/direct_memory_logger.xml b/conf/settings/modules/direct_memory_logger.xml
deleted file mode 100644
index ae9140aa0f..0000000000
--- a/conf/settings/modules/direct_memory_logger.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/conf/settings/modules/enose.xml b/conf/settings/modules/enose.xml
deleted file mode 100644
index b4abd356a8..0000000000
--- a/conf/settings/modules/enose.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
diff --git a/conf/settings/modules/formation.xml b/conf/settings/modules/formation.xml
deleted file mode 100644
index 7c2a4847f6..0000000000
--- a/conf/settings/modules/formation.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/conf/settings/modules/gas_engine_idle_trim.xml b/conf/settings/modules/gas_engine_idle_trim.xml
deleted file mode 100644
index 88a31503b4..0000000000
--- a/conf/settings/modules/gas_engine_idle_trim.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
-
-
-
diff --git a/conf/settings/modules/gps_ubx_ucenter.xml b/conf/settings/modules/gps_ubx_ucenter.xml
deleted file mode 100644
index fccb43bab0..0000000000
--- a/conf/settings/modules/gps_ubx_ucenter.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/conf/settings/modules/hackhd.xml b/conf/settings/modules/hackhd.xml
deleted file mode 100644
index 10ac672159..0000000000
--- a/conf/settings/modules/hackhd.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/conf/settings/modules/high_speed_logger_direct_memory.xml b/conf/settings/modules/high_speed_logger_direct_memory.xml
deleted file mode 100644
index 6c923d2e43..0000000000
--- a/conf/settings/modules/high_speed_logger_direct_memory.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
diff --git a/conf/settings/modules/imu_quality_assessment.xml b/conf/settings/modules/imu_quality_assessment.xml
deleted file mode 100644
index 3b15def65f..0000000000
--- a/conf/settings/modules/imu_quality_assessment.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/conf/settings/modules/ins_arduimu_basic.xml b/conf/settings/modules/ins_arduimu_basic.xml
deleted file mode 100644
index 6389e0c1b1..0000000000
--- a/conf/settings/modules/ins_arduimu_basic.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
diff --git a/conf/settings/modules/ir_i2c.xml b/conf/settings/modules/ir_i2c.xml
deleted file mode 100644
index a099750c7f..0000000000
--- a/conf/settings/modules/ir_i2c.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/conf/settings/modules/light.xml b/conf/settings/modules/light.xml
deleted file mode 100644
index 1a480d8122..0000000000
--- a/conf/settings/modules/light.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/conf/settings/modules/meteo_france_DAQ.xml b/conf/settings/modules/meteo_france_DAQ.xml
deleted file mode 100644
index 479ab8b3bd..0000000000
--- a/conf/settings/modules/meteo_france_DAQ.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/conf/settings/modules/pbn.xml b/conf/settings/modules/pbn.xml
deleted file mode 100644
index 4feb83118d..0000000000
--- a/conf/settings/modules/pbn.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/conf/settings/modules/photogrammetry_calculator.xml b/conf/settings/modules/photogrammetry_calculator.xml
deleted file mode 100644
index 082c975451..0000000000
--- a/conf/settings/modules/photogrammetry_calculator.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/conf/settings/modules/poles.xml b/conf/settings/modules/poles.xml
deleted file mode 100644
index 56751801b3..0000000000
--- a/conf/settings/modules/poles.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
diff --git a/conf/settings/modules/rotorcraft_cam.xml b/conf/settings/modules/rotorcraft_cam.xml
deleted file mode 100644
index 17ae9b50b4..0000000000
--- a/conf/settings/modules/rotorcraft_cam.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/conf/settings/modules/servo_switch.xml b/conf/settings/modules/servo_switch.xml
deleted file mode 100644
index 687f0c7bb5..0000000000
--- a/conf/settings/modules/servo_switch.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/conf/settings/modules/vehicle_interface.xml b/conf/settings/modules/vehicle_interface.xml
deleted file mode 100644
index 606d83c72b..0000000000
--- a/conf/settings/modules/vehicle_interface.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/sw/lib/ocaml/Makefile b/sw/lib/ocaml/Makefile
index 9b0f9e53c1..8ebe48f28c 100644
--- a/sw/lib/ocaml/Makefile
+++ b/sw/lib/ocaml/Makefile
@@ -55,7 +55,7 @@ PKGCOMMON=xml-light,netclient,glibivy,lablgtk2
XINCLUDES=
XPKGCOMMON=xml-light,glibivy,$(LABLGTK2GNOMECANVAS),lablgtk2.glade
-SRC = fig.ml debug.ml base64.ml serial.ml ocaml_tools.ml expr_syntax.ml expr_parser.ml expr_lexer.ml extXml.ml env.ml xml2h.ml latlong.ml egm96.ml srtm.ml http.ml maps_support.ml gm.ml iGN.ml geometry_2d.ml cserial.o convert.o ubx.ml pprz.ml xbee.ml logpprz.ml xmlCom.ml os_calls.ml editAirframe.ml defivybus.ml fp_proc.ml
+SRC = fig.ml debug.ml base64.ml serial.ml ocaml_tools.ml expr_syntax.ml expr_parser.ml expr_lexer.ml extXml.ml env.ml xml2h.ml latlong.ml egm96.ml srtm.ml http.ml maps_support.ml gm.ml iGN.ml geometry_2d.ml cserial.o convert.o ubx.ml pprz.ml xbee.ml logpprz.ml xmlCom.ml os_calls.ml editAirframe.ml defivybus.ml fp_proc.ml gen_common.ml
CMO = $(SRC:.ml=.cmo)
CMX = $(SRC:.ml=.cmx)
diff --git a/sw/lib/ocaml/env.ml b/sw/lib/ocaml/env.ml
index a7d172bdb0..3d303115a8 100644
--- a/sw/lib/ocaml/env.ml
+++ b/sw/lib/ocaml/env.ml
@@ -56,11 +56,37 @@ let gcs_icons_path = paparazzi_home // "data" // "pictures" // "gcs_icons"
let dump_fp = paparazzi_src // "sw" // "tools" // "generators" // "gen_flight_plan.out -dump"
+let filter_absolute_path = fun path ->
+ Str.replace_first (Str.regexp (paparazzi_home // "conf/")) "" path
+
+
+(* filter settings and keep the ones without brackets *)
+let filter_settings = fun settings ->
+ let sl = Str.split (Str.regexp "[ ]+") settings in
+ let sl = List.filter (fun s -> not (s.[0] = '[' && s.[String.length s - 1] = ']')) sl in
+ String.concat " " sl
+
+(* filter on modules based on target *)
+let filter_modules_target = fun module_xml ->
+ let target = try Sys.getenv "TARGET" with _ -> "" in
+ if Xml.tag module_xml = "module"
+ then begin
+ (* test if the module is loaded or not *)
+ if List.exists (fun n ->
+ let t = ExtXml.attrib_or_default n "target" "" in
+ Str.string_match (Str.regexp (".*"^target^".*")) t 0
+ ) (Xml.children module_xml)
+ then Xml.Element ("settings", [], List.filter (fun t -> Xml.tag t = "settings") (Xml.children module_xml))
+ else Xml.Element ("",[],[])
+ end
+ else module_xml
+
+
let expand_ac_xml = fun ?(raise_exception = true) ac_conf ->
let prefix = fun s -> sprintf "%s/conf/%s" paparazzi_home s in
- let parse_file = fun a file ->
+ let parse_file = fun ?(parse_filter=(fun x -> x)) a file ->
try
- ExtXml.parse_file file
+ parse_filter (ExtXml.parse_file file)
with
Failure msg ->
if raise_exception then
@@ -70,10 +96,10 @@ let expand_ac_xml = fun ?(raise_exception = true) ac_conf ->
make_element "parse error" ["file",a; "msg", msg] []
end in
- let parse = fun a ->
+ let parse = fun ?(pre_filter=(fun x -> x)) ?(parse_filter=(fun x -> x)) a ->
List.map
- (fun filename -> parse_file a (prefix filename))
- (Str.split space_regexp (ExtXml.attrib ac_conf a)) in
+ (fun filename -> parse_file ~parse_filter a (prefix filename))
+ (Str.split space_regexp (pre_filter (ExtXml.attrib ac_conf a))) in
let parse_opt = fun a ->
try parse a with ExtXml.Error _ -> [] in
@@ -101,7 +127,7 @@ let expand_ac_xml = fun ?(raise_exception = true) ac_conf ->
with _ -> []
in
- let pervasives = parse "airframe" @ parse "telemetry" @ parse "settings" in
+ let pervasives = parse "airframe" @ parse "telemetry" @ parse ~pre_filter:filter_settings "settings" @ parse ~pre_filter:filter_settings ~parse_filter:filter_modules_target "settings_modules" in
let optionals = parse_opt "radio" @ parse_fp "flight_plan" @ pervasives in
let children = Xml.children ac_conf@optionals in
diff --git a/sw/lib/ocaml/env.mli b/sw/lib/ocaml/env.mli
index 3442afa763..54d9303088 100644
--- a/sw/lib/ocaml/env.mli
+++ b/sw/lib/ocaml/env.mli
@@ -48,6 +48,15 @@ val gconf_file : string
val gcs_icons_path : string
+val filter_absolute_path : string -> string
+(** remove absolute path paparazzi_home/conf if it exists
+ * returns a relative path *)
+
+val filter_settings : string -> string
+(** filter settings (a string separted by white spaces)
+ * and keep the ones without brackets
+ * (return a string of filtered name separate by white spaces) *)
+
val expand_ac_xml : ?raise_exception:bool -> Xml.xml -> Xml.xml
(** Expands a conf.xml aircraft entry, adding the XML configuration files
(listed as attributes) as children. Returns an element containing the error
diff --git a/sw/tools/generators/gen_common.ml b/sw/lib/ocaml/gen_common.ml
similarity index 100%
rename from sw/tools/generators/gen_common.ml
rename to sw/lib/ocaml/gen_common.ml
diff --git a/sw/tools/generators/gen_common.mli b/sw/lib/ocaml/gen_common.mli
similarity index 100%
rename from sw/tools/generators/gen_common.mli
rename to sw/lib/ocaml/gen_common.mli
diff --git a/sw/lib/ocaml/gtk_tools.ml b/sw/lib/ocaml/gtk_tools.ml
index 4ad5b7a408..fc902bdafc 100644
--- a/sw/lib/ocaml/gtk_tools.ml
+++ b/sw/lib/ocaml/gtk_tools.ml
@@ -113,46 +113,75 @@ let combo_connect = fun ((combo: #GEdit.combo_box), (_,column)) cb ->
cb data))
-type tree = GTree.view * (GTree.list_store * string GTree.column)
+type tree = GTree.view * (GTree.list_store * string GTree.column * bool GTree.column * GTree.cell_renderer_toggle_signals)
let tree_widget = fst
let tree_model = snd
-let tree = fun (t:GTree.view) ->
+let tree = fun ?(check_box=false) (t:GTree.view) ->
let cols = new GTree.column_list in
- let col_name = cols#add Gobject.Data.string in
+ let col_name = cols#add Gobject.Data.string
+ and col_check = cols#add Gobject.Data.boolean in
let store = GTree.list_store cols in
t#set_model (Some store#coerce);
let col1 = GTree.view_column ~renderer:(GTree.cell_renderer_text [], ["text",col_name]) () in
ignore (t#append_column col1);
- (t , (store, col_name))
+ let renderer = GTree.cell_renderer_toggle [`XALIGN 1.] in
+ if check_box then begin
+ let col2 = GTree.view_column ~renderer:(renderer, ["active",col_check]) () in
+ ignore (t#append_column col2);
+ (** Toggling a tree element *)
+ let item_toggled = fun ~(model : GTree.list_store) ~column path ->
+ let row = model#get_iter path in
+ let b = model#get ~row ~column in
+ model#set ~row ~column (not b);
+ in
+ ignore (renderer#connect#toggled ~callback:(item_toggled ~model:store ~column:col_check));
+ end;
+ (t , (store, col_name, col_check, renderer#connect))
-let tree_of = fun (t:GTree.view) (m:(GTree.list_store * string GTree.column)) ->
+let tree_of = fun (t:GTree.view) (m:(GTree.list_store * string GTree.column * bool GTree.column * GTree.cell_renderer_toggle_signals)) ->
(t, m)
-let tree_values = fun (tree : tree) ->
- let (store, column) = tree_model tree in
+let tree_values = fun ?(only_checked=true) (tree : tree) ->
+ let (store, name, check, _) = tree_model tree in
let values = ref "" in
store#foreach (fun _ row ->
- values := !values^" "^(store#get ~row ~column);
+ let v = store#get ~row ~column:name
+ and c = store#get ~row ~column:check in
+ let space = if String.length !values > 0 then " " else "" in
+ let v =
+ if c then v else
+ if only_checked then ""
+ else "["^v^"]"
+ in
+ values := !values^space^v;
false);
!values
let get_selected_in_tree = fun (tree : tree) ->
- let (store, column) = tree_model tree in
+ let (store, _, _, _) = tree_model tree in
let t = tree_widget tree in
let sel_paths = t#selection#get_selected_rows in
List.map (fun p -> store#get_row_reference p) sel_paths
+(* add element to the tree
+ * if element is between brackets, set to unchecked
+ * and remove brackets in tree name
+ *)
let add_to_tree = fun (tree : tree) string ->
- let (store, column) = tree_model tree in
+ let (store, name, check, _) = tree_model tree in
let row = store#append () in
- store#set ~row ~column string
+ let l = String.length string in
+ let checked = not (string.[0] = '[' && string.[l - 1] = ']') in
+ let string = if not checked then String.sub string 1 (l - 2) else string in
+ store#set ~row ~column:check checked;
+ store#set ~row ~column:name string
let remove_selected_from_tree = fun (tree : tree) ->
let selected = get_selected_in_tree tree in
- let (store, _) = tree_model tree in
+ let (store, _, _, _) = tree_model tree in
List.iter (fun r -> ignore (store#remove r#iter)) selected
let clear_tree = fun (tree : tree) ->
- let (store, _) = tree_model tree in
+ let (store, _, _, _) = tree_model tree in
store#clear ()
diff --git a/sw/lib/ocaml/gtk_tools.mli b/sw/lib/ocaml/gtk_tools.mli
index 7e1f437735..33b6676c8c 100644
--- a/sw/lib/ocaml/gtk_tools.mli
+++ b/sw/lib/ocaml/gtk_tools.mli
@@ -61,13 +61,14 @@ val combo_connect : combo -> (string -> unit) -> unit
(*** Utilities for a tree view widget ***)
type tree
val tree_widget : tree -> GTree.view
-val tree_model : tree -> (GTree.list_store * string GTree.column)
+val tree_model : tree -> (GTree.list_store * string GTree.column * bool GTree.column * GTree.cell_renderer_toggle_signals)
-val tree : GTree.view -> tree
-val tree_of : GTree.view -> (GTree.list_store * string GTree.column) -> tree
+val tree : ?check_box:bool -> GTree.view -> tree
+val tree_of : GTree.view -> (GTree.list_store * string GTree.column * bool GTree.column * GTree.cell_renderer_toggle_signals) -> tree
-val tree_values : tree -> string
+val tree_values : ?only_checked:bool -> tree -> string
val get_selected_in_tree : tree -> GTree.row_reference list
val add_to_tree : tree -> string -> unit
val remove_selected_from_tree : tree -> unit
val clear_tree : tree -> unit
+
diff --git a/sw/supervision/Makefile b/sw/supervision/Makefile
index 49634ee0e4..35153682b1 100644
--- a/sw/supervision/Makefile
+++ b/sw/supervision/Makefile
@@ -45,7 +45,7 @@ PAPARAZZICENTERCMO = gtk_pc.cmo gtk_process.cmo pc_common.cmo pc_control_panel.c
all: paparazzicenter
-paparazzicenter : $(PAPARAZZICENTERCMO)
+paparazzicenter : $(PAPARAZZICENTERCMO) $(LIBPPRZCMA) $(XLIBPPRZCMA)
@echo OL $@
$(Q)$(OCAMLC) $(INCLUDES) -o $@ $(XLINKPKG) gtkInit.cmo $^
diff --git a/sw/supervision/paparazzicenter.glade b/sw/supervision/paparazzicenter.glade
index 1e147c606c..bd3b28cb0f 100644
--- a/sw/supervision/paparazzicenter.glade
+++ b/sw/supervision/paparazzicenter.glade
@@ -660,86 +660,86 @@
False
0
-
+
True
False
- 12
-
+
True
False
+ 12
-
- 4
- True
- True
- False
-
-
- True
- True
- 0
-
-
-
-
- True
- False
-
-
- False
- True
- 1
-
-
-
-
+
True
False
-
- gtk-add
+
True
True
- True
- True
- Add a settings file
- False
- True
- True
+ False
- False
- False
+ True
+ True
0
-
- gtk-edit
+
True
- True
- True
- True
- Launch an editor on all the settings file
- False
- True
-
-
- False
- False
- 1
-
-
-
-
- gtk-remove
- True
- True
- True
- Remove the selected settings file
- False
- True
+ False
+
+
+ gtk-add
+ True
+ True
+ True
+ True
+ Add a settings file
+ False
+ True
+ True
+
+
+ False
+ False
+ 0
+
+
+
+
+ gtk-edit
+ True
+ True
+ True
+ True
+ Launch an editor on all the settings file
+ False
+ True
+
+
+ False
+ False
+ 1
+
+
+
+
+ gtk-remove
+ True
+ True
+ True
+ True
+ Remove the selected settings file
+ False
+ True
+
+
+ False
+ False
+ 2
+
+
False
@@ -748,13 +748,34 @@
-
- False
- False
- 2
-
+
+ True
+ True
+ 0
+
+
+
+
+ True
+ False
+ 4
+ 12
+ 12
+
+
+ True
+ True
+ False
+
+
+
+
+ True
+ True
+ 1
+
diff --git a/sw/supervision/pc_aircraft.ml b/sw/supervision/pc_aircraft.ml
index a939a363ac..2551bb16b5 100644
--- a/sw/supervision/pc_aircraft.ml
+++ b/sw/supervision/pc_aircraft.ml
@@ -37,15 +37,16 @@ let string_of_gdkcolor = fun c ->
let aircraft_sample = fun name ac_id ->
Xml.Element ("aircraft",
- ["name", name;
- "ac_id", ac_id;
- "airframe", "airframes/examples/microjet.xml";
- "radio", "radios/cockpitSX.xml";
- "telemetry", "telemetry/default_fixedwing.xml";
- "flight_plan", "flight_plans/basic.xml";
- "settings", "settings/fixedwing_basic.xml";
- "gui_color", "blue"],
- [])
+ [ "name", name;
+ "ac_id", ac_id;
+ "airframe", "airframes/examples/microjet.xml";
+ "radio", "radios/cockpitSX.xml";
+ "telemetry", "telemetry/default_fixedwing.xml";
+ "flight_plan", "flight_plans/basic.xml";
+ "settings", "settings/fixedwing_basic.xml";
+ "settings_modules", "";
+ "gui_color", "blue" ],
+ [])
let write_conf_xml = fun ?(user_save = false) () ->
@@ -110,13 +111,6 @@ let string_of_ac_data = fun d ->
Label l -> l#text
| Tree t -> Gtk_tools.tree_values t
-let ac_files = fun gui model ->
- ["airframe", "airframes", Label gui#label_airframe, gui#button_browse_airframe, gui#button_edit_airframe, edit, None;
- "flight_plan", "flight_plans", Label gui#label_flight_plan, gui#button_browse_flight_plan, gui#button_edit_flight_plan, gcs_or_edit, None;
- "settings", "settings", Tree (Gtk_tools.tree_of gui#tree_settings model), gui#button_browse_settings, gui#button_edit_settings, edit, Some gui#button_remove_settings;
- "radio", "radios", Label gui#label_radio, gui#button_browse_radio, gui#button_edit_radio, edit, None;
- "telemetry", "telemetry", Label gui#label_telemetry, gui#button_browse_telemetry, gui#button_edit_telemetry, edit, None]
-
(* Awful but easier *)
let current_color = ref "white"
@@ -138,8 +132,8 @@ let correct_ac_name = fun s ->
with
Exit -> false
- (*TODO function text of date_type*)
-let save_callback = fun ?user_save gui ac_combo model () ->
+(*TODO function text of date_type*)
+let save_callback = fun ?user_save gui ac_combo tree tree_modules () ->
let ac_name = Gtk_tools.combo_value ac_combo
and ac_id = gui#entry_ac_id#text in
@@ -148,23 +142,71 @@ let save_callback = fun ?user_save gui ac_combo model () ->
GToolbox.message_box ~title:"Error on A/C id" "A/C id must be a non null number less than 255"
else
let color = !current_color in
- let tree = Gtk_tools.tree_of gui#tree_settings model in
let aircraft =
- Xml.Element ("aircraft",
- ["name", ac_name;
- "ac_id", ac_id;
- "airframe", gui#label_airframe#text;
- "radio", gui#label_radio#text;
- "telemetry", gui#label_telemetry#text;
- "flight_plan", gui#label_flight_plan#text;
- "settings", Gtk_tools.tree_values tree;
- "gui_color", color],
- []) in
+ Xml.Element ("aircraft",
+ [ "name", ac_name;
+ "ac_id", ac_id;
+ "airframe", gui#label_airframe#text;
+ "radio", gui#label_radio#text;
+ "telemetry", gui#label_telemetry#text;
+ "flight_plan", gui#label_flight_plan#text;
+ "settings", Gtk_tools.tree_values ~only_checked:false tree;
+ "settings_modules", Gtk_tools.tree_values ~only_checked:false tree_modules;
+ "gui_color", color ],
+ []) in
begin try Hashtbl.remove Utils.aircrafts ac_name with _ -> () end;
Hashtbl.add Utils.aircrafts ac_name aircraft
end;
write_conf_xml ?user_save ()
+(* selected state type *)
+type selected_t = Selected | Unselected | Unknown
+
+(* Get the settings (string list) with current modules *)
+let get_settings_modules = fun ac_xml settings_modules ->
+ (* get modules *)
+ let modules = Gen_common.get_modules_of_airframe ac_xml in
+ let modules = List.map (fun m -> m.Gen_common.xml, m.Gen_common.file ) modules in
+ (* get list of settings files *)
+ let settings = List.fold_left (fun l (m, f) ->
+ (* get list of settings_file xml node if any *)
+ let settings_file_list = List.filter (fun t -> Xml.tag t = "settings_file") (Xml.children m) in
+ let file_list = List.map (fun s -> "settings/"^(Xml.attrib s "name")) settings_file_list in
+ (* include module file in the list only if it has a 'settings' node *)
+ let settings_list = List.filter (fun t -> Xml.tag t = "settings") (Xml.children m) in
+ let module_file = if List.length settings_list > 0 then [Env.filter_absolute_path f] else [] in
+ (* include module file with specific name if they exist *)
+ let settings_list = List.fold_left (fun l s ->
+ try
+ let name = Xml.attrib s "name" in
+ (* test if there is no white space in settings name *)
+ if Str.string_match (Str.regexp ".* .*") name 0
+ then failwith "Paparazzicenter: no white space allowed in modules settings name";
+ l @ [(Env.filter_absolute_path f)^"~"^name^"~"]
+ with
+ | Failure x -> prerr_endline x; l
+ | _ -> l
+ ) [] settings_list in
+ l @ file_list @ module_file @ settings_list
+ ) [] modules in
+ (* store current state in a hashtable *)
+ let current = Hashtbl.create 7 in
+ let set = Str.split regexp_space settings_modules in
+ List.iter (fun s ->
+ let l = String.length s in
+ if s.[0] == '[' && s.[l - 1] = ']'
+ then Hashtbl.add current (String.sub s 1 (l - 2)) Unselected
+ else Hashtbl.add current s Selected
+ ) set;
+ (* build list with previous state if necessary *)
+ List.map (fun s ->
+ (* get previous state, unknonw otherwise (new module, will be selected by default) *)
+ let checked = try Hashtbl.find current s with _ -> Unknown in
+ (* add to tree with correct state *)
+ match checked with
+ | Selected | Unknown -> s
+ | Unselected -> ("["^s^"]")
+ ) settings
let first_word = fun s ->
try
@@ -220,30 +262,58 @@ let parse_ac_flash = fun target flash_combo ac_file ->
(* not a valid airframe file *)
(Gtk_tools.combo_widget flash_combo)#misc#set_sensitive false
-
(* Link A/C to airframe & flight_plan labels *)
let ac_combo_handler = fun gui (ac_combo:Gtk_tools.combo) target_combo flash_combo (log:string->unit) ->
(* build tree for settings *)
- let tree_set = Gtk_tools.tree gui#tree_settings in
- let model = Gtk_tools.tree_model tree_set in
- (* attach vertical scrollbar *)
- gui#tree_settings#set_vadjustment gui#tree_settings_scrollbar#adjustment;
+ let tree_set = Gtk_tools.tree ~check_box:true gui#tree_settings in
+ (* build tree for modules settings *)
+ let tree_set_mod = Gtk_tools.tree ~check_box:true gui#tree_settings_modules in
+
+ (* connect save_callback to the two toggle signals
+ * it can't be done before because we need the two tree models
+ *)
+ let (_, _, _, tree_signal) = Gtk_tools.tree_model tree_set in
+ ignore (tree_signal#toggled ~callback:(fun _ -> save_callback gui ac_combo tree_set tree_set_mod ()));
+ let (_, _, _, tree_signal) = Gtk_tools.tree_model tree_set_mod in
+ ignore (tree_signal#toggled ~callback:(fun _ -> save_callback gui ac_combo tree_set tree_set_mod ()));
+
+ (* Link AC conf with labels and buttons *)
+ let ac_files =
+ [ "airframe", "airframes", Label gui#label_airframe, Some gui#button_browse_airframe, Some gui#button_edit_airframe, edit, None;
+ "flight_plan", "flight_plans", Label gui#label_flight_plan, Some gui#button_browse_flight_plan, Some gui#button_edit_flight_plan, gcs_or_edit, None;
+ "settings", "settings", Tree tree_set, Some gui#button_browse_settings, Some gui#button_edit_settings, edit, Some gui#button_remove_settings;
+ "settings_modules", "settings", Tree tree_set_mod, None, None, (fun _ -> ()), None;
+ "radio", "radios", Label gui#label_radio, Some gui#button_browse_radio, Some gui#button_edit_radio, edit, None;
+ "telemetry", "telemetry", Label gui#label_telemetry, Some gui#button_browse_telemetry, Some gui#button_edit_telemetry, edit, None]
+ in
(* Update_params callback *)
let update_params = fun ac_name ->
try
let aircraft = Hashtbl.find Utils.aircrafts ac_name in
let sample = aircraft_sample ac_name "42" in
- let value = fun a ->
- try (ExtXml.attrib aircraft a) with _ -> Xml.attrib sample a in
- List.iter (fun (a, _subdir, label, _, _, _, _) ->
+ (* update list of modules settings *)
+ let settings_modules = try
+ let af_xml = Xml.parse_file (Env.paparazzi_home // "conf" // (Xml.attrib aircraft "airframe")) in
+ get_settings_modules af_xml (ExtXml.attrib_or_default aircraft "settings_modules" "")
+ with
+ | Failure x -> prerr_endline x; []
+ | _ -> []
+ in
+ (* update aicraft hashtable *)
+ let aircraft = ExtXml.subst_attrib "settings_modules" (String.concat " " settings_modules) aircraft in
+ begin try Hashtbl.remove Utils.aircrafts ac_name with _ -> () end;
+ Hashtbl.add Utils.aircrafts ac_name aircraft;
+ let value = fun a -> try (ExtXml.attrib aircraft a) with _ -> Xml.attrib sample a in
+ (* update elements *)
+ List.iter (fun (a, _subdir, label, _, _, _, _) ->
match label with
- Label l -> l#set_text (value a)
+ | Label l -> l#set_text (value a)
| Tree t ->
- ignore (Gtk_tools.clear_tree tree_set);
- let names = Str.split regexp_space (value a) in
- List.iter (fun n -> Gtk_tools.add_to_tree t n) names
- ) (ac_files gui model);
+ ignore (Gtk_tools.clear_tree t);
+ let names = Str.split regexp_space (value a) in
+ List.iter (fun n -> Gtk_tools.add_to_tree t n) names;
+ ) ac_files;
let ac_id = ExtXml.attrib aircraft "ac_id"
and gui_color = ExtXml.attrib_or_default aircraft "gui_color" "white" in
gui#button_clean#misc#set_sensitive true;
@@ -320,27 +390,31 @@ let ac_combo_handler = fun gui (ac_combo:Gtk_tools.combo) target_combo flash_com
let colorname = string_of_gdkcolor csd#colorsel#color in
gui#eventbox_gui_color#misc#modify_bg [`NORMAL, `NAME colorname];
current_color := colorname;
- save_callback gui ac_combo model ();
+ save_callback gui ac_combo tree_set tree_set_mod ();
csd#destroy () in
ignore (csd#ok_button#connect#clicked ~callback);
ignore (csd#cancel_button#connect#clicked ~callback:csd#destroy) in
ignore(gui#button_gui_color#connect#clicked ~callback);
(* A/C id *)
- ignore(gui#entry_ac_id#connect#changed ~callback:(fun () -> save_callback gui ac_combo model ()));
+ ignore(gui#entry_ac_id#connect#changed ~callback:(fun () -> save_callback gui ac_combo tree_set tree_set_mod ()));
(* Conf *)
- List.iter (fun (name, subdir, label, button_browse, button_edit, editor, remove) ->
+ List.iter (fun (name, subdir, label, button_browse, button_edit, editor, button_remove) ->
+ (* editor button callback *)
let callback = fun _ ->
let rel_files = match label with
Label l -> Str.split regexp_space l#text
- | Tree t -> Str.split regexp_space (Gtk_tools.tree_values t)
+ | Tree t -> Str.split regexp_space (Gtk_tools.tree_values ~only_checked:true t)
in
let abs_files = List.map (Filename.concat Utils.conf_dir) rel_files in
let quoted_files = List.map (fun s -> "'"^s^"'") abs_files in
let arg = String.concat " " quoted_files in
editor arg in
- ignore (button_edit#connect#clicked ~callback);
+ (* connect editor button *)
+ ignore (match button_edit with Some e -> ignore(e#connect#clicked ~callback) | _ -> ());
+
+ (* browse button callback *)
let callback = fun _ ->
let cb = fun names ->
ignore (match label with
@@ -350,30 +424,29 @@ let ac_combo_handler = fun gui (ac_combo:Gtk_tools.combo) target_combo flash_com
| Tree t ->
List.iter (fun n -> Gtk_tools.add_to_tree t n) names
);
- save_callback gui ac_combo model ();
+ save_callback gui ac_combo tree_set tree_set_mod ();
let ac_name = Gtk_tools.combo_value ac_combo in
update_params ac_name
in
Utils.choose_xml_file name subdir cb in
- ignore (button_browse#connect#clicked ~callback);
- ignore (match remove with
- Some r ->
- let callback = fun _ ->
- match label with
- Tree t ->
- Gtk_tools.remove_selected_from_tree t;
- save_callback gui ac_combo model ()
- | _ -> ()
- in
- ignore (r#connect#clicked ~callback)
- | _ -> ()
- )
- )
- (ac_files gui model);
+ (* connect browse button *)
+ ignore (match button_browse with Some b -> ignore(b#connect#clicked ~callback) | _ -> ());
+ (* remove button callback *)
+ let callback = fun _ ->
+ match label with
+ Tree t ->
+ Gtk_tools.remove_selected_from_tree t;
+ save_callback gui ac_combo tree_set tree_set_mod ()
+ | _ -> ()
+ in
+ (* connect remove button *)
+ ignore (match button_remove with Some r -> ignore(r#connect#clicked ~callback) | _ -> ())
+ )
+ ac_files;
(* Save button *)
- ignore(gui#menu_item_save_ac#connect#activate ~callback:(save_callback ~user_save:true gui ac_combo model))
+ ignore(gui#menu_item_save_ac#connect#activate ~callback:(save_callback ~user_save:true gui ac_combo tree_set tree_set_mod))
let build_handler = fun ~file gui ac_combo (target_combo:Gtk_tools.combo) (flash_combo:Gtk_tools.combo) (log:string->unit) ->
diff --git a/sw/tools/generators/Makefile b/sw/tools/generators/Makefile
index dcc5a43ff8..b36889317d 100644
--- a/sw/tools/generators/Makefile
+++ b/sw/tools/generators/Makefile
@@ -28,7 +28,7 @@ INCLUDES =
PKG = -package pprz
LINKPKG = $(PKG) -linkpkg -dllpath-pkg pprz
-all: gen_common.cmo gen_aircraft.out gen_airframe.out gen_messages2.out gen_messages.out gen_ubx.out gen_mtk.out gen_flight_plan.out gen_radio.out gen_periodic.out gen_settings.out gen_xsens.out gen_modules.out gen_autopilot.out gen_abi.out gen_srtm.out
+all: gen_aircraft.out gen_airframe.out gen_messages2.out gen_messages.out gen_ubx.out gen_mtk.out gen_flight_plan.out gen_radio.out gen_periodic.out gen_settings.out gen_xsens.out gen_modules.out gen_autopilot.out gen_abi.out gen_srtm.out
gen_flight_plan.out : gen_flight_plan.cmo $(LIBPPRZCMA)
@echo OL $@
@@ -38,9 +38,9 @@ gen_srtm.out : gen_srtm.ml $(LIBPPRZCMA)
@echo OL $@
$(Q)$(OCAMLC) $(INCLUDES) -o $@ $(LINKPKG) $<
-%.out : %.ml gen_common.cmo $(LIBPPRZCMA)
+%.out : %.ml $(LIBPPRZCMA)
@echo OL $<
- $(Q)$(OCAMLC) $(INCLUDES) -o $@ $(LINKPKG) gen_common.cmo $<
+ $(Q)$(OCAMLC) $(INCLUDES) -o $@ $(LINKPKG) $<
%.cmo : %.ml
@echo OC $<
diff --git a/sw/tools/generators/gen_aircraft.ml b/sw/tools/generators/gen_aircraft.ml
index d733e7251b..9d42c484e2 100644
--- a/sw/tools/generators/gen_aircraft.ml
+++ b/sw/tools/generators/gen_aircraft.ml
@@ -340,10 +340,12 @@ let () =
mkdir (aircraft_conf_dir // "telemetry");
let settings =
- try value "settings" with
+ try Env.filter_settings (value "settings") with
_ ->
- fprintf stderr "\nWARNING: No 'settings' attribute specified for A/C '%s', using 'settings/basic.xml'\n\n%!" aircraft;
- "settings/basic.xml" in
+ fprintf stderr "\nWARNING: No 'settings' attribute specified for A/C '%s', using 'settings/dummy.xml'\n\n%!" aircraft;
+ "settings/dummy.xml" in
+ (* add modules settings *)
+ let settings = String.concat " " [settings; (try Env.filter_settings (value "settings_modules") with _ -> "")] in
(** Expands the configuration of the A/C into one single file *)
let conf_aircraft = Env.expand_ac_xml aircraft_xml in
diff --git a/sw/tools/generators/gen_settings.ml b/sw/tools/generators/gen_settings.ml
index d87d457766..df167b2505 100644
--- a/sw/tools/generators/gen_settings.ml
+++ b/sw/tools/generators/gen_settings.ml
@@ -269,14 +269,42 @@ let parse_rc_modes = fun xml ->
let join_xml_files = fun xml_files ->
let dl_settings = ref []
and rc_settings = ref [] in
+ let target = try Sys.getenv "TARGET" with _ -> "" in
List.iter (fun xml_file ->
+ (* look for a specific name after settings file (in case of modules) *)
+ let split = Str.split (Str.regexp "~") xml_file in
+ let xml_file, name = match split with
+ | [f; n] -> f, n
+ | _ -> xml_file, ""
+ in
let xml = Xml.parse_file xml_file in
let these_rc_settings =
try Xml.children (ExtXml.child xml "rc_settings") with
Not_found -> [] in
let these_dl_settings =
- try Xml.children (ExtXml.child xml "dl_settings") with
- Not_found -> [] in
+ try
+ (* test if the file is plain settings file or a module file *)
+ let xml =
+ if Xml.tag xml = "module"
+ then begin
+ (* test if the module is loaded or not *)
+ if List.exists (fun n ->
+ let t = ExtXml.attrib_or_default n "target" "" in
+ Str.string_match (Str.regexp (".*"^target^".*")) t 0
+ ) (Xml.children xml)
+ then List.filter (fun t -> Xml.tag t = "settings") (Xml.children xml)
+ else []
+ end
+ else [xml]
+ in
+ (* include settings if name is matching *)
+ List.fold_left (fun l x ->
+ if (ExtXml.attrib_or_default x "name" "") = name then
+ l @ (Xml.children (ExtXml.child x "dl_settings"))
+ else l
+ ) [] xml
+ with
+ | Not_found -> [] in
rc_settings := these_rc_settings @ !rc_settings;
dl_settings := these_dl_settings @ !dl_settings)
xml_files;