Skip to content

Commit e9076f1

Browse files
author
Marcus Sonestedt
committed
Add MSI file generation + semver to servopidcontrol
1 parent 5f30b6c commit e9076f1

File tree

9 files changed

+232
-36
lines changed

9 files changed

+232
-36
lines changed

ServoPID.sln

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Adafruit-PWM-Servo-Driver",
2020
Adafruit-PWM-Servo-Driver-Library\Adafruit_PWMServoDriver.h = Adafruit-PWM-Servo-Driver-Library\Adafruit_PWMServoDriver.h
2121
EndProjectSection
2222
EndProject
23+
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "ServoPidControlSetup", "ServoPidControlSetup\ServoPidControlSetup.wixproj", "{D6D93CD3-04CD-4E19-8242-EF0FF7ECFCD5}"
24+
EndProject
2325
Global
2426
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2527
Debug|Any CPU = Debug|Any CPU
@@ -54,6 +56,14 @@ Global
5456
{96237EB6-57EC-451E-A34B-A645B3D5E17B}.Release|x64.Build.0 = Release|Any CPU
5557
{96237EB6-57EC-451E-A34B-A645B3D5E17B}.Release|x86.ActiveCfg = Release|Any CPU
5658
{96237EB6-57EC-451E-A34B-A645B3D5E17B}.Release|x86.Build.0 = Release|Any CPU
59+
{D6D93CD3-04CD-4E19-8242-EF0FF7ECFCD5}.Debug|Any CPU.ActiveCfg = Debug|x86
60+
{D6D93CD3-04CD-4E19-8242-EF0FF7ECFCD5}.Debug|x64.ActiveCfg = Debug|x86
61+
{D6D93CD3-04CD-4E19-8242-EF0FF7ECFCD5}.Debug|x86.ActiveCfg = Debug|x86
62+
{D6D93CD3-04CD-4E19-8242-EF0FF7ECFCD5}.Debug|x86.Build.0 = Debug|x86
63+
{D6D93CD3-04CD-4E19-8242-EF0FF7ECFCD5}.Release|Any CPU.ActiveCfg = Release|x86
64+
{D6D93CD3-04CD-4E19-8242-EF0FF7ECFCD5}.Release|x64.ActiveCfg = Release|x86
65+
{D6D93CD3-04CD-4E19-8242-EF0FF7ECFCD5}.Release|x86.ActiveCfg = Release|x86
66+
{D6D93CD3-04CD-4E19-8242-EF0FF7ECFCD5}.Release|x86.Build.0 = Release|x86
5767
EndGlobalSection
5868
GlobalSection(SolutionProperties) = preSolution
5969
HideSolutionNode = FALSE

ServoPIDControl/Properties/AssemblyInfo.cs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
using System.Reflection;
2-
using System.Resources;
3-
using System.Runtime.CompilerServices;
42
using System.Runtime.InteropServices;
53
using System.Windows;
64

75
// General Information about an assembly is controlled through the following
86
// set of attributes. Change these attribute values to modify the information
97
// associated with an assembly.
108
[assembly: AssemblyTitle("ServoPIDControl")]
11-
[assembly: AssemblyDescription("")]
9+
[assembly: AssemblyDescription("Control program for Arduino Servo PID")]
1210
[assembly: AssemblyConfiguration("")]
13-
[assembly: AssemblyCompany("")]
14-
[assembly: AssemblyProduct("ServoPIDControl")]
15-
[assembly: AssemblyCopyright("Copyright © 2019")]
11+
[assembly: AssemblyCompany("Marcus Sonestedt")]
12+
[assembly: AssemblyProduct("Arduiono ServoPID Control")]
13+
[assembly: AssemblyCopyright("Copyright © Marcus Sonestedt 2019")]
1614
[assembly: AssemblyTrademark("")]
1715
[assembly: AssemblyCulture("")]
1816

@@ -51,5 +49,5 @@
5149
// You can specify all the values or you can default the Build and Revision Numbers
5250
// by using the '*' as shown below:
5351
// [assembly: AssemblyVersion("1.0.*")]
54-
[assembly: AssemblyVersion("1.0.0.0")]
55-
[assembly: AssemblyFileVersion("1.0.0.0")]
52+
//[assembly: AssemblyVersion("1.0.0.0")]
53+
//[assembly: AssemblyFileVersion("1.0.0.0")]

