Skip to content
This repository was archived by the owner on May 6, 2021. It is now read-only.

Commit 668084e

Browse files
committed
Update LedDevicePiBlaster.cpp
updated for the new version of pi-blaster
1 parent 650ce3b commit 668084e

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

libsrc/leddevice/LedDevicePiBlaster.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,14 @@ int LedDevicePiBlaster::write(const std::vector<ColorRgb> & ledValues)
7979
{
8080
return -1;
8181
}
82+
83+
std::vector<int> iPins = {4, 17, 18, 27, 21, 22, 23, 24, 25};
8284

8385
unsigned colorIdx = 0;
84-
for (unsigned iChannel=0; iChannel<8; ++iChannel)
86+
for (std::vector<int>::iterator it = iPins.begin; it != iPins.end(); ++it)
8587
{
8688
double pwmDutyCycle = 0.0;
87-
switch (_channelAssignment[iChannel])
89+
switch (_channelAssignment[*it])
8890
{
8991
case 'r':
9092
pwmDutyCycle = ledValues[colorIdx].red / 255.0;
@@ -117,11 +119,13 @@ int LedDevicePiBlaster::switchOff()
117119
return -1;
118120
}
119121

120-
for (unsigned iChannel=0; iChannel<8; ++iChannel)
122+
std::vector<int> iPins = {4, 17, 18, 21, 22, 23, 24, 25};
123+
124+
for (std::vector<int>::iterator it = iPins.begin; it != iPins.end(); ++it)
121125
{
122-
if (_channelAssignment[iChannel] != ' ')
126+
if (_channelAssignment[*it] != ' ')
123127
{
124-
fprintf(_fid, "%i=%f\n", iChannel, 0.0);
128+
fprintf(_fid, "%i=%f\n", *it, 0.0);
125129
fflush(_fid);
126130
}
127131
}

0 commit comments

Comments
 (0)