Skip to content

Commit

Permalink
Add Config File with JIT on by default to all Project Templates (#89)
Browse files Browse the repository at this point in the history
* Add meadow.config.yaml file on project templates with JIT enabled by default

* Fix F7Feather comments
  • Loading branch information
jorgedevs authored Oct 23, 2022
1 parent 0b1e27c commit 1c88579
Show file tree
Hide file tree
Showing 12 changed files with 79 additions and 55 deletions.
7 changes: 6 additions & 1 deletion Meadow.CSharp.Template/Meadow.CSharp.Application.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,9 @@
<PackageReference Include="Meadow.F7" Version="0.*" />
<PackageReference Include="Meadow.Foundation" Version="0.*" />
</ItemGroup>
</Project>
<ItemGroup>
<None Update="meadow.config.yaml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
1 change: 1 addition & 0 deletions Meadow.CSharp.Template/Meadow.CSharp.Template.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<None Include="meadow.config.yaml" />
<None Include="MeadowApp.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
Expand Down
100 changes: 50 additions & 50 deletions Meadow.CSharp.Template/MeadowApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,65 +9,65 @@

namespace $safeprojectname$
{
// Change F7FeatherV2 to F7FeatherV1 for V1.x boards
// Change F7FeatherV2 to F7FeatherV1 for V1.x boards
public class MeadowApp : App<F7FeatherV2>
{
RgbPwmLed onboardLed;
RgbPwmLed onboardLed;

public override Task Run()
{
Console.WriteLine("Run...");
public override Task Run()
{
Console.WriteLine("Run...");

CycleColors(TimeSpan.FromMilliseconds(1000));
return base.Run();
}
CycleColors(TimeSpan.FromMilliseconds(1000));
return base.Run();
}

public override Task Initialize()
{
Console.WriteLine("Initialize...");
public override Task Initialize()
{
Console.WriteLine("Initialize...");

onboardLed = new RgbPwmLed(device: Device,
redPwmPin: Device.Pins.OnboardLedRed,
greenPwmPin: Device.Pins.OnboardLedGreen,
bluePwmPin: Device.Pins.OnboardLedBlue,
CommonType.CommonAnode);
onboardLed = new RgbPwmLed(device: Device,
redPwmPin: Device.Pins.OnboardLedRed,
greenPwmPin: Device.Pins.OnboardLedGreen,
bluePwmPin: Device.Pins.OnboardLedBlue,
CommonType.CommonAnode);

return base.Initialize();
}
return base.Initialize();
}

void CycleColors(TimeSpan duration)
{
Console.WriteLine("Cycle colors...");
void CycleColors(TimeSpan duration)
{
Console.WriteLine("Cycle colors...");

while (true)
{
ShowColorPulse(Color.Blue, duration);
ShowColorPulse(Color.Cyan, duration);
ShowColorPulse(Color.Green, duration);
ShowColorPulse(Color.GreenYellow, duration);
ShowColorPulse(Color.Yellow, duration);
ShowColorPulse(Color.Orange, duration);
ShowColorPulse(Color.OrangeRed, duration);
ShowColorPulse(Color.Red, duration);
ShowColorPulse(Color.MediumVioletRed, duration);
ShowColorPulse(Color.Purple, duration);
ShowColorPulse(Color.Magenta, duration);
ShowColorPulse(Color.Pink, duration);
}
}
while (true)
{
ShowColorPulse(Color.Blue, duration);
ShowColorPulse(Color.Cyan, duration);
ShowColorPulse(Color.Green, duration);
ShowColorPulse(Color.GreenYellow, duration);
ShowColorPulse(Color.Yellow, duration);
ShowColorPulse(Color.Orange, duration);
ShowColorPulse(Color.OrangeRed, duration);
ShowColorPulse(Color.Red, duration);
ShowColorPulse(Color.MediumVioletRed, duration);
ShowColorPulse(Color.Purple, duration);
ShowColorPulse(Color.Magenta, duration);
ShowColorPulse(Color.Pink, duration);
}
}

void ShowColorPulse(Color color, TimeSpan duration)
{
onboardLed.StartPulse(color, duration / 2);
Thread.Sleep(duration);
onboardLed.Stop();
}
void ShowColorPulse(Color color, TimeSpan duration)
{
onboardLed.StartPulse(color, duration / 2);
Thread.Sleep(duration);
onboardLed.Stop();
}

void ShowColor(Color color, TimeSpan duration)
{
onboardLed.SetColor(color);
Thread.Sleep(duration);
onboardLed.Stop();
}
}
void ShowColor(Color color, TimeSpan duration)
{
onboardLed.SetColor(color);
Thread.Sleep(duration);
onboardLed.Stop();
}
}
}
2 changes: 2 additions & 0 deletions Meadow.CSharp.Template/meadow.config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
MonoControl:
Options: --jit
7 changes: 6 additions & 1 deletion Meadow.FSharp.Template/Meadow.FSharp.Application.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,9 @@
<PackageReference Include="Meadow.F7" Version="0.*" />
<PackageReference Include="Meadow.Foundation" Version="0.*" />
</ItemGroup>
</Project>
<ItemGroup>
<None Update="meadow.config.yaml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
1 change: 1 addition & 0 deletions Meadow.FSharp.Template/Meadow.FSharp.Template.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
<Content Include="meadow_icon.png" />
</ItemGroup>
<ItemGroup>
<None Include="meadow.config.yaml" />
<None Include="Meadow.FSharp.Application.fsproj" />
<None Include="Program.fs" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Meadow.FSharp.Template/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ open Meadow.Foundation
open Meadow.Peripherals.Leds

type MeadowApp() =
// Change F7MicroV2 to F7Micro for V1.x boards
// Change F7FeatherV2 to F7FeatherV1 for V1.x boards
inherit App<F7FeatherV2>()

let mutable led : RgbPwmLed =
Expand Down
2 changes: 2 additions & 0 deletions Meadow.FSharp.Template/meadow.config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
MonoControl:
Options: --jit
7 changes: 6 additions & 1 deletion Meadow.VBNet.Template/Meadow.VBNet.Application.vbproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,9 @@
<PackageReference Include="Meadow.F7" Version="0.*" />
<PackageReference Include="Meadow.Foundation" Version="0.*" />
</ItemGroup>
</Project>
<ItemGroup>
<None Update="meadow.config.yaml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
1 change: 1 addition & 0 deletions Meadow.VBNet.Template/Meadow.VBNet.Template.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
<Content Include="meadow_icon.png" />
</ItemGroup>
<ItemGroup>
<None Include="meadow.config.yaml" />
<None Include="Meadow.VBNet.Application.vbproj" />
<None Include="MeadowApp.vb" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Meadow.VBNet.Template/MeadowApp.vb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Imports Meadow.Foundation.Leds
Imports Meadow.Peripherals.Leds

Public Class MeadowApp
'Change F7MicroV2 to F7Micro for V1.x boards'
'Change F7FeatherV2 to F7FeatherV1 for V1.x boards'
Inherits App(Of F7FeatherV2)

Private onboardLed As RgbPwmLed
Expand Down
2 changes: 2 additions & 0 deletions Meadow.VBNet.Template/meadow.config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
MonoControl:
Options: --jit

0 comments on commit 1c88579

Please sign in to comment.