diff --git a/conf/Makefile.avr b/conf/Makefile.avr index 406a556e24..52e52f88a8 100644 --- a/conf/Makefile.avr +++ b/conf/Makefile.avr @@ -65,7 +65,7 @@ Q=@ CFLAGS = \ - -Werror -W -Wall \ + -Werror -W -Wall -Wundef \ $(ATMEL_INCLUDES) \ $(INCLUDES) \ -Wstrict-prototypes \ diff --git a/conf/airframes/twinstar4.xml b/conf/airframes/twinstar4.xml index 16d135bde4..fc42fba536 100755 --- a/conf/airframes/twinstar4.xml +++ b/conf/airframes/twinstar4.xml @@ -133,7 +133,7 @@ ap.srcs += rc_settings.c ap.CFLAGS += -DDATALINK=WAVECARD ap.srcs += traffic_info.c datalink.c -ap.CFLAGS += -DWAVECARD -DWAVECARD_UART=Uart0 -DUSE_UART0 +ap.CFLAGS += -DWAVECARD_UART=Uart0 -DUSE_UART0 ap.srcs += wavecard.c diff --git a/conf/flight_plans/airexpo.xml b/conf/flight_plans/airexpo.xml index 9db34e2501..4262408710 100644 --- a/conf/flight_plans/airexpo.xml +++ b/conf/flight_plans/airexpo.xml @@ -1,4 +1,4 @@ - + @@ -34,7 +34,7 @@ - + diff --git a/conf/flight_plans/sectors.xml b/conf/flight_plans/sectors.xml index 904849f1c1..46c85d1246 100644 --- a/conf/flight_plans/sectors.xml +++ b/conf/flight_plans/sectors.xml @@ -12,4 +12,13 @@ + + + + + + + + + diff --git a/sw/airborne/nav.c b/sw/airborne/nav.c index bdf8f81f44..4353f6b863 100644 --- a/sw/airborne/nav.c +++ b/sw/airborne/nav.c @@ -176,7 +176,7 @@ static float qdr; static struct point survey_from; static struct point survey_to; static float shift; -static bool_t survey_uturn = FALSE; +static bool_t survey_uturn __attribute__ ((unused)) = FALSE; #include @@ -204,7 +204,12 @@ void nav_goto_block(uint8_t b) { GotoBlock(b); } -static void survey_init(float y_south, float y_north, float grid); +static inline void survey_init(float y_south, float y_north, float grid) { + survey_from.x = survey_to.x = estimator_x; + survey_from.y = y_south; + survey_to.y = y_north; + shift = grid; +} #include "flight_plan.h" @@ -324,19 +329,11 @@ static inline void compute_dist2_to_home(void) { dist2_to_home = ph_x*ph_x + ph_y *ph_y; too_far_from_home = dist2_to_home > (MAX_DIST_FROM_HOME*MAX_DIST_FROM_HOME); #if defined InAirspace - too_far_from_home = too_far_from_home || !(InAirspace()); + too_far_from_home = too_far_from_home || !(InAirspace(estimator_x, estimator_y)); #endif } -static void survey_init(float y_south, float y_north, float grid) { - survey_from.x = survey_to.x = estimator_x; - survey_from.y = y_south; - survey_to.y = y_north; - shift = grid; -} - - #ifndef FAILSAFE_HOME_RADIUS #define FAILSAFE_HOME_RADIUS 50 #endif diff --git a/sw/ground_segment/tmtc/Makefile b/sw/ground_segment/tmtc/Makefile index 49c1cb790b..10c41b1800 100644 --- a/sw/ground_segment/tmtc/Makefile +++ b/sw/ground_segment/tmtc/Makefile @@ -28,7 +28,6 @@ CONF = ../../../conf VAR = ../../../var all: link server messages $(VAR)/boa.conf -# stereo_demod clean: rm -f link server messages *.bak *~ core *.o .depend *.opt *.out *.cm* @@ -36,7 +35,7 @@ clean: OCAMLC = ocamlc OCAMLOPT = ocamlopt OCAMLLIB = ../../lib/ocaml -INCLUDES= -I $(OCAMLLIB) -I +lablgtk2 +INCLUDES= -I $(OCAMLLIB) -I ../multimon -I +lablgtk2 LIBPPRZCMA=$(OCAMLLIB)/lib-pprz.cma $(VAR)/boa.conf :$(CONF)/boa.conf @@ -45,29 +44,18 @@ $(VAR)/boa.conf :$(CONF)/boa.conf chmod a+x boa - -messages.opt : messages.ml - $(OCAMLOPT) $(INCLUDES) -o $@ str.cmxa unix.cmxa xml-light.cmxa glibivy-ocaml.cmxa -I +lablgtk2 lablgtk.cmxa gtkInit.cmx lib-pprz.cmxa $^ - strip $@ - messages : messages.cmo @echo OL $@ $(Q)$(OCAMLC) -custom $(INCLUDES) -o $@ lablgtk.cma glibivy-ocaml.cma lib-pprz.cma gtkInit.cmo $^ -stereo_demod : ../multimon/multimon.cma stereo_demod.ml ../../lib/ocaml/lib-pprz.cma - $(OCAMLC) $(INCLUDES) -I ../multimon -o $@ lablgtk.cma glibivy-ocaml.cma lib-pprz.cma multimon.cma $^ - @cat ../../../pprz_src_test.sh > $@ - @echo 'exec lablgtk2 -I $$PAPARAZZI_SRC/sw/lib/ocaml -I $$PAPARAZZI_SRC/sw/ground_segment/multimon glibivy-ocaml.cma lib-pprz.cma -I $$PAPARAZZI_SRC/sw/ground_segment/tmtc $$PAPARAZZI_SRC/sw/ground_segment/multimon/multimon.cma $$PAPARAZZI_SRC/sw/ground_segment/tmtc/stereo_demod.ml $$*' >> $@ - @chmod a+x $@ - server : aircraft.cmo wind.cmo airprox.cmo server.cmo @echo OL $@ $(Q)$(OCAMLC) -custom $(INCLUDES) -o $@ lablgtk.cma glibivy-ocaml.cma lib-pprz.cma $^ -link : modem.cmo link.cmo +link : modem.cmo link.cmo @echo OL $@ - $(Q)$(OCAMLC) -custom $(INCLUDES) -o $@ lablgtk.cma glibivy-ocaml.cma lib-pprz.cma $^ + $(Q)$(OCAMLC) -custom $(INCLUDES) -o $@ lablgtk.cma glibivy-ocaml.cma lib-pprz.cma multimon.cma $^ %.cmo : %.ml $(LIBPPRZCMA) @@ -78,11 +66,6 @@ link : modem.cmo link.cmo @echo OC $< $(Q)$(OCAMLC) $(INCLUDES) $< -airprox.cmi aircraft.cmo : aircraft.cmi -airprox.cmo : airprox.cmi - -wavecard_c : wavecard_c.c wavecard_utils_c.c wavecard_foo_c.c - gcc -Wall -o $@ $^ `pkg-config --cflags glib-2.0` `pkg-config --libs glib-2.0` # # Dependencies diff --git a/sw/lib/ocaml/mapFP.ml b/sw/lib/ocaml/mapFP.ml index 9f74b95784..06c48a4e87 100644 --- a/sw/lib/ocaml/mapFP.ml +++ b/sw/lib/ocaml/mapFP.ml @@ -156,11 +156,12 @@ class flight_plan = fun ?edit geomap color fp_dtd xml -> end) (XmlEdit.children xml_wpts) in + (** Expands the blocks *) let _ = XmlEdit.expand_node xml_tree_view xml_root; let blocks = XmlEdit.child xml_root "blocks" in XmlEdit.expand_node xml_tree_view blocks in - + object method georef = ref_wgs84 method window = xml_window diff --git a/sw/tools/gen_flight_plan.ml b/sw/tools/gen_flight_plan.ml index 5471f0c963..a8bb4b849d 100644 --- a/sw/tools/gen_flight_plan.ml +++ b/sw/tools/gen_flight_plan.ml @@ -391,18 +391,19 @@ let rec print_stage = fun index_of_waypoints sectors x -> let grid = parsed_attrib x "grid" and sector_name = ExtXml.attrib x "sector" in let s = try List.assoc sector_name sectors with Not_found -> failwith (sprintf "Error, sector %s unknown" sector_name) in - let x1 = ref max_float and x2 = ref min_float - and y1 = ref max_float and y2 = ref min_float in + let x1 = ref max_float and x2 = ref (-.max_float) + and y1 = ref max_float and y2 = ref (-.max_float) in List.iter (fun {G2D.x2D=x; G2D.y2D=y} -> x1 := min !x1 x; y1 := min !y1 y; x2 := max !x2 x; y2 := max !y2 y) s; stage (); - lprintf "survey_init(%f, %f, %s);\n" !y1 !y2 grid; + lprintf "survey_init(%.1f, %.1f, %s);\n" !y1 !y2 grid; lprintf "NextStage();\n"; + left (); stage (); let inside_sector = inside_function sector_name in - lprintf "Survey(%s,%f,%f,%f,%f);\n" inside_sector !x1 !x2 !y1 !y2; + lprintf "Survey(%s,%.1f,%.1f,%.1f,%.1f);\n" inside_sector !x1 !x2 !y1 !y2; lprintf "return;\n" | _s -> failwith "Unreachable" end; @@ -613,13 +614,13 @@ let print_inside_polygon = fun pts -> if xg > xd then begin lprintf "return FALSE;\n" end else begin - lprintf "float dy = _y - %f;\n" yl; - lprintf "return (%f+dy*%f <= _x && _x <= %f+dy*%f);\n" xg ag xd ad + lprintf "float dy = _y - %.1f;\n" yl; + lprintf "return (%.1f+dy*%.1f <= _x && _x <= %.1f+dy*%f);\n" xg ag xd ad end else let ij2 = (i+j) / 2 in let yl = layers.(ij2).G2D.top in - lprintf "if (_y <= %f) {\n" yl; + lprintf "if (_y <= %.1f) {\n" yl; right (); f i ij2; left (); lprintf "} else {\n"; right (); f (ij2+1) j; left (); @@ -733,7 +734,7 @@ let _ = let i = ref (-1) in List.map (fun w -> incr i; (name_of w, !i)) waypoints in - let sectors_filename = Filename.concat dir "sectors.xml" in + let sectors_filename = Filename.concat dir "sectors.xml" in (** FIXME **) let sectors_xml = Xml.parse_file sectors_filename in let sectors = List.map (parse_sector rel_utm_of_wgs84) (Xml.children sectors_xml) in List.iter print_inside_sector sectors; @@ -753,23 +754,13 @@ let _ = print_dl_settings dl_settings; -(*** begin try - let airspace = ExtXml.attrib xml "airspace" in - begin - match Str.split (Str.regexp "\\.") airspace with - [base; sector_name] -> - let file = dir ^ "/" ^ base ^".xml" in - let sectors_xml = Xml.parse_file file in - let sector = ExtXml.child sectors_xml "sector" ~select:(fun x -> ExtXml.attrib x "name" = sector_name) in - print_inside_sector rel_utm_of_wgs84 (ExtXml.child sector "0") - | _ -> failwith "airspace" - end + let airspace = Xml.attrib xml "airspace" in + lprintf "#define InAirspace(_x, _y) %s(_x, _y)\n" (inside_function airspace) with _ -> () end; -***) Xml2h.finish h_name end