Files
HC_APTBS/Views/UserControls/PumpIdentificationCard.xaml
LucianoDev d9775b48be feat: chart grid, pressure tolerance bands, QDelivery RPM normalization, pump page polish
Charts
- Add faint background grid (0.75px, #E0E0E0) to all live charts; matches PDF report style
- Show min/max tolerance bands on P1/P2 pressure charts during test runs (previously only Q-Delivery/Q-Over)
- Broaden BenchService.ToleranceUpdated to fire for every phase receive; UI routes by name
- Clear P1/P2 traces on PhaseChanged alongside Delivery/Over

CAN
- Normalize QDelivery flow rate to 1000 RPM reference before IIR filter so RPM spikes are low-pass filtered with flow-rate transients (matches old_source behavior)

Pump page
- Reorder columns: identification left, commands center, live data right
- PreIn control always visible; disabled when pump lacks pre-injection (rename IsPreInVisible -> IsPreInAvailable)
- Swap value/label order in command cards
- Remove redundant KlineErrors row from identification card

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-20 21:42:30 +02:00

152 lines
8.8 KiB
XML

<UserControl x:Class="HC_APTBS.Views.UserControls.PumpIdentificationCard"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
mc:Ignorable="d"
d:DesignHeight="360" d:DesignWidth="320">
<!-- DataContext = PumpIdentificationViewModel (via {Binding Identification}) -->
<UserControl.Resources>
<BooleanToVisibilityConverter x:Key="BoolToVis"/>
<Style x:Key="IdLabel" TargetType="TextBlock">
<Setter Property="FontFamily" Value="{DynamicResource ContentControlThemeFontFamily}"/>
<Setter Property="FontSize" Value="11"/>
<Setter Property="Foreground" Value="{DynamicResource TextFillColorSecondaryBrush}"/>
<Setter Property="Width" Value="88"/>
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
<Style x:Key="IdValue" TargetType="TextBlock">
<Setter Property="FontFamily" Value="Consolas"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="Foreground" Value="{DynamicResource TextFillColorPrimaryBrush}"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="TextTrimming" Value="CharacterEllipsis"/>
</Style>
</UserControl.Resources>
<Border Style="{StaticResource PumpCard}">
<DockPanel LastChildFill="True">
<!-- ── Card header ───────────────────────────────────────────── -->
<DockPanel DockPanel.Dock="Top" Margin="0,0,0,12">
<ui:SymbolIcon DockPanel.Dock="Left" Symbol="Server24" FontSize="16"
Foreground="{DynamicResource AccentTextFillColorPrimaryBrush}"
Margin="0,0,8,0" VerticalAlignment="Center"/>
<TextBlock Text="{DynamicResource Pump.Identification.Title}"
Style="{StaticResource PumpCardHeader}"/>
</DockPanel>
<!-- ── Action row: Read + Disconnect + progress ──────────────── -->
<Grid DockPanel.Dock="Top" Margin="0,0,0,10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="8"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<ui:Button Grid.Column="0"
Content="{DynamicResource PumpId.ReadKLine}"
Command="{Binding ReadKlineCommand}"
Appearance="Primary"
FontWeight="Bold" Height="32"/>
<ui:Button Grid.Column="2"
Content="{DynamicResource PumpId.Disconnect}"
Command="{Binding DisconnectKLineCommand}"
Appearance="Secondary"
Height="32"/>
</Grid>
<!-- ── Inline progress (visible while reading) ───────────────── -->
<StackPanel DockPanel.Dock="Top"
Margin="0,0,0,8"
Visibility="{Binding IsReading, Converter={StaticResource BoolToVis}}">
<TextBlock Text="{Binding ProgressMessage}"
FontSize="11"
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
TextTrimming="CharacterEllipsis"
Margin="0,0,0,3"/>
<ProgressBar Value="{Binding ProgressPercent, Mode=OneWay}"
Minimum="0" Maximum="100" Height="4"/>
</StackPanel>
<!-- ── ECU info: two columns ─────────────────────────────────── -->
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="8"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<!-- Left column -->
<StackPanel Grid.Column="0">
<StackPanel Orientation="Horizontal" Margin="0,2">
<TextBlock Text="{DynamicResource PumpId.PumpId}" Style="{StaticResource IdLabel}"/>
<TextBlock Text="{Binding KlinePumpId}" Style="{StaticResource IdValue}"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,2">
<TextBlock Text="{DynamicResource PumpId.SerialNo}" Style="{StaticResource IdLabel}"/>
<TextBlock Text="{Binding KlineSerialNumber}" Style="{StaticResource IdValue}"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,2">
<TextBlock Text="{DynamicResource PumpId.ModelRef}" Style="{StaticResource IdLabel}"/>
<TextBlock Text="{Binding KlineModelRef}" Style="{StaticResource IdValue}"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,2">
<TextBlock Text="{DynamicResource PumpId.ModelIndex}" Style="{StaticResource IdLabel}"/>
<TextBlock Text="{Binding KlineModelIndex}" Style="{StaticResource IdValue}"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,2">
<TextBlock Text="{DynamicResource PumpId.DataRecord}" Style="{StaticResource IdLabel}"/>
<TextBlock Text="{Binding KlineDataRecord}" Style="{StaticResource IdValue}"/>
</StackPanel>
</StackPanel>
<!-- Right column -->
<StackPanel Grid.Column="2">
<StackPanel Orientation="Horizontal" Margin="0,2">
<TextBlock Text="{DynamicResource PumpId.SwVer1}" Style="{StaticResource IdLabel}"/>
<TextBlock Text="{Binding KlineSwVersion1}" Style="{StaticResource IdValue}"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,2">
<TextBlock Text="{DynamicResource PumpId.SwVer2}" Style="{StaticResource IdLabel}"/>
<TextBlock Text="{Binding KlineSwVersion2}" Style="{StaticResource IdValue}"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,2">
<TextBlock Text="{DynamicResource PumpId.PumpCtrl}" Style="{StaticResource IdLabel}"/>
<TextBlock Text="{Binding KlinePumpControl}" Style="{StaticResource IdValue}"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,2">
<TextBlock Text="{DynamicResource PumpId.Dfi}" Style="{StaticResource IdLabel}"/>
<TextBlock Text="{Binding KlineDfi}" Style="{StaticResource IdValue}"/>
</StackPanel>
</StackPanel>
</Grid>
<!-- ── Connection error footer ──────────────────────────────── -->
<Border DockPanel.Dock="Bottom"
Background="{DynamicResource SystemFillColorCriticalBackgroundBrush}"
BorderBrush="{DynamicResource SystemFillColorCriticalBrush}"
BorderThickness="1" CornerRadius="4"
Padding="8,4" Margin="0,10,0,0">
<Border.Style>
<Style TargetType="Border">
<Style.Triggers>
<DataTrigger Binding="{Binding KlineConnectError}" Value="">
<Setter Property="Visibility" Value="Collapsed"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Style>
<TextBlock Text="{Binding KlineConnectError}"
FontSize="11" FontFamily="Consolas"
Foreground="{DynamicResource SystemFillColorCriticalBrush}"
TextWrapping="Wrap"/>
</Border>
</DockPanel>
</Border>
</UserControl>