Merge pull request #64 from scdwyer/dev

dynamic google_version update and cleaned up os_calls.ml and speech.ml
This commit is contained in:
Felix Ruess
2011-07-30 16:34:44 -07:00
10 changed files with 78 additions and 31 deletions
+13 -13
View File
@@ -70,16 +70,16 @@ endif
OCAML=$(shell which ocaml)
OCAMLRUN=$(shell which ocamlrun)
all: commands static conf
all: conf commands static
static : lib center tools cockpit multimon tmtc misc logalizer lpc21iap sim_static static_h usb_lib
conf: conf/conf.xml conf/control_panel.xml conf/maps_data/maps.conf
conf: conf/conf.xml conf/control_panel.xml conf/maps.xml
conf/%.xml :conf/%.xml.example
[ -L $@ ] || [ -f $@ ] || cp $< $@
conf/maps_data/maps.conf:
conf/maps.xml:
cd data/maps; $(MAKE)
@@ -87,10 +87,10 @@ lib:
cd $(LIB)/ocaml; $(MAKE)
center: lib
cd sw/supervision; make
cd sw/supervision; $(MAKE)
tools: lib
cd $(TOOLS); make
cd $(TOOLS); $(MAKE)
logalizer: lib
cd $(LOGALIZER); $(MAKE)
@@ -166,7 +166,7 @@ ac_h ac1 ac2 ac3 ac fbw ap: static conf
#
# call with : make bl PROC=[TINY|FBW|AP|GENERIC]
bl:
cd $(AIRBORNE)/arch/lpc21/test/bootloader; make clean; make
cd $(AIRBORNE)/arch/lpc21/test/bootloader; $(MAKE) clean; $(MAKE)
BOOTLOADER_DEV=/dev/ttyUSB0
upload_bl bl.upload: bl
@@ -181,15 +181,15 @@ upload_jtag: bl
lpc21iap:
cd sw/ground_segment/lpc21iap; make
cd sw/ground_segment/lpc21iap; $(MAKE)
upgrade_bl bl.upgrade: bl lpc21iap
$(PAPARAZZI_SRC)/sw/ground_segment/lpc21iap/lpc21iap $(AIRBORNE)/arch/lpc21/test/bootloader/bl_ram.elf
$(PAPARAZZI_SRC)/sw/ground_segment/lpc21iap/lpc21iap $(AIRBORNE)/arch/lpc21/test/bootloader/bl.elf
ms:
cd $(AIRBORNE)/arch/lpc21/lpcusb; make
cd $(AIRBORNE)/arch/lpc21/lpcusb/examples; make
cd $(AIRBORNE)/arch/lpc21/lpcusb; $(MAKE)
cd $(AIRBORNE)/arch/lpc21/lpcusb/examples; $(MAKE)
upload_ms ms.upload: ms
$(PAPARAZZI_SRC)/sw/ground_segment/lpc21iap/lpc21iap $(AIRBORNE)/arch/lpc21/lpcusb/examples/msc.elf
@@ -205,10 +205,10 @@ run_sitl :
$(PAPARAZZI_HOME)/var/$(AIRCRAFT)/sim/simsitl
install :
make -f Makefile.install PREFIX=$(PREFIX)
$(MAKE) -f Makefile.install PREFIX=$(PREFIX)
uninstall :
make -f Makefile.install PREFIX=$(PREFIX) uninstall
$(MAKE) -f Makefile.install PREFIX=$(PREFIX) uninstall
DISTRO=lenny
deb :
@@ -218,7 +218,7 @@ deb :
dpkg-buildpackage $(DEBFLAGS) -Ivar -rfakeroot
fast_deb:
make deb OCAMLC=ocamlc.opt DEBFLAGS=-b
$(MAKE) deb OCAMLC=ocamlc.opt DEBFLAGS=-b
clean:
rm -fr dox build-stamp configure-stamp conf/%gconf.xml debian/files debian/paparazzi-arm7 debian/paparazzi-avr debian/paparazzi-base debian/paparazzi-bin debian/paparazzi-dev
@@ -237,7 +237,7 @@ cleanspaces:
distclean : dist_clean
dist_clean : clean
rm -r conf/srtm_data
rm -r conf/maps_data
rm -r conf/maps_data conf/maps.xml
ab_clean:
find sw/airborne -name '*~' -exec rm -f {} \;
+6
View File
@@ -0,0 +1,6 @@
<!-- Paparazzi Maps Support Configuration DTD -->
<!ELEMENT maps EMPTY>
<!ATTLIST maps
google_version CDATA #REQUIRED>
+3
View File
@@ -0,0 +1,3 @@
<!DOCTYPE maps SYSTEM "maps.dtd">
<maps google_version="89"/>
+4 -4
View File
@@ -1,7 +1,7 @@
DATADIR = $(PAPARAZZI_HOME)/conf/maps_data
Q=@
all: $(DATADIR)/maps.google.com $(DATADIR)/maps.conf
all: $(DATADIR)/maps.google.com $(PAPARAZZI_HOME)/conf/maps.xml
$(DATADIR):
mkdir $(DATADIR)
@@ -9,8 +9,8 @@ $(DATADIR):
$(DATADIR)/maps.google.com: $(DATADIR)
wget -O $(@) http://maps.google.com/
$(DATADIR)/maps.conf: $(DATADIR)/maps.google.com
$(Q)echo "[GOOGLE]" > $(@)
$(Q)echo "google_version:" `grep -P "http://khm[0-9]+.google.com/kh/v=[0-9]+.x26" $(DATADIR)/maps.google.com | sed -E s#.*http://khm[0-9]+.google.com/kh/v=## | sed -E s#.x26.*##` >> $(@)
$(PAPARAZZI_HOME)/conf/maps.xml: $(DATADIR)/maps.google.com
$(Q)echo "<!DOCTYPE maps SYSTEM \"maps.dtd\">" > $(@)
$(Q)echo "<maps google_version=\""`grep -P "http://khm[0-9]+.google.com/kh/v=[0-9]+.x26" $(DATADIR)/maps.google.com | sed -E s#.*http://khm[0-9]+.google.com/kh/v=## | sed -E s#.x26.*##`"\"/>" >> $(@)
$(Q)echo "" >> $(@)
+9 -11
View File
@@ -27,15 +27,13 @@
let active = ref false
let say = fun s ->
(
if !active then (
(* If the os is Linux, use "spd-say" (add additional cases here if necessary) *)
if Os_calls.contains (Os_calls.os_name) "Linux" then
ignore (Sys.command (Printf.sprintf "spd-say '%s'&" s))
(* If the os is Darwin, then use "say" *)
else if Os_calls.contains (Os_calls.os_name) "Darwin" then
ignore (Sys.command (Printf.sprintf "say '%s'&" s))
(* If the os is anything else, not supported (add additional cases here if necessary) *)
else
ignore (Sys.command (Printf.sprintf "echo Current OS not supported by -speech option"))
));;
let os = (Os_calls.os_name) in
match os with
(* If the os is Darwin, then use "say" *)
"Linux" -> ignore (Sys.command (Printf.sprintf "spd-say '%s'&" s))
(* If the os is Linux, use "spd-say" *)
| "Darwin" -> ignore (Sys.command (Printf.sprintf "say '%s'&" s))
(* Add more cases here to enhance support *)
| _ -> ignore (Sys.command (Printf.sprintf "echo Current OS not supported by -speech option"))
)
+1 -1
View File
@@ -39,7 +39,7 @@ OCAMLYACC=ocamlyacc
OCAMLLIBDIR=$(shell ocamlc -where)
SRC = fig.ml debug.ml base64.ml serial.ml ocaml_tools.ml expr_syntax.ml expr_parser.ml expr_lexer.ml extXml.ml env.ml xml2h.ml latlong.ml egm96.ml srtm.ml http.ml gm.ml iGN.ml geometry_2d.ml cserial.o convert.o ubx.ml pprz.ml xbee.ml logpprz.ml xmlCom.ml os_calls.ml editAirframe.ml defivybus.ml
SRC = fig.ml debug.ml base64.ml serial.ml ocaml_tools.ml expr_syntax.ml expr_parser.ml expr_lexer.ml extXml.ml env.ml xml2h.ml latlong.ml egm96.ml srtm.ml http.ml maps_support.ml gm.ml iGN.ml geometry_2d.ml cserial.o convert.o ubx.ml pprz.ml xbee.ml logpprz.ml xmlCom.ml os_calls.ml editAirframe.ml defivybus.ml
CMO = $(SRC:.ml=.cmo)
CMX = $(SRC:.ml=.cmx)
+1 -1
View File
@@ -196,7 +196,7 @@ let ms_key = fun key ->
done;
(ms_key, ms_key.[n-2])
let google_version = 87
let google_version = Maps_support.google_version
let url_of_tile_key = fun maps_source s ->
let (x, y, z) = xyz_of_qsrt s in
+38
View File
@@ -0,0 +1,38 @@
(*
* $Id$
*
* Support for obtaining google maps api information at runtime
*
* Copyright (C) 2011 Stephen Dwyer
*
* This file is part of paparazzi.
*
* paparazzi is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* paparazzi is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with paparazzi; see the file COPYING. If not, write to
* the Free Software Foundation, 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*)
let google_ver = ref 0
let home = Env.paparazzi_home
let (//) = Filename.concat
let maps_xml_path = home // "conf" // "maps.xml"
let maps_xml = ExtXml.parse_file maps_xml_path
let google_version = (
if !google_ver == 0 then (
google_ver := ExtXml.int_attrib maps_xml "google_version" );
!google_ver
)
+1
View File
@@ -0,0 +1 @@
val google_version : int
+2 -1
View File
@@ -36,7 +36,8 @@ let read_process_output command =
Buffer.add_substring buffer string 0 !chars_read
done;
ignore (Unix.close_process_in in_channel);
Buffer.contents buffer
try Buffer.sub buffer 0 ((Buffer.length buffer) - 1)
with _ -> Buffer.contents buffer
let contains s substring =
try ignore (Str.search_forward (Str.regexp_string substring) s 0); true