Bladeren bron

支持KCS_KDC3_24V300W_8T灯控器型号注册

在LightManagerService中新增对KCS_KDC3_24V300W_8T型号的控制器工厂注册逻辑,通过串口协议实例化对应控制器,提升了系统对新型号灯光控制器的扩展能力。
孝锋 徐 7 maanden geleden
bovenliggende
commit
ca06aff11f
1 gewijzigde bestanden met toevoegingen van 8 en 0 verwijderingen
  1. 8 0
      TeamAAS-VM/Services/LightManagerService.cs

+ 8 - 0
TeamAAS-VM/Services/LightManagerService.cs

@@ -88,6 +88,14 @@ namespace TeamAAS_VP.Services
                 var protocol = new SerialPortProtocol(config.SerialPortConfig);
                 var protocol = new SerialPortProtocol(config.SerialPortConfig);
                 return new KCSLightController(id, protocol, config.ChannelCount,config);
                 return new KCSLightController(id, protocol, config.ChannelCount,config);
             });
             });
+            // 注册KCS控制器工厂
+            RegisterControllerFactory(LightModel.KCS_KDC3_24V300W_8T, (id, config) =>
+            {
+                if (config == null) throw new ArgumentNullException(nameof(config));
+                // 使用配置里的串口配置创建协议实现,再创建控制器实例
+                var protocol = new SerialPortProtocol(config.SerialPortConfig);
+                return new KCSLightController(id, protocol, config.ChannelCount, config);
+            });
         }
         }
 
 
         /// <summary>
         /// <summary>