可模拟起飞灯光

This commit is contained in:
xu 2020-04-21 15:36:17 +08:00
parent f787069624
commit d525f00222

View File

@ -140,6 +140,25 @@ namespace Plane.FormationCreator.Formation
await Task.Delay(100).ConfigureAwait(false);
dtNow = DateTime.Now;
ts = dtNow - dtLastTime;
//灯光控制
if (info.LEDInfos.Count > 0)
{
string LEDRGB = "";
List<LEDInfo> LedControl = info.LEDInfos.ToList();
double time = 0;
for (int i = 0; i < LedControl.Count; i++)
{
var led = LedControl[i];
time += led.Delay * 1000;
if (ts.TotalMilliseconds >= time)
LEDRGB = info.LEDInfos[i].LEDRGB;
else
break;
}
info.Copter.LEDColor = LEDRGB;
///灯光控制结束
}
}
//起飞完成用默认颜色
info.Copter.LEDColor = CopterManager.CopterFlyingColor;