ServoPIDControl/ServoPidControl.csproj

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="..\packages\GitVersionTask.5.0.0\build\GitVersionTask.props" Condition="Exists('..\packages\GitVersionTask.5.0.0\build\GitVersionTask.props')" />
34
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
45
<PropertyGroup>
56
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -14,6 +15,8 @@
1415
<WarningLevel>4</WarningLevel>
1516
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
1617
<Deterministic>true</Deterministic>
18+
<NuGetPackageImportStamp>
19+
</NuGetPackageImportStamp>
1720
</PropertyGroup>
1821
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1922
<PlatformTarget>AnyCPU</PlatformTarget>
@@ -154,4 +157,12 @@
154157
<Folder Include="Tests\" />
155158
</ItemGroup>
156159
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
160+
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
161+
<PropertyGroup>
162+
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
163+
</PropertyGroup>
164+
<Error Condition="!Exists('..\packages\GitVersionTask.5.0.0\build\GitVersionTask.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\GitVersionTask.5.0.0\build\GitVersionTask.props'))" />
165+
<Error Condition="!Exists('..\packages\GitVersionTask.5.0.0\build\GitVersionTask.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\GitVersionTask.5.0.0\build\GitVersionTask.targets'))" />
166+
</Target>
167+
<Import Project="..\packages\GitVersionTask.5.0.0\build\GitVersionTask.targets" Condition="Exists('..\packages\GitVersionTask.5.0.0\build\GitVersionTask.targets')" />
157168
</Project>

ServoPIDControl/packages.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<packages>
33
<package id="Castle.Core" version="4.4.0" targetFramework="net472" />
44
<package id="ControlzEx" version="3.0.2.4" targetFramework="net472" />
5+
<package id="GitVersionTask" version="5.0.0" targetFramework="net472" developmentDependency="true" />
56
<package id="MahApps.Metro" version="1.6.5" targetFramework="net472" />
67
<package id="Microsoft.Maps.MapControl.WPF" version="1.0.0.3" targetFramework="net472" />
78
<package id="Moq" version="4.12.0" targetFramework="net472" />

ServoPidControlSetup/Product.wxs

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
3+
xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension">
4+
5+
<?define ServoPidControl_TargetDir = $(var.ServoPidControl.TargetDir)?>
6+
7+
<!-- Product name as you want it to appear in Add/Remove Programs-->
8+
<?if $(var.Platform) = x64 ?>
9+
<?define ProductName = "Arduino ServoPID Control (64 bit)" ?>
10+
<?define Win64 = "yes" ?>
11+
<?define PlatformProgramFilesFolder = "ProgramFiles64Folder" ?>
12+
<?else ?>
13+
<?define ProductName = "Arduino ServoPID Control" ?>
14+
<?define Win64 = "no" ?>
15+
<?define PlatformProgramFilesFolder = "ProgramFilesFolder" ?>
16+
<?endif ?>
17+
18+
<?define InstallName = "$(var.ProductName) Setup" ?>
19+
20+
<Product Id="*" Name="ServoPidControlSetup" Language="1033" Version="!(bind.fileVersion.fil98E434A3D16D3BA191E09BFF8689F70E)" Manufacturer="Marcus Sonestedt" UpgradeCode="2e6a5032-2d70-4ecd-9af1-66c9a3ce4e4b">
21+
<Package InstallerVersion="200" InstallPrivileges="elevated" InstallScope="perMachine" Platform="$(var.Platform)" Compressed="yes" Description="$(var.ProductName)" />
22+
23+
<MajorUpgrade AllowDowngrades="yes" Schedule="afterInstallInitialize" />
24+
<MediaTemplate EmbedCab="yes" />
25+
26+
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />
27+
<UIRef Id="WixUI_InstallDir" />
28+
29+
<Property Id="INSTALLLOCATION">
30+
<RegistrySearch Id="RegistrySearch" Type="raw" Root="HKLM" Win64="$(var.Win64)" Key="Software\Company\Product" Name="InstallLocation" />
31+
</Property>
32+
33+
<Property Id="ARPHELPLINK" Value="https://github.com/marcusl/ArduinoServoPID" />
34+
35+
<Feature Id="ProductFeature" Title="ServoPidControlSetup" Level="1">
36+
<ComponentGroupRef Id="ServoPidControl.Binaries" />
37+
<ComponentGroupRef Id="ServoPidControl.Content" />
38+
<ComponentGroupRef Id="ServoPidControl.Satellites" />
39+
<Component Directory='INSTALLLOCATION'>
40+
<RegistryValue Root='HKCU' Key='SOFTWARE\ServoPidControl' Name='InstallLocation' Value='[INSTALLLOCATION]' Type='string' />
41+
<RemoveFolder Id='CleanupApplicationFolder' On='uninstall' />
42+
</Component>
43+
</Feature>
44+
45+
<!-- Not supported yet? https://github.com/wixtoolset/issues/issues/5575
46+
<PropertyRef Id="NETFRAMEWORK471" />
47+
<Condition Message="You must install Microsoft .NET 4.7.1">
48+
<![CDATA[Installed OR NETFRAMEWORK471]]>
49+
</Condition>
50+
-->
51+
<PropertyRef Id="NETFRAMEWORK45" />
52+
<Condition Message="[ProductName] Requires .NET Framework 4.7.2 or later to be installed">
53+
<![CDATA[Installed OR (NETFRAMEWORK45 AND NETFRAMEWORK45 >= "#461814")]]> <!-- see https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed -->
54+
</Condition>
55+
56+
<InstallExecuteSequence>
57+
<InstallExecute After="RemoveExistingProducts" />
58+
</InstallExecuteSequence>
59+
</Product>
60+
61+
<Fragment>
62+
<Directory Id="TARGETDIR" Name="SourceDir">
63+
<Directory Id="ProgramFilesFolder">
64+
<Directory Id="INSTALLLOCATION" Name="$(var.InstallName)"/>
65+
</Directory>
66+
</Directory>
67+
</Fragment>
68+
</Wix>
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" DefaultTargets="Build" InitialTargets="EnsureWixToolsetInstalled" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
6+
<ProductVersion>3.10</ProductVersion>
7+
<ProjectGuid>d6d93cd3-04cd-4e19-8242-ef0ff7ecfcd5</ProjectGuid>
8+
<SchemaVersion>2.0</SchemaVersion>
9+
<OutputName>ServoPidControlSetup</OutputName>
10+
<OutputType>Package</OutputType>
11+
</PropertyGroup>
12+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
13+
<OutputPath>bin\$(Configuration)\</OutputPath>
14+
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
15+
<DefineConstants>Debug</DefineConstants>
16+
</PropertyGroup>
17+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
18+
<OutputPath>bin\$(Configuration)\</OutputPath>
19+
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
20+
</PropertyGroup>
21+
<ItemGroup>
22+
<Compile Include="Product.wxs" />
23+
</ItemGroup>
24+
<ItemGroup>
25+
<ProjectReference Include="..\ServoPIDControl\ServoPidControl.csproj">
26+
<Name>ServoPidControl</Name>
27+
<Project>{96237eb6-57ec-451e-a34b-a645b3d5e17b}</Project>
28+
<Private>True</Private>
29+
<DoNotHarvest>
30+
</DoNotHarvest>
31+
<RefProjectOutputGroups>Binaries;Symbols;Sources;Content;Satellites;Documents</RefProjectOutputGroups>
32+
<RefTargetDir>INSTALLLOCATION</RefTargetDir>
33+
</ProjectReference>
34+
</ItemGroup>
35+
<ItemGroup>
36+
<WixExtension Include="WixUIExtension">
37+
<HintPath>$(WixExtDir)\WixUIExtension.dll</HintPath>
38+
<Name>WixUIExtension</Name>
39+
</WixExtension>
40+
<WixExtension Include="WixNetFxExtension">
41+
<HintPath>$(WixExtDir)\WixNetFxExtension.dll</HintPath>
42+
<Name>WixNetFxExtension</Name>
43+
</WixExtension>
44+
</ItemGroup>
45+
<ItemGroup>
46+
<Folder Include="obj\" />
47+
<Folder Include="obj\Release\" />
48+
</ItemGroup>
49+
<ItemGroup>
50+
<EmbeddedResource Include="Strings.wxl" />
51+
</ItemGroup>
52+
<PropertyGroup>
53+
<EnableProjectHarvesting>True</EnableProjectHarvesting>
54+
</PropertyGroup>
55+
<Import Project="$(WixTargetsPath)" Condition=" '$(WixTargetsPath)' != '' " />
56+
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets" Condition=" '$(WixTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets') " />
57+
<Target Name="EnsureWixToolsetInstalled" Condition=" '$(WixTargetsImported)' != 'true' ">
58+
<Error Text="The WiX Toolset v3.11 (or newer) build tools must be installed to build this project. To download the WiX Toolset, see http://wixtoolset.org/releases/" />
59+
</Target>
60+
61+
<Target Name="BeforeBuild">
62+
<GetAssemblyIdentity AssemblyFiles="..\ServoPidControl\bin\$(Configuration)\ServoPidControl.exe">
63+
<Output TaskParameter="Assemblies" ItemName="AsmInfo" />
64+
</GetAssemblyIdentity>
65+
<CreateProperty Value="ServoPidControl Setup %(AsmInfo.Version) $(Platform) $(Configuration)">
66+
<Output TaskParameter="Value" PropertyName="TargetName" />
67+
</CreateProperty>
68+
</Target>
69+
<!--
70+
To modify your build process, add your task inside one of the targets below and uncomment it.
71+
Other similar extension points exist, see Wix.targets.
72+
<Target Name="BeforeBuild">
73+
</Target>
74+
<Target Name="AfterBuild">
75+
</Target>
76+
-->
77+
</Project>

ServoPidControlSetup/Strings.wxl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<WixLocalization Culture="en-US" xmlns="http://schemas.microsoft.com/wix/2006/localization">
3+
<String Id="WelcomeDlgTitle">{\WixUI_Font_Bigger}Welcome to the [ProductName] [ProductVersion] Setup Wizard</String>
4+
</WixLocalization>

TestServoPID/AdafruitPwmServoDriverMock.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
#include "AdafruitPwmServoDriverMock.h"
44

5-
Adafruit_PWMServoDriver::~Adafruit_PWMServoDriver() = default;
6-
75
void Adafruit_PWMServoDriver::setPin(uint8_t num, uint16_t val, bool invert) {
86
// Clamp value between 0 and 4095 inclusive.
97
val = std::min(val, (uint16_t)4095);

TestServoPID/AdafruitPwmServoDriverMock.h

Lines changed: 55 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -18,31 +18,60 @@
1818
#define ALLLED_OFF_L 0xFC /**< load all the LEDn_OFF registers, byte 0 */
1919
#define ALLLED_OFF_H 0xFD /**< load all the LEDn_OFF registers, byte 1 */
2020

21-
class Adafruit_PWMServoDriver {
22-
public:
23-
Adafruit_PWMServoDriver(uint8_t addr = 0x40, void *I2C = nullptr) : _i2caddr(addr), _i2c(I2C) {}
24-
~Adafruit_PWMServoDriver();
25-
26-
27-
28-
void begin(uint8_t prescale = 0) {}
29-
void reset() {}
30-
void sleep() {}
31-
void wakeup() {}
32-
void setExtClk(uint8_t prescale) {}
33-
void setPWMFreq(float freq) { _freq = freq; }
34-
void setOutputMode(bool totempole) { _outputMode = totempole; }
35-
uint8_t getPWM(uint8_t num) { return (_pwmOff[num] - _pwmOn[num]) / (4096/256); }
36-
void setPWM(uint8_t num, uint16_t on, uint16_t off) { _pwmOn[num] = on; _pwmOff[num] = off; }
37-
void setPin(uint8_t num, uint16_t val, bool invert=false);
38-
39-
public:
40-
std::array<uint16_t, 16> _pwmOn;
41-
std::array<uint16_t, 16> _pwmOff;
42-
float _freq;
43-
bool _outputMode;
21+
// ReSharper disable CppMemberFunctionMayBeStatic
22+
23+
24+
class Adafruit_PWMServoDriver
25+
{
26+
public:
27+
Adafruit_PWMServoDriver(uint8_t addr = 0x40, void* I2C = nullptr)
28+
: _i2caddr(addr), _i2c(I2C)
29+
{
30+
}
31+
32+
~Adafruit_PWMServoDriver() = default;
33+
34+
void begin(uint8_t prescale = 0)
35+
{
36+
}
37+
38+
void reset()
39+
{
40+
}
41+
42+
void sleep()
43+
{
44+
}
45+
46+
void wakeup()
47+
{
48+
}
49+
50+
void setExtClk(uint8_t prescale)
51+
{
52+
}
53+
54+
void setPWMFreq(float freq) { _freq = freq; }
55+
void setOutputMode(bool totempole) { _outputMode = totempole; }
56+
uint8_t getPWM(uint8_t num) { return (_pwmOff[num] - _pwmOn[num]) / (4096 / 256); }
57+
58+
void setPWM(uint8_t num, uint16_t on, uint16_t off)
59+
{
60+
_pwmOn[num] = on;
61+
_pwmOff[num] = off;
62+
}
63+
64+
void setPin(uint8_t num, uint16_t val, bool invert = false);
65+
66+
public:
67+
std::array<uint16_t, 16> _pwmOn;
68+
std::array<uint16_t, 16> _pwmOff;
69+
float _freq = 60;
70+
bool _outputMode = false;
4471

4572
private:
46-
void *_i2c;
47-
uint8_t _i2caddr;
48-
};
73+
void* _i2c = nullptr;
74+
uint8_t _i2caddr = 0x40;
75+
};
76+
77+
// ReSharper restore CppMemberFunctionMayBeStatic

0 commit comments

Comments
 (0)