Skip to content

Commit 0984c48

Browse files
committed
v2.40
- Added enum types for coils and discrete inputs - Fixed minor bugs and translations
1 parent 0253519 commit 0984c48

11 files changed

Lines changed: 284 additions & 139 deletions

ModBus_Client/Config/SettingsToSave.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,12 @@
6565
"menuItems": {
6666
"viewTabCoilsRegisters": {},
6767
"viewTabCoilsValues": {},
68+
"viewTabCoilsConvertedValues": {},
6869
"viewTabCoilsNotes": {},
6970

7071
"viewTabInputsRegisters": {},
7172
"viewTabInputsValues": {},
73+
"viewTabInputsConvertedValues": {},
7274
"viewTabInputsNotes": {},
7375

7476
"viewTabInputRegistersRegisters": {},

ModBus_Client/DatabaseManager.xaml

Lines changed: 120 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,128 @@
77
mc:Ignorable="d"
88
Title="DatabaseManager" Height="462" Width="417.127" Loaded="Window_Loaded" KeyUp="Window_KeyUp" Closing="Window_Closing">
99
<Grid>
10-
<Button x:Name="ButtonExportZip" Content="Export .mbp/.zip" Margin="0,0,11,10" Click="ButtonExportZip_Click" Height="25" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="100" IsEnabled="False"/>
11-
<Button x:Name="ButtonImportZip" Content="Import .mbp/.zip" Margin="0,0,116,10" Click="ButtonImportZip_Click" Height="25" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="100" IsEnabled="True"/>
12-
<Button x:Name="buttonOpenFileLocation" Content="Open directory" HorizontalAlignment="Left" Margin="10,0,0,10" Width="104" Click="ButtonOpenFileLocation_Click" Height="25" VerticalAlignment="Bottom"/>
10+
<Button x:Name="ButtonExportZip" Margin="0,0,11,10" Click="ButtonExportZip_Click" Height="25" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="85" IsEnabled="False">
11+
<StackPanel Orientation="Horizontal">
12+
<Viewbox Width="16 " Height="16" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:System="clr-namespace:System;assembly=mscorlib">
13+
<Rectangle Width="16 " Height="16">
14+
<Rectangle.Resources>
15+
<SolidColorBrush x:Key="canvas" Opacity="0" />
16+
<SolidColorBrush x:Key="light-defaultgrey-10" Color="#212121" Opacity="0.1" />
17+
<SolidColorBrush x:Key="light-defaultgrey" Color="#212121" Opacity="1" />
18+
<SolidColorBrush x:Key="light-blue" Color="#005dba" Opacity="1" />
19+
</Rectangle.Resources>
20+
<Rectangle.Fill>
21+
<DrawingBrush Stretch="None">
22+
<DrawingBrush.Drawing>
23+
<DrawingGroup>
24+
<DrawingGroup>
25+
<GeometryDrawing Brush="{DynamicResource canvas}" Geometry="F1M16,16H0V0H16Z" />
26+
</DrawingGroup>
27+
<DrawingGroup>
28+
<GeometryDrawing Brush="{DynamicResource light-defaultgrey-10}" Geometry="F1M12,6.5l-.11-.27L13.3,4.11,11.89,2.7,9.77,4.11,9.5,4,9,1.5H7L6.5,4l-.27.11L4.11,2.7,2.7,4.11,4.11,6.23,4,6.5,1.5,7V9L4,9.5l.11.27L2.7,11.89,4.11,13.3l2.12-1.41L6.5,12,7,14.5H9l.1-.5H7V11h3.88l-.65-.65,2.12-2.12,1,1L14,9.1V9h.5V7ZM5.55,7.97a2.475,2.475,0,1,1,2.48,2.48A2.477,2.477,0,0,1,5.55,7.97Z" />
29+
<GeometryDrawing Brush="{DynamicResource light-defaultgrey}" Geometry="F1M8,5a3,3,0,1,0,3,3A3.009,3.009,0,0,0,8,5Zm0,5a2,2,0,1,1,2-2A2.006,2.006,0,0,1,8,10Zm7-3.41V9H14v.61l-.23.04-.42-.42-.43-.43L14,8.59V7.41l-2.36-.47-.32-.76,1.34-2.01-.83-.83L9.82,4.68l-.76-.32L8.59,2H7.41L6.94,4.36l-.76.32L4.17,3.34l-.83.83L4.68,6.18l-.32.76L2,7.41V8.59l2.36.47.32.76L3.34,11.83l.83.83,2.01-1.34.76.32.06.3V14H9.61l-.2,1H6.59l-.48-2.43L4.05,13.95l-2-2L3.43,9.89,1,9.41V6.59l2.43-.48L2.05,4.05l2-2L6.11,3.43,6.59,1H9.41l.48,2.43,2.06-1.38,2,2L12.57,6.11Z" />
30+
<GeometryDrawing Brush="{DynamicResource light-blue}" Geometry="F1M12.354,9.646l2.5,2.5v.708l-2.5,2.5-.708-.708L13.293,13H8V12h5.293l-1.647-1.646ZM15,10v5h1V10Z" />
31+
</DrawingGroup>
32+
</DrawingGroup>
33+
</DrawingBrush.Drawing>
34+
</DrawingBrush>
35+
</Rectangle.Fill>
36+
</Rectangle>
37+
</Viewbox>
38+
<TextBlock Margin="5,0,0,0" Text="Export"></TextBlock>
39+
</StackPanel>
40+
</Button>
41+
<Button x:Name="ButtonImportZip" Margin="0,0,101,10" Click="ButtonImportZip_Click" Height="25" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="85" IsEnabled="True">
42+
<StackPanel Orientation="Horizontal">
43+
<Viewbox Width="16 " Height="16" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:System="clr-namespace:System;assembly=mscorlib">
44+
<Rectangle Width="16 " Height="16">
45+
<Rectangle.Resources>
46+
<SolidColorBrush x:Key="canvas" Opacity="0" />
47+
<SolidColorBrush x:Key="light-defaultgrey-10" Color="#212121" Opacity="0.1" />
48+
<SolidColorBrush x:Key="light-defaultgrey" Color="#212121" Opacity="1" />
49+
<SolidColorBrush x:Key="light-blue" Color="#005dba" Opacity="1" />
50+
</Rectangle.Resources>
51+
<Rectangle.Fill>
52+
<DrawingBrush Stretch="None">
53+
<DrawingBrush.Drawing>
54+
<DrawingGroup>
55+
<DrawingGroup>
56+
<GeometryDrawing Brush="{DynamicResource canvas}" Geometry="F1M16,16H0V0H16Z" />
57+
</DrawingGroup>
58+
<DrawingGroup>
59+
<GeometryDrawing Brush="{DynamicResource light-defaultgrey-10}" Geometry="F1M14.5,9V7L12,6.5l-.11-.27L13.3,4.11,11.89,2.7,9.77,4.11,9.5,4,9,1.5H7L6.77,2.68l.42.42.66.66V5.3l-.24.24a1.992,1.992,0,0,1,.42-.04A2.475,2.475,0,1,1,5.55,7.97a2.6,2.6,0,0,1,.03-.4l-.57.57-.66.66L2.8,7.25l-.42-.42L1.5,7V9L4,9.5l.11.27L2.7,11.89,4.11,13.3l2.12-1.41L6.5,12,7,14.5H9L9.5,12l.27-.11,2.12,1.41,1.41-1.41L11.89,9.77,12,9.5Z" />
60+
<GeometryDrawing Brush="{DynamicResource light-defaultgrey}" Geometry="F1M8,5a.757.757,0,0,0-.15.01V5.3l-.24.24L5.58,7.57l-.57.57A3,3,0,1,0,8,5ZM8,6A2,2,0,1,1,6,8,2.006,2.006,0,0,1,8,6Zm7,.59-2.43-.48,1.38-2.06-2-2L9.89,3.43,9.41,1H6.59L6.34,2.25l.85.85L7.41,2H8.59l.47,2.36.76.32,2.01-1.34.83.83L11.32,6.18l.32.76L14,7.41V8.59l-2.36.47-.32.76,1.34,2.01-.83.83L9.82,11.32l-.76.32L8.59,14H7.41l-.47-2.36-.76-.32L4.17,12.66l-.83-.83L4.68,9.82l-.32-.76L2,8.59V7.41l.8-.16-.42-.42-.15-.15.41-.41L1,6.59V9.41l2.43.48L2.05,11.95l2,2,2.06-1.38L6.59,15H9.41l.48-2.43,2.06,1.38,2-2L12.57,9.89,15,9.41ZM8,11A3,3,0,0,0,8,5a.757.757,0,0,0-.15.01V5.3l-.24.24L5.58,7.57l-.57.57A3,3,0,0,0,8,11ZM8,6A2,2,0,1,1,6,8,2.006,2.006,0,0,1,8,6ZM8,5a.757.757,0,0,0-.15.01V5.3l-.24.24L5.58,7.57l-.57.57A3,3,0,1,0,8,5ZM8,6A2,2,0,1,1,6,8,2.006,2.006,0,0,1,8,6Z" />
61+
<GeometryDrawing Brush="{DynamicResource light-blue}" Geometry="F1M2.5,0H3V1H2.5a1.5,1.5,0,0,0,0,3H5.258L3.644,2.385l.707-.707,2.5,2.5v.707l-2.5,2.5-.707-.707L5.322,5H2.5a2.5,2.5,0,0,1,0-5Z" />
62+
</DrawingGroup>
63+
</DrawingGroup>
64+
</DrawingBrush.Drawing>
65+
</DrawingBrush>
66+
</Rectangle.Fill>
67+
</Rectangle>
68+
</Viewbox>
69+
<TextBlock Margin="5,0,0,0" Text="Import"></TextBlock>
70+
</StackPanel>
71+
</Button>
72+
<Button x:Name="buttonOpenFileLocation" HorizontalAlignment="Left" Margin="10,0,0,10" Width="118" Click="ButtonOpenFileLocation_Click" Height="25" VerticalAlignment="Bottom">
73+
<StackPanel Orientation="Horizontal">
74+
<Viewbox Width="16 " Height="16" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:System="clr-namespace:System;assembly=mscorlib">
75+
<Rectangle Width="16 " Height="16">
76+
<Rectangle.Resources>
77+
<SolidColorBrush x:Key="canvas" Opacity="0" />
78+
<SolidColorBrush x:Key="light-yellow-10" Color="#996f00" Opacity="0.1" />
79+
<SolidColorBrush x:Key="light-yellow" Color="#996f00" Opacity="1" />
80+
</Rectangle.Resources>
81+
<Rectangle.Fill>
82+
<DrawingBrush Stretch="None">
83+
<DrawingBrush.Drawing>
84+
<DrawingGroup>
85+
<DrawingGroup x:Name="canvas">
86+
<GeometryDrawing Brush="{DynamicResource canvas}" Geometry="F1M16,16H0V0H16Z" />
87+
</DrawingGroup>
88+
<DrawingGroup x:Name="level_1">
89+
<GeometryDrawing Brush="{DynamicResource light-yellow-10}" Geometry="F1M14.5,3.5v9H1.5V2.5h6l1,1Z" />
90+
<GeometryDrawing Brush="{DynamicResource light-yellow}" Geometry="F1M14.5,3H8.707l-.853-.854L7.5,2h-6L1,2.5v10l.5.5h13l.5-.5v-9ZM7.293,3l.488.488L7.268,4H2V3ZM14,12H2V5H7.475l.354-.146L8.682,4H14Z" />
91+
</DrawingGroup>
92+
</DrawingGroup>
93+
</DrawingBrush.Drawing>
94+
</DrawingBrush>
95+
</Rectangle.Fill>
96+
</Rectangle>
97+
</Viewbox>
98+
<TextBlock Margin="5,0,0,0" Text="Open directory"></TextBlock>
99+
</StackPanel>
100+
</Button>
13101
<Button x:Name="ButtonRefresh" Content="Refresh" HorizontalAlignment="Left" Margin="119,0,0,10" Width="75" Click="ButtonRefresh_Click" Height="21" VerticalAlignment="Bottom" Visibility="Hidden"/>
14102
<Label x:Name="labelProfileSelected" Content="Profile" HorizontalAlignment="Left" Margin="10,0,0,35" Height="32" VerticalAlignment="Bottom" Visibility="Visible" FontSize="14"/>
15-
<Button x:Name="ButtonDeleteProfile" Content="Delete" Margin="0,0,11,42" Height="25" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="72" IsEnabled="False" Click="ButtonDeleteProfile_Click"/>
103+
<Button x:Name="ButtonDeleteProfile" Margin="0,0,11,42" Height="25" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="85" IsEnabled="False" Click="ButtonDeleteProfile_Click">
104+
<StackPanel Orientation="Horizontal">
105+
<Viewbox Width="16 " Height="16" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:System="clr-namespace:System;assembly=mscorlib">
106+
<Rectangle Width="16 " Height="16">
107+
<Rectangle.Resources>
108+
<SolidColorBrush x:Key="canvas2" Opacity="0" />
109+
<SolidColorBrush x:Key="light-defaultgrey-10" Color="#212121" Opacity="0.1" />
110+
<SolidColorBrush x:Key="light-defaultgrey" Color="#212121" Opacity="1" />
111+
</Rectangle.Resources>
112+
<Rectangle.Fill>
113+
<DrawingBrush Stretch="None">
114+
<DrawingBrush.Drawing>
115+
<DrawingGroup>
116+
<DrawingGroup x:Name="canvas2">
117+
<GeometryDrawing Brush="{DynamicResource canvas2}" Geometry="F1M16,16H0V0H16Z" />
118+
</DrawingGroup>
119+
<DrawingGroup x:Name="level_12">
120+
<GeometryDrawing Brush="{DynamicResource light-defaultgrey-10}" Geometry="F1M12.5,2.5v13H2.5V2.5Z" />
121+
<GeometryDrawing Brush="{DynamicResource light-defaultgrey}" Geometry="F1M14,2H10V1A1,1,0,0,0,9,0H6A1,1,0,0,0,5,1V2H1V3H2V15.5l.5.5h10l.5-.5V3h1ZM6,1H9V2H6Zm6,14H3V3h9ZM5,13V5H6v8Zm5,0H9V5h1ZM8,13H7V5H8Z" />
122+
</DrawingGroup>
123+
</DrawingGroup>
124+
</DrawingBrush.Drawing>
125+
</DrawingBrush>
126+
</Rectangle.Fill>
127+
</Rectangle>
128+
</Viewbox>
129+
<TextBlock Margin="5,0,0,0" Text="Delete"></TextBlock>
130+
</StackPanel>
131+
</Button>
16132
<ListBox x:Name="ListBoxProfiles" d:ItemsSource="{d:SampleData ItemCount=5}" Margin="10,10,10,72" SelectionChanged="ListBoxProfiles_SelectionChanged" FontSize="14"/>
17133

18134
</Grid>

ModBus_Client/Lang/Mappings_EN.info

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
-----------------------------------------------------------------------
1818
- Enum: "E1:Idle;E2:Run;E3:Stop"
1919
-> Show different labels according to register value (enum datatype)
20+
-> Enum is also available for coils and discrete inputs
2021
-----------------------------------------------------------------------
2122

2223
32 bit values uses two word in big endian format, the current one and the previous register:
@@ -45,7 +46,7 @@
4546
-> Show the value converted as unsigned integer 64
4647
-----------------------------------------------------------------------
4748

48-
Altri formati:
49+
Other datatypes:
4950

5051
-----------------------------------------------------------------------
5152
- String(len): "String(8):Model"

ModBus_Client/Lang/Mappings_IT.info

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Nella colonna mappings è possibile inserite alcune informazioni sul tipo di ris
1919
-----------------------------------------------------------------------
2020
- Enum: "E1:Idle;E2:Run;E3:Stop"
2121
-> Mostra l'etichetta corrispondente al valore presente nel registro.
22+
-> Il tipo enum può essere usato anche coils e discrete inputs
2223
-----------------------------------------------------------------------
2324

2425
Le variabili seguenti a 32 bit (due word) utilizzano la word del registro precedente (High Word) e corrente (Low Word) a cui fa riferimento

ModBus_Client/ModBus_Chicco.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,13 @@ public void handleTxRxGui()
258258

259259
public void open()
260260
{
261-
if(type == def.TYPE_TCP_SOCK)
261+
if (type == def.TYPE_TCP_SOCK)
262262
client = new TcpClient(ip_address, int.Parse(port));
263+
if (type == def.TYPE_TCP_REOPEN)
264+
{
265+
client = new TcpClient(ip_address, int.Parse(port));
266+
client.Close();
267+
}
263268
if (type == def.TYPE_TCP_SECURE)
264269
{
265270
System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;

0 commit comments

Comments
 (0)