Skip to content

Commit

Permalink
Make bat_checker configurable via airframe file
Browse files Browse the repository at this point in the history
  • Loading branch information
cfr34k committed Apr 6, 2012
1 parent 4b838a3 commit 12613b3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
15 changes: 7 additions & 8 deletions conf/modules/bat_checker.xml
@@ -1,22 +1,21 @@
<!DOCTYPE module SYSTEM "module.dtd">

<!--
Battery checker module
@define BAT_CHECKER_DELAY Number of seconds the battery voltage has to be
below LOW_BAT_LEVEL before the warning signal is
activated.
@define BAT_CHECKER_LED The LED to use for the warning signal.
-->
<module name="bat_checker">
<header>
<file name="bat_checker.h"/>
</header>
<init fun="init_bat_checker()"/>
<periodic fun="bat_checker_periodic()" freq="2" autorun="TRUE"/>
<makefile>
<!-- the warning signal will be enabled when supply voltage is below
LOW_BAT_LEVEL for this number of seconds -->
<define name="BAT_CHECKER_DELAY" value="5"/>
<define name="BAT_CHECKER_LED" value="4"/>
<define name="bat_checker_periodic_FREQ" value="2"/>
<file name="bat_checker.c"/>
</makefile>
<!--makefile target="demo">
<define name="SOME_FLAG"/>
<configure name="SOME_DEFINE" value="bla"/>
</makefile-->
</module>

13 changes: 13 additions & 0 deletions sw/airborne/modules/bat_checker/bat_checker.c
Expand Up @@ -31,6 +31,19 @@
#error You must define CRITIC_BAT_LEVEL to use this module!
#endif

#ifndef LOW_BAT_LEVEL
#error You must define LOW_BAT_LEVEL to use this module!
#endif

#ifndef BAT_CHECKER_LED
#error You must define BAT_CHECKER_LED in your airframe file.
#endif

#ifndef BAT_CHECKER_DELAY
#warning BAT_CHECKER_DELAY is undefined. Falling back to 5 seconds.
#define BAT_CHECKER_DELAY 5
#endif

// at this level, the buzzer will be activated periodically
#define WARN_BAT_LEVEL1 (LOW_BAT_LEVEL*10)

Expand Down

0 comments on commit 12613b3

Please sign in to comment.