mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-04 13:55:40 +08:00
rebringing hardware tests to life
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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) = @_;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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") {
|
||||
|
||||
Reference in New Issue
Block a user