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

Commit 53764c0

Browse files
committed
Second attempt to fix the pi-blaster device
1 parent 8be6135 commit 53764c0

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

libsrc/leddevice/LedDevicePiBlaster.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ int LedDevicePiBlaster::write(const std::vector<ColorRgb> & ledValues)
8383
std::vector<int> iPins = {4, 17, 18, 27, 21, 22, 23, 24, 25};
8484

8585
unsigned colorIdx = 0;
86-
for (std::vector<int>::iterator it = iPins.begin(); it != iPins.end(); ++it)
86+
for (unsigned iPin=0; iPin<iPins.size(); ++iPin)
8787
{
8888
double pwmDutyCycle = 0.0;
89-
switch (_channelAssignment[*it])
89+
switch (_channelAssignment[iPin])
9090
{
9191
case 'r':
9292
pwmDutyCycle = ledValues[colorIdx].red / 255.0;
@@ -104,7 +104,7 @@ int LedDevicePiBlaster::write(const std::vector<ColorRgb> & ledValues)
104104
continue;
105105
}
106106

107-
fprintf(_fid, "%i=%f\n", iChannel, pwmDutyCycle);
107+
fprintf(_fid, "%i=%f\n", iPins[iPin], pwmDutyCycle);
108108
fflush(_fid);
109109
}
110110

@@ -121,11 +121,11 @@ int LedDevicePiBlaster::switchOff()
121121

122122
std::vector<int> iPins = {4, 17, 18, 21, 22, 23, 24, 25};
123123

124-
for (std::vector<int>::iterator it = iPins.begin(); it != iPins.end(); ++it)
124+
for (unsigned iPin=0; iPin<iPins.size(); ++iPin)
125125
{
126-
if (_channelAssignment[*it] != ' ')
126+
if (_channelAssignment[iPin] != ' ')
127127
{
128-
fprintf(_fid, "%i=%f\n", *it, 0.0);
128+
fprintf(_fid, "%i=%f\n", iPins[iPin], 0.0);
129129
fflush(_fid);
130130
}
131131
}

0 commit comments

Comments
 (0)