aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml
blob: 60010409551ecb637394b13862f7797b9da7890f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
<UserControl x:Class="Tango.MachineStudio.UI.Views.ConnectedMachineView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls"
             xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:integration="clr-namespace:Tango.Integration.ExternalBridge;assembly=Tango.Integration"
             xmlns:integ="clr-namespace:Tango.Integration.Operation;assembly=Tango.Integration"
             xmlns:emulations="clr-namespace:Tango.Emulations.ExternalBridge;assembly=Tango.Emulations"
             xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI"
             xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:Tango.MachineStudio.UI.Views"
             mc:Ignorable="d" 
              d:DesignHeight="300" d:DesignWidth="300" Width="800" Height="540" Background="{StaticResource Dialog.Background}" DataContext="{Binding ConnectedMachineViewVM, Source={StaticResource Locator}}" Foreground="{StaticResource MainWindow.Foreground}">

    <UserControl.Resources>
        <converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"></converters:BooleanToVisibilityConverter>
        <converters:BooleanToVisibilityInverseConverter x:Key="BooleanToVisibilityInverseConverter"></converters:BooleanToVisibilityInverseConverter>
        <converters:BooleanInverseConverter x:Key="BooleanInverseConverter"></converters:BooleanInverseConverter>
        <converters:ByteArrayToFileSizeConverter x:Key="ByteArrayToFileSizeConverter" />
        <converters:GenericMessageProtocolToStringConverter x:Key="GenericMessageProtocolToStringConverter" />
        <converters:BooleanToYesNoConverter x:Key="BooleanToYesNoConverter" />
    </UserControl.Resources>

    <Grid>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="80"/>
                <RowDefinition Height="1*"/>
            </Grid.RowDefinitions>

            <Grid>
                <StackPanel Orientation="Horizontal" Margin="10">
                    <ContentControl Content="{Binding ApplicationManager.ConnectedMachine}">
                        <ContentControl.Resources>
                            <DataTemplate DataType="{x:Type integration:ExternalBridgeSignalRClient}">
                                <Image Source="/Images/external-bridge-signalr.png" Width="48" Height="48" RenderOptions.BitmapScalingMode="Fant"></Image>
                            </DataTemplate>

                            <DataTemplate DataType="{x:Type integration:ExternalBridgeTcpClient}">
                                <Image Source="/Images/external-bridge-tcp.png" Width="48" Height="48" RenderOptions.BitmapScalingMode="Fant"></Image>
                            </DataTemplate>

                            <DataTemplate DataType="{x:Type integration:ExternalBridgeUsbClient}">
                                <Image Source="/Images/external-bridge-usb.png" Width="48" Height="48" RenderOptions.BitmapScalingMode="Fant"></Image>
                            </DataTemplate>

                            <DataTemplate DataType="{x:Type emulations:EmulatorExternalBridge}">
                                <Image Source="/Images/external-bridge-emulator.png" Width="48" Height="48" RenderOptions.BitmapScalingMode="Fant"></Image>
                            </DataTemplate>
                        </ContentControl.Resources>
                    </ContentControl>

                    <TextBlock Text="Machine Connection" VerticalAlignment="Center" Margin="10 0 0 0" FontSize="20"></TextBlock>
                </StackPanel>
            </Grid>

            <Grid Grid.Row="1" Margin="10 0 10 10">

                <Grid.RowDefinitions>
                    <RowDefinition Height="1*"></RowDefinition>
                    <RowDefinition Height="Auto"></RowDefinition>
                </Grid.RowDefinitions>

                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="1*"></ColumnDefinition>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                </Grid.ColumnDefinitions>

                <Grid d:DataContext="{d:DesignInstance Type=integ:MachineOperator, IsDesignTimeCreatable=False}">
                    <ContentControl Content="{Binding ApplicationManager.ConnectedMachine}">
                        <ContentControl.Resources>

                            <DataTemplate DataType="{x:Type integration:ExternalBridgeSignalRClient}">
                                <controls:TableGrid RowHeight="22">
                                    <TextBlock FontWeight="SemiBold" Text="Serial Number:" />
                                    <TextBlock Text="{Binding SerialNumber}" />
                                    <TextBlock FontWeight="SemiBold" Text="Name:" />
                                    <TextBlock Text="{Binding Machine.Name}" />
                                    <TextBlock FontWeight="SemiBold" Text="Organization:" />
                                    <TextBlock Text="{Binding Machine.Organization.Name}" />
                                    <TextBlock FontWeight="SemiBold" Text="Total Dye Time:" />
                                    <TextBlock Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.TotalMachineWorkTime}" />
                                    <TextBlock FontWeight="SemiBold" Text="Total Dye Meters:" />
                                    <TextBlock Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.TotalMachineMeters}" />
                                    <TextBlock FontWeight="SemiBold" Text="Embedded Software Version:" />
                                    <TextBlock Text="{Binding DeviceInformation.Version}" />
                                    <TextBlock FontWeight="SemiBold" Text="Address:" />
                                    <TextBlock Text="{Binding Adapter.Address}" />
                                    <TextBlock FontWeight="SemiBold" Text="Total Bytes Sent:" />
                                    <TextBlock Text="{Binding Adapter.TotalBytesSent,Converter={StaticResource ByteArrayToFileSizeConverter},Mode=OneWay}" />
                                    <TextBlock FontWeight="SemiBold" Text="Total Bytes Received:" />
                                    <TextBlock Text="{Binding Adapter.TotalBytesReceived,Converter={StaticResource ByteArrayToFileSizeConverter},Mode=OneWay}" />
                                    <TextBlock FontWeight="SemiBold" Text="Transfer Rate:" />
                                    <TextBlock>
                                        <Run Text="{Binding Adapter.TransferRate,Converter={StaticResource ByteArrayToFileSizeConverter},Mode=OneWay}"></Run>
                                        <Run Text="/ sec"></Run>
                                    </TextBlock>
                                    <TextBlock FontWeight="SemiBold" Text="Compression:" />
                                    <TextBlock Text="{Binding Adapter.EnableCompression,Mode=OneWay,Converter={StaticResource BooleanToYesNoConverter}}" />
                                    <TextBlock FontWeight="SemiBold" Text="Generic Protocol:" />
                                    <TextBlock Text="{Binding GenericProtocol,Mode=OneWay,Converter={StaticResource GenericMessageProtocolToStringConverter}}" />
                                    <TextBlock FontWeight="SemiBold" Text="Diagnostics Frame Rate:" />
                                    <TextBlock>
                                        <Run Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.DiagnosticsFrameProvider.FrameRate,Mode=OneWay,IsAsync=True}"></Run>
                                        <Run Text="/ sec"></Run>
                                    </TextBlock>
                                    <TextBlock FontWeight="SemiBold" Text="Enable Diagnostics:" />
                                    <ToggleButton IsChecked="{Binding EnableDiagnostics}" HorizontalAlignment="Left"></ToggleButton>
                                    <TextBlock FontWeight="SemiBold" Text="Enable Embedded Debug Logs:" />
                                    <ToggleButton IsChecked="{Binding EnableEmbeddedDebugging}" HorizontalAlignment="Left"></ToggleButton>
                                    <TextBlock FontWeight="SemiBold" Text="Enable KeepAlive:" />
                                    <ToggleButton IsChecked="{Binding UseKeepAlive}" HorizontalAlignment="Left"></ToggleButton>
                                    <TextBlock FontWeight="SemiBold" Text="Enable Events:" />
                                    <ToggleButton IsChecked="{Binding EnableEventsNotification}" HorizontalAlignment="Left"></ToggleButton>
                                    <TextBlock FontWeight="SemiBold" Text="Enable Application Logs:" />
                                    <ToggleButton IsChecked="{Binding EnableApplicationLogs}" HorizontalAlignment="Left"></ToggleButton>
                                </controls:TableGrid>
                            </DataTemplate>

                            <DataTemplate DataType="{x:Type integration:ExternalBridgeTcpClient}">
                                <controls:TableGrid RowHeight="22">
                                    <TextBlock FontWeight="SemiBold" Text="Serial Number:" />
                                    <TextBlock Text="{Binding SerialNumber}" />
                                    <TextBlock FontWeight="SemiBold" Text="Name:" />
                                    <TextBlock Text="{Binding Machine.Name}" />
                                    <TextBlock FontWeight="SemiBold" Text="Organization:" />
                                    <TextBlock Text="{Binding Machine.Organization.Name}" />
                                    <TextBlock FontWeight="SemiBold" Text="Total Dye Time:" />
                                    <TextBlock Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.TotalMachineWorkTime}" />
                                    <TextBlock FontWeight="SemiBold" Text="Total Dye Meters:" />
                                    <TextBlock Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.TotalMachineMeters}" />
                                    <TextBlock FontWeight="SemiBold" Text="Embedded Software Version:" />
                                    <TextBlock Text="{Binding DeviceInformation.Version}" />
                                    <TextBlock FontWeight="SemiBold" Text="IP Address:" />
                                    <TextBlock Text="{Binding IPAddress}" />
                                    <TextBlock FontWeight="SemiBold" Text="Total Bytes Sent:" />
                                    <TextBlock Text="{Binding Adapter.TotalBytesSent,Converter={StaticResource ByteArrayToFileSizeConverter},Mode=OneWay}" />
                                    <TextBlock FontWeight="SemiBold" Text="Total Bytes Received:" />
                                    <TextBlock Text="{Binding Adapter.TotalBytesReceived,Converter={StaticResource ByteArrayToFileSizeConverter},Mode=OneWay}" />
                                    <TextBlock FontWeight="SemiBold" Text="Transfer Rate:" />
                                    <TextBlock>
                                        <Run Text="{Binding Adapter.TransferRate,Converter={StaticResource ByteArrayToFileSizeConverter},Mode=OneWay}"></Run>
                                        <Run Text="/ sec"></Run>
                                    </TextBlock>
                                    <TextBlock FontWeight="SemiBold" Text="Compression:" />
                                    <TextBlock Text="{Binding Adapter.EnableCompression,Mode=OneWay,Converter={StaticResource BooleanToYesNoConverter}}" />
                                    <TextBlock FontWeight="SemiBold" Text="Generic Protocol:" />
                                    <TextBlock Text="{Binding GenericProtocol,Mode=OneWay,Converter={StaticResource GenericMessageProtocolToStringConverter}}" />
                                    <TextBlock FontWeight="SemiBold" Text="Diagnostics Frame Rate:" />
                                    <TextBlock>
                                        <Run Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.DiagnosticsFrameProvider.FrameRate,Mode=OneWay,IsAsync=True}"></Run>
                                        <Run Text="/ sec"></Run>
                                    </TextBlock>
                                    <TextBlock FontWeight="SemiBold" Text="Enable Diagnostics:" />
                                    <ToggleButton IsChecked="{Binding EnableDiagnostics}" HorizontalAlignment="Left"></ToggleButton>
                                    <TextBlock FontWeight="SemiBold" Text="Enable Embedded Debug Logs:" />
                                    <ToggleButton IsChecked="{Binding EnableEmbeddedDebugging}" HorizontalAlignment="Left"></ToggleButton>
                                    <TextBlock FontWeight="SemiBold" Text="Enable KeepAlive:" />
                                    <ToggleButton IsChecked="{Binding UseKeepAlive}" HorizontalAlignment="Left"></ToggleButton>
                                    <TextBlock FontWeight="SemiBold" Text="Enable Events:" />
                                    <ToggleButton IsChecked="{Binding EnableEventsNotification}" HorizontalAlignment="Left"></ToggleButton>
                                    <TextBlock FontWeight="SemiBold" Text="Enable Application Logs:" />
                                    <ToggleButton IsChecked="{Binding EnableApplicationLogs}" HorizontalAlignment="Left"></ToggleButton>
                                </controls:TableGrid>
                            </DataTemplate>

                            <DataTemplate DataType="{x:Type integration:ExternalBridgeUsbClient}">
                                <controls:TableGrid RowHeight="22">
                                    <TextBlock FontWeight="SemiBold" Text="Serial Number:" />
                                    <TextBlock Text="{Binding SerialNumber}" />
                                    <TextBlock FontWeight="SemiBold" Text="Name:" />
                                    <TextBlock Text="{Binding Machine.Name}" />
                                    <TextBlock FontWeight="SemiBold" Text="Organization:" />
                                    <TextBlock Text="{Binding Machine.Organization.Name}" />
                                    <TextBlock FontWeight="SemiBold" Text="Total Dye Time:" />
                                    <TextBlock Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.TotalMachineWorkTime}" />
                                    <TextBlock FontWeight="SemiBold" Text="Total Dye Meters:" />
                                    <TextBlock Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.TotalMachineMeters}" />
                                    <TextBlock FontWeight="SemiBold" Text="Embedded Software Version:" />
                                    <TextBlock Text="{Binding DeviceInformation.Version}" />
                                    <TextBlock FontWeight="SemiBold" Text="FPGA Version:" />
                                    <TextBlock TextTrimming="CharacterEllipsis">
                                        <TextBlock.ToolTip>
                                            <TextBlock>
                                        <Run Text="{Binding DeviceInformation.FPGA1Version}"></Run> •
                                        <Run Text="{Binding DeviceInformation.FPGA2Version}"></Run> •
                                        <Run Text="{Binding DeviceInformation.FPGA3Version}"></Run>
                                            </TextBlock>
                                        </TextBlock.ToolTip>
                                        <Run Text="{Binding DeviceInformation.FPGA1Version}"></Run> •
                                        <Run Text="{Binding DeviceInformation.FPGA2Version}"></Run> •
                                        <Run Text="{Binding DeviceInformation.FPGA3Version}"></Run>
                                    </TextBlock>
                                    <TextBlock FontWeight="SemiBold" Text="COM Port:" />
                                    <TextBlock Text="{Binding ComPort}" />
                                    <TextBlock FontWeight="SemiBold" Text="Device:" />
                                    <TextBlock Text="{Binding Device}" />
                                    <TextBlock FontWeight="SemiBold" Text="Total Bytes Sent:" />
                                    <TextBlock Text="{Binding Adapter.TotalBytesSent,Converter={StaticResource ByteArrayToFileSizeConverter},Mode=OneWay}" />
                                    <TextBlock FontWeight="SemiBold" Text="Total Bytes Received:" />
                                    <TextBlock Text="{Binding Adapter.TotalBytesReceived,Converter={StaticResource ByteArrayToFileSizeConverter},Mode=OneWay}" />
                                    <TextBlock FontWeight="SemiBold" Text="Transfer Rate:" />
                                    <TextBlock>
                                        <Run Text="{Binding Adapter.TransferRate,Converter={StaticResource ByteArrayToFileSizeConverter},Mode=OneWay}"></Run>
                                        <Run Text="/ sec"></Run>
                                    </TextBlock>
                                    <TextBlock FontWeight="SemiBold" Text="Diagnostics Frame Rate:" />
                                    <TextBlock>
                                        <Run Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.DiagnosticsFrameProvider.FrameRate,Mode=OneWay,IsAsync=True}"></Run>
                                        <Run Text="/ sec"></Run>
                                    </TextBlock>
                                    <TextBlock FontWeight="SemiBold" Text="Enable Diagnostics:" />
                                    <ToggleButton IsChecked="{Binding EnableDiagnostics}" HorizontalAlignment="Left"></ToggleButton>
                                    <TextBlock FontWeight="SemiBold" Text="Enable Embedded Debug Logs:" />
                                    <ToggleButton IsChecked="{Binding EnableEmbeddedDebugging}" HorizontalAlignment="Left"></ToggleButton>
                                    <TextBlock FontWeight="SemiBold" Text="Enable KeepAlive:" />
                                    <ToggleButton IsChecked="{Binding UseKeepAlive}" HorizontalAlignment="Left"></ToggleButton>
                                    <TextBlock FontWeight="SemiBold" Text="Enable Events:" />
                                    <ToggleButton IsChecked="{Binding EnableEventsNotification}" HorizontalAlignment="Left"></ToggleButton>
                                </controls:TableGrid>
                            </DataTemplate>

                            <DataTemplate DataType="{x:Type emulations:EmulatorExternalBridge}">
                                <controls:TableGrid RowHeight="22">
                                    <TextBlock FontWeight="SemiBold" Text="Address:" />
                                    <TextBlock Text="{Binding Adapter.Address}" />
                                    <TextBlock FontWeight="SemiBold" Text="Serial Number:" />
                                    <TextBlock Text="{Binding SerialNumber}" />
                                    <TextBlock FontWeight="SemiBold" Text="Name:" />
                                    <TextBlock Text="{Binding Machine.Name}" />
                                    <TextBlock FontWeight="SemiBold" Text="Organization:" />
                                    <TextBlock Text="{Binding Machine.Organization.Name}" />
                                    <TextBlock FontWeight="SemiBold" Text="Total Dye Time:" />
                                    <TextBlock Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.TotalMachineWorkTime}" />
                                    <TextBlock FontWeight="SemiBold" Text="Total Dye Meters:" />
                                    <TextBlock Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.TotalMachineMeters}" />
                                    <TextBlock FontWeight="SemiBold" Text="Embedded Software Version:" />
                                    <TextBlock Text="{Binding DeviceInformation.Version}" />
                                    <TextBlock FontWeight="SemiBold" Text="FPGA Version:" />
                                    <TextBlock TextTrimming="CharacterEllipsis">
                                        <TextBlock.ToolTip>
                                            <TextBlock>
                                        <Run Text="{Binding DeviceInformation.FPGA1Version}"></Run> •
                                        <Run Text="{Binding DeviceInformation.FPGA2Version}"></Run> •
                                        <Run Text="{Binding DeviceInformation.FPGA3Version}"></Run>
                                            </TextBlock>
                                        </TextBlock.ToolTip>
                                        <Run Text="{Binding DeviceInformation.FPGA1Version}"></Run> •
                                        <Run Text="{Binding DeviceInformation.FPGA2Version}"></Run> •
                                        <Run Text="{Binding DeviceInformation.FPGA3Version}"></Run>
                                    </TextBlock>
                                    <TextBlock FontWeight="SemiBold" Text="Total Bytes Sent:" />
                                    <TextBlock Text="{Binding Adapter.TotalBytesSent,Converter={StaticResource ByteArrayToFileSizeConverter},Mode=OneWay}" />
                                    <TextBlock FontWeight="SemiBold" Text="Total Bytes Received:" />
                                    <TextBlock Text="{Binding Adapter.TotalBytesReceived,Converter={StaticResource ByteArrayToFileSizeConverter},Mode=OneWay}" />
                                    <TextBlock FontWeight="SemiBold" Text="Transfer Rate:" />
                                    <TextBlock>
                                        <Run Text="{Binding Adapter.TransferRate,Converter={StaticResource ByteArrayToFileSizeConverter},Mode=OneWay}"></Run>
                                        <Run Text="/ sec"></Run>
                                    </TextBlock>
                                    <TextBlock FontWeight="SemiBold" Text="Diagnostics Frame Rate:" />
                                    <TextBlock>
                                        <Run Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.DiagnosticsFrameProvider.FrameRate,Mode=OneWay,IsAsync=True}"></Run>
                                        <Run Text="/ sec"></Run>
                                    </TextBlock>
                                    <TextBlock FontWeight="SemiBold" Text="Enable Diagnostics:" />
                                    <ToggleButton IsChecked="{Binding EnableDiagnostics}" HorizontalAlignment="Left"></ToggleButton>
                                    <TextBlock FontWeight="SemiBold" Text="Enable Embedded Debug Logs:" />
                                    <ToggleButton IsChecked="{Binding EnableEmbeddedDebugging}" HorizontalAlignment="Left"></ToggleButton>
                                    <TextBlock FontWeight="SemiBold" Text="Enable KeepAlive:" />
                                    <ToggleButton IsChecked="{Binding UseKeepAlive}" HorizontalAlignment="Left"></ToggleButton>
                                    <TextBlock FontWeight="SemiBold" Text="Enable Events:" />
                                    <ToggleButton IsChecked="{Binding EnableEventsNotification}" HorizontalAlignment="Left"></ToggleButton>
                                </controls:TableGrid>
                            </DataTemplate>
                        </ContentControl.Resources>
                    </ContentControl>
                </Grid>

                <Grid Grid.Row="1" Grid.ColumnSpan="2">
                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Height="40" VerticalAlignment="Bottom">

                    </StackPanel>
                </Grid>

                <Grid Grid.Row="1" Grid.ColumnSpan="2">
                    <StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
                        <Button DockPanel.Dock="Bottom" Height="40" Width="170" Command="{Binding UploadHardwareConfigurationCommand}" ToolTip="Upload the current hardware configuration stored for this machine">UPLOAD HW CONFIG</Button>
                        <Button DockPanel.Dock="Bottom" Height="40" Width="140" Command="{Binding DisconnectCommand}" Margin="10 0 0 0">DISCONNECT</Button>
                    </StackPanel>
                </Grid>

                <Grid Grid.Column="1">
                    <DockPanel>
                        <StackPanel>
                            <Button FontSize="11" Height="40" Width="140" Command="{Binding ResetCommand}" Background="Transparent" BorderBrush="{StaticResource DarkGrayBrush}" Foreground="{StaticResource DarkGrayBrush}" Margin="0 2" ToolTip="Reset the embedded device">RESET</Button>
                            <Button FontSize="11" Height="40" Width="140" Command="{Binding TurnOffHeatersCommand}" Background="Transparent" BorderBrush="{StaticResource DarkGrayBrush}" Foreground="{StaticResource DarkGrayBrush}" Margin="0 2" ToolTip="Resets the current process parameters in the embedded device">
                                <TextBlock TextWrapping="Wrap" TextAlignment="Center">
                                TURN OFF HEATERS
                                </TextBlock>
                            </Button>
                        </StackPanel>
                    </DockPanel>
                </Grid>
            </Grid>
        </Grid>
    </Grid>
