fixed exception flags

This commit is contained in:
Ewoud Smeur
2015-09-13 12:10:40 +02:00
parent 944ed27d5b
commit 387f51c1de
6 changed files with 15 additions and 9 deletions
+1 -1
View File
@@ -16,7 +16,7 @@
airframe="airframes/BR/bebop_indi_frog.xml" airframe="airframes/BR/bebop_indi_frog.xml"
radio="radios/dummy.xml" radio="radios/dummy.xml"
telemetry="telemetry/default_rotorcraft.xml" telemetry="telemetry/default_rotorcraft.xml"
flight_plan="flight_plans/Tudelft/rotorcraft_survey_delft.xml" flight_plan="flight_plans/Tudelft/rotorcraft_survey_competition.xml"
settings="settings/rotorcraft_basic.xml settings/control/rotorcraft_guidance.xml settings/estimation/ahrs_secondary.xml settings/estimation/ahrs_float_mlkf.xml settings/estimation/ahrs_int_cmpl_quat.xml settings/control/stabilization_att_indi.xml" settings="settings/rotorcraft_basic.xml settings/control/rotorcraft_guidance.xml settings/estimation/ahrs_secondary.xml settings/estimation/ahrs_float_mlkf.xml settings/estimation/ahrs_int_cmpl_quat.xml settings/control/stabilization_att_indi.xml"
settings_modules="modules/geo_mag.xml modules/air_data.xml modules/video_thread.xml modules/video_rtp_stream.xml modules/nav_survey_rectangle_rotorcraft.xml modules/digital_cam_video.xml modules/cv_colorfilter.xml" settings_modules="modules/geo_mag.xml modules/air_data.xml modules/video_thread.xml modules/video_rtp_stream.xml modules/nav_survey_rectangle_rotorcraft.xml modules/digital_cam_video.xml modules/cv_colorfilter.xml"
gui_color="#ffff0689b7a1" gui_color="#ffff0689b7a1"
@@ -1,6 +1,6 @@
<!DOCTYPE flight_plan SYSTEM "../flight_plan.dtd"> <!DOCTYPE flight_plan SYSTEM "../flight_plan.dtd">
<flight_plan alt="30" ground_alt="0" lat0="50.789517" lon0="6.047089" max_dist_from_home="150" name="IMAV2015_competition_outdoor" security_height="2"> <flight_plan alt="30" ground_alt="0" lat0="50.789517" lon0="6.047089" max_dist_from_home="400" name="IMAV2015_competition_outdoor" security_height="2">
<waypoints> <waypoints>
<waypoint name="HOME" x="0.0" y="0.0"/> <waypoint name="HOME" x="0.0" y="0.0"/>
@@ -10,8 +10,8 @@
</header> </header>
<exceptions> <exceptions>
<exception cond="electrical.bat_low" deroute="Standby"/> <exception cond="electrical.bat_low && (exception_flag[0] == 0)" deroute="Standby" exec="check_exception_flag(0)"/>
<exception cond="electrical.bat_critical" deroute="land_here"/> <exception cond="electrical.bat_critical && (exception_flag[1] == 0)" deroute="land_here" exec="check_exception_flag(1)"/>
</exceptions> </exceptions>
<blocks> <blocks>
@@ -32,4 +32,8 @@ bool_t exception_flag[10];
void exception_flags_init(void) { void exception_flags_init(void) {
memset(exception_flag,0,sizeof(exception_flag)); memset(exception_flag,0,sizeof(exception_flag));
}
void check_exception_flag(uint8_t flag_num) {
exception_flag[flag_num] = 1;
} }
@@ -31,6 +31,7 @@
#define EXCEPTION_FLAGS_H_ #define EXCEPTION_FLAGS_H_
extern void exception_flags_init(void); extern void exception_flags_init(void);
extern void check_exception_flag(uint8_t flag_num);
extern bool_t exception_flag[10]; extern bool_t exception_flag[10];
+6 -5
View File
@@ -158,15 +158,16 @@ let get_index_block = fun x ->
let print_exception = fun x -> let print_exception = fun x ->
let c = parsed_attrib x "cond" in let c = parsed_attrib x "cond" in
let i = get_index_block (ExtXml.attrib x "deroute") in
begin begin
try try
let f = ExtXml.attrib x "exec" in let f = ExtXml.attrib x "exec" in
lprintf "if (%s) { %s; }\n" c f lprintf "if ((nav_block != %d) && %s) {%s; GotoBlock(%d); return; }\n" i c f i
with with
ExtXml.Error _ -> () ExtXml.Error _ -> (
end; lprintf "if ((nav_block != %d) && %s) { GotoBlock(%d); return; }\n" i c i
let i = get_index_block (ExtXml.attrib x "deroute") in )
lprintf "if ((nav_block != %d) && %s) { GotoBlock(%d); return; }\n" i c i end
let element = fun a b c -> Xml.Element (a, b, c) let element = fun a b c -> Xml.Element (a, b, c)