Skip to content

Commit 06ef2aa

Browse files
author
Marcus Sonestedt
committed
TestServoPID: Add test that just calls setup() / loop()
1 parent a341cfb commit 06ef2aa

File tree

5 files changed

+21
-3
lines changed

5 files changed

+21
-3
lines changed

ServoPID.sln

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServoPidControl", "ServoPID
99
EndProject
1010
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{CC0AF209-905C-441A-B514-14BEF063E465}"
1111
ProjectSection(SolutionItems) = preProject
12-
PCA9684-Arduino\PCA9685.cpp = PCA9684-Arduino\PCA9685.cpp
13-
PCA9684-Arduino\PCA9685.h = PCA9684-Arduino\PCA9685.h
12+
LICENSE = LICENSE
13+
README.md = README.md
1414
servopid.ino = servopid.ino
1515
EndProjectSection
1616
EndProject

TestServoPID/TestServoPID.vcxproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@
162162
</ClCompile>
163163
<ClCompile Include="TestPID.cpp" />
164164
<ClCompile Include="TestSerial.cpp" />
165+
<ClCompile Include="TestSetupAndLoop.cpp" />
165166
</ItemGroup>
166167
<ItemGroup>
167168
<None Include="README.md" />

TestServoPID/TestServoPID.vcxproj.filters

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@
3333
<ClCompile Include="TestSerial.cpp">
3434
<Filter>Source Files</Filter>
3535
</ClCompile>
36+
<ClCompile Include="TestSetupAndLoop.cpp">
37+
<Filter>Source Files</Filter>
38+
</ClCompile>
3639
</ItemGroup>
3740
<ItemGroup>
3841
<None Include="README.md" />

TestServoPID/TestSetupAndLoop.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#include "pch.h"
2+
3+
#include "../servopid.ino"
4+
5+
TEST(TestSetupAndLoop, TestSetup)
6+
{
7+
setup();
8+
}
9+
10+
TEST(TestSetupAndLoop, TestSetupAndLoop)
11+
{
12+
setup();
13+
loop();
14+
}

servopid.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ void handleSerialCommand()
369369
return;
370370
}
371371

372-
auto& servoPid = PidServos[serialBuf[2]];
372+
auto& servoPid = PidServos[int(serialBuf[2])];
373373
const auto value = *reinterpret_cast<float*>(serialBuf + 4);
374374
switch (ServoParam(serialBuf[3]))
375375
{

0 commit comments

Comments
 (0)