diff --git a/conf/Makefile.avr b/conf/Makefile.avr index a2a86c22df..fb64ea2f1a 100644 --- a/conf/Makefile.avr +++ b/conf/Makefile.avr @@ -115,7 +115,7 @@ $(OBJDIR)/%.hex: $(OBJDIR)/%.elf %.install: $(OBJDIR)/%.hex check_arch # stk200 needs to be erased first $(UISP) $(UISP_FLAGS) --erase - $(UISP) $(UISP_FLAGS) --upload if=$< + $(UISP) $(UISP_FLAGS) --upload --verify if=$< erase: check_arch $(UISP) $(ISP_FLAGS) --erase diff --git a/sw/ground_segment/cockpit/Paparazzi/NDPage.pm b/sw/ground_segment/cockpit/Paparazzi/NDPage.pm index 619b3231cb..73100487e1 100644 --- a/sw/ground_segment/cockpit/Paparazzi/NDPage.pm +++ b/sw/ground_segment/cockpit/Paparazzi/NDPage.pm @@ -24,6 +24,8 @@ sub populate { sub completeinit { my $self = shift; $self->SUPER::completeinit; + $self->{normal_font} = "bleriot-radar-m12c"; + $self->{small_font} = "bleriot-radar-m8c"; $self->build_gui(); } diff --git a/sw/ground_segment/cockpit/Paparazzi/SettingsPage.pm b/sw/ground_segment/cockpit/Paparazzi/SettingsPage.pm index 65d1eed3e4..0b68906d50 100644 --- a/sw/ground_segment/cockpit/Paparazzi/SettingsPage.pm +++ b/sw/ground_segment/cockpit/Paparazzi/SettingsPage.pm @@ -7,34 +7,59 @@ use Data::Dumper; use constant TITLE => "Settings"; -my @fields = ('if_mode', 'if_value1', 'if_value2'); +my @fields = ('if_mode', 'ap_mode'); sub populate { my ($self, $args) = @_; $args->{-title} = TITLE; $self->SUPER::populate($args); $self->configspec( - -fields => [S_NEEDINIT, S_PASSIVE, S_RDONLY, S_OVRWRT, S_NOPRPG, []], ); } + + sub set_aircraft { my ($self, $prev_ac, $new_ac) = @_; foreach my $field (@fields) { $prev_ac->detach($self, $field, [\&update_field]) if ($prev_ac); $new_ac->attach($self, $field, [\&update_field]) if ($new_ac); } - my $fligh_plan = $new_ac->get('flight_plan'); - - use Data::Dumper; - print "#####".Dumper(scalar $fligh_plan->get('-rc_control')); - + # use Data::Dumper; + # print "#####".Dumper(scalar $fligh_plan->get('-rc_control')); + my $zinc = $self->get('-zinc'); + my $rc_controls = $fligh_plan->get('-rc_control'); + foreach my $mode (keys %{$rc_controls}) { + foreach my $dir (keys %{$rc_controls->{$mode}}) { + foreach my $slider (keys %{$rc_controls->{$mode}->{$dir}}) { + my $label = $self->{'label_'.$mode."_".$dir."_".$slider}; + $zinc->itemconfigure($label, -text => $rc_controls->{$mode}->{$dir}->{$slider}->[0]); + } + } + } } sub update_field { my ($self, $aircraft, $field, $new_value) = @_; - $self->get('-zinc')->itemconfigure($self->{'text_'.$field}, -text => $new_value); + if ($field eq 'ap_mode' or $field eq 'if_mode') { + $self->get('-zinc')->itemconfigure($self->{'text_'.$field}, -text => $new_value); + } +# else { + my $zinc = $self->get('-zinc'); + my $ap_mode = $aircraft->get('ap_mode'); + my $if_mode = $aircraft->get('if_mode'); + foreach my $slider ('gain_1', 'gain_2') { + my $label = $self->{'label_'.$ap_mode."_".$if_mode."_".$slider}; + $zinc->itemconfigure($label, -color => 'green'); + print "$ap_mode $if_mode $slider $label\n"; + } + # $field =~ /if_value(\S)/; + # my $slider = "GAIN_".$1; + # my $label = $self->{'label_'.$ap_mode."_".$if_mode."_".$slider}; + # print "$ap_mode $if_mode $slider $label\n"; + +# } } sub build_gui { @@ -57,5 +82,46 @@ sub build_gui { -text => 'NA'); $y+=$dy; } + + my @ap_modes = ('AUTO1', 'AUTO2'); + my @if_modes = ('UP', 'DOWN'); + my @sliders = ('gain_1', 'gain_2'); + foreach my $ap_mode (@ap_modes) { + $x = 10; + $zinc->add('text', $self->{main_group}, + -position => [$x, $y+$self->{vmargin}], + -color => 'white', + -anchor => 'w', + -text => $ap_mode); + foreach my $slider (@sliders) { + $x += 100; + $zinc->add('text', $self->{main_group}, + -position => [$x, $y+$self->{vmargin}], + -color => 'white', + -anchor => 'w', + -text => $slider); + } + foreach my $if_mode (@if_modes) { + $x = 10; + $y += 35; + $zinc->add('text', $self->{main_group}, + -position => [$x, $y+$self->{vmargin}], + -color => 'white', + -anchor => 'w', + -text => $if_mode); + foreach my $slider (@sliders) { + $x += 100; + $self->{'label_'.$ap_mode."_".$if_mode."_".$slider} = + $zinc->add('text', $self->{main_group}, + -position => [$x, $y+$self->{vmargin}], + -color => 'white', + -anchor => 'w', + -text => "N/A", + -font => $self->{small_font}, + ); + } + } + $y += 35; + } } diff --git a/sw/lib/perl/Paparazzi/Flightplan.pm b/sw/lib/perl/Paparazzi/Flightplan.pm index 6d16fcd930..4ddd206746 100644 --- a/sw/lib/perl/Paparazzi/Flightplan.pm +++ b/sw/lib/perl/Paparazzi/Flightplan.pm @@ -142,11 +142,13 @@ sub parse_rc_control { my $mode_name = $mode->getAttribute('name'); my @settings = $mode->getElementsByTagName('setting'); foreach my $s (@settings) { - my ($var, $range, $rc, $type) = ($s->getAttribute('var'), + my ($rc, $var, $range, $type) = ($s->getAttribute('rc'), + $s->getAttribute('var'), $s->getAttribute('range'), - $s->getAttribute('rc'), $s->getAttribute('type')); - $rc_control->{$mode_name} = [$var, $range, $rc, $type]; + $rc =~ /(gain_.+)_(\S+)/; + my ($slider, $direction) = ($1, $2); + $rc_control->{$mode_name}->{$direction}->{$slider} = [$var, $range, $type]; } } $self->configure('-rc_control', $rc_control);