Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a283537d5e | ||
|
|
8d3773368e |
77
Datasheet.cs
77
Datasheet.cs
@@ -83,10 +83,23 @@ namespace Gidrolock_Modbus_Scanner
|
|||||||
|
|
||||||
for (int i = 0; i < device.wiredSensors; i++)
|
for (int i = 0; i < device.wiredSensors; i++)
|
||||||
{
|
{
|
||||||
WiredSensor ws = new WiredSensor(i) { Width = 495, Height = 24 };
|
WiredSensor ws = new WiredSensor(i,device) { Width = 495, Height = 24 };
|
||||||
sensorPanel.Controls.Add(ws);
|
sensorPanel.Controls.Add(ws);
|
||||||
ws.Visible = true;
|
ws.Visible = true;
|
||||||
|
|
||||||
|
if (device.modelName == "PRPLS1")
|
||||||
|
{
|
||||||
|
ws.wspPlusEntry = device.wspPlusMode[i];
|
||||||
|
ws.wspPlusCheckbox.CheckedChanged += (s, e) =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ushort value = ws.wspPlusCheckbox.Checked ? (ushort)0xFF00 : (ushort)0x0000;
|
||||||
|
SetEntry(ws.wspPlusEntry, value);
|
||||||
|
}
|
||||||
|
catch (Exception err) { MessageBox.Show(err.Message, "WSP+ toggle error"); }
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (device.hasScenarioSensor)
|
if (device.hasScenarioSensor)
|
||||||
{
|
{
|
||||||
@@ -197,20 +210,36 @@ namespace Gidrolock_Modbus_Scanner
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (device.wiredLineBreak != null || device.wiredLineBreak.Count > 0)
|
if (device.wspPlusMode != null)
|
||||||
{
|
if (device.wspPlusMode.Count > 0)
|
||||||
for (int i = 0; i < device.wiredLineBreak.Count; i++)
|
|
||||||
{
|
{
|
||||||
res = PollEntry(device.wiredLineBreak[i]);
|
for(int i = 0; i < device.wspPlusMode.Count; i++)
|
||||||
if (res)
|
|
||||||
{
|
{
|
||||||
bool value = latestMessage.Data[0] > 0x00 ? true : false;
|
res = PollEntry(device.wspPlusMode[i]);
|
||||||
WiredSensor snsr = sensorPanel.Controls[i] as WiredSensor;
|
if (res)
|
||||||
snsr.Invoke(new MethodInvoker(delegate { snsr.labelBreak.Text = value ? "Обрыв!" : "ОК"; }));
|
{
|
||||||
|
bool value = latestMessage.Data[0] > 0x00 ? true : false;
|
||||||
|
WiredSensor snsr = sensorPanel.Controls[i] as WiredSensor;
|
||||||
|
snsr.Invoke(new MethodInvoker(delegate { snsr.wspPlusCheckbox.Checked = value; }));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (device.wiredLineBreak != null)
|
||||||
|
if(device.wiredLineBreak.Count > 0)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < device.wiredLineBreak.Count; i++)
|
||||||
|
{
|
||||||
|
res = PollEntry(device.wiredLineBreak[i]);
|
||||||
|
if (res)
|
||||||
|
{
|
||||||
|
bool value = latestMessage.Data[0] > 0x00 ? true : false;
|
||||||
|
WiredSensor snsr = sensorPanel.Controls[i] as WiredSensor;
|
||||||
|
snsr.Invoke(new MethodInvoker(delegate { snsr.labelBreak.Text = value ? "Обрыв!" : "ОК"; }));
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
res = PollEntry(device.sensorAlarm);
|
res = PollEntry(device.sensorAlarm);
|
||||||
if (res)
|
if (res)
|
||||||
@@ -591,6 +620,8 @@ namespace Gidrolock_Modbus_Scanner
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region Sensor Classes
|
||||||
public class Sensor : FlowLayoutPanel
|
public class Sensor : FlowLayoutPanel
|
||||||
{
|
{
|
||||||
public Label labelName = new Label() { Width = 60, Height = 24 };
|
public Label labelName = new Label() { Width = 60, Height = 24 };
|
||||||
@@ -602,9 +633,10 @@ namespace Gidrolock_Modbus_Scanner
|
|||||||
public Label labelBreakFluff = new Label() { Width = 45, Height = 24 };
|
public Label labelBreakFluff = new Label() { Width = 45, Height = 24 };
|
||||||
public Label labelBreak = new Label() { Width = 55, Height = 24 }; // обрыв линии для WSP+
|
public Label labelBreak = new Label() { Width = 55, Height = 24 }; // обрыв линии для WSP+
|
||||||
|
|
||||||
//public Label labelWSPPlusFluff = new Label() { Width = 45, Height = 24 };
|
public Label labelWSPPlusFluff;
|
||||||
//public CheckBox wspPlusCheckbox = new CheckBox() { Width = 20, Height = 14 };
|
public CheckBox wspPlusCheckbox;
|
||||||
public WiredSensor(int count)
|
public Entry wspPlusEntry; // for WSP+ control
|
||||||
|
public WiredSensor(int count, Device device)
|
||||||
{
|
{
|
||||||
this.Margin = Padding.Empty;
|
this.Margin = Padding.Empty;
|
||||||
this.Padding = new Padding(0, 5, 0, 0);
|
this.Padding = new Padding(0, 5, 0, 0);
|
||||||
@@ -620,9 +652,6 @@ namespace Gidrolock_Modbus_Scanner
|
|||||||
this.Controls.Add(labelLeakFluff);
|
this.Controls.Add(labelLeakFluff);
|
||||||
this.Controls.Add(labelLeak);
|
this.Controls.Add(labelLeak);
|
||||||
|
|
||||||
//this.Controls.Add(labelWSPPlusFluff);
|
|
||||||
//this.Controls.Add(wspPlusCheckbox);
|
|
||||||
|
|
||||||
labelName.Text = "WSP " + (count + 1);
|
labelName.Text = "WSP " + (count + 1);
|
||||||
|
|
||||||
labelLeakFluff.Text = "Протечка:";
|
labelLeakFluff.Text = "Протечка:";
|
||||||
@@ -630,9 +659,16 @@ namespace Gidrolock_Modbus_Scanner
|
|||||||
|
|
||||||
labelBreakFluff.Text = "Обрыв:";
|
labelBreakFluff.Text = "Обрыв:";
|
||||||
labelBreak.Text = "неизвестно";
|
labelBreak.Text = "неизвестно";
|
||||||
|
if (device.wspPlusMode != null)
|
||||||
|
if (device.wspPlusMode.Count > 0)
|
||||||
|
{
|
||||||
|
labelWSPPlusFluff = new Label() { Width = 45, Height = 24, Text = "WSP+:" };
|
||||||
|
wspPlusCheckbox = new CheckBox() { Width = 20, Height = 14, Margin = Padding.Empty };
|
||||||
|
|
||||||
|
this.Controls.Add(labelWSPPlusFluff);
|
||||||
|
this.Controls.Add(wspPlusCheckbox);
|
||||||
|
}
|
||||||
|
|
||||||
//labelWSPPlusFluff.Text = "WSP+:";
|
|
||||||
//wspPlusCheckbox.Margin = Padding.Empty;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -686,4 +722,5 @@ namespace Gidrolock_Modbus_Scanner
|
|||||||
labelLeak.Text = "неизвестно";
|
labelLeak.Text = "неизвестно";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
10
Main.cs
10
Main.cs
@@ -376,6 +376,16 @@ namespace Gidrolock_Modbus_Scanner
|
|||||||
d.wiredSensors = 7;
|
d.wiredSensors = 7;
|
||||||
d.hasScenarioSensor = true;
|
d.hasScenarioSensor = true;
|
||||||
d.sensorAlarm = new Entry(RegisterType.Discrete, 1343, 29);
|
d.sensorAlarm = new Entry(RegisterType.Discrete, 1343, 29);
|
||||||
|
d.wspPlusMode = new List<Entry>()
|
||||||
|
{
|
||||||
|
new Entry(RegisterType.Coil, 1041),
|
||||||
|
new Entry(RegisterType.Coil, 1042),
|
||||||
|
new Entry(RegisterType.Coil, 1043),
|
||||||
|
new Entry(RegisterType.Coil, 1044),
|
||||||
|
new Entry(RegisterType.Coil, 1045),
|
||||||
|
new Entry(RegisterType.Coil, 1046),
|
||||||
|
new Entry(RegisterType.Coil, 1047),
|
||||||
|
};
|
||||||
d.wiredLineBreak = new List<Entry>()
|
d.wiredLineBreak = new List<Entry>()
|
||||||
{
|
{
|
||||||
new Entry(RegisterType.Discrete, 1025),
|
new Entry(RegisterType.Discrete, 1025),
|
||||||
|
|||||||
3
Model.cs
3
Model.cs
@@ -25,8 +25,9 @@ namespace Gidrolock_Modbus_Scanner
|
|||||||
public bool hasScenarioSensor;
|
public bool hasScenarioSensor;
|
||||||
public Entry sensorAlarm;
|
public Entry sensorAlarm;
|
||||||
|
|
||||||
|
public List<Entry> wspPlusMode; // Premium Plus only for now
|
||||||
public List<Entry> wiredLineBreak;
|
public List<Entry> wiredLineBreak;
|
||||||
|
|
||||||
public Entry radioStatus;
|
public Entry radioStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,6 @@ using System.Runtime.InteropServices;
|
|||||||
// Build Number
|
// Build Number
|
||||||
// Revision
|
// Revision
|
||||||
//
|
//
|
||||||
[assembly: AssemblyVersion("0.9.5.0")]
|
[assembly: AssemblyVersion("1.1.1.0")]
|
||||||
[assembly: AssemblyFileVersion("0.9.5.0")]
|
[assembly: AssemblyFileVersion("1.1.1.0")]
|
||||||
[assembly: NeutralResourcesLanguage("en")]
|
[assembly: NeutralResourcesLanguage("en")]
|
||||||
|
|||||||
Reference in New Issue
Block a user