removed device selection in favour of auto-detection

This commit is contained in:
nikzori
2025-01-27 11:23:57 +03:00
parent 0012d3e8a1
commit 6514007cdb
5 changed files with 117 additions and 174 deletions

65
Datasheet.Designer.cs generated
View File

@@ -30,6 +30,9 @@
{ {
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Datasheet)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Datasheet));
this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.GroupBox();
this.cBoxSpeed = new System.Windows.Forms.ComboBox();
this.buttonSetSpeed = new System.Windows.Forms.Button();
this.label8 = new System.Windows.Forms.Label();
this.labelBattery = new System.Windows.Forms.Label(); this.labelBattery = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label(); this.label6 = new System.Windows.Forms.Label();
this.buttonPoll = new System.Windows.Forms.Button(); this.buttonPoll = new System.Windows.Forms.Button();
@@ -52,9 +55,6 @@
this.label4 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label();
this.sensorPanel = new System.Windows.Forms.FlowLayoutPanel(); this.sensorPanel = new System.Windows.Forms.FlowLayoutPanel();
this.label9 = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.label8 = new System.Windows.Forms.Label();
this.cBoxSpeed = new System.Windows.Forms.ComboBox();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nudModbusID)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nudModbusID)).BeginInit();
this.groupBox2.SuspendLayout(); this.groupBox2.SuspendLayout();
@@ -63,7 +63,7 @@
// groupBox1 // groupBox1
// //
this.groupBox1.Controls.Add(this.cBoxSpeed); this.groupBox1.Controls.Add(this.cBoxSpeed);
this.groupBox1.Controls.Add(this.button1); this.groupBox1.Controls.Add(this.buttonSetSpeed);
this.groupBox1.Controls.Add(this.label8); this.groupBox1.Controls.Add(this.label8);
this.groupBox1.Controls.Add(this.labelBattery); this.groupBox1.Controls.Add(this.labelBattery);
this.groupBox1.Controls.Add(this.label6); this.groupBox1.Controls.Add(this.label6);
@@ -82,6 +82,34 @@
this.groupBox1.TabStop = false; this.groupBox1.TabStop = false;
this.groupBox1.Text = "Инфо"; this.groupBox1.Text = "Инфо";
// //
// cBoxSpeed
//
this.cBoxSpeed.FormattingEnabled = true;
this.cBoxSpeed.Location = new System.Drawing.Point(74, 97);
this.cBoxSpeed.Name = "cBoxSpeed";
this.cBoxSpeed.Size = new System.Drawing.Size(73, 21);
this.cBoxSpeed.TabIndex = 13;
this.cBoxSpeed.Text = "9600";
//
// buttonSetSpeed
//
this.buttonSetSpeed.Location = new System.Drawing.Point(153, 94);
this.buttonSetSpeed.Name = "buttonSetSpeed";
this.buttonSetSpeed.Size = new System.Drawing.Size(75, 23);
this.buttonSetSpeed.TabIndex = 12;
this.buttonSetSpeed.Text = "Изменить";
this.buttonSetSpeed.UseVisualStyleBackColor = true;
this.buttonSetSpeed.Click += new System.EventHandler(this.buttonSetSpeed_Click);
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(6, 99);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(58, 13);
this.label8.TabIndex = 10;
this.label8.Text = "Скорость:";
//
// labelBattery // labelBattery
// //
this.labelBattery.AutoSize = true; this.labelBattery.AutoSize = true;
@@ -297,33 +325,6 @@
this.label9.TabIndex = 5; this.label9.TabIndex = 5;
this.label9.Text = "Датчики"; this.label9.Text = "Датчики";
// //
// button1
//
this.button1.Location = new System.Drawing.Point(153, 94);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 12;
this.button1.Text = "Изменить";
this.button1.UseVisualStyleBackColor = true;
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(6, 99);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(58, 13);
this.label8.TabIndex = 10;
this.label8.Text = "Скорость:";
//
// cBoxSpeed
//
this.cBoxSpeed.FormattingEnabled = true;
this.cBoxSpeed.Location = new System.Drawing.Point(74, 97);
this.cBoxSpeed.Name = "cBoxSpeed";
this.cBoxSpeed.Size = new System.Drawing.Size(73, 21);
this.cBoxSpeed.TabIndex = 13;
this.cBoxSpeed.Text = "9600";
//
// Datasheet // Datasheet
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -373,7 +374,7 @@
private System.Windows.Forms.Label label9; private System.Windows.Forms.Label label9;
private System.Windows.Forms.Label label6; private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label labelBattery; private System.Windows.Forms.Label labelBattery;
private System.Windows.Forms.Button button1; private System.Windows.Forms.Button buttonSetSpeed;
private System.Windows.Forms.Label label8; private System.Windows.Forms.Label label8;
private System.Windows.Forms.ComboBox cBoxSpeed; private System.Windows.Forms.ComboBox cBoxSpeed;
} }

View File

@@ -346,6 +346,38 @@ namespace Gidrolock_Modbus_Scanner
buttonCleaning.Text = cleaningStatus ? "Выключить" : "Включить"; buttonCleaning.Text = cleaningStatus ? "Выключить" : "Включить";
} }
} }
private async void buttonSetSpeed_Click(object sender, EventArgs e)
{
try
{
string str = cBoxSpeed.Items[cBoxSpeed.SelectedIndex].ToString();
str = str.Substring(0, str.Length - 2); //clip off two zeroes at the end
ushort newSpeed = (ushort)Int16.Parse(str);
//Console.WriteLine("Baudrate: " + newSpeed);
// send speed value to device
// await for response
Modbus.WriteSingleAsync(FunctionCode.WriteRegister, modbusID, device.baudRate.address, newSpeed);
await Task.Delay(2000).ContinueWith(_ =>
{
if (isAwaitingResponse)
{
MessageBox.Show("Превышено время ожидания ответа от устройства.");
isAwaitingResponse = false;
}
return false;
});
while (isAwaitingResponse) { continue; }
if (latestMessage.Status != ModbusStatus.Error)
{
port.Close();
port.BaudRate = newSpeed;
port.Open();
}
}
catch (Exception ex) { MessageBox.Show(ex.Message); }
}
} }
public class Sensor : FlowLayoutPanel public class Sensor : FlowLayoutPanel
{ {

72
Main.Designer.cs generated
View File

@@ -30,17 +30,14 @@
{ {
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(App)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(App));
this.TextBox_Log = new System.Windows.Forms.TextBox(); this.TextBox_Log = new System.Windows.Forms.TextBox();
this.UpDown_ModbusID = new System.Windows.Forms.NumericUpDown(); this.upDownModbusID = new System.Windows.Forms.NumericUpDown();
this.label2 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label();
this.cBoxPorts = new System.Windows.Forms.ComboBox(); this.cBoxPorts = new System.Windows.Forms.ComboBox();
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button(); this.button1 = new System.Windows.Forms.Button();
this.cBoxDevice = new System.Windows.Forms.ComboBox();
this.label3 = new System.Windows.Forms.Label();
this.checkboxID = new System.Windows.Forms.CheckBox();
this.cBoxSpeed = new System.Windows.Forms.ComboBox(); this.cBoxSpeed = new System.Windows.Forms.ComboBox();
this.label4 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.UpDown_ModbusID)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.upDownModbusID)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
// TextBox_Log // TextBox_Log
@@ -53,17 +50,22 @@
this.TextBox_Log.Size = new System.Drawing.Size(498, 160); this.TextBox_Log.Size = new System.Drawing.Size(498, 160);
this.TextBox_Log.TabIndex = 1; this.TextBox_Log.TabIndex = 1;
// //
// UpDown_ModbusID // upDownModbusID
// //
this.UpDown_ModbusID.Location = new System.Drawing.Point(334, 26); this.upDownModbusID.Location = new System.Drawing.Point(164, 27);
this.UpDown_ModbusID.Name = "UpDown_ModbusID"; this.upDownModbusID.Name = "upDownModbusID";
this.UpDown_ModbusID.Size = new System.Drawing.Size(66, 20); this.upDownModbusID.Size = new System.Drawing.Size(66, 20);
this.UpDown_ModbusID.TabIndex = 1; this.upDownModbusID.TabIndex = 1;
this.upDownModbusID.Value = new decimal(new int[] {
30,
0,
0,
0});
// //
// label2 // label2
// //
this.label2.AutoSize = true; this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(331, 9); this.label2.Location = new System.Drawing.Point(161, 9);
this.label2.Name = "label2"; this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(59, 13); this.label2.Size = new System.Drawing.Size(59, 13);
this.label2.TabIndex = 0; this.label2.TabIndex = 0;
@@ -72,7 +74,7 @@
// cBoxPorts // cBoxPorts
// //
this.cBoxPorts.FormattingEnabled = true; this.cBoxPorts.FormattingEnabled = true;
this.cBoxPorts.Location = new System.Drawing.Point(139, 24); this.cBoxPorts.Location = new System.Drawing.Point(12, 26);
this.cBoxPorts.Name = "cBoxPorts"; this.cBoxPorts.Name = "cBoxPorts";
this.cBoxPorts.Size = new System.Drawing.Size(65, 21); this.cBoxPorts.Size = new System.Drawing.Size(65, 21);
this.cBoxPorts.TabIndex = 1; this.cBoxPorts.TabIndex = 1;
@@ -81,7 +83,7 @@
// label1 // label1
// //
this.label1.AutoSize = true; this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(136, 7); this.label1.Location = new System.Drawing.Point(9, 9);
this.label1.Name = "label1"; this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(32, 13); this.label1.Size = new System.Drawing.Size(32, 13);
this.label1.TabIndex = 0; this.label1.TabIndex = 0;
@@ -97,38 +99,10 @@
this.button1.UseVisualStyleBackColor = true; this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.ButtonConnect_Click); this.button1.Click += new System.EventHandler(this.ButtonConnect_Click);
// //
// cBoxDevice
//
this.cBoxDevice.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cBoxDevice.Location = new System.Drawing.Point(12, 24);
this.cBoxDevice.Name = "cBoxDevice";
this.cBoxDevice.Size = new System.Drawing.Size(121, 21);
this.cBoxDevice.TabIndex = 3;
this.cBoxDevice.SelectedIndexChanged += new System.EventHandler(this.cBoxDevice_SelectedIndexChanged);
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(9, 8);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(67, 13);
this.label3.TabIndex = 4;
this.label3.Text = "Устройство";
//
// checkboxID
//
this.checkboxID.AutoSize = true;
this.checkboxID.Location = new System.Drawing.Point(313, 29);
this.checkboxID.Name = "checkboxID";
this.checkboxID.Size = new System.Drawing.Size(15, 14);
this.checkboxID.TabIndex = 5;
this.checkboxID.UseVisualStyleBackColor = true;
this.checkboxID.CheckedChanged += new System.EventHandler(this.checkboxID_CheckedChanged);
//
// cBoxSpeed // cBoxSpeed
// //
this.cBoxSpeed.FormattingEnabled = true; this.cBoxSpeed.FormattingEnabled = true;
this.cBoxSpeed.Location = new System.Drawing.Point(210, 24); this.cBoxSpeed.Location = new System.Drawing.Point(83, 26);
this.cBoxSpeed.Name = "cBoxSpeed"; this.cBoxSpeed.Name = "cBoxSpeed";
this.cBoxSpeed.Size = new System.Drawing.Size(78, 21); this.cBoxSpeed.Size = new System.Drawing.Size(78, 21);
this.cBoxSpeed.TabIndex = 7; this.cBoxSpeed.TabIndex = 7;
@@ -137,7 +111,7 @@
// label4 // label4
// //
this.label4.AutoSize = true; this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(207, 7); this.label4.Location = new System.Drawing.Point(80, 9);
this.label4.Name = "label4"; this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(55, 13); this.label4.Size = new System.Drawing.Size(55, 13);
this.label4.TabIndex = 6; this.label4.TabIndex = 6;
@@ -150,13 +124,10 @@
this.ClientSize = new System.Drawing.Size(518, 226); this.ClientSize = new System.Drawing.Size(518, 226);
this.Controls.Add(this.cBoxSpeed); this.Controls.Add(this.cBoxSpeed);
this.Controls.Add(this.label4); this.Controls.Add(this.label4);
this.Controls.Add(this.checkboxID);
this.Controls.Add(this.label3);
this.Controls.Add(this.cBoxDevice);
this.Controls.Add(this.button1); this.Controls.Add(this.button1);
this.Controls.Add(this.cBoxPorts); this.Controls.Add(this.cBoxPorts);
this.Controls.Add(this.label1); this.Controls.Add(this.label1);
this.Controls.Add(this.UpDown_ModbusID); this.Controls.Add(this.upDownModbusID);
this.Controls.Add(this.TextBox_Log); this.Controls.Add(this.TextBox_Log);
this.Controls.Add(this.label2); this.Controls.Add(this.label2);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
@@ -167,7 +138,7 @@
this.Text = "Gidrolock Modbus Scanner"; this.Text = "Gidrolock Modbus Scanner";
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.App_FormClosed); this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.App_FormClosed);
this.Load += new System.EventHandler(this.Form1_Load); this.Load += new System.EventHandler(this.Form1_Load);
((System.ComponentModel.ISupportInitialize)(this.UpDown_ModbusID)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.upDownModbusID)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
@@ -175,14 +146,11 @@
#endregion #endregion
private System.Windows.Forms.TextBox TextBox_Log; private System.Windows.Forms.TextBox TextBox_Log;
private System.Windows.Forms.NumericUpDown UpDown_ModbusID; private System.Windows.Forms.NumericUpDown upDownModbusID;
private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label2;
private System.Windows.Forms.ComboBox cBoxPorts; private System.Windows.Forms.ComboBox cBoxPorts;
private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button1;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.CheckBox checkboxID;
private System.Windows.Forms.ComboBox cBoxDevice;
private System.Windows.Forms.ComboBox cBoxSpeed; private System.Windows.Forms.ComboBox cBoxSpeed;
private System.Windows.Forms.Label label4; private System.Windows.Forms.Label label4;
} }

87
Main.cs
View File

@@ -27,7 +27,7 @@ namespace Gidrolock_Modbus_Scanner
Modbus.Init(); Modbus.Init();
Modbus.ResponseReceived += OnResponseReceived; Modbus.ResponseReceived += OnResponseReceived;
this.UpDown_ModbusID.Value = 0; this.upDownModbusID.Value = 0;
TextBox_Log.Text = "Приложение готово к работе."; TextBox_Log.Text = "Приложение готово к работе.";
cBoxSpeed.Items.Add("1200"); cBoxSpeed.Items.Add("1200");
@@ -41,17 +41,9 @@ namespace Gidrolock_Modbus_Scanner
cBoxSpeed.Items.Add("115200"); cBoxSpeed.Items.Add("115200");
cBoxSpeed.SelectedIndex = 3; cBoxSpeed.SelectedIndex = 3;
cBoxDevice.Items.Add("Standard"); upDownModbusID.Value = 30;
cBoxDevice.Items.Add("Premium Plus"); upDownModbusID.Minimum = 1;
//cBoxDevice.Items.Add("Inteli"); upDownModbusID.Maximum = 247;
//cBoxDevice.Items.Add("Premium");
cBoxDevice.SelectedIndex = 0;
checkboxID.Checked = false;
UpDown_ModbusID.Enabled = false;
UpDown_ModbusID.Value = 30;
UpDown_ModbusID.Minimum = 1;
UpDown_ModbusID.Maximum = 247;
models.Add("Standard", "STW485"); models.Add("Standard", "STW485");
models.Add("Premium Plus", "PRPLS1"); models.Add("Premium Plus", "PRPLS1");
@@ -92,7 +84,7 @@ namespace Gidrolock_Modbus_Scanner
if (res == DialogResult.Cancel) if (res == DialogResult.Cancel)
return; return;
} }
if (UpDown_ModbusID.Value == 0) if (upDownModbusID.Value == 0)
{ {
DialogResult res = MessageBox.Show("Указан Modbus ID 0 — глобальное вещание. Устройства не смогут отвечать на сообщения. Продолжить?", "Внимание", MessageBoxButtons.OKCancel); DialogResult res = MessageBox.Show("Указан Modbus ID 0 — глобальное вещание. Устройства не смогут отвечать на сообщения. Продолжить?", "Внимание", MessageBoxButtons.OKCancel);
if (res == DialogResult.Cancel) if (res == DialogResult.Cancel)
@@ -124,15 +116,12 @@ namespace Gidrolock_Modbus_Scanner
// if matching model is found, instantiate device window // if matching model is found, instantiate device window
string selectedModel = models[cBoxDevice.SelectedItem.ToString()];
int selectedIndex = cBoxDevice.SelectedIndex;
AddLog("Проверка модели устройства.");
await Task.Run(async () => await Task.Run(async () =>
{ {
// send message // send message
latestMessage = null; latestMessage = null;
isAwaitingResponse = true; isAwaitingResponse = true;
var send = Modbus.ReadRegAsync((byte)UpDown_ModbusID.Value, FunctionCode.ReadInput, 200, 6); var send = Modbus.ReadRegAsync((byte)upDownModbusID.Value, FunctionCode.ReadInput, 200, 6);
await Task.Delay(2000).ContinueWith(_ => await Task.Delay(2000).ContinueWith(_ =>
{ {
if (isAwaitingResponse) if (isAwaitingResponse)
@@ -145,28 +134,15 @@ namespace Gidrolock_Modbus_Scanner
while (isAwaitingResponse) { continue; } while (isAwaitingResponse) { continue; }
if (latestMessage is null)
{
Console.WriteLine("latestMessage is still null");
return;
}
if (latestMessage.Status == ModbusStatus.Error) if (latestMessage.Status == ModbusStatus.Error)
return; return;
// confirm the model // confirm the model
string response = ByteArrayToUnicode(latestMessage.Data); string response = ByteArrayToUnicode(latestMessage.Data);
Console.WriteLine("device model response: " + response); int index = 0;
Console.WriteLine("expected response: " + selectedModel);
if (response != selectedModel)
{
// response doesn't match expected model
AddLog("Ответ устройства не соответствует выбранной модели. Поиск подходящей модели.");
// check whether it matches anything else, offer to open that model if it does
string match = ""; string match = "";
string model = ""; string model = "";
int index = 0;
foreach (string key in models.Keys) foreach (string key in models.Keys)
{ {
if (models[key] == response) if (models[key] == response)
@@ -178,14 +154,10 @@ namespace Gidrolock_Modbus_Scanner
index++; index++;
} }
if (match == "") // if no matches found if (match == "") // if no matches found
MessageBox.Show("Подключенное устройство не соответствует ни одной из поддерживаемых моделей."); MessageBox.Show("Подключенное устройство не соответствует ни одной из поддерживаемых моделей.");
else // match found, offer to switch to that model instead else // match found
{
DialogResult result = MessageBox.Show(("Подключенное устройство соответствует модели " + model + ". Нажмите ОК, чтобы открыть настройки для модели " + model), "Внимание", MessageBoxButtons.OKCancel);
if (result == DialogResult.OK)
{ {
// instantiate panel // instantiate panel
AddLog("Открываю панель конфигурации."); AddLog("Открываю панель конфигурации.");
@@ -193,15 +165,6 @@ namespace Gidrolock_Modbus_Scanner
Device device = GetDevice((DeviceType)index); Device device = GetDevice((DeviceType)index);
StartDatasheet(device); StartDatasheet(device);
} }
}
}
else
{
// model is correct, instantiate config panel
AddLog("Устройство соответстует модели, открываю панель конфигурации.");
Device device = GetDevice((DeviceType)selectedIndex);
StartDatasheet(device);
}
}); });
} }
catch (Exception ex) catch (Exception ex)
@@ -212,7 +175,7 @@ namespace Gidrolock_Modbus_Scanner
void StartDatasheet(Device device) void StartDatasheet(Device device)
{ {
datasheet = new Datasheet((byte)UpDown_ModbusID.Value, device); datasheet = new Datasheet((byte)upDownModbusID.Value, device);
Application.Run(datasheet); Application.Run(datasheet);
} }
@@ -319,33 +282,6 @@ namespace Gidrolock_Modbus_Scanner
return new string(result.ToArray()); return new string(result.ToArray());
} }
private void checkboxID_CheckedChanged(object sender, EventArgs e)
{
UpDown_ModbusID.Enabled = checkboxID.Checked ? true : false;
}
private void cBoxDevice_SelectedIndexChanged(object sender, EventArgs e)
{
switch (cBoxDevice.SelectedItem)
{
case "Standard":
UpDown_ModbusID.Value = 30;
break;
case "Premium Plus":
UpDown_ModbusID.Value = 30;
break;
case "Inteli":
UpDown_ModbusID.Value = 26;
break;
case "Premium":
UpDown_ModbusID.Value = 26;
break;
default:
Console.WriteLine("Invalid change");
break;
}
}
public Device GetDevice(DeviceType dt) public Device GetDevice(DeviceType dt)
{ {
Device d = new Device(); Device d = new Device();
@@ -355,6 +291,7 @@ namespace Gidrolock_Modbus_Scanner
d.name = "Standard Wi-Fi RS485"; d.name = "Standard Wi-Fi RS485";
d.id = 30; d.id = 30;
d.modelName = "STW485"; d.modelName = "STW485";
d.baudRate = new Entry(RegisterType.Holding, 110);
d.valveStatus = new Entry(RegisterType.Coil, 1202); d.valveStatus = new Entry(RegisterType.Coil, 1202);
d.alarmStatus = new Entry(RegisterType.Coil, 1201); d.alarmStatus = new Entry(RegisterType.Coil, 1201);
@@ -378,6 +315,7 @@ namespace Gidrolock_Modbus_Scanner
d.name = "Premium Plus Wi-Fi"; d.name = "Premium Plus Wi-Fi";
d.id = 30; d.id = 30;
d.modelName = "PRPLS1"; d.modelName = "PRPLS1";
d.baudRate = new Entry(RegisterType.Holding, 110);
d.valveStatus = new Entry(RegisterType.Coil, 1202); d.valveStatus = new Entry(RegisterType.Coil, 1202);
d.alarmStatus = new Entry(RegisterType.Coil, 1201); d.alarmStatus = new Entry(RegisterType.Coil, 1201);
@@ -395,6 +333,9 @@ namespace Gidrolock_Modbus_Scanner
break; break;
case DeviceType.Premium: case DeviceType.Premium:
d.modelName = "Premium"; d.modelName = "Premium";
d.id = 26;
d.modelName = "BUP485";
d.baudRate = new Entry(RegisterType.Holding, 110);
break; break;
default: default:
break; break;

View File

@@ -8,6 +8,7 @@ namespace Gidrolock_Modbus_Scanner
public string name; public string name;
public byte id; public byte id;
public string modelName; public string modelName;
public Entry baudRate;
public Entry valveStatus; public Entry valveStatus;
public Entry alarmStatus; public Entry alarmStatus;