diff --git a/Makefile.gen b/Makefile.gen index a1842aa770..8eefa4d422 100644 --- a/Makefile.gen +++ b/Makefile.gen @@ -31,13 +31,21 @@ MESSAGES_H=$(STATICINCLUDE)/messages.h UBX_PROTOCOL_H=$(STATICINCLUDE)/ubx_protocol.h MESSAGES_XML = $(CONF)/messages.xml UBX_XML = $(CONF)/ubx.xml +FBW_MESSAGES_H=$(STATICINCLUDE)/fbw_messages.h -static: $(MESSAGES_H) $(UBX_PROTOCOL_H) +static: $(MESSAGES_H) $(UBX_PROTOCOL_H) $(FBW_MESSAGES_H) $(MESSAGES_H) : $(MESSAGES_XML) $(CONF_XML) - $(TOOLS)/gen_messages.out $< telemetry_ap > /tmp/messages.h - mv /tmp/messages.h $@ + test -d $(STATICINCLUDE) || mkdir -p $(STATICINCLUDE) + TMP_FILE=`mktemp`;\ + $(TOOLS)/gen_messages.out $< telemetry_ap > $$TMP_FILE;\ + mv $$TMP_FILE $@ + +$(FBW_MESSAGES_H) : $(MESSAGES_XML) $(CONF_XML) + TMP_FILE=`mktemp`;\ + $(TOOLS)/gen_messages.out $< telemetry_fbw > $$TMP_FILE;\ + mv $$TMP_FILE $@ $(UBX_PROTOCOL_H) : $(UBX_XML) $(CONF_XML) $(TOOLS)/gen_ubx.out $< > /tmp/ubx.h diff --git a/conf/Makefile.avr b/conf/Makefile.avr index 91d39d7b32..0dd47f33b0 100644 --- a/conf/Makefile.avr +++ b/conf/Makefile.avr @@ -129,6 +129,7 @@ avr_clean: # $(OBJDIR)/.depend: + test -d $(OBJDIR) || mkdir -p $(OBJDIR) $(CC) -M $(CFLAGS) $($(TARGET).srcs) > $@ ifneq ($(MAKECMDGOALS),clean) diff --git a/conf/messages.xml b/conf/messages.xml index 897d239767..163da6f73f 100644 --- a/conf/messages.xml +++ b/conf/messages.xml @@ -146,16 +146,29 @@ - - - + + + + + + + + + + + + diff --git a/sw/airborne/fly_by_wire/test/Makefile b/sw/airborne/fly_by_wire/test/Makefile index 3d1ba17283..4ead2cce50 100644 --- a/sw/airborne/fly_by_wire/test/Makefile +++ b/sw/airborne/fly_by_wire/test/Makefile @@ -1,14 +1,39 @@ +# +# $Id$ +# Copyright (C) 2005 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. +# all: @echo "call with 'make TARGET=... compile (or load)'" -TARGET=check_uart - LOCAL_CFLAGS= $(CTL_BRD_FLAGS) ARCH = atmega8 -INCLUDES = -I ../ -I ../../../include -I ../../../var/include +TARGET = check_uart + + +VARINCLUDE = $(PAPARAZZI_HOME)/var/include +ACINCLUDE = $(PAPARAZZI_HOME)/var/$(AIRCRAFT) +INCLUDES = -I ../ -I ../../../include -I $(ACINCLUDE) -I $(VARINCLUDE) +#-I ../../../var/include CONF_DIR = ../../../../conf CONF_XML = $(CONF_DIR)/conf.xml @@ -28,6 +53,8 @@ endif rc_transmitter.srcs = rc_transmitter.c ../ppm.c ../uart.c +new_rc_transmitter.srcs = new_rc_transmitter.c ../ppm.c ../uart.c + setup_servos.srcs = setup_servos.c ../uart.c ../servo.c check_uart.srcs = check_uart.c ../uart.c @@ -40,4 +67,6 @@ check_spi.srcs = check_spi.c ../uart.c ../spi.c include ../../../../conf/Makefile.local include ../../../../conf/Makefile.avr +main.o .depend : $(ACINCLUDE)/radio.h $(ACINCLUDE)/airframe.h + clean: avr_clean diff --git a/sw/airborne/fly_by_wire/uart.h b/sw/airborne/fly_by_wire/uart.h index 9c95d4e9e6..3b9df1834b 100644 --- a/sw/airborne/fly_by_wire/uart.h +++ b/sw/airborne/fly_by_wire/uart.h @@ -36,4 +36,13 @@ void uart_print_hex16 ( uint16_t c ); void uart_print_string(const uint8_t* s); void uart_print_float( const float * f); +#define TX_BUF_SIZE 256 +extern uint8_t tx_head; +extern volatile uint8_t tx_tail; +extern uint8_t tx_buf[ TX_BUF_SIZE ]; + +#define UART_CHECK_FREE_SPACE(_space) (tx_head>=tx_tail? _space < (TX_BUF_SIZE - (tx_head - tx_tail)) : _space < (tx_tail - tx_head)) + + + #endif diff --git a/sw/lib/perl/Paparazzi/Environment.pm b/sw/lib/perl/Paparazzi/Environment.pm index de4f9fc353..4ad15a92b1 100644 --- a/sw/lib/perl/Paparazzi/Environment.pm +++ b/sw/lib/perl/Paparazzi/Environment.pm @@ -2,6 +2,7 @@ package Paparazzi::Environment; use File::NCopy; use Getopt::Long; +use XML::DOM; use constant INST_PREFIX => "/usr"; @@ -57,6 +58,18 @@ sub check_paparazzi_home { } } +sub read_config { + my $filename = $paparazzi_home."/conf/conf.xml"; + my $parser = XML::DOM::Parser->new(); + my $doc = $parser->parsefile($filename); + my $conf = $doc->getElementsByTagName("conf")->[0]; + my $aircrafts = $conf->getElementsByTagName("aircraft");; + foreach my $aircraft (@{$aircrafts}){ + my $name = $aircraft->getAttribute('name'); + print ("name $name\n"); + } +} + sub paparazzi_src { return $paparazzi_src; } diff --git a/sw/supervision/Paparazzi/CpGui.pm b/sw/supervision/Paparazzi/CpGui.pm index c445d5e388..0b2a0ae6f3 100755 --- a/sw/supervision/Paparazzi/CpGui.pm +++ b/sw/supervision/Paparazzi/CpGui.pm @@ -39,6 +39,14 @@ sub onSessionSelected { use constant LIST_WIDTH => 80; use constant LIST_HEIGHT => 20; + +sub onCompile { + my ($self) = @_; + my $paparazzi_src = Paparazzi::Environment::paparazzi_src(); + print `cd $paparazzi_src; make`; + +} + sub build_gui { my ($self) = @_; my $mw = MainWindow->new(); @@ -67,6 +75,7 @@ sub build_gui { -padx => 5, -pady => 5, -side => "top"); $self->build_logo_page($notebook); + $self->build_compile_page($notebook); $self->build_list_page($notebook, "hosts", "Hosts", ["name", "ip", "status"], \&build_hosts_page); $self->build_list_page($notebook, "variables", "Variables", ["name", "value"], \&build_variables_page); # $self->build_list_page($notebook, "programs", "Programs", ["name", "command", "args"], \&build_programs_page); @@ -85,13 +94,48 @@ sub build_logo_page { my $logo_filename = $self->get('-logo_file'); return unless defined $logo_filename; my $logo_page = $notebook->add("logo", -label => "Logo", -underline => 0); - my $image = $logo_page->Photo('logogif', - -format => 'GIF', + my $image = $logo_page->Photo('logogif', -format => 'GIF', -file => $logo_filename); my $labelImage = $logo_page->Label('-image' => 'logogif')->pack(); return $logo_page; } +sub build_compile_page { + my ($self, $notebook) = @_; + my $compile_page = $notebook->add("compile", -label => "Compile", -underline => 0); + my $paparazzi_src = Paparazzi::Environment::paparazzi_src(); + my(@pl) = qw/-side top -expand yes -padx 10 -pady 10 -fill both/; + my $ground_frame = $compile_page->Frame(-label => 'Ground', -borderwidth => 2, - relief =>'groove')->pack(@pl); +# my $airborne_frame = $compile_page->Frame(-label => "Air", -borderwidth => 2, - relief =>'groove')->pack(@pl); +# my $ground_frame = $compile_page->Frame(-borderwidth => 2, - relief =>'groove')->pack(@pl); + my $airborne_frame = $compile_page->Frame(-borderwidth => 2, - relief =>'groove')->pack(@pl); + @pl = qw/-side top -expand yes -pady 2 -anchor w/; + my $mode_txt = 'Mode : '. (defined $paparazzi_src ? "Source tree" : "System install"); + my $mode_label = $ground_frame->Label(-text => $mode_txt)->pack(@pl); + my $paparazzi_src_txt = 'location : '.$paparazzi_src; + my $paparazzi_src_label = $ground_frame->Label(-text => $paparazzi_src_txt)->pack(@pl); + my $make_button = $ground_frame->Button( + -text => "Compile", + -width => 10, + -command => [\&onCompile, $self], + ); + $make_button->pack(qw/-side top -expand yes -pady 2/); + + my @header = ("name", "airframe", "radio", "flight plan"); + my $hlist = $airborne_frame->Scrolled ('HList', + # -selectmode => 'extended', + -header => 1, + # -columns => $#header + 1, + -width => LIST_WIDTH, +# -height => LIST_HEIGHT, + -itemtype => 'imagetext', + -indent => 35, + -separator => '/', + )->grid(-sticky => 'nsew'); + + Paparazzi::Environment::read_config(); + +} sub build_hosts_page { my ($self, $hlist, $e, $section_h, $item) = @_; diff --git a/sw/supervision/Paparazzi/CpPgmMgr.pm b/sw/supervision/Paparazzi/CpPgmMgr.pm index 48b9a1d509..0b5dd4558d 100644 --- a/sw/supervision/Paparazzi/CpPgmMgr.pm +++ b/sw/supervision/Paparazzi/CpPgmMgr.pm @@ -44,9 +44,9 @@ sub start_program() { # parent $children{$pid} = {cmd => $pgm, args => \@args};#, ktw => $fh}; $self->configure('-children', \%children); - foreach my $key (keys %children) { +# foreach my $key (keys %children) { # print("in ChildrenSpawner::start_programm child: [$key $children{$key}]\n"); - } +# } return $pid; } diff --git a/sw/supervision/Paparazzi/CpSessionMgr.pm b/sw/supervision/Paparazzi/CpSessionMgr.pm index 0579e90c6b..e392e32073 100644 --- a/sw/supervision/Paparazzi/CpSessionMgr.pm +++ b/sw/supervision/Paparazzi/CpSessionMgr.pm @@ -135,7 +135,7 @@ sub xml_parse_section { # print "section $section_name items_name $items_name\n"; my $items = $section->getElementsByTagName($items_name); my $h_name = '-'.$section_name; - print "h_name $h_name\n"; +# print "h_name $h_name\n"; my $tmp = $self->get($h_name); foreach my $item (@{$items}){ if ($section_name eq "hosts") {