protected override void ProcessSpoilerDemand(ExtendedSimConnect simConnect, SpoilerData data) { int? newPosition = null; IEvent?toSend = null; if (data.armed != 0) { toSend = armOffEvent; //newPosition = 0; } else if (data.position < 100) { newPosition = Math.Min(data.position + 25, 100); } if (toSend != null) { _logger.LogDebug($"Now send {toSend}"); simConnect.SendEvent(toSend); } if (newPosition != null) { uint eventData = (uint)newPosition * 164; eventData = Math.Min(eventData, 16384u); _logger.LogDebug($"Now demand position {newPosition} or as U {eventData}"); simConnect.SendEvent(setEvent, eventData); } }
protected override void ProcessSpoilerDemand(ExtendedSimConnect simConnect, SpoilerData data) { if (data.position > 0) { int newPosition = Math.Max(data.position - 25, 0); uint eventData = (uint)newPosition * 164u; eventData = Math.Min(eventData, 16384u); _logger.LogDebug($"Now demand position {newPosition} or as U {eventData}"); simConnect.SendEvent(setEvent, eventData); } else if (data.armed == 0) { _logger.LogDebug($"Now send {armOnEvent}"); simConnect.SendEvent(armOnEvent); } }