Swicht using a Servo
No detailed description...
Example for airframe file
Add to your firmware section: This example contains all possible configuration options, not all of them are mandatory!
<module name="switch_servo">
b'<define name="SWITCH_SERVO_ON_VALUE" value="pprz_cmd" />\n '
b'<define name="SWITCH_SERVO_OFF_VALUE" value="pprz_cmd" />\n '
b'<define name="SWITCH_SERVO_SERVO" value="nb" />\n '
</module>
Module configuration options
Define Options
- name:
SWITCH_SERVO_ON_VALUE
value: pprz_cmd
Description: servo value in pprz units
- name:
SWITCH_SERVO_OFF_VALUE
value: pprz_cmd
Description: servo value in pprz units
- name:
SWITCH_SERVO_SERVO
value: nb
Description: Id of the servo (default: SWITCH)
Module functions
Init Functions
These initialization functions are called once on startup.
Periodic Functions
These functions are called periodically at the specified frequency from the module periodic loop.
- switch_servo_periodic()
- Frequency in Hz: 10.
- Autorun: LOCK
Periodic function automatically starts after init and can't be stopped.
Files
Header Files
The following headers are automatically included in modules.h
Source Files
Raw switch_servo.xml file:
<!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="pprz_cmd" description="servo value in pprz units"/>
<define name="SWITCH_SERVO_OFF_VALUE" value="pprz_cmd" description="servo value in pprz units"/>
<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">
<file name="switch_servo.c"/>
</makefile>
</module>