mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-29 19:17:28 +08:00
removed old booz generation of radio_control ppm
This commit is contained in:
@@ -18,7 +18,7 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with paparazzi; see the file COPYING. If not, write to
|
# along with paparazzi; see the file COPYING. If not, write to
|
||||||
# the Free Software Foundation, 59 Temple Place - Suite 330,
|
# the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||||
# Boston, MA 02111-1307, USA.
|
# Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
# The default is to produce a quiet echo of compilation commands
|
# The default is to produce a quiet echo of compilation commands
|
||||||
# Launch with "make Q=''" to get full echo
|
# Launch with "make Q=''" to get full echo
|
||||||
@@ -73,8 +73,8 @@ static : lib center tools cockpit multimon tmtc logalizer lpc21iap sim_static st
|
|||||||
|
|
||||||
conf: conf/conf.xml conf/control_panel.xml
|
conf: conf/conf.xml conf/control_panel.xml
|
||||||
|
|
||||||
conf/%.xml :conf/%.xml.example
|
conf/%.xml :conf/%.xml.example
|
||||||
[ -L $@ ] || [ -f $@ ] || cp $< $@
|
[ -L $@ ] || [ -f $@ ] || cp $< $@
|
||||||
|
|
||||||
|
|
||||||
lib:
|
lib:
|
||||||
@@ -152,7 +152,7 @@ ac_h ac1 ac2 ac3 ac fbw ap: static conf
|
|||||||
#
|
#
|
||||||
# call with : make bl PROC=[TINY|FBW|AP|GENERIC]
|
# call with : make bl PROC=[TINY|FBW|AP|GENERIC]
|
||||||
bl:
|
bl:
|
||||||
cd $(AIRBORNE)/arch/lpc21/test/bootloader; make clean; make
|
cd $(AIRBORNE)/arch/lpc21/test/bootloader; make clean; make
|
||||||
|
|
||||||
BOOTLOADER_DEV=/dev/ttyUSB0
|
BOOTLOADER_DEV=/dev/ttyUSB0
|
||||||
upload_bl bl.upload: bl
|
upload_bl bl.upload: bl
|
||||||
@@ -175,7 +175,7 @@ upgrade_bl bl.upgrade: bl lpc21iap
|
|||||||
|
|
||||||
ms:
|
ms:
|
||||||
cd $(AIRBORNE)/arch/lpc21/lpcusb; make
|
cd $(AIRBORNE)/arch/lpc21/lpcusb; make
|
||||||
cd $(AIRBORNE)/arch/lpc21/lpcusb/examples; make
|
cd $(AIRBORNE)/arch/lpc21/lpcusb/examples; make
|
||||||
|
|
||||||
upload_ms ms.upload: ms
|
upload_ms ms.upload: ms
|
||||||
$(PAPARAZZI_SRC)/sw/ground_segment/lpc21iap/lpc21iap $(AIRBORNE)/arch/lpc21/lpcusb/examples/msc.elf
|
$(PAPARAZZI_SRC)/sw/ground_segment/lpc21iap/lpc21iap $(AIRBORNE)/arch/lpc21/lpcusb/examples/msc.elf
|
||||||
@@ -209,7 +209,7 @@ fast_deb:
|
|||||||
clean:
|
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
|
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
|
||||||
rm -f $(MESSAGES_H) $(MESSAGES2_H) $(UBX_PROTOCOL_H) $(DL_PROTOCOL_H)
|
rm -f $(MESSAGES_H) $(MESSAGES2_H) $(UBX_PROTOCOL_H) $(DL_PROTOCOL_H)
|
||||||
find . -mindepth 2 -name Makefile -exec sh -c '$(MAKE) -C `dirname {}` $@' \;
|
find . -mindepth 2 -name Makefile -exec sh -c '$(MAKE) -C `dirname {}` $@' \;
|
||||||
find . -name '*~' -exec rm -f {} \;
|
find . -name '*~' -exec rm -f {} \;
|
||||||
|
|
||||||
dist_clean : clean
|
dist_clean : clean
|
||||||
|
|||||||
+3
-10
@@ -17,7 +17,7 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with paparazzi; see the file COPYING. If not, write to
|
# along with paparazzi; see the file COPYING. If not, write to
|
||||||
# the Free Software Foundation, 59 Temple Place - Suite 330,
|
# the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||||
# Boston, MA 02111-1307, USA.
|
# Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
# Preprocessing of XML configuration files
|
# Preprocessing of XML configuration files
|
||||||
|
|
||||||
@@ -39,7 +39,6 @@ endif
|
|||||||
|
|
||||||
PERIODIC_H=$(ACINCLUDE)/periodic.h
|
PERIODIC_H=$(ACINCLUDE)/periodic.h
|
||||||
RADIO_H=$(ACINCLUDE)/radio.h
|
RADIO_H=$(ACINCLUDE)/radio.h
|
||||||
CONF_RADIO_CONTROL_PPM_H=$(ACINCLUDE)/conf_radio_control_ppm.h
|
|
||||||
FLIGHT_PLAN_H=$(ACINCLUDE)/flight_plan.h
|
FLIGHT_PLAN_H=$(ACINCLUDE)/flight_plan.h
|
||||||
FLIGHT_PLAN_XML=$(ACINCLUDE)/flight_plan.xml
|
FLIGHT_PLAN_XML=$(ACINCLUDE)/flight_plan.xml
|
||||||
SETTINGS_H=$(ACINCLUDE)/settings.h
|
SETTINGS_H=$(ACINCLUDE)/settings.h
|
||||||
@@ -65,7 +64,7 @@ init:
|
|||||||
demo:
|
demo:
|
||||||
$(SUPERVISION)
|
$(SUPERVISION)
|
||||||
|
|
||||||
ifeq ($(MAKECMDGOALS),all_ac_h)
|
ifeq ($(MAKECMDGOALS),all_ac_h)
|
||||||
-include $(MAKEFILE_AC)
|
-include $(MAKEFILE_AC)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -76,7 +75,7 @@ all_ac_h: $(AIRFRAME_H) $(MODULES_H) $(SETTINGS_H) $(TUNING_H) $(MAKEFILE_AC) $(
|
|||||||
@echo "CFLAGS: " $($(TARGET).CFLAGS) "\n" >> $(ACINCLUDE)/$(TARGET)_srcs.list
|
@echo "CFLAGS: " $($(TARGET).CFLAGS) "\n" >> $(ACINCLUDE)/$(TARGET)_srcs.list
|
||||||
@echo "srcs: " $($(TARGET).srcs) >> $(ACINCLUDE)/$(TARGET)_srcs.list
|
@echo "srcs: " $($(TARGET).srcs) >> $(ACINCLUDE)/$(TARGET)_srcs.list
|
||||||
|
|
||||||
radio_ac_h : $(RADIO_H) $(CONF_RADIO_CONTROL_PPM_H)
|
radio_ac_h : $(RADIO_H)
|
||||||
|
|
||||||
flight_plan_ac_h : $(FLIGHT_PLAN_H) $(FLIGHT_PLAN_XML)
|
flight_plan_ac_h : $(FLIGHT_PLAN_H) $(FLIGHT_PLAN_XML)
|
||||||
|
|
||||||
@@ -94,12 +93,6 @@ $(RADIO_H) : $(CONF)/$(RADIO) $(CONF_XML) $(TOOLS)/gen_radio.out
|
|||||||
$(Q)mv /tmp/radio.h $@
|
$(Q)mv /tmp/radio.h $@
|
||||||
$(Q)cp $< $(AIRCRAFT_CONF_DIR)/radios
|
$(Q)cp $< $(AIRCRAFT_CONF_DIR)/radios
|
||||||
|
|
||||||
$(CONF_RADIO_CONTROL_PPM_H) : $(CONF)/$(RADIO) $(CONF_XML) $(TOOLS)/gen_conf_radio_control_ppm.out
|
|
||||||
@echo BUILD $@
|
|
||||||
$(Q)$(TOOLS)/gen_conf_radio_control_ppm.out $< > /tmp/conf_radio_control_ppm.h
|
|
||||||
$(Q)mv /tmp/conf_radio_control_ppm.h $@
|
|
||||||
$(Q)cp $< $(AIRCRAFT_CONF_DIR)/radios
|
|
||||||
|
|
||||||
$(PERIODIC_H) : $(CONF)/$(AIRFRAME_XML) $(MESSAGES_XML) $(CONF_XML) $(CONF)/$(TELEMETRY) $(MAKEFILE_AC)
|
$(PERIODIC_H) : $(CONF)/$(AIRFRAME_XML) $(MESSAGES_XML) $(CONF_XML) $(CONF)/$(TELEMETRY) $(MAKEFILE_AC)
|
||||||
@echo BUILD $@
|
@echo BUILD $@
|
||||||
$(Q)$(TOOLS)/gen_periodic.out $(CONF)/$(AIRFRAME_XML) $(MESSAGES_XML) $(CONF)/$(TELEMETRY) $(PERIODIC_FREQ) > $@
|
$(Q)$(TOOLS)/gen_periodic.out $(CONF)/$(AIRFRAME_XML) $(MESSAGES_XML) $(CONF)/$(TELEMETRY) $(PERIODIC_FREQ) > $@
|
||||||
|
|||||||
+3
-3
@@ -1,5 +1,5 @@
|
|||||||
# $Id$
|
# $Id$
|
||||||
#
|
#
|
||||||
# Copyright (C) 2003-2006 Pascal Brisset, Antoine Drouin
|
# Copyright (C) 2003-2006 Pascal Brisset, Antoine Drouin
|
||||||
#
|
#
|
||||||
# This file is part of paparazzi.
|
# This file is part of paparazzi.
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with paparazzi; see the file COPYING. If not, write to
|
# along with paparazzi; see the file COPYING. If not, write to
|
||||||
# the Free Software Foundation, 59 Temple Place - Suite 330,
|
# the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||||
# Boston, MA 02111-1307, USA.
|
# Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
# Quiet compilation
|
# Quiet compilation
|
||||||
Q=@
|
Q=@
|
||||||
@@ -30,7 +30,7 @@ OCAMLNETCMA=$(shell ocamlfind query -r -a-format -predicates byte netstring)
|
|||||||
OCAMLLEX=ocamllex
|
OCAMLLEX=ocamllex
|
||||||
OCAMLYACC=ocamlyacc
|
OCAMLYACC=ocamlyacc
|
||||||
|
|
||||||
all: gen_aircraft.out gen_airframe.out gen_messages2.out gen_messages.out gen_ubx.out gen_flight_plan.out gen_radio.out gen_periodic.out gen_settings.out gen_tuning.out gen_xsens.out gen_modules.out gen_conf_radio_control_ppm.out find_free_msg_id.out
|
all: gen_aircraft.out gen_airframe.out gen_messages2.out gen_messages.out gen_ubx.out gen_flight_plan.out gen_radio.out gen_periodic.out gen_settings.out gen_tuning.out gen_xsens.out gen_modules.out find_free_msg_id.out
|
||||||
|
|
||||||
FP_CMO = fp_proc.cmo gen_flight_plan.cmo
|
FP_CMO = fp_proc.cmo gen_flight_plan.cmo
|
||||||
ABS_FP = $(FP_CMO:%=$$PAPARAZZI_SRC/sw/tools/%)
|
ABS_FP = $(FP_CMO:%=$$PAPARAZZI_SRC/sw/tools/%)
|
||||||
|
|||||||
@@ -1,162 +0,0 @@
|
|||||||
(*
|
|
||||||
* $Id: gen_radio.ml 3610 2009-07-02 16:35:18Z poine $
|
|
||||||
*
|
|
||||||
* XML preprocessing for radio-control parameters
|
|
||||||
*
|
|
||||||
* Copyright (C) 2003 Pascal Brisset, Antoine Drouin
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
*)
|
|
||||||
|
|
||||||
open Printf
|
|
||||||
open Xml2h
|
|
||||||
|
|
||||||
let h_name = "CONF_RADIO_CONTROL_PPM_H"
|
|
||||||
|
|
||||||
let fos = float_of_string
|
|
||||||
type us = int
|
|
||||||
|
|
||||||
type channel = {
|
|
||||||
name : string;
|
|
||||||
min : us;
|
|
||||||
max : us;
|
|
||||||
neutral : us;
|
|
||||||
averaged : bool }
|
|
||||||
|
|
||||||
|
|
||||||
(* Characters used in Gen_airframe.pprz_value *)
|
|
||||||
let check_function_name = fun s ->
|
|
||||||
for i = 0 to String.length s - 1 do
|
|
||||||
match s.[i] with
|
|
||||||
'A'..'Z' | '0'..'9' | '_' -> ()
|
|
||||||
| _ ->
|
|
||||||
failwith (sprintf "Character '%c' not allowed in function name '%s'" s.[i] s)
|
|
||||||
done
|
|
||||||
|
|
||||||
let parse_channel =
|
|
||||||
let no_channel = ref 0 in
|
|
||||||
fun c ->
|
|
||||||
let name = ExtXml.attrib c "function" in
|
|
||||||
check_function_name name;
|
|
||||||
let ctl = "RADIO_CTL_"^ExtXml.attrib c "ctl"
|
|
||||||
and fct = "RADIO_CONTROL_" ^ name in
|
|
||||||
define ctl (string_of_int !no_channel);
|
|
||||||
define fct ctl;
|
|
||||||
no_channel := !no_channel + 1;
|
|
||||||
let int_attrib = fun x -> int_of_string (ExtXml.attrib c x) in
|
|
||||||
{ min = int_attrib "min";
|
|
||||||
neutral = int_attrib "neutral";
|
|
||||||
max = int_attrib "max";
|
|
||||||
averaged = ExtXml.attrib_or_default c "average" "0" <> "0";
|
|
||||||
name = name
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
let norm1_ppm = fun c ->
|
|
||||||
if c.neutral = c.min then
|
|
||||||
sprintf "tmp_radio * (MAX_PPRZ / (float)(RC_PPM_SIGNED_TICS_OF_USEC(%d-%d)))" c.max c.min, "0"
|
|
||||||
else
|
|
||||||
sprintf "tmp_radio * (tmp_radio >=0 ? (MAX_PPRZ/(float)(RC_PPM_SIGNED_TICS_OF_USEC(%d-%d))) : (MIN_PPRZ/(float)(RC_PPM_SIGNED_TICS_OF_USEC(%d-%d))))" c.max c.neutral c.min c.neutral, "MIN_PPRZ"
|
|
||||||
|
|
||||||
let gen_normalize_ppm = fun channels ->
|
|
||||||
printf "#define NormalizePpm() {\\\n";
|
|
||||||
(* printf " static uint8_t avg_cpt = 0; /* Counter for averaging */\\\n";*)
|
|
||||||
printf " int16_t tmp_radio;\\\n";
|
|
||||||
List.iter
|
|
||||||
(fun c ->
|
|
||||||
let value, min_pprz = norm1_ppm c in
|
|
||||||
begin
|
|
||||||
printf " tmp_radio = booz_radio_control_ppm_pulses[RADIO_CONTROL_%s] - RC_PPM_TICS_OF_USEC(%d);\\\n" c.name c.neutral;
|
|
||||||
printf " radio_control.values[RADIO_CONTROL_%s] = %s;\\\n" c.name value;
|
|
||||||
printf " Bound(radio_control.values[RADIO_CONTROL_%s], %s, MAX_PPRZ); \\\n\\\n" c.name min_pprz;
|
|
||||||
end
|
|
||||||
)
|
|
||||||
channels;
|
|
||||||
(*
|
|
||||||
printf " avg_cpt++;\\\n";
|
|
||||||
printf " if (avg_cpt == RC_AVG_PERIOD) {\\\n";
|
|
||||||
printf " avg_cpt = 0;\\\n";
|
|
||||||
List.iter
|
|
||||||
(fun c ->
|
|
||||||
if c.averaged then begin
|
|
||||||
let value, min_pprz = norm1_ppm c in
|
|
||||||
printf " tmp_radio = avg_rc_values[RADIO_CONTROL_%s] / RC_AVG_PERIOD - RC_PPM_TICS_OF_USEC(%d);\\\n" c.name c.neutral;
|
|
||||||
printf " rc_values[RADIO_CONTROL_%s] = %s;\\\n" c.name value;
|
|
||||||
printf " avg_rc_values[RADIO_CONTROL_%s] = 0;\\\n" c.name;
|
|
||||||
printf " Bound(rc_values[RADIO_CONTROL_%s], %s, MAX_PPRZ); \\\n\\\n" c.name min_pprz;
|
|
||||||
end
|
|
||||||
)
|
|
||||||
channels;
|
|
||||||
printf " rc_values_contains_avg_channels = TRUE;\\\n";
|
|
||||||
printf " }\\\n";
|
|
||||||
*)
|
|
||||||
printf "}\n"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
let _ =
|
|
||||||
if Array.length Sys.argv < 2 then
|
|
||||||
failwith "Usage: gen_radio xml_file";
|
|
||||||
let xml_file = Sys.argv.(1) in
|
|
||||||
let xml = Xml.parse_file xml_file in
|
|
||||||
|
|
||||||
printf "/* This file has been generated from %s */\n" xml_file;
|
|
||||||
printf "/* Please DO NOT EDIT */\n\n";
|
|
||||||
printf "#ifndef %s\n" h_name;
|
|
||||||
define h_name "";
|
|
||||||
nl ();
|
|
||||||
let channels = Xml.children xml in
|
|
||||||
let n = ExtXml.attrib xml "name" in
|
|
||||||
(* Xml2h.warning ("RADIO MODEL: "^n); *)
|
|
||||||
define_string "RADIO_NAME" n;
|
|
||||||
nl ();
|
|
||||||
define "RADIO_CONTROL_NB_CHANNEL" (string_of_int (List.length channels));
|
|
||||||
nl ();
|
|
||||||
|
|
||||||
let channels_params = List.map parse_channel channels in
|
|
||||||
nl ();
|
|
||||||
|
|
||||||
List.iter
|
|
||||||
(fun c ->
|
|
||||||
begin
|
|
||||||
printf "#define RADIO_CONTROL_%s_NEUTRAL %d\n" c.name c.neutral;
|
|
||||||
printf "#define RADIO_CONTROL_%s_MIN %d\n" c.name c.min;
|
|
||||||
printf "#define RADIO_CONTROL_%s_MAX %d\n" c.name c.max;
|
|
||||||
end
|
|
||||||
)
|
|
||||||
channels_params;
|
|
||||||
nl();
|
|
||||||
|
|
||||||
let ppm_pulse_type = ExtXml.attrib xml "pulse_type" in
|
|
||||||
let ppm_data_min = ExtXml.attrib xml "data_min" in
|
|
||||||
let ppm_data_max = ExtXml.attrib xml "data_max" in
|
|
||||||
let ppm_sync_min = ExtXml.attrib xml "sync_min" in
|
|
||||||
let ppm_sync_max = ExtXml.attrib xml "sync_max" in
|
|
||||||
|
|
||||||
printf "#define PPM_PULSE_TYPE PPM_PULSE_TYPE_%s\n" ppm_pulse_type;
|
|
||||||
printf "#define PPM_DATA_MIN_LEN (%sul)\n" ppm_data_min;
|
|
||||||
printf "#define PPM_DATA_MAX_LEN (%sul)\n" ppm_data_max;
|
|
||||||
printf "#define PPM_SYNC_MIN_LEN (%sul)\n" ppm_sync_min;
|
|
||||||
printf "#define PPM_SYNC_MAX_LEN (%sul)\n" ppm_sync_max;
|
|
||||||
nl ();
|
|
||||||
|
|
||||||
gen_normalize_ppm channels_params;
|
|
||||||
|
|
||||||
printf "\n#endif // %s\n" h_name
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user