Update LedDevicePiBlaster.cpp

updated for the new version of pi-blaster

Former-commit-id: 668084eefcb05f58e1f2e0ef6fc97ead2e540a65
This commit is contained in:
pckhib 2015-02-09 23:11:59 +01:00
parent a1d489f62f
commit 2076675e8d
1 changed files with 9 additions and 5 deletions

View File

@ -80,11 +80,13 @@ int LedDevicePiBlaster::write(const std::vector<ColorRgb> & ledValues)
return -1; return -1;
} }
std::vector<int> iPins = {4, 17, 18, 27, 21, 22, 23, 24, 25};
unsigned colorIdx = 0; unsigned colorIdx = 0;
for (unsigned iChannel=0; iChannel<8; ++iChannel) for (std::vector<int>::iterator it = iPins.begin; it != iPins.end(); ++it)
{ {
double pwmDutyCycle = 0.0; double pwmDutyCycle = 0.0;
switch (_channelAssignment[iChannel]) switch (_channelAssignment[*it])
{ {
case 'r': case 'r':
pwmDutyCycle = ledValues[colorIdx].red / 255.0; pwmDutyCycle = ledValues[colorIdx].red / 255.0;
@ -117,11 +119,13 @@ int LedDevicePiBlaster::switchOff()
return -1; return -1;
} }
for (unsigned iChannel=0; iChannel<8; ++iChannel) std::vector<int> iPins = {4, 17, 18, 21, 22, 23, 24, 25};
for (std::vector<int>::iterator it = iPins.begin; it != iPins.end(); ++it)
{ {
if (_channelAssignment[iChannel] != ' ') if (_channelAssignment[*it] != ' ')
{ {
fprintf(_fid, "%i=%f\n", iChannel, 0.0); fprintf(_fid, "%i=%f\n", *it, 0.0);
fflush(_fid); fflush(_fid);
} }
} }