wei
2021-07-05 992cc7d4433f8f9e9b0a930ec095973e056abe1c
HDL_ON/DAL/DriverLayer/Control_Udp.cs
@@ -52,6 +52,15 @@
        /// </summary>
        public void ControlBytesSend(Command command, byte subnetID, byte deviceID, byte[] gatewayBytes, int sendCount = 3)
        {
#if DEBUG
            string ddd = "";
            foreach (var bb in gatewayBytes)
            {
                ddd += bb + ",";
            }
            MainPage.Log($"发送bus命令:" + ((int)command).ToString("X").PadLeft(4,'0') + " : 数据:" + ddd);
#endif
            var control = new Control_Udp();
            control.Send(new Target()
            {
@@ -429,13 +438,16 @@
                        {
                            case SPK.LightCCT:
                                byte b0 = 100;//开关操作依据on_off字段,实际开关值依据brightness,当on_off为打开,brightness不能为0
                                if (function.trait_on_off.curValue.ToString() == "off")
                                if(commandDictionary.ContainsKey(FunctionAttributeKey.OnOff))
                                {
                                    b0 = 0;
                                    if (function.trait_on_off.curValue.ToString() == "off")
                                    {
                                        b0 = 0;
                                    }
                                }
                                else
                                {
                                    b0 = Convert.ToByte( function.GetAttrState(FunctionAttributeKey.Brightness)) == 0 ? (byte)100 : Convert.ToByte(function.GetAttrState(FunctionAttributeKey.Brightness));
                                    b0 = Convert.ToByte(function.GetAttrState(FunctionAttributeKey.Brightness));// == 0 ? (byte)100 : Convert.ToByte(function.GetAttrState(FunctionAttributeKey.Brightness));
                                }
                                var bytes0 = new byte[] { function.bus.LoopId,
                                            b0,