</UserControl>
1, &g_pui32ADCData[bufferFlipFlop][16]); // // Release adc result semaphore // //the ADC Process task is mot currently active. the results will be copied to a second buffer and supplied upon request //Semaphore_post(adcResultSem); } //***************************************************************************** // //***************************************************************************** Void ADCProcessTask(UArg arg0, UArg arg1) { while(1) { // // Wait until new ADC data is available // Semaphore_pend(adcResultSem, BIOS_WAIT_FOREVER); // // Process the ADC data // if (processCallBack != NULL) { processCallBack(g_pui32ADCData[bufferFlipFlop]); } } } void ADCAcquireInit(void) // (called by MillisecInit) { uint32_t ui32Chan, ui32Base, ui32Seq; #ifndef EVALUATION_BOARD //Avaraging 8 //TODO //MAP_ADCHardwareOversampleConfigure(ADC0_BASE, 8); //MAP_ADCHardwareOversampleConfigure(ADC1_BASE, 8); // // Initialize both ADC peripherals using sequencer 0 and processor trigger. // MAP_ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_PROCESSOR, 0); MAP_ADCSequenceConfigure(ADC1_BASE, 0, ADC_TRIGGER_PROCESSOR, 0); MAP_ADCSequenceConfigure(ADC0_BASE, 1, ADC_TRIGGER_PROCESSOR, 1); //sequencer 1 ADCSequenceDisable(ADC0_BASE, 1); // // Enter loop to configure all of the ADC sequencer steps needed to // acquire the data for the data logger. Multiple ADC and sequencers // will be used in order to acquire all the channels. // for(ui32Chan = 0; ui32Chan < ADC_MAX_ADC_DEVICES; ui32Chan++) { // // If this is the first ADC then set the base for ADC0 // if(ui32Chan < 8) { ui32Base = ADC0_BASE; ui32Seq = 0; } else if(ui32Chan < 16) { // // Second ADC, set the base for ADC1 // ui32Base = ADC1_BASE; ui32Seq = 0; } else { ui32Base = ADC0_BASE; ui32Seq = 1; } // // Get the channel control for each channel. Test to see if it is the // last channel for the sequencer, and if so then also set the // interrupt and "end" flags. // uint32_t ui32ChCtl = g_pui32ADCSeq[ui32Chan]; //TODO define all the numbers under #define and not here if((ui32Chan == 7) || (ui32Chan == 15) || (ui32Chan == (ADC_MAX_ADC_DEVICES - 1))) { ui32ChCtl |= ADC_CTL_IE | ADC_CTL_END; } // // Configure the sequence step // MAP_ADCSequenceStepConfigure(ui32Base, ui32Seq, ui32Chan % 8, ui32ChCtl); } ADCSequenceEnable(ADC0_BASE, 1); ADCReferenceSet(ADC0_BASE, ADC_REF_EXT_3V); ADCReferenceSet(ADC1_BASE, ADC_REF_EXT_3V); //VOCAlarmsInit(); if (!isInitialized) { // Create a periodic Clock Instance with _period - triggers the ADC sampling isInitialized = true; //InitI2C(); } #endif } //***************************************************************************** // // This function is called to start an acquisition running. It determines // which channels are to be logged, enables the ADC/I2C sequencers. // This will start the acquisition running. // //***************************************************************************** void ADCAcquireStart(ProcessCallback _callback, uint32_t _period) // (called by MillisecStart) { #ifndef EVALUATION_BOARD // // Enable the ADC sequencers // MAP_ADCSequenceEnable(ADC0_BASE, 0); MAP_ADCSequenceEnable(ADC1_BASE, 0); MAP_ADCSequenceEnable(ADC0_BASE, 1); // // Flush the ADC sequencers to be sure there is no lingering/ trush data. // MAP_ADCSequenceDataGet(ADC0_BASE, 0, g_pui32ADCData[0]); MAP_ADCSequenceDataGet(ADC1_BASE, 0, g_pui32ADCData[0]); MAP_ADCSequenceDataGet(ADC1_BASE, 1, g_pui32ADCData[0]); // // Enable ADC interrupts // MAP_ADCIntClear(ADC0_BASE, 0); MAP_ADCIntClear(ADC1_BASE, 0); MAP_ADCIntEnable(ADC0_BASE, 0); MAP_ADCIntEnable(ADC0_BASE, 1); //ROM_IntEnable(INT_ADC0SS0); // Store process processCallBack = _callback; // Start a periodic Clock Instance with _period - triggers the ADC sampling adcCollectActive = true; // // Logging data should now start running // #endif } //***************************************************************************** // // This function is called to stop an acquisition running. It disables the // ADC sequencers. // //***************************************************************************** void ADCAcquireStop(void) { //Stop trigger adc sampling adcCollectActive = false; // // Disable ADC interrupts // MAP_IntDisable(INT_ADC0SS0); MAP_IntDisable(INT_ADC1SS0); // // Disable ADC sequencers // MAP_ADCSequenceDisable(ADC0_BASE, 0); MAP_ADCSequenceDisable(ADC1_BASE, 0); MAP_ADCSequenceDisable(ADC0_BASE, 1); } double VPressure_0 = 0; double A_offset =-2.429, B_slope_coefficient = 0.267;//A - offset, B - slope coefficient /*double Calculate_Pitot_Pressure(bool flow ) // WHS - AN_AIRPRESS_1 { //MPXV7002 (NXP) uint32_t VsampleInBits; double Pressure = 0.0, temp, /`*PKpa,PBar,*`/VADC = 0.0 ,VSensor/`*,PMicroBar*`/; VsampleInBits = ADC_GetReading(ADC_AIR_PRESSURE_1); //---- VBits -> VADC ---- //ADC 12 bit -> 4096 -> 2.5V temp = VsampleInBits*2.5; VADC = temp / 4096; //---- VADC -> VSensor --- //VADC = 1.96 - 10k( VSensor - 1.96) / 46.4k (from the electrical scheme) // VSensor = 0 V -> VADC = 2.3824 V // VSensor = 10 V -> VADC = 0.2272 V VSensor = (1.96- VADC) * 4.64 + 1.96; if(flow == false) { VPressure_0 = VSensor; return VPressure_0; } else { Pressure = A_offset + B_slope_coefficient * (sqrt(VSensor - VPressure_0)); /`* PKpa = 5 * VSensor; // ---- P[Kpa] -> BAR ---- PBar = PKpa / 100.0; PMicroBar = PBar/1000; Pressure = PMicroBar;*`/ return Pressure; } }*/ uint32_t Read_Dryer_Heaters_Current(HEATERS_CURRENT Heater_ID) // { /* * On Dryer have two heaters , 4*220w and 2*220w that work on 220Vac. Current transformer convert (thru resistor ) the Current of load to Voltage then convert from RMS to DC and connect to A2D pin of Tiva. A2D is 12 bits and his reference is 3.3V (VDDA) or 3V(VREFA+) (depend on s/w). I=A2D bits *K *VREF *N /(4096*R) Where : K= K factor of transformer (less than 1 ) VREF 3 or 3.3v depended of s/w N turns ratio (800 in our case ) Heater_No. Heater_SSR Resistor Power Current AIN# Heater_1 4 SSR_1 50 ohm 880W 8A 17 Heater_2 2 SSR_2 100 ohm 440W 4A 16 * */ uint32_t Status = OK; float temp = 0; float Vref = 3; // External 3V reference using - ADC_REF_EXT_3V float K = 95; //0.95; //See graph in data sheet of CTL-6 float N = 800; //See data sheet of CTL-6 float R; // if (Heaters_Current_Read_Enable[Heater_ID] == false) return ERROR; // Heaters_Current[Heater_ID] switch(Heater_ID) { case HEATER_DRYER_CURRENT_1: temp = ADC_GetReading(ADC_DRYER_CURRENT_1);//ADC_CTL_CH17 R = 50;//50 Ohm //Expected 8A break; case HEATER_DRYER_CURRENT_2: temp = ADC_GetReading(ADC_DRYER_CURRENT_2);//ADC_CTL_CH16 R = 100;//100 Ohm //Expected 4A break; // case DRYER_CURRENT_3: // temp = ADC_GetReading(ADC_DRYER_CURRENT_3);//Not in use // break; default: return ERROR; //break; } Heaters_Current_Bits[Heater_ID] = temp; Heaters_Current[Heater_ID] = (double)((temp * 100 / K * Vref * N) / (4096 * R));// [Amper] // ReportWithPackageFilter(HeatersFilter,"------------Heaters_Current-----------------", __FILE__,__LINE__,Heater_ID, RpMessage, Heaters_Current[Heater_ID]*10000, 0); return Status; } PowerControlFlag Power_Control_Flag; uint8_t Input_Voltage; void CheckAcInputVoltage() { //TODO Change to external Parameters uint8_t High_Voltage_Limit = 237;//for 264V AC - 10% uint8_t Low_Voltage_Limit = 204;//for 185 VAC + 10% //-------------------------------------------------- uint8_t Rt_Heaters_Zone1 = 60; //240||240||240||240 Ohm //uint8_t Rt_Heaters_Zone2 = 120;//240||240 Ohm Read_Heaters_Current(HEATER_DRYER_CURRENT_1); Input_Voltage = Heaters_Current[HEATER_DRYER_CURRENT_1] * Rt_Heaters_Zone1; if( (Input_Voltage) > High_Voltage_Limit ) { Power_Control_Flag = High_Voltage; } else if( (Input_Voltage) < Low_Voltage_Limit ) { Power_Control_Flag = Low_Voltage_Limit; } else { Power_Control_Flag = Normal_Voltage; } }