From a9d1161b1df96e7ddad566335989a1444e433ef5 Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期二, 28 三月 2023 11:54:45 +0800
Subject: [PATCH] 2023年03月28日11:52:02

---
 HDL_ON/DAL/DriverLayer/Control_Udp.cs |   23 ++++++++++++++++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/HDL_ON/DAL/DriverLayer/Control_Udp.cs b/HDL_ON/DAL/DriverLayer/Control_Udp.cs
index ce7be67..5dba3fd 100644
--- a/HDL_ON/DAL/DriverLayer/Control_Udp.cs
+++ b/HDL_ON/DAL/DriverLayer/Control_Udp.cs
@@ -552,7 +552,28 @@
                         }
                         else
                         {
-                            ControlBytesSend(Command.SetCurtainModelStutas, subnetId, deviceId, new byte[] { 17, Convert.ToByte(function.GetAttrState(FunctionAttributeKey.Percent)) });
+                            if (commandDictionary.ContainsKey(FunctionAttributeKey.Percent))
+                            {
+                                ControlBytesSend(Command.SetCurtainModelStutas, subnetId, deviceId, new byte[] { (byte)(((int)function.bus.LoopId) + 16), Convert.ToByte(function.GetAttrState(FunctionAttributeKey.Percent)) });
+                            }
+                            else
+                            {
+
+                                byte tempCurtainState = 0;
+                                if (function.trait_on_off.curValue.ToString() == "stop")
+                                {
+                                    tempCurtainState = 0;
+                                }
+                                else if (function.trait_on_off.curValue.ToString() == "on")
+                                {
+                                    tempCurtainState = 1;
+                                }
+                                else
+                                {
+                                    tempCurtainState = 2;
+                                }
+                                ControlBytesSend(Command.SetCurtainModelStutas, subnetId, deviceId, new byte[] { function.bus.LoopId, tempCurtainState });
+                            }
 
                         }
                         break;

--
Gitblit v1.8.0