1 Commits

Author SHA1 Message Date
nikzori
8d3773368e added WSP+ checkboxes for Premium Plus Wi-Fi 2025-06-24 10:09:11 +03:00
4 changed files with 58 additions and 13 deletions

View File

@@ -83,10 +83,23 @@ namespace Gidrolock_Modbus_Scanner
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);
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)
{
@@ -197,6 +210,20 @@ namespace Gidrolock_Modbus_Scanner
}
}
if (device.wspPlusMode != null || device.wspPlusMode.Count > 0)
{
for(int i = 0; i < device.wspPlusMode.Count; i++)
{
res = PollEntry(device.wspPlusMode[i]);
if (res)
{
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 || device.wiredLineBreak.Count > 0)
{
for (int i = 0; i < device.wiredLineBreak.Count; i++)
@@ -591,6 +618,8 @@ namespace Gidrolock_Modbus_Scanner
}
}
#region Sensor Classes
public class Sensor : FlowLayoutPanel
{
public Label labelName = new Label() { Width = 60, Height = 24 };
@@ -602,9 +631,10 @@ namespace Gidrolock_Modbus_Scanner
public Label labelBreakFluff = new Label() { Width = 45, Height = 24 };
public Label labelBreak = new Label() { Width = 55, Height = 24 }; // обрыв линии для WSP+
//public Label labelWSPPlusFluff = new Label() { Width = 45, Height = 24 };
//public CheckBox wspPlusCheckbox = new CheckBox() { Width = 20, Height = 14 };
public WiredSensor(int count)
public Label labelWSPPlusFluff;
public CheckBox wspPlusCheckbox;
public Entry wspPlusEntry; // for WSP+ control
public WiredSensor(int count, Device device)
{
this.Margin = Padding.Empty;
this.Padding = new Padding(0, 5, 0, 0);
@@ -620,9 +650,6 @@ namespace Gidrolock_Modbus_Scanner
this.Controls.Add(labelLeakFluff);
this.Controls.Add(labelLeak);
//this.Controls.Add(labelWSPPlusFluff);
//this.Controls.Add(wspPlusCheckbox);
labelName.Text = "WSP " + (count + 1);
labelLeakFluff.Text = "Протечка:";
@@ -630,9 +657,15 @@ namespace Gidrolock_Modbus_Scanner
labelBreakFluff.Text = "Обрыв:";
labelBreak.Text = "неизвестно";
if (device.wspPlusMode != null || 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 +719,5 @@ namespace Gidrolock_Modbus_Scanner
labelLeak.Text = "неизвестно";
}
}
}
}
#endregion

10
Main.cs
View File

@@ -376,6 +376,16 @@ namespace Gidrolock_Modbus_Scanner
d.wiredSensors = 7;
d.hasScenarioSensor = true;
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>()
{
new Entry(RegisterType.Discrete, 1025),

View File

@@ -25,8 +25,9 @@ namespace Gidrolock_Modbus_Scanner
public bool hasScenarioSensor;
public Entry sensorAlarm;
public List<Entry> wspPlusMode; // Premium Plus only for now
public List<Entry> wiredLineBreak;
public Entry radioStatus;
}

View File

@@ -30,6 +30,6 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("0.9.5.0")]
[assembly: AssemblyFileVersion("0.9.5.0")]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: NeutralResourcesLanguage("en")]