From 43b0d5870d528f23ecd6aeceb6cfd4325188b46f Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期四, 01 七月 2021 15:50:43 +0800
Subject: [PATCH] Revert "1"

---
 HDL_ON/DAL/DriverLayer/Packet.cs |   81 ++++++++++++++++++++++++----------------
 1 files changed, 48 insertions(+), 33 deletions(-)

diff --git a/HDL_ON/DAL/DriverLayer/Packet.cs b/HDL_ON/DAL/DriverLayer/Packet.cs
index 5f0b9f5..a5b60c5 100644
--- a/HDL_ON/DAL/DriverLayer/Packet.cs
+++ b/HDL_ON/DAL/DriverLayer/Packet.cs
@@ -97,7 +97,7 @@
                 {
                     ddd += bb + ",";
                 }
-                MainPage.Log(ddd);
+                MainPage.Log($"bus鍛戒护:"+ ((int)command) + " : 鏁版嵁:" + ddd);
 #endif
                 //澶勭悊鏄惁瑕侀噸鍙戞暟鎹�
                 ManagerReceive(subnetID, deviceID, command, usefulBytes);
@@ -405,38 +405,44 @@
                                 {
                                     function.Fh_Mode_Temp.Add("away", receiveBytes[7]);
                                 }
-
-                                switch (function.GetAttrState(FunctionAttributeKey.Mode))
+                                if (function.GetAttribute(FunctionAttributeKey.Mode) == null)
                                 {
-                                    case "normal":
-                                        function.lastState = Language.StringByID(StringId.Normal);
-                                        function.SetAttrState(FunctionAttributeKey.SetTemp,receiveBytes[4].ToString());
-                                        break;
-                                    case "day":
-                                        function.lastState = Language.StringByID(StringId.Day);
-                                        function.SetAttrState(FunctionAttributeKey.SetTemp, receiveBytes[5].ToString());
-                                        break;
-                                    case "night":
-                                        function.lastState = Language.StringByID(StringId.Night);
-                                        function.SetAttrState(FunctionAttributeKey.SetTemp, receiveBytes[6].ToString());
-                                        break;
-                                    case "timer":
-                                        function.lastState = Language.StringByID(StringId.Auto);
-                                        if (receiveBytes[8] == 0)
-                                        {
-                                            function.SetAttrState(FunctionAttributeKey.TimeFlag, 0);
+                                    function.SetAttrState(FunctionAttributeKey.SetTemp, receiveBytes[4].ToString());
+                                }
+                                else
+                                {
+                                    switch (function.GetAttrState(FunctionAttributeKey.Mode))
+                                    {
+                                        case "normal":
+                                            function.lastState = Language.StringByID(StringId.Normal);
+                                            function.SetAttrState(FunctionAttributeKey.SetTemp, receiveBytes[4].ToString());
+                                            break;
+                                        case "day":
+                                            function.lastState = Language.StringByID(StringId.Day);
                                             function.SetAttrState(FunctionAttributeKey.SetTemp, receiveBytes[5].ToString());
-                                        }
-                                        else
-                                        {
-                                            function.SetAttrState(FunctionAttributeKey.TimeFlag, 1);
+                                            break;
+                                        case "night":
+                                            function.lastState = Language.StringByID(StringId.Night);
                                             function.SetAttrState(FunctionAttributeKey.SetTemp, receiveBytes[6].ToString());
-                                        }
-                                        break;
-                                    case "away":
-                                        function.SetAttrState(FunctionAttributeKey.SetTemp, receiveBytes[7].ToString());
-                                        function.lastState = Language.StringByID(StringId.Away);
-                                        break;
+                                            break;
+                                        case "timer":
+                                            function.lastState = Language.StringByID(StringId.Auto);
+                                            if (receiveBytes[8] == 0)
+                                            {
+                                                function.SetAttrState(FunctionAttributeKey.TimeFlag, 0);
+                                                function.SetAttrState(FunctionAttributeKey.SetTemp, receiveBytes[5].ToString());
+                                            }
+                                            else
+                                            {
+                                                function.SetAttrState(FunctionAttributeKey.TimeFlag, 1);
+                                                function.SetAttrState(FunctionAttributeKey.SetTemp, receiveBytes[6].ToString());
+                                            }
+                                            break;
+                                        case "away":
+                                            function.SetAttrState(FunctionAttributeKey.SetTemp, receiveBytes[7].ToString());
+                                            function.lastState = Language.StringByID(StringId.Away);
+                                            break;
+                                    }
                                 }
                                 var indoorTemp = 0;
                                 if (receiveBytes[9] > 128)
@@ -448,7 +454,14 @@
                                 }
                                 function.SetAttrState(FunctionAttributeKey.RoomTemp, indoorTemp);
 
-                                function.lastState += " " + function.GetAttrState(FunctionAttributeKey.Mode) + new FloorHeating().GetTempUnitString(function);
+                                if (function.GetAttribute(FunctionAttributeKey.Mode) == null)
+                                {
+                                    function.lastState = "";
+                                }
+                                else
+                                {
+                                    function.lastState += " " + function.GetAttrState(FunctionAttributeKey.Mode) + new FloorHeating().GetTempUnitString(function);
+                                }
                                 RoomPage.UpdataStates(function);
                                 FunctionPage.UpdataStates(function);
                                 HomePage.UpdataFunctionStates(function);
@@ -653,8 +666,8 @@
                             /// 10	杩囨护缃戝墿浣�	%
                             /// 11	杩囨护缃戜娇鐢ㄨ秴鏃�	1 瓒呮椂 0 鏃� true/false
                             airFresh.SetAttrState(FunctionAttributeKey.OnOff, receiveBytes[2] == 0 ? "off" : "on");
-                            airFresh.SetAttrState(FunctionAttributeKey.Mode, receiveBytes[3] == 1 ? "humidification" : "fan");
-                            airFresh.SetAttrState(FunctionAttributeKey.Energy, receiveBytes[4] == 1 ? "true" : "false");
+                            airFresh.SetAttrState(FunctionAttributeKey.Mode, receiveBytes[3] == 1 ? "fan" : "humidification");
+                            airFresh.SetAttrState(FunctionAttributeKey.Energy, receiveBytes[4] == 1 ? "false" : "true");
                             switch (receiveBytes[5])
                             {
                                 case 0:
@@ -675,6 +688,8 @@
                             airFresh.SetAttrState(FunctionAttributeKey.IndoorHumidity, receiveBytes[8].ToString());
                             airFresh.SetAttrState(FunctionAttributeKey.FilterRemain, receiveBytes[9].ToString());
                             airFresh.SetAttrState(FunctionAttributeKey.FilterTimeout, receiveBytes[10] == 1 ? "true" : "false");
+                            //璁惧鐘舵�佹帹閫�
+                            Stan.HdlFormLogic.Current.DeviceStatuPush(airFresh, true);
                         }
                         break;
                 }

--
Gitblit v1.8.0