*** empty log message ***

This commit is contained in:
Antoine Drouin
2005-08-20 13:47:20 +00:00
parent 373b4db177
commit 1f1638bdf3
3 changed files with 13 additions and 95 deletions
+2 -2
View File
@@ -302,8 +302,8 @@
<field name="ap_mode" type="string" values="MANUAL|AUTO1|AUTO2|HOME"/>
<field name="lat_mode" type="string" values="MANUAL|ROLL_RATE|ROLL|COURSE"/>
<field name="gaz_mode" type="string" values="MANUAL|GAZ|CLIMB|ALT"/>
<field name="gps_mode" type="string" />
<field name="flight_time" type="uint32" values="NOFIX|DRO|2D|3D|GPSDRO"/>
<field name="gps_mode" type="string" values="NOFIX|DRO|2D|3D|GPSDRO"/>
<field name="flight_time" type="uint32" />
</message>
<message name="NAV_STATUS" ID="13">
+11 -15
View File
@@ -73,10 +73,10 @@ sub completeinit {
# { name => ["Manual", "Auto1", "Auto2", "Home"],
# color => ["sienna", "blue", "brown", "red"]
# },
gps_mode =>
{ name => [ "No fix", "GPS dead reckoning only", "2D-fix", "3D-fix", "GPS + dead reckoning combined"],
color => ["red", "red", "orange", "brown", "orange"]
},
# gps_mode =>
# { name => [ "No fix", "GPS dead reckoning only", "2D-fix", "3D-fix", "GPS + dead reckoning combined"],
# color => ["red", "red", "orange", "brown", "orange"]
# },
# rc_status =>
# { name => ["Ok","Lost", "Really lost", "error"],
# color => ["orange", "brown", "red", "red"]
@@ -93,6 +93,7 @@ sub completeinit {
rc_status => {'OK' => 'brown', 'LOST' => 'orange', 'REALLY_LOST' => 'red'},
rc_mode => {'AUTO'=> 'orange', 'MANUAL' => 'brown', 'FAILSAFE' => 'red'},
contrast_status => {'DEFAULT' => 'orange', 'WAITING' => 'brown', 'SET' => 'set'},
gps_mode => {'NOFIX' => 'red', 'DRO' => 'red', '2D' => 'orange', '3D' => 'brown', 'GPSDRO' => 'red'},
};
$self->{frame} = undef;
@@ -166,7 +167,7 @@ sub draw {
$zinc->bind($self->{frame}, '<1>', [\&onStripPressed, $self, $ident]);
## ident of the plane
$zinc->add('text', $self->{contentgroup}, -text => uc($ident), -position=>[10,10], -font => $self->{options}->{normal_font}, -color => "midnightblue");
$self->{ident} = $zinc->add('text', $self->{contentgroup}, -text => uc($ident), -position=>[10,10], -font => $self->{options}->{normal_font}, -color => "midnightblue");
my @label_attr = (['AP', 'ap_mode', 70, 10],
['RC', 'rc_status', 70, 22],
@@ -359,7 +360,7 @@ sub string_of_time {
##############################################################################
sub attach_to_aircraft {
my ($self) = @_;
my @options = ('flight_plan', 'ap_mode', 'rc_status', 'gps_mode', 'contrast_status', 'contrast_value',
my @options = ('airframe', 'flight_plan', 'ap_mode', 'rc_status', 'gps_mode', 'contrast_status', 'contrast_value',
'flight_time', 'alt', 'target_alt', 'speed', 'climb', 'bat');
foreach my $option (@options) {
$self->get('-aircraft')->attach($self, $option, [\&aircraft_config_changed]);
@@ -373,18 +374,13 @@ sub aircraft_config_changed {
if ($event eq 'flight_plan') {
# $self->border_block() if (defined $new_value) ; # display blocks of flight plan
}
elsif ($event eq 'rc_status' or $event eq 'rc_mode' or $event eq 'contrast_status' or $event eq 'ap_mode' ) {
elsif ($event eq 'airframe') {
$self->get('-zinc')->itemconfigure($self->{ident}, -text => scalar $new_value->get('-name')) if defined $new_value;
}
elsif ($event eq 'rc_status' or $event eq 'rc_mode' or $event eq 'contrast_status' or $event eq 'ap_mode' or $event eq 'gps_mode') {
my $color = $self->{new_modes}->{$event}->{$new_value};
$self->set_item($event, $new_value, $color);
}
elsif ($event eq 'gps_mode' ) {
my $names = $self->{modes}->{$event}->{name};
my $colors = $self->{modes}->{$event}->{color};
if ($new_value < @{$names} ) {
$self->set_item($event,$self->{modes}->{$event}->{name}[$new_value], $self->{modes}->{$event}->{color}[$new_value]);
}
else { print "in Strip::aircraft_config_changed : wrong value $new_value for $event\n"}
}
elsif ($event eq 'flight_time') {
$self->set_item("flight_time",$self->string_of_time($new_value), $self->{options}->{value_color});
}
-78
View File
@@ -34,14 +34,8 @@
#include <sys/wait.h>
#include <stdlib.h>
#ifdef SUN_AUDIO
#include <sys/audioio.h>
#include <stropts.h>
#include <sys/conf.h>
#else /* SUN_AUDIO */
#include <sys/soundcard.h>
#include <sys/ioctl.h>
#endif /* SUN_AUDIO */
/* ---------------------------------------------------------------------- */
@@ -90,77 +84,6 @@ static void process_buffer(float *buf, unsigned int len)
dem[i]->demod(dem_st+i, buf, len);
}
/* ---------------------------------------------------------------------- */
#ifdef SUN_AUDIO
static void input_sound(unsigned int sample_rate, unsigned int overlap,
const char *ifname)
{
audio_info_t audioinfo;
audio_info_t audioinfo2;
audio_device_t audiodev;
int fd;
short buffer[8192];
float fbuf[16384];
unsigned int fbuf_cnt = 0;
int i;
short *sp;
if ((fd = open(ifname ? ifname : "/dev/audio", O_RDONLY)) < 0) {
perror("open");
exit (10);
}
if (ioctl(fd, AUDIO_GETDEV, &audiodev) == -1) {
perror("ioctl: AUDIO_GETDEV");
exit (10);
}
AUDIO_INITINFO(&audioinfo);
audioinfo.record.sample_rate = sample_rate;
audioinfo.record.channels = 1;
audioinfo.record.precision = 16;
audioinfo.record.encoding = AUDIO_ENCODING_LINEAR;
/*audioinfo.record.gain = 0x20;
audioinfo.record.port = AUDIO_LINE_IN;
audioinfo.monitor_gain = 0;*/
if (ioctl(fd, AUDIO_SETINFO, &audioinfo) == -1) {
perror("ioctl: AUDIO_SETINFO");
exit (10);
}
if (ioctl(fd, I_FLUSH, FLUSHR) == -1) {
perror("ioctl: I_FLUSH");
exit (10);
}
if (ioctl(fd, AUDIO_GETINFO, &audioinfo2) == -1) {
perror("ioctl: AUDIO_GETINFO");
exit (10);
}
fprintf(stdout, "Audio device: name %s, ver %s, config %s, "
"sampling rate %d\n", audiodev.name, audiodev.version,
audiodev.config, audioinfo.record.sample_rate);
for (;;) {
i = read(fd, sp = buffer, sizeof(buffer));
if (i < 0 && errno != EAGAIN) {
perror("read");
exit(4);
}
if (!i)
break;
if (i > 0) {
for (; i >= sizeof(buffer[0]); i -= sizeof(buffer[0]), sp++)
fbuf[fbuf_cnt++] = (*sp) * (1.0/32768.0);
if (i)
fprintf(stderr, "warning: noninteger number of samples read\n");
if (fbuf_cnt > overlap) {
process_buffer(fbuf, fbuf_cnt-overlap);
memmove(fbuf, fbuf+fbuf_cnt-overlap, overlap*sizeof(fbuf[0]));
fbuf_cnt = overlap;
}
}
}
close(fd);
}
#else /* SUN_AUDIO */
/* ---------------------------------------------------------------------- */
static void input_sound(unsigned int sample_rate, unsigned int overlap,
@@ -287,7 +210,6 @@ static void input_sound(unsigned int sample_rate, unsigned int overlap,
}
close(fd);
}
#endif /* SUN_AUDIO */
/* ---------------------------------------------------------------------- */