Skip to content

Commit

Permalink
Merge pull request #179 from calibx/develop
Browse files Browse the repository at this point in the history
release 2.2
  • Loading branch information
calibx committed Nov 17, 2022
2 parents 358b0dd + d48e8e6 commit 8b7b27f
Show file tree
Hide file tree
Showing 39 changed files with 446 additions and 587 deletions.
28 changes: 28 additions & 0 deletions MsfsPlugin/MsfsPlugin/MsfsPlugin.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
<Compile Include="input\debug\AircraftInput.cs" />
<Compile Include="input\light\LightsMultiInputs.cs" />
<Compile Include="input\misc\AutoTaxiInput.cs" />
<Compile Include="input\misc\IconInput.cs" />
<Compile Include="input\misc\GearInput.cs" />
<Compile Include="input\misc\EngineInput.cs" />
<Compile Include="input\misc\ParkingBrakeInput.cs" />
Expand All @@ -110,6 +111,7 @@
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="tools\ImageTool.cs" />
<Compile Include="tools\ConvertTool.cs" />
<Compile Include="MSFSApplication.cs" />
<Compile Include="MSFSPlugin.cs" />
Expand All @@ -124,6 +126,8 @@
<ItemGroup>
<None Include="App.config" />
<EmbeddedResource Include="Resources\DefaultProfile30win.lp4" />
<EmbeddedResource Include="Resources\DefaultProfile40win.lp4" />
<EmbeddedResource Include="Resources\DefaultProfile50win.lp4" />
<None Include="Resources\LoupedeckPackage.yaml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
Expand Down Expand Up @@ -164,6 +168,30 @@
<EmbeddedResource Include="Resources\32.png" />
<EmbeddedResource Include="Resources\48.png" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\availableFull.png" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\disableFull.png" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\disconnectFull.png" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\offFull.png" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\onFull.png" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\tryingFull.png" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\waitFull.png" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\availableBorder.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<PostBuildEvent>$(ILMergeConsolePath) /out:$(OutDir)/bin/win/MSFSPlugin.dll $(OutDir)MSFSPlugin.dll $(OutDir)fsuipcClient.dll</PostBuildEvent>
Expand Down
2 changes: 1 addition & 1 deletion MsfsPlugin/MsfsPlugin/PluginConfiguration.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"displayName": "MSFS",
"supportedDevices": "Loupedeck20,Loupedeck30"
"supportedDevices": "Loupedeck20,Loupedeck30,Loupedeck40,Loupedeck50"
}
2 changes: 1 addition & 1 deletion MsfsPlugin/MsfsPlugin/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("4.3.0.7478")]
[assembly: AssemblyVersion("2.1.0")]
[assembly: AssemblyVersion("2.2.0")]
Binary file modified MsfsPlugin/MsfsPlugin/Resources/DefaultProfile20win.lp4
Binary file not shown.
Binary file modified MsfsPlugin/MsfsPlugin/Resources/DefaultProfile30win.lp4
Binary file not shown.
Binary file not shown.
Binary file not shown.
6 changes: 5 additions & 1 deletion MsfsPlugin/MsfsPlugin/Resources/LoupedeckPackage.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
type: plugin4
name: MSFS
displayName: Microsoft Flight Simulator
version: 2.1.0
version: 2.2.0
author: CaliBx
copyright: CaliBx

supportedDevices:
- LoupedeckCt
- LoupedeckLive
- LoupedeckLiveS
- RazorStreamController



