优化当固件版本大于43时开关机提示音和风速提示音的组包方式

This commit is contained in:
2026-03-05 17:23:36 +08:00
parent 0bf7fdecf4
commit f61b4beb3f
3 changed files with 60 additions and 8 deletions

Binary file not shown.

View File

@@ -4402,7 +4402,7 @@ Public Class FrmMain
Public _TableInteraction As TableInteraction
Private Sub T_OpenfileXML_Click(sender As Object, e As EventArgs) Handles T_OpenfileXML.Click
If IsNothing(_ConfigInfo.Author) Then
If IsNothing(_ConfigInfo.Author) OrElse IsNothing(TvwMain.SelectedNode) Then
MsgBox("Room type not selected")
Return
End If
@@ -4560,6 +4560,18 @@ Public Class FrmMain
'填充配置信息
'_grdModel._ConfigInf
Dim TrNode As TreeNode = TvwMain.SelectedNode
If TrNode.Level > 1 Then
TrNode = TrNode.Parent
End If
Dim FirmwareVer As String = TrNode.FirstNode.NextNode.NextNode.Text ' TrNode.NextVisibleNode.NextNode.Text
Dim FVer As Integer = 0
If Not String.IsNullOrEmpty(FirmwareVer) Then
Dim Firbuf As String() = FirmwareVer.Split("_")
If Firbuf.Length > 3 Then
FVer = Convert.ToInt32(Firbuf(3))
End If
End If
If _TableInteraction.TableCompiletoByte(savePath, True) = True Then
_TableInteraction.Save(savePath) '保存配置文件
If IsShowCompileResult Then MsgBox($"Compile complete Configuration version number" & _TableInteraction.ConfigInfo.CfgFileVersion)
@@ -4644,6 +4656,10 @@ Public Class FrmMain
Private Sub ToolStripButton10_Click(sender As Object, e As EventArgs) Handles ToolStripButton10.Click
If IsNothing(TvwMain.SelectedNode) Then
MsgBox("请先选择一个项目节点!")
Return
End If
Dim tmpMsgReslut As MsgBoxResult '弹出消息框的选定值
Me.Cursor = System.Windows.Forms.Cursors.WaitCursor '光标变成漏斗状
Try

View File

@@ -2805,7 +2805,7 @@ Public Class TableInteraction
#End Region
#Region "编译"
Public Function TableCompiletoByte(Optional savePath As String = "",
Public Function TableCompiletoByte(FVer As Integer,Optional savePath As String = "",
Optional ByVal IsShowCompileResult As Boolean = False,
Optional ByVal ifCfgVerPlusPlus As Boolean = False) As Boolean
Dim lst As New List(Of Byte())
@@ -2824,7 +2824,7 @@ Public Class TableInteraction
'编译设备存在
Dim deviceExistsDatas As List(Of Byte())
Dim OutDevlist As New List(Of Byte)
deviceExistsDatas = FillDeviceExistsData(Dic_Devicemodel)
deviceExistsDatas = FillDeviceExistsData(Dic_Devicemodel,FVer)
lst.AddRange(deviceExistsDatas.ToArray)
'获取编译的设备动作
Dim actibuf As List(Of Byte()) = FillDeviceObject(Dic_Devicemodel, Dic_ActionConfiguration, _grd)
@@ -4178,7 +4178,7 @@ Public Class TableInteraction
End Function
Private Function TempDeviceObject(ByRef Eventnumber As Integer, DeviceModuleDic As Dictionary(Of String DeviceModel) DevName As String, DevNodeName As String) As List(Of Byte())
Private Function TempDeviceObject(ByRef Eventnumber As Integer, DeviceModuleDic As Dictionary(Of String DeviceModel) DevName As String, DevNodeName As String,FVer As Integer) As List(Of Byte())
'返回变量
Dim result As New List(Of Byte())
Dim ncbuf As New List(Of Byte())
@@ -4303,8 +4303,25 @@ Public Class TableInteraction
Dbuf = dic.Item(GetDescriptionOriginalAddPeripherals.Temproweven.互锁)).Trim.Split("*")
ncbuf.Add(GetActionData(DeviceModuleDic, Dbuf(0), "Temp", Dbuf(1), "0,1,1,1,1,1,16"))
End If
If checkbuf(1).Equals("1") Then
'Dbuf = dic.Item(GetDescriptionOriginal( AddPeripherals.Temproweven.互锁)).Trim.Split("*")
If FVer >43 Then
Dim btxtr As string
Dim bctr As Integer=32
If checkbuf(0).Equals("1") Then
bctr=bctr or (1<<2)
End If
If checkbuf(3).Equals("1") Then
bctr=bctr or (1<<3)
End If
btxtr= $"0,2,0,2,1,0,0"
dim btxli As Byte()= GetActionData(DeviceModuleDic, DevName, "Temp", 1, btxtr)
btxli(5) = bctr
ncbuf.Add(btxli)
Else
If checkbuf(1).Equals("1") Then
'Dbuf = dic.Item([Enum].GetName(GetType(AddPeripherals.Temproweven), AddPeripherals.Temproweven.互锁)).Trim.Split("*")
ncbuf.Add(GetActionData(DeviceModuleDic, hostname, "MUSIC", 1, "0,2,3,1,11,0"))
End If
If checkbuf(3).Equals("1") Then
@@ -4312,6 +4329,8 @@ Public Class TableInteraction
Else
ncbuf.Add(GetActionData(DeviceModuleDic, DevName, "Temp", 1, "0,2,0,2,2,0,0"))
End If
End If
Case 2 '关机
UShort.TryParse(32, strEventNum)
@@ -4367,6 +4386,22 @@ Public Class TableInteraction
ncbuf.Add(GetActionData(DeviceModuleDic, Dbuf(0), "Temp", Dbuf(1), "0,1,1,1,1,1,16"))
End If
If FVer >43 Then
Dim btxtr As string
Dim bctr As Integer=32
If checkbuf(0).Equals("1") Then
bctr=bctr or (1<<2)
End If
If checkbuf(3).Equals("1") Then
bctr=bctr or (1<<3)
End If
btxtr= $"0,2,0,2,1,0,0"
dim btxli As Byte()= GetActionData(DeviceModuleDic, DevName, "Temp", 1, btxtr)
btxli(5) = bctr
ncbuf.Add(btxli)
Else
If checkbuf(1).Equals("1") Then
Dbuf = dic.Item(GetDescriptionOriginalAddPeripherals.Temproweven.互锁)).Trim.Split("*")
ncbuf.Add(GetActionData(DeviceModuleDic, hostname, "MUSIC", 1, "0,2,3,1,12,0"))
@@ -4377,6 +4412,7 @@ Public Class TableInteraction
Else
ncbuf.Add(GetActionData(DeviceModuleDic, DevName, "Temp", 1, "0,2,0,2,2,0,0"))
End If
End If
Case 3 '冷阀开
UShort.TryParse(1028, strEventNum)
eventNum = BitConverter.GetBytes(strEventNum)
@@ -6092,7 +6128,7 @@ Public Class TableInteraction
Public Voicement As List(Of DeviceModel)
Public devTempment As List(Of DeviceModel)
Public devRKEY As List(Of DeviceModel)
Public Function FillDeviceExistsData(ByRef DeviceModuleDic As Dictionary(Of String DeviceModel)) As List(Of Byte())
Public Function FillDeviceExistsData(ByRef DeviceModuleDic As Dictionary(Of String DeviceModel),Optional FVer As Integer =38) As List(Of Byte())
Dim resultDatas As New List(Of Byte())
Dim cmd As Byte = &H3
Dim buf As List(Of Byte)
@@ -6190,7 +6226,7 @@ Public Class TableInteraction
' resultDatas.AddRange(result.ToArray)
'Next
For Each node In devTempment
result = TempDeviceObject(T_SceneID, DeviceModuleDic, node.Name, "Temp")
result = TempDeviceObject(T_SceneID, DeviceModuleDic, node.Name, "Temp",FVer )
If IsNothing(result) Then Continue For
resultDatas.AddRange(result.ToArray)
Next