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

This commit is contained in:
2026-03-05 17:21:29 +08:00
parent 25ce769d58
commit c1299e6bd7
2 changed files with 68 additions and 8 deletions

View File

@@ -4455,7 +4455,8 @@ 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("未选中房型!!!")
Return
End If
@@ -4612,7 +4613,21 @@ Public Class FrmMain
Try
'填充配置信息
'_grdModel._ConfigInf
If _TableInteraction.TableCompiletoByte(savePath, True) = True Then
'获取选中房型节点
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(FVer, savePath, True) = True Then
_TableInteraction.Save(savePath) '保存配置文件
If IsShowCompileResult Then MsgBox($"编译完成, 配置版本号:" & _TableInteraction.ConfigInfo.CfgFileVersion)
Return True
@@ -4642,6 +4657,7 @@ Public Class FrmMain
End Function
Public Function fulijisuanqi()
Dim ager As Integer = 20000
Dim addr As Integer = 3000
@@ -4701,6 +4717,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

@@ -1551,6 +1551,9 @@ Public Class TableInteraction
Next
End If
'设置到弹窗显示
Dim from1 As New AddPeripherals
from1.g_Devicemodel = Dic_Devicemodel
@@ -1566,6 +1569,7 @@ Public Class TableInteraction
from1.g_DevScenenumber = GetSceneNumbeAr()
from1.g_ColumnAnothername = ColumnAnothername
from1.EditFeedbackLamp(rvdicv, devmodw)
If from1.ShowDialog() <> DialogResult.OK Then Return
'根据弹窗设置重新设置界面置
@@ -2867,7 +2871,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())
@@ -2886,7 +2890,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)
@@ -4134,7 +4138,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())
@@ -4259,8 +4263,25 @@ Public Class TableInteraction
Dbuf = dic.Item([Enum].GetName(GetType(AddPeripherals.Temproweven), AddPeripherals.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
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
@@ -4268,6 +4289,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)
@@ -4323,6 +4346,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([Enum].GetName(GetType(AddPeripherals.Temproweven), AddPeripherals.Temproweven.互锁)).Trim.Split("*")
ncbuf.Add(GetActionData(DeviceModuleDic, hostname, "MUSIC", 1, "0,2,3,1,12,0"))
@@ -4332,6 +4371,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)
@@ -6190,7 +6230,7 @@ Public Class TableInteraction
Public Voicement As List(Of DeviceModel)
Public devTempment 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)
@@ -6285,7 +6325,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