pluginFileName: MSFSPlugin.dll
pluginFolderWin: ./bin/win/
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MsfsPlugin/MsfsPlugin/Resources/availableFull.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MsfsPlugin/MsfsPlugin/Resources/disableFull.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MsfsPlugin/MsfsPlugin/Resources/offFull.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MsfsPlugin/MsfsPlugin/Resources/onFull.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MsfsPlugin/MsfsPlugin/Resources/tryingFull.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MsfsPlugin/MsfsPlugin/Resources/waitFull.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion MsfsPlugin/MsfsPlugin/encoder/BarometerEncoder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
class BarometerEncoder : DefaultEncoder
{
public BarometerEncoder() : base("Baro", "Barometer encoder", "Nav", true, 2799, 3201, 1) => this._bindings.Add(MsfsData.Instance.Register(new Binding(BindingKeys.KOHLSMAN)));
protected override void RunCommand(String actionParameter) => this.SetValue(this._bindings[0].ControllerValue);
protected override void RunCommand(String actionParameter) => this.SetValue(2992);
protected override String GetDisplayValue() => (this._bindings[0].ControllerValue / 100f).ToString();
protected override Int64 GetValue() => this._bindings[0].ControllerValue;
protected override void SetValue(Int64 newValue) => this._bindings[0].SetControllerValue(newValue);
Expand Down
1 change: 1 addition & 0 deletions MsfsPlugin/MsfsPlugin/encoder/DefaultEncoder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
{
using System;
using System.Collections.Generic;

using Loupedeck.MsfsPlugin.tools;

public abstract class DefaultEncoder : PluginDynamicAdjustment, Notifiable
Expand Down
1 change: 1 addition & 0 deletions MsfsPlugin/MsfsPlugin/encoder/HeadignAPEncoder.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
namespace Loupedeck.MsfsPlugin
{
using System;

using Loupedeck.MsfsPlugin.encoder;
using Loupedeck.MsfsPlugin.tools;

Expand Down
5 changes: 5 additions & 0 deletions MsfsPlugin/MsfsPlugin/event/BindingKeys.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,15 @@ public enum BindingKeys
AP_MASTER_SWITCH_AP_FOLDER,
AP_THROTTLE_SWITCH_AP_FOLDER,
AP_VSPEED_SWITCH_AP_FOLDER,
AP_YAW_DAMPER_AP_FOLDER,
AP_ALT_SWITCH,
AP_HEAD_SWITCH,
AP_NAV_SWITCH,
AP_SPEED_SWITCH,
AP_MASTER_SWITCH,
AP_THROTTLE_SWITCH,
AP_VSPEED_SWITCH,
AP_YAW_DAMPER_SWITCH,
ATC_ATC_FOLDER,
ATC_0_ATC_FOLDER,
ATC_1_ATC_FOLDER,
Expand Down Expand Up @@ -135,6 +137,7 @@ public enum BindingKeys
AP_HEAD_SWITCH_AL_FOLDER,
AP_THROTTLE_SWITCH_AL_FOLDER,
AP_VSPEED_SWITCH_AL_FOLDER,
AP_YAW_DAMPER_AL_FOLDER,
AUTO_TAXI,
COM1_ACTIVE_FREQUENCY,
COM2_ACTIVE_FREQUENCY,
Expand All @@ -154,6 +157,8 @@ public enum BindingKeys
COM1_RADIO_SWAP,
COM2_RADIO_SWAP,
COM3_RADIO_SWAP,
FLASHLIGHT,
ICON_SIZE,
}
}

28 changes: 18 additions & 10 deletions MsfsPlugin/MsfsPlugin/folder/APDynamicFolder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
{
using System;
using System.Collections.Generic;

using Loupedeck.MsfsPlugin.tools;

public class APDynamicFolder : PluginDynamicFolder, Notifiable
{
protected readonly String _imageOffResourcePath = "Loupedeck.MsfsPlugin.Resources.off.png";
protected readonly String _imageOnResourcePath = "Loupedeck.MsfsPlugin.Resources.on.png";
protected readonly List<Binding> _bindings = new List<Binding>();
public APDynamicFolder()
{
Expand All @@ -31,6 +30,8 @@ public APDynamicFolder()
this._bindings.Add(MsfsData.Instance.Register(new Binding(BindingKeys.AP_MASTER_SWITCH_AP_FOLDER)));
this._bindings.Add(MsfsData.Instance.Register(new Binding(BindingKeys.AP_THROTTLE_SWITCH_AP_FOLDER)));
this._bindings.Add(MsfsData.Instance.Register(new Binding(BindingKeys.AP_VSPEED_SWITCH_AP_FOLDER)));
this._bindings.Add(MsfsData.Instance.Register(new Binding(BindingKeys.AP_YAW_DAMPER_AP_FOLDER)));

}

public override PluginDynamicFolderNavigation GetNavigationArea(DeviceType _) => PluginDynamicFolderNavigation.None;
Expand Down Expand Up @@ -67,6 +68,7 @@ public override IEnumerable<String> GetButtonPressActionNames(DeviceType deviceT
this.CreateCommandName("AP"),
this.CreateCommandName("Throttle"),
this.CreateCommandName("VS Speed"),
this.CreateCommandName("Yaw Damper"),
};
}
public override String GetAdjustmentDisplayName(String actionParameter, PluginImageSize imageSize)
Expand Down Expand Up @@ -95,25 +97,28 @@ public override BitmapImage GetCommandImage(String actionParameter, PluginImageS
switch (actionParameter)
{
case "Altitude":
bitmapBuilder.SetBackgroundImage(this._bindings[8].ControllerValue == 1 ? EmbeddedResources.ReadImage(this._imageOnResourcePath) : EmbeddedResources.ReadImage(this._imageOffResourcePath));
bitmapBuilder.SetBackgroundImage(ImageTool.GetOnOffImage(this._bindings[8].ControllerValue));
break;
case "Heading":
bitmapBuilder.SetBackgroundImage(this._bindings[9].ControllerValue == 1 ? EmbeddedResources.ReadImage(this._imageOnResourcePath) : EmbeddedResources.ReadImage(this._imageOffResourcePath));
bitmapBuilder.SetBackgroundImage(ImageTool.GetOnOffImage(this._bindings[9].ControllerValue));
break;
case "Nav":
bitmapBuilder.SetBackgroundImage(this._bindings[10].ControllerValue == 1 ? EmbeddedResources.ReadImage(this._imageOnResourcePath) : EmbeddedResources.ReadImage(this._imageOffResourcePath));
bitmapBuilder.SetBackgroundImage(ImageTool.GetOnOffImage(this._bindings[10].ControllerValue));
break;
case "Speed":
bitmapBuilder.SetBackgroundImage(this._bindings[11].ControllerValue == 1 ? EmbeddedResources.ReadImage(this._imageOnResourcePath) : EmbeddedResources.ReadImage(this._imageOffResourcePath));
bitmapBuilder.SetBackgroundImage(ImageTool.GetOnOffImage(this._bindings[11].ControllerValue));
break;
case "AP":
bitmapBuilder.SetBackgroundImage(this._bindings[12].ControllerValue == 1 ? EmbeddedResources.ReadImage(this._imageOnResourcePath) : EmbeddedResources.ReadImage(this._imageOffResourcePath));
bitmapBuilder.SetBackgroundImage(ImageTool.GetOnOffImage(this._bindings[12].ControllerValue));
break;
case "Throttle":
bitmapBuilder.SetBackgroundImage(this._bindings[13].ControllerValue == 1 ? EmbeddedResources.ReadImage(this._imageOnResourcePath) : EmbeddedResources.ReadImage(this._imageOffResourcePath));
bitmapBuilder.SetBackgroundImage(ImageTool.GetOnOffImage(this._bindings[13].ControllerValue));
break;
case "VS Speed":
bitmapBuilder.SetBackgroundImage(this._bindings[14].ControllerValue == 1 ? EmbeddedResources.ReadImage(this._imageOnResourcePath) : EmbeddedResources.ReadImage(this._imageOffResourcePath));
bitmapBuilder.SetBackgroundImage(ImageTool.GetOnOffImage(this._bindings[14].ControllerValue));
break;
case "Yaw Damper":
bitmapBuilder.SetBackgroundImage(ImageTool.GetOnOffImage(this._bindings[15].ControllerValue));
break;
}
bitmapBuilder.DrawText(actionParameter);
Expand All @@ -127,7 +132,7 @@ public override void ApplyAdjustment(String actionParameter, Int32 ticks)
this._bindings[0].SetControllerValue(ConvertTool.ApplyAdjustment(this._bindings[0].ControllerValue, ticks, -10000, 99900, 100));
break;
case "Heading Encoder":
this._bindings[2].SetControllerValue(ConvertTool.ApplyAdjustment(this._bindings[2].ControllerValue, ticks,1, 360, 1, true));
this._bindings[2].SetControllerValue(ConvertTool.ApplyAdjustment(this._bindings[2].ControllerValue, ticks, 1, 360, 1, true));
break;
case "Speed Encoder":
this._bindings[4].SetControllerValue(ConvertTool.ApplyAdjustment(this._bindings[4].ControllerValue, ticks, 0, 2000, 1));
Expand Down Expand Up @@ -163,6 +168,9 @@ public override void RunCommand(String actionParameter)
case "VS Speed":
this._bindings[14].SetControllerValue(1);
break;
case "Yaw Damper":
this._bindings[15].SetControllerValue(1);
break;
case "Altitude Reset":
this._bindings[0].SetControllerValue((Int64)(Math.Round(this._bindings[1].ControllerValue / 100d, 0) * 100));
break;
Expand Down
42 changes: 20 additions & 22 deletions MsfsPlugin/MsfsPlugin/folder/AirlinerDynamicFolder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
{
using System;
using System.Collections.Generic;

using Loupedeck.MsfsPlugin.tools;

public class AirlinerDynamicFolder : PluginDynamicFolder, Notifiable
{
protected readonly String _imageOffResourcePath = "Loupedeck.MsfsPlugin.Resources.off.png";
protected readonly String _imageOnResourcePath = "Loupedeck.MsfsPlugin.Resources.on.png";
protected readonly List<Binding> _bindings = new List<Binding>();
public AirlinerDynamicFolder()
{
Expand All @@ -34,6 +33,7 @@ public AirlinerDynamicFolder()
this._bindings.Add(MsfsData.Instance.Register(new Binding(BindingKeys.AP_HEAD_SWITCH_AL_FOLDER)));
this._bindings.Add(MsfsData.Instance.Register(new Binding(BindingKeys.AP_THROTTLE_SWITCH_AL_FOLDER)));
this._bindings.Add(MsfsData.Instance.Register(new Binding(BindingKeys.AP_VSPEED_SWITCH_AL_FOLDER)));
this._bindings.Add(MsfsData.Instance.Register(new Binding(BindingKeys.AP_YAW_DAMPER_AL_FOLDER)));

}

Expand Down Expand Up @@ -75,6 +75,7 @@ public override IEnumerable<String> GetButtonPressActionNames(DeviceType deviceT
this.CreateCommandName("Heading"),
this.CreateCommandName("Throttle"),
this.CreateCommandName("VS Speed"),
this.CreateCommandName("Yaw Damper"),
};
}
public override String GetAdjustmentDisplayName(String actionParameter, PluginImageSize imageSize)
Expand Down Expand Up @@ -103,37 +104,40 @@ public override BitmapImage GetCommandImage(String actionParameter, PluginImageS
switch (actionParameter)
{
case "LOC":
bitmapBuilder.SetBackgroundImage(this._bindings[14].ControllerValue == 1 ? EmbeddedResources.ReadImage(this._imageOnResourcePath) : EmbeddedResources.ReadImage(this._imageOffResourcePath));
bitmapBuilder.SetBackgroundImage(ImageTool.GetOnOffImage(this._bindings[14].ControllerValue));
break;
case "FD":
bitmapBuilder.SetBackgroundImage(this._bindings[8].ControllerValue == 1 ? EmbeddedResources.ReadImage(this._imageOnResourcePath) : EmbeddedResources.ReadImage(this._imageOffResourcePath));
bitmapBuilder.SetBackgroundImage(ImageTool.GetOnOffImage(this._bindings[8].ControllerValue));
break;
case "FLC":
bitmapBuilder.SetBackgroundImage(this._bindings[12].ControllerValue == 1 ? EmbeddedResources.ReadImage(this._imageOnResourcePath) : EmbeddedResources.ReadImage(this._imageOffResourcePath));
bitmapBuilder.SetBackgroundImage(ImageTool.GetOnOffImage(this._bindings[12].ControllerValue));
break;
case "APP":
bitmapBuilder.SetBackgroundImage(this._bindings[13].ControllerValue == 1 ? EmbeddedResources.ReadImage(this._imageOnResourcePath) : EmbeddedResources.ReadImage(this._imageOffResourcePath));
bitmapBuilder.SetBackgroundImage(ImageTool.GetOnOffImage(this._bindings[13].ControllerValue));
break;
case "Altitude":
bitmapBuilder.SetBackgroundImage(this._bindings[9].ControllerValue == 1 ? EmbeddedResources.ReadImage(this._imageOnResourcePath) : EmbeddedResources.ReadImage(this._imageOffResourcePath));
bitmapBuilder.SetBackgroundImage(ImageTool.GetOnOffImage(this._bindings[9].ControllerValue));
break;
case "Heading":
bitmapBuilder.SetBackgroundImage(this._bindings[16].ControllerValue == 1 ? EmbeddedResources.ReadImage(this._imageOnResourcePath) : EmbeddedResources.ReadImage(this._imageOffResourcePath));
bitmapBuilder.SetBackgroundImage(ImageTool.GetOnOffImage(this._bindings[16].ControllerValue));
break;
case "GPS":
bitmapBuilder.SetBackgroundImage(this._bindings[11].ControllerValue == 1 ? EmbeddedResources.ReadImage(this._imageOnResourcePath) : EmbeddedResources.ReadImage(this._imageOffResourcePath));
bitmapBuilder.SetBackgroundImage(ImageTool.GetOnOffImage(this._bindings[11].ControllerValue));
break;
case "Speed":
bitmapBuilder.SetBackgroundImage(this._bindings[15].ControllerValue == 1 ? EmbeddedResources.ReadImage(this._imageOnResourcePath) : EmbeddedResources.ReadImage(this._imageOffResourcePath));
bitmapBuilder.SetBackgroundImage(ImageTool.GetOnOffImage(this._bindings[15].ControllerValue));
break;
case "AP":
bitmapBuilder.SetBackgroundImage(this._bindings[10].ControllerValue == 1 ? EmbeddedResources.ReadImage(this._imageOnResourcePath) : EmbeddedResources.ReadImage(this._imageOffResourcePath));
bitmapBuilder.SetBackgroundImage(ImageTool.GetOnOffImage(this._bindings[10].ControllerValue));
break;
case "Throttle":
bitmapBuilder.SetBackgroundImage(this._bindings[17].ControllerValue == 1 ? EmbeddedResources.ReadImage(this._imageOnResourcePath) : EmbeddedResources.ReadImage(this._imageOffResourcePath));
bitmapBuilder.SetBackgroundImage(ImageTool.GetOnOffImage(this._bindings[17].ControllerValue));
break;
case "VS Speed":
bitmapBuilder.SetBackgroundImage(this._bindings[18].ControllerValue == 1 ? EmbeddedResources.ReadImage(this._imageOnResourcePath) : EmbeddedResources.ReadImage(this._imageOffResourcePath));
bitmapBuilder.SetBackgroundImage(ImageTool.GetOnOffImage(this._bindings[18].ControllerValue));
break;
case "Yaw Damper":
bitmapBuilder.SetBackgroundImage(ImageTool.GetOnOffImage(this._bindings[19].ControllerValue));
break;
}
bitmapBuilder.DrawText(actionParameter);
Expand Down Expand Up @@ -195,6 +199,9 @@ public override void RunCommand(String actionParameter)
case "VS Speed":
this._bindings[18].SetControllerValue(1);
break;
case "Yaw Damper":
this._bindings[19].SetControllerValue(1);
break;
case "Altitude Reset":
//this._bindings[18].SetControllerValue(1);
break;
Expand All @@ -220,14 +227,5 @@ public void Notify()
}
}

private Int64 ApplyAdjustment(Int64 value, Int32 min, Int32 max, Int32 steps, Int32 ticks)
{
value += ticks * steps;
if (value < min)
{ value = min; }
else if (value > max)
{ value = max; }
return value;
}
}
}
Loading

0 comments on commit 8b7b27f

Please sign in to comment.