[servo_switch] -> module name=switch type=servo|uart

This commit is contained in:
Christophe De Wagter
2016-10-28 10:12:45 +02:00
parent a7e3bccdfe
commit aa3294cd4e
24 changed files with 148 additions and 148 deletions
+7 -7
View File
@@ -35,7 +35,7 @@
<modules>
<module name="geo_mag"/>
<module name="air_data"/>
<module name="servo_switch"/>
<module name="switch" type="servo"/>
<module name="gps" type="ubx_ucenter"/>
</modules>
@@ -63,12 +63,12 @@
<define name="REVERSE" value="TRUE"/>
</section>
<section name="SERVO_SWITCH">
<define name="SERVO_SWITCH_SERVO" value="DROP"/>
<define name="SERVO_SWITCH_ON_VALUE" value="SERVO_DROP_MIN"/>
<define name="SERVO_SWITCH_OFF_VALUE" value="SERVO_DROP_MAX"/>
<define name="DropOpen()" value="ServoSwitchOn()"/>
<define name="DropClose()" value="ServoSwitchOff()"/>
<section name="SWITCH_SERVO">
<define name="SWITCH_SERVO_SERVO" value="DROP"/>
<define name="SWITCH_SERVO_ON_VALUE" value="SERVO_DROP_MIN"/>
<define name="SWITCH_SERVO_OFF_VALUE" value="SERVO_DROP_MAX"/>
<define name="DropOpen()" value="SwitchServoOn()"/>
<define name="DropClose()" value="SwitchServoOff()"/>
</section>
<command_laws>
+2 -2
View File
@@ -7,7 +7,7 @@
telemetry="telemetry/default_rotorcraft.xml"
flight_plan="flight_plans/rotorcraft_basic.xml"
settings="settings/rotorcraft_basic.xml settings/control/stabilization_att_int.xml settings/modules/config_asctec_v2.xml"
settings_modules="modules/geo_mag.xml modules/air_data.xml modules/servo_switch.xml modules/gps_ubx_ucenter.xml"
settings_modules="modules/geo_mag.xml modules/air_data.xml modules/switch_servo.xml modules/gps_ubx_ucenter.xml"
gui_color="white"
/>
<aircraft
@@ -106,7 +106,7 @@
telemetry="telemetry/default_rotorcraft.xml"
flight_plan="flight_plans/rotorcraft_basic.xml"
settings="settings/rotorcraft_basic.xml settings/control/stabilization_att_int.xml settings/modules/config_asctec_v2.xml settings/control/rotorcraft_guidance.xml "
settings_modules="modules/geo_mag.xml modules/air_data.xml modules/servo_switch.xml modules/gps_ubx_ucenter.xml"
settings_modules="modules/geo_mag.xml modules/air_data.xml modules/switch_servo.xml modules/gps_ubx_ucenter.xml"
gui_color="blue"
/>
</conf>
+7 -7
View File
@@ -35,7 +35,7 @@
<modules>
<module name="geo_mag"/>
<module name="air_data"/>
<module name="servo_switch"/>
<module name="switch" type="servo"/>
<module name="gps" type="ubx_ucenter"/>
</modules>
@@ -63,12 +63,12 @@
<define name="REVERSE" value="TRUE"/>
</section>
<section name="SERVO_SWITCH">
<define name="SERVO_SWITCH_SERVO" value="DROP"/>
<define name="SERVO_SWITCH_ON_VALUE" value="SERVO_DROP_MIN"/>
<define name="SERVO_SWITCH_OFF_VALUE" value="SERVO_DROP_MAX"/>
<define name="DropOpen()" value="ServoSwitchOn()"/>
<define name="DropClose()" value="ServoSwitchOff()"/>
<section name="SWITCH_SERVO">
<define name="SWITCH_SERVO_SERVO" value="DROP"/>
<define name="SWITCH_SERVO_ON_VALUE" value="SERVO_DROP_MIN"/>
<define name="SWITCH_SERVO_OFF_VALUE" value="SERVO_DROP_MAX"/>
<define name="DropOpen()" value="SwitchServoOn()"/>
<define name="DropClose()" value="SwitchServoOff()"/>
</section>
<command_laws>
+1 -1
View File
@@ -29,7 +29,7 @@
telemetry="telemetry/default_rotorcraft.xml"
flight_plan="flight_plans/TUDELFT/tudelft_rotorcraft_survey_imav2015_competition.xml"
settings="settings/rotorcraft_basic.xml settings/control/stabilization_att_int.xml settings/modules/config_asctec_v2.xml settings/control/rotorcraft_guidance.xml"
settings_modules="modules/servo_switch.xml modules/gps_ubx_ucenter.xml modules/nav_survey_rectangle_rotorcraft.xml modules/nav_survey_poly_rotorcraft.xml modules/geo_mag.xml"
settings_modules="modules/switch_servo.xml modules/gps_ubx_ucenter.xml modules/nav_survey_rectangle_rotorcraft.xml modules/nav_survey_poly_rotorcraft.xml modules/geo_mag.xml"
gui_color="blue"
/>
<aircraft
+7 -7
View File
@@ -42,7 +42,7 @@
<modules main_freq="512">
<!-- <module name="logger_spi_link"/>
<module name="imu_quality_assessment"/> -->
<module name="servo_switch"/>
<module name="switch" type="servo"/>
<module name="send_imu_mag_current"/>
<module name="gps" type="ubx_ucenter" />
<module name="nav" type="survey_rectangle_rotorcraft"/>
@@ -65,12 +65,12 @@
<servo name="DROP" no="4" min="1100" neutral="1500" max="2100"/>
</servos>
<section name="SERVO_SWITCH">
<define name="SERVO_SWITCH_SERVO" value="DROP"/>
<define name="SERVO_SWITCH_ON_VALUE" value="SERVO_DROP_MIN"/>
<define name="SERVO_SWITCH_OFF_VALUE" value="SERVO_DROP_MAX"/>
<define name="DropOpen()" value="ServoSwitchOn()"/>
<define name="DropClose()" value="ServoSwitchOff()"/>
<section name="SWITCH_SERVO">
<define name="SWITCH_SERVO_SERVO" value="DROP"/>
<define name="SWITCH_SERVO_ON_VALUE" value="SERVO_DROP_MIN"/>
<define name="SWITCH_SERVO_OFF_VALUE" value="SERVO_DROP_MAX"/>
<define name="DropOpen()" value="SwitchServoOn()"/>
<define name="DropClose()" value="SwitchServoOff()"/>
</section>
<commands>
+2 -2
View File
@@ -62,7 +62,7 @@
telemetry="telemetry/default_rotorcraft.xml"
flight_plan="flight_plans/rotorcraft_basic.xml"
settings="settings/rotorcraft_basic.xml settings/control/stabilization_att_int.xml settings/control/rotorcraft_guidance.xml "
settings_modules="modules/servo_switch.xml modules/rotorcraft_cam.xml"
settings_modules="modules/switch_servo.xml modules/rotorcraft_cam.xml"
gui_color="#3cf2d51335a7"
/>
<aircraft
@@ -84,7 +84,7 @@
telemetry="telemetry/default_rotorcraft.xml"
flight_plan="flight_plans/rotorcraft_basic.xml"
settings="settings/rotorcraft_basic.xml settings/control/stabilization_att_int.xml settings/control/rotorcraft_guidance.xml"
settings_modules="modules/servo_switch.xml modules/rotorcraft_cam.xml"
settings_modules="modules/switch_servo.xml modules/rotorcraft_cam.xml"
gui_color="blue"
/>
<aircraft
+7 -7
View File
@@ -28,7 +28,7 @@
<module name="ahrs" type="int_cmpl_quat"/>
<module name="ins" type="hff"/>
<module name="servo_switch"/>
<module name="switch" type="servo"/>
<module name="rotorcraft_cam"/>
<!--module name="sonar" type="adc"/-->
<!--module name="adc_generic">
@@ -225,12 +225,12 @@
<define name="DEFAULT_MODE" value="ROTORCRAFT_CAM_MODE_MANUAL"/>
</section>
<section name="SERVO_SWITCH">
<define name="SERVO_SWITCH_SERVO" value="DROP"/>
<define name="SERVO_SWITCH_ON_VALUE" value="SERVO_DROP_MIN"/>
<define name="SERVO_SWITCH_OFF_VALUE" value="SERVO_DROP_MAX"/>
<define name="DropOpen()" value="ServoSwitchOn()"/>
<define name="DropClose()" value="ServoSwitchOff()"/>
<section name="SWITCH_SERVO">
<define name="SWITCH_SERVO_SERVO" value="DROP"/>
<define name="SWITCH_SERVO_ON_VALUE" value="SERVO_DROP_MIN"/>
<define name="SWITCH_SERVO_OFF_VALUE" value="SERVO_DROP_MAX"/>
<define name="DropOpen()" value="SwitchServoOn()"/>
<define name="DropClose()" value="SwitchServoOff()"/>
</section>
<section name="MISC">
+6 -6
View File
@@ -31,7 +31,7 @@
<module name="ahrs" type="int_cmpl_euler"/>
<module name="ins" type="extended"/>
<module name="servo_switch"/>
<module name="switch" type="servo"/>
<module name="rotorcraft_cam"/>
<module name="sonar_adc">
<configure name="ADC_SONAR" value="ADC_0"/>
@@ -221,11 +221,11 @@
<define name="TILT_ANGLE_MIN" value=" 10." unit="deg"/>
</section>
<section name="SERVO_SWITCH">
<define name="SERVO_SWITCH_ON_VALUE" value="SERVO_SWITCH_MIN"/>
<define name="SERVO_SWITCH_OFF_VALUE" value="SERVO_SWITCH_MAX"/>
<define name="DropOpen()" value="ServoSwitchOn()"/>
<define name="DropClose()" value="ServoSwitchOff()"/>
<section name="SWITCH_SERVO">
<define name="SWITCH_SERVO_ON_VALUE" value="SWITCH_SERVO_MIN"/>
<define name="SWITCH_SERVO_OFF_VALUE" value="SWITCH_SERVO_MAX"/>
<define name="DropOpen()" value="SwitchServoOn()"/>
<define name="DropClose()" value="SwitchServoOff()"/>
</section>
<section name="MISC">
+1 -1
View File
@@ -40,7 +40,7 @@
telemetry="telemetry/default_fixedwing_imu.xml"
flight_plan="flight_plans/basic.xml"
settings="settings/fixedwing_basic.xml settings/control/ctl_new.xml"
settings_modules="modules/gps.xml modules/servo_switch.xml"
settings_modules="modules/gps.xml modules/switch_servo.xml"
gui_color="blue"
/>
<aircraft
+2 -2
View File
@@ -50,7 +50,7 @@
<module name="current_sensor">
<configure name="ADC_CURRENT_SENSOR" value="ADC_3"/>
</module>
<module name="servo_switch"/>
<module name="switch" type="servo"/>
<module name="sys_mon"/>
<module name="adc_generic">
<configure name="ADC_CHANNEL_GENERIC1" value="ADC_4"/> <!-- voltage sensor -->
@@ -83,7 +83,7 @@
<servo name="HATCH" no="7" min="1100" neutral="1100" max="1900"/>
</servos>
<section name="SERVO_SWITCH" PREFIX="SERVO_SWITCH_">
<section name="SWITCH_SERVO" PREFIX="SWITCH_SERVO_">
<define name="SERVO" value="HATCH"/>
<define name="ON_VALUE" value="SERVO_HATCH_MIN"/>
<define name="OFF_VALUE" value="SERVO_HATCH_MAX"/>
@@ -37,7 +37,7 @@
<modules>
<module name="geo_mag"/>
<module name="air_data"/>
<module name="servo_switch"/>
<module name="switch" type="servo"/>
<module name="gps" type="ubx_ucenter"/>
<module name="logger_spi_link"/>
</modules>
@@ -66,12 +66,12 @@
<define name="REVERSE" value="TRUE"/>
</section>
<section name="SERVO_SWITCH">
<define name="SERVO_SWITCH_SERVO" value="DROP"/>
<define name="SERVO_SWITCH_ON_VALUE" value="SERVO_DROP_MIN"/>
<define name="SERVO_SWITCH_OFF_VALUE" value="SERVO_DROP_MAX"/>
<define name="DropOpen()" value="ServoSwitchOn()"/>
<define name="DropClose()" value="ServoSwitchOff()"/>
<section name="SWITCH_SERVO">
<define name="SWITCH_SERVO_SERVO" value="DROP"/>
<define name="SWITCH_SERVO_ON_VALUE" value="SERVO_DROP_MIN"/>
<define name="SWITCH_SERVO_OFF_VALUE" value="SERVO_DROP_MAX"/>
<define name="DropOpen()" value="SwitchServoOn()"/>
<define name="DropClose()" value="SwitchServoOff()"/>
</section>
<command_laws>
+3 -3
View File
@@ -205,7 +205,7 @@
telemetry="telemetry/default_rotorcraft.xml"
flight_plan="flight_plans/TUDELFT/tudelft_rotorcraft_survey_imav2015_competition.xml"
settings="settings/rotorcraft_basic.xml settings/control/stabilization_att_int.xml settings/modules/config_asctec_v2.xml settings/control/rotorcraft_guidance.xml"
settings_modules="modules/imu_common.xml modules/gps.xml modules/ahrs_float_mlkf.xml modules/servo_switch.xml modules/gps_ubx_ucenter.xml [modules/nav_survey_rectangle_rotorcraft.xml] [modules/nav_survey_poly_rotorcraft.xml] [modules/geo_mag.xml]"
settings_modules="modules/imu_common.xml modules/gps.xml modules/ahrs_float_mlkf.xml modules/switch_servo.xml modules/gps_ubx_ucenter.xml [modules/nav_survey_rectangle_rotorcraft.xml] [modules/nav_survey_poly_rotorcraft.xml] [modules/geo_mag.xml]"
gui_color="#ffffd5c5aead"
/>
<aircraft
@@ -216,7 +216,7 @@
telemetry="telemetry/default_rotorcraft.xml"
flight_plan="flight_plans/TUDELFT/tudelft_delft_basic.xml"
settings="settings/rotorcraft_basic.xml settings/control/stabilization_att_int.xml settings/modules/config_asctec_v2.xml settings/control/rotorcraft_guidance.xml"
settings_modules="modules/imu_common.xml modules/gps.xml modules/ahrs_int_cmpl_quat.xml [modules/geo_mag.xml] [modules/air_data.xml] modules/servo_switch.xml"
settings_modules="modules/imu_common.xml modules/gps.xml modules/ahrs_int_cmpl_quat.xml [modules/geo_mag.xml] [modules/air_data.xml] modules/switch_servo.xml"
gui_color="#e66affffaa08"
/>
<aircraft
@@ -227,7 +227,7 @@
telemetry="telemetry/default_rotorcraft.xml"
flight_plan="flight_plans/TUDELFT/tudelft_delft_basic.xml"
settings="settings/rotorcraft_basic.xml settings/modules/config_asctec_v2.xml settings/control/rotorcraft_guidance.xml"
settings_modules="modules/imu_common.xml modules/gps.xml modules/ahrs_int_cmpl_quat.xml [modules/geo_mag.xml] [modules/air_data.xml] modules/servo_switch.xml modules/gps_ubx_ucenter.xml"
settings_modules="modules/imu_common.xml modules/gps.xml modules/ahrs_int_cmpl_quat.xml [modules/geo_mag.xml] [modules/air_data.xml] modules/switch_servo.xml modules/gps_ubx_ucenter.xml"
gui_color="#8c63ffff8e00"
/>
<aircraft
+1 -1
View File
@@ -53,7 +53,7 @@
<modules>
<module name="baro_sim"/>
<module name="servo_switch"/>
<module name="switch" type="servo"/>
<module name="gps" type="ubx_ucenter"/>
</modules>
+7 -7
View File
@@ -38,7 +38,7 @@
<modules>
<module name="geo_mag"/>
<module name="air_data"/>
<module name="servo_switch"/>
<module name="switch" type="servo"/>
<!--module name="gps" type="ubx_ucenter"/-->
</modules>
@@ -66,12 +66,12 @@
<define name="REVERSE" value="TRUE"/>
</section>
<section name="SERVO_SWITCH">
<define name="SERVO_SWITCH_SERVO" value="DROP"/>
<define name="SERVO_SWITCH_ON_VALUE" value="SERVO_DROP_MIN"/>
<define name="SERVO_SWITCH_OFF_VALUE" value="SERVO_DROP_MAX"/>
<define name="DropOpen()" value="ServoSwitchOn()"/>
<define name="DropClose()" value="ServoSwitchOff()"/>
<section name="SWITCH_SERVO">
<define name="SWITCH_SERVO_SERVO" value="DROP"/>
<define name="SWITCH_SERVO_ON_VALUE" value="SERVO_DROP_MIN"/>
<define name="SWITCH_SERVO_OFF_VALUE" value="SERVO_DROP_MAX"/>
<define name="DropOpen()" value="SwitchServoOn()"/>
<define name="DropClose()" value="SwitchServoOff()"/>
</section>
<command_laws>
+7 -7
View File
@@ -37,7 +37,7 @@
<modules>
<module name="geo_mag"/>
<module name="air_data"/>
<module name="servo_switch"/>
<module name="switch" type="servo"/>
<module name="gps" type="ubx_ucenter"/>
<module name="logger_spi_link">
<configure name="HS_LOG_SPI_DEV" value="SPI1"/>
@@ -69,12 +69,12 @@
<define name="REVERSE" value="TRUE"/>
</section>
<section name="SERVO_SWITCH">
<define name="SERVO_SWITCH_SERVO" value="DROP"/>
<define name="SERVO_SWITCH_ON_VALUE" value="SERVO_DROP_MIN"/>
<define name="SERVO_SWITCH_OFF_VALUE" value="SERVO_DROP_MAX"/>
<define name="DropOpen()" value="ServoSwitchOn()"/>
<define name="DropClose()" value="ServoSwitchOff()"/>
<section name="SWITCH_SERVO">
<define name="SWITCH_SERVO_SERVO" value="DROP"/>
<define name="SWITCH_SERVO_ON_VALUE" value="SERVO_DROP_MIN"/>
<define name="SWITCH_SERVO_OFF_VALUE" value="SERVO_DROP_MAX"/>
<define name="DropOpen()" value="SwitchServoOn()"/>
<define name="DropClose()" value="SwitchServoOff()"/>
</section>
<command_laws>
+7 -7
View File
@@ -3,7 +3,7 @@
<airframe name="Blender">
<modules main_freq="512">
<module name="servo_switch"/>
<module name="switch" type="servo"/>
<module name="rotorcraft_cam"/>
<module name="digital_cam">
<!-- AUX1 -->
@@ -231,12 +231,12 @@
<define name="AUTOSHOOT_DISTANCE_INTERVAL" value="5" unit="meter"/>
</section>
<section name="SERVO_SWITCH">
<define name="SERVO_SWITCH_SERVO" value="DROP"/>
<define name="SERVO_SWITCH_ON_VALUE" value="SERVO_DROP_MIN"/>
<define name="SERVO_SWITCH_OFF_VALUE" value="SERVO_DROP_MAX"/>
<define name="DropOpen()" value="ServoSwitchOn()"/>
<define name="DropClose()" value="ServoSwitchOff()"/>
<section name="SWITCH_SERVO">
<define name="SWITCH_SERVO_SERVO" value="DROP"/>
<define name="SWITCH_SERVO_ON_VALUE" value="SERVO_DROP_MIN"/>
<define name="SWITCH_SERVO_OFF_VALUE" value="SERVO_DROP_MAX"/>
<define name="DropOpen()" value="SwitchServoOn()"/>
<define name="DropClose()" value="SwitchServoOff()"/>
</section>
<section name="MISC">
+1 -1
View File
@@ -172,7 +172,7 @@
telemetry="telemetry/default_rotorcraft.xml"
flight_plan="flight_plans/rotorcraft_basic.xml"
settings="settings/rotorcraft_basic.xml settings/control/rotorcraft_guidance.xml settings/control/stabilization_att_int.xml settings/nps.xml"
settings_modules="modules/servo_switch.xml modules/rotorcraft_cam.xml modules/digital_cam.xml modules/nav_survey_rectangle_rotorcraft.xml modules/imu_common.xml modules/gps.xml modules/ahrs_int_cmpl_quat.xml"
settings_modules="modules/switch_servo.xml modules/rotorcraft_cam.xml modules/digital_cam.xml modules/nav_survey_rectangle_rotorcraft.xml modules/imu_common.xml modules/gps.xml modules/ahrs_int_cmpl_quat.xml"
gui_color="white"
/>
<aircraft
+1 -1
View File
@@ -271,7 +271,7 @@
telemetry="telemetry/default_rotorcraft.xml"
flight_plan="flight_plans/rotorcraft_basic.xml"
settings="settings/rotorcraft_basic.xml settings/control/rotorcraft_guidance.xml settings/control/stabilization_att_int.xml settings/nps.xml"
settings_modules="modules/servo_switch.xml modules/rotorcraft_cam.xml modules/digital_cam.xml modules/nav_survey_rectangle_rotorcraft.xml modules/imu_common.xml modules/gps.xml modules/ahrs_int_cmpl_quat.xml"
settings_modules="modules/switch_servo.xml modules/rotorcraft_cam.xml modules/digital_cam.xml modules/nav_survey_rectangle_rotorcraft.xml modules/imu_common.xml modules/gps.xml modules/ahrs_int_cmpl_quat.xml"
gui_color="white"
/>
<aircraft
+1 -1
View File
@@ -271,7 +271,7 @@
telemetry="telemetry/default_rotorcraft.xml"
flight_plan="flight_plans/rotorcraft_basic.xml"
settings="settings/rotorcraft_basic.xml settings/control/rotorcraft_guidance.xml settings/control/stabilization_att_int.xml settings/nps.xml"
settings_modules="modules/servo_switch.xml modules/rotorcraft_cam.xml modules/digital_cam.xml modules/nav_survey_rectangle_rotorcraft.xml modules/gps.xml"
settings_modules="modules/switch_servo.xml modules/rotorcraft_cam.xml modules/digital_cam.xml modules/nav_survey_rectangle_rotorcraft.xml modules/gps.xml"
gui_color="white"
/>
<aircraft
-41
View File
@@ -1,41 +0,0 @@
<!DOCTYPE module SYSTEM "module.dtd">
<module name="servo_switch" dir="switching">
<doc>
<description>Servo switch</description>
<define name="SERVO_SWITCH_ON_VALUE" value="pwm" description="servo value in usec"/>
<define name="SERVO_SWITCH_OFF_VALUE" value="pwm" description="servo value in usec"/>
<define name="SERVO_SWITCH_SERVO" value="nb" description="Id of the servo (default: SWITCH)"/>
</doc>
<settings>
<dl_settings NAME="Servo switch control">
<dl_settings NAME="SWITCH">
<dl_setting var="servo_switch_on" min="0" step="1" max="1" module="switching/servo_switch" values="Off|On">
<strip_button name="ON" value="1" group="servo_switch"/>
<strip_button name="OFF" value="0" group="servo_switch"/>
</dl_setting>
</dl_settings>
</dl_settings>
</settings>
<header>
<file name="servo_switch.h"/>
</header>
<init fun="servo_switch_init()"/>
<periodic fun="servo_switch_periodic()" freq="10."/>
<makefile target="ap|sim|nps">
<!-- these parameters should be set for that module in the airframe file unless you want the defaults
Servo value in usec
<load name="servo_switch.xml">
<define name="SERVO_SWITCH_ON_VALUE" value="2000"/>
<define name="SERVO_SWITCH_OFF_VALUE" value="1000"/>
<define name="SERVO_SWITCH_SERVO" value="SWITCH"/>
</load>
The servo will not exceed the min and max positions defined in the servo section
-->
<file name="servo_switch.c"/>
</makefile>
</module>
+41
View File
@@ -0,0 +1,41 @@
<!DOCTYPE module SYSTEM "module.dtd">
<module name="switch_servo" dir="switching">
<doc>
<description>Swicht using a Servo</description>
<define name="SWITCH_SERVO_ON_VALUE" value="pwm" description="servo value in usec"/>
<define name="SWITCH_SERVO_OFF_VALUE" value="pwm" description="servo value in usec"/>
<define name="SWITCH_SERVO_SERVO" value="nb" description="Id of the servo (default: SWITCH)"/>
</doc>
<settings>
<dl_settings NAME="Switch Servo">
<dl_settings NAME="SWITCH">
<dl_setting var="switch_servo_on" min="0" step="1" max="1" module="switching/switch_servo" values="Off|On">
<strip_button name="ON" value="1" group="switching"/>
<strip_button name="OFF" value="0" group="switching"/>
</dl_setting>
</dl_settings>
</dl_settings>
</settings>
<header>
<file name="switch_servo.h"/>
</header>
<init fun="switch_servo_init()"/>
<periodic fun="switch_servo_periodic()" freq="10."/>
<makefile target="ap|sim|nps">
<!-- these parameters should be set for that module in the airframe file unless you want the defaults
Servo value in usec
<load name="switch_servo.xml">
<define name="SWITCH_SERVO_ON_VALUE" value="2000"/>
<define name="SWITCH_SERVO_OFF_VALUE" value="1000"/>
<define name="SWITCH_SERVO_SERVO" value="SWITCH"/>
</load>
The servo will not exceed the min and max positions defined in the servo section
-->
<file name="switch_servo.c"/>
</makefile>
</module>
+4 -4
View File
@@ -10,10 +10,10 @@
<dl_settings NAME="Switch control">
<dl_settings NAME="SWITCH">
<dl_setting var="switch_uart_channel" min="0" step="1" max="4" module="switching/switch_uart" handler="SwitchUartChannel">
<strip_button name="1" value="1" group="servo_switch"/>
<strip_button name="2" value="2" group="servo_switch"/>
<strip_button name="3" value="3" group="servo_switch"/>
<strip_button name="4" value="4" group="servo_switch"/>
<strip_button name="1" value="1" group="switching"/>
<strip_button name="2" value="2" group="switching"/>
<strip_button name="3" value="3" group="switching"/>
<strip_button name="4" value="4" group="switching"/>
</dl_setting>
</dl_settings>
</dl_settings>
@@ -19,27 +19,27 @@
* Boston, MA 02111-1307, USA.
*/
#include "switching/servo_switch.h"
#include "switching/switch_servo.h"
#include "generated/airframe.h"
#include "subsystems/actuators.h"
bool servo_switch_on;
bool switch_servo_on;
// One level of macro stack to allow redefinition of the default servo
#define _ServoSwitch(_n, _v) ActuatorSet(_n, _v)
#define ServoSwitch(_n, _v) _ServoSwitch(_n, _v)
#define _SwitchServo(_n, _v) ActuatorSet(_n, _v)
#define SwitchServo(_n, _v) _SwitchServo(_n, _v)
void servo_switch_init(void)
void switch_servo_init(void)
{
servo_switch_on = false;
servo_switch_periodic();
switch_servo_on = false;
switch_servo_periodic();
}
void servo_switch_periodic(void)
void switch_servo_periodic(void)
{
if (servo_switch_on == TRUE) {
ServoSwitch(SERVO_SWITCH_SERVO, SERVO_SWITCH_ON_VALUE);
if (switch_servo_on == TRUE) {
SwitchServo(SWITCH_SERVO_SERVO, SWITCH_SERVO_ON_VALUE);
} else {
ServoSwitch(SERVO_SWITCH_SERVO, SERVO_SWITCH_OFF_VALUE);
SwitchServo(SWITCH_SERVO_SERVO, SWITCH_SERVO_OFF_VALUE);
}
}
@@ -19,32 +19,32 @@
* Boston, MA 02111-1307, USA.
*/
#ifndef SERVO_SWITCH_H
#define SERVO_SWITCH_H
#ifndef SWITCH_SERVO_H
#define SWITCH_SERVO_H
#include "std.h"
#include "paparazzi.h"
#include "generated/airframe.h"
extern bool servo_switch_on;
extern int16_t servo_switch_value;
extern bool switch_servo_on;
extern int16_t switch_servo_value;
#ifndef SERVO_SWITCH_ON_VALUE
#define SERVO_SWITCH_ON_VALUE 2000
#ifndef SWITCH_SERVO_ON_VALUE
#define SWITCH_SERVO_ON_VALUE 2000
#endif
#ifndef SERVO_SWITCH_OFF_VALUE
#define SERVO_SWITCH_OFF_VALUE 1000
#ifndef SWITCH_SERVO_OFF_VALUE
#define SWITCH_SERVO_OFF_VALUE 1000
#endif
#ifndef SERVO_SWITCH_SERVO
#define SERVO_SWITCH_SERVO SWITCH
#ifndef SWITCH_SERVO_SERVO
#define SWITCH_SERVO_SERVO SWITCH
#endif
extern void servo_switch_init(void);
extern void servo_switch_periodic(void);
extern void switch_servo_init(void);
extern void switch_servo_periodic(void);
#define ServoSwitchOn() ({ servo_switch_on = true; false; })
#define ServoSwitchOff() ({ servo_switch_on = false; false; })
#define SwitchServoOn() ({ switch_servo_on = true; false; })
#define SwitchServoOff() ({ switch_servo_on = false; false; })
#endif //SERVO_SWITCH_H
#endif //SWITCH_SERVO_H