From e1b93fdc286e0f73b2b9a09c0a82a22a71074f2f Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期五, 26 三月 2021 09:47:49 +0800
Subject: [PATCH] 1

---
 HDL_ON/DAL/DriverLayer/Packet.cs |   73 +++++++++++++++++++++---------------
 1 files changed, 43 insertions(+), 30 deletions(-)

diff --git a/HDL_ON/DAL/DriverLayer/Packet.cs b/HDL_ON/DAL/DriverLayer/Packet.cs
index 5f0b9f5..ad530d3 100644
--- a/HDL_ON/DAL/DriverLayer/Packet.cs
+++ b/HDL_ON/DAL/DriverLayer/Packet.cs
@@ -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);

--
Gitblit v1.8.0