rebringing hardware tests to life

This commit is contained in:
Antoine Drouin
2005-02-21 02:54:00 +00:00
parent c2949ada65
commit 03b4a942dd
9 changed files with 135 additions and 18 deletions
+11 -3
View File
@@ -31,13 +31,21 @@ MESSAGES_H=$(STATICINCLUDE)/messages.h
UBX_PROTOCOL_H=$(STATICINCLUDE)/ubx_protocol.h UBX_PROTOCOL_H=$(STATICINCLUDE)/ubx_protocol.h
MESSAGES_XML = $(CONF)/messages.xml MESSAGES_XML = $(CONF)/messages.xml
UBX_XML = $(CONF)/ubx.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) $(MESSAGES_H) : $(MESSAGES_XML) $(CONF_XML)
$(TOOLS)/gen_messages.out $< telemetry_ap > /tmp/messages.h test -d $(STATICINCLUDE) || mkdir -p $(STATICINCLUDE)
mv /tmp/messages.h $@ 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) $(UBX_PROTOCOL_H) : $(UBX_XML) $(CONF_XML)
$(TOOLS)/gen_ubx.out $< > /tmp/ubx.h $(TOOLS)/gen_ubx.out $< > /tmp/ubx.h
+1
View File
@@ -129,6 +129,7 @@ avr_clean:
# #
$(OBJDIR)/.depend: $(OBJDIR)/.depend:
test -d $(OBJDIR) || mkdir -p $(OBJDIR)
$(CC) -M $(CFLAGS) $($(TARGET).srcs) > $@ $(CC) -M $(CFLAGS) $($(TARGET).srcs) > $@
ifneq ($(MAKECMDGOALS),clean) ifneq ($(MAKECMDGOALS),clean)
+20 -7
View File
@@ -146,16 +146,29 @@
<message name="RC" ID="0x01" period="1"> <message name="RC" ID="0x01" period="1">
<field name="nb_channels" type="uint8"/> <field name="nb_channels" type="uint8"/>
<block times="nb_channels"> <!--
<field name="ppm" type="uint16" unit="us"/> <block times="nb_channels">
</block> <field name="ppm" type="uint16" unit="us"/>
</block>
-->
<field name="ppm01" type="uint16" unit="us"/>
<field name="ppm02" type="uint16" unit="us"/>
<field name="ppm03" type="uint16" unit="us"/>
<field name="ppm04" type="uint16" unit="us"/>
<field name="ppm05" type="uint16" unit="us"/>
<field name="ppm06" type="uint16" unit="us"/>
<field name="ppm07" type="uint16" unit="us"/>
<field name="ppm08" type="uint16" unit="us"/>
<field name="ppm09" type="uint16" unit="us"/>
<field name="ppm10" type="uint16" unit="us"/>
</message> </message>
<!--
<message name="SERVOS" ID="0x02" period="1"> <message name="SERVOS" ID="0x02" period="1">
<field name="nb_channels" type="uint8"/> <field name="nb_channels" type="uint8"/>
<block times="nb_channels"> <block times="nb_channels">
<field name="ppm" type="uint16" unit="us"/> <field name="ppm" type="uint16" unit="us"/>
</block> </block>
</message> </message>
<message name="PPRZ" ID="0x03" period="1"> <message name="PPRZ" ID="0x03" period="1">
@@ -164,7 +177,7 @@
<field name="pprz" type="int16" unit="pprz"/> <field name="pprz" type="int16" unit="pprz"/>
</block> </block>
</message> </message>
-->
<message name="FBW_STATUS" ID="0x04" period="1"> <message name="FBW_STATUS" ID="0x04" period="1">
<field name="nb_spi_err" type="uint8"/> <field name="nb_spi_err" type="uint8"/>
<field name="rc_status" type="uint8" values="OK|LOST|REALLY_LOST"/> <field name="rc_status" type="uint8" values="OK|LOST|REALLY_LOST"/>
+32 -3
View File
@@ -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: all:
@echo "call with 'make TARGET=... compile (or load)'" @echo "call with 'make TARGET=... compile (or load)'"
TARGET=check_uart
LOCAL_CFLAGS= $(CTL_BRD_FLAGS) LOCAL_CFLAGS= $(CTL_BRD_FLAGS)
ARCH = atmega8 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_DIR = ../../../../conf
CONF_XML = $(CONF_DIR)/conf.xml CONF_XML = $(CONF_DIR)/conf.xml
@@ -28,6 +53,8 @@ endif
rc_transmitter.srcs = rc_transmitter.c ../ppm.c ../uart.c 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 setup_servos.srcs = setup_servos.c ../uart.c ../servo.c
check_uart.srcs = check_uart.c ../uart.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.local
include ../../../../conf/Makefile.avr include ../../../../conf/Makefile.avr
main.o .depend : $(ACINCLUDE)/radio.h $(ACINCLUDE)/airframe.h
clean: avr_clean clean: avr_clean
+9
View File
@@ -36,4 +36,13 @@ void uart_print_hex16 ( uint16_t c );
void uart_print_string(const uint8_t* s); void uart_print_string(const uint8_t* s);
void uart_print_float( const float * f); 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 #endif
+13
View File
@@ -2,6 +2,7 @@ package Paparazzi::Environment;
use File::NCopy; use File::NCopy;
use Getopt::Long; use Getopt::Long;
use XML::DOM;
use constant INST_PREFIX => "/usr"; 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 { sub paparazzi_src {
return $paparazzi_src; return $paparazzi_src;
} }
+46 -2
View File
@@ -39,6 +39,14 @@ sub onSessionSelected {
use constant LIST_WIDTH => 80; use constant LIST_WIDTH => 80;
use constant LIST_HEIGHT => 20; use constant LIST_HEIGHT => 20;
sub onCompile {
my ($self) = @_;
my $paparazzi_src = Paparazzi::Environment::paparazzi_src();
print `cd $paparazzi_src; make`;
}
sub build_gui { sub build_gui {
my ($self) = @_; my ($self) = @_;
my $mw = MainWindow->new(); my $mw = MainWindow->new();
@@ -67,6 +75,7 @@ sub build_gui {
-padx => 5, -pady => 5, -padx => 5, -pady => 5,
-side => "top"); -side => "top");
$self->build_logo_page($notebook); $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, "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, "variables", "Variables", ["name", "value"], \&build_variables_page);
# $self->build_list_page($notebook, "programs", "Programs", ["name", "command", "args"], \&build_programs_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'); my $logo_filename = $self->get('-logo_file');
return unless defined $logo_filename; return unless defined $logo_filename;
my $logo_page = $notebook->add("logo", -label => "Logo", -underline => 0); my $logo_page = $notebook->add("logo", -label => "Logo", -underline => 0);
my $image = $logo_page->Photo('logogif', my $image = $logo_page->Photo('logogif', -format => 'GIF',
-format => 'GIF',
-file => $logo_filename); -file => $logo_filename);
my $labelImage = $logo_page->Label('-image' => 'logogif')->pack(); my $labelImage = $logo_page->Label('-image' => 'logogif')->pack();
return $logo_page; 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 { sub build_hosts_page {
my ($self, $hlist, $e, $section_h, $item) = @_; my ($self, $hlist, $e, $section_h, $item) = @_;
+2 -2
View File
@@ -44,9 +44,9 @@ sub start_program() {
# parent # parent
$children{$pid} = {cmd => $pgm, args => \@args};#, ktw => $fh}; $children{$pid} = {cmd => $pgm, args => \@args};#, ktw => $fh};
$self->configure('-children', \%children); $self->configure('-children', \%children);
foreach my $key (keys %children) { # foreach my $key (keys %children) {
# print("in ChildrenSpawner::start_programm child: [$key $children{$key}]\n"); # print("in ChildrenSpawner::start_programm child: [$key $children{$key}]\n");
} # }
return $pid; return $pid;
} }
+1 -1
View File
@@ -135,7 +135,7 @@ sub xml_parse_section {
# print "section $section_name items_name $items_name\n"; # print "section $section_name items_name $items_name\n";
my $items = $section->getElementsByTagName($items_name); my $items = $section->getElementsByTagName($items_name);
my $h_name = '-'.$section_name; my $h_name = '-'.$section_name;
print "h_name $h_name\n"; # print "h_name $h_name\n";
my $tmp = $self->get($h_name); my $tmp = $self->get($h_name);
foreach my $item (@{$items}){ foreach my $item (@{$items}){
if ($section_name eq "hosts") { if ($section_name eq "hosts") {