mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
Second attempt to fix the pi-blaster device
Former-commit-id: 53764c0169093bb50e0e9a64dc9112c3bebdf0f4
This commit is contained in:
parent
b3db42810c
commit
a8c8a6a0d9
@ -83,10 +83,10 @@ int LedDevicePiBlaster::write(const std::vector<ColorRgb> & ledValues)
|
||||
std::vector<int> iPins = {4, 17, 18, 27, 21, 22, 23, 24, 25};
|
||||
|
||||
unsigned colorIdx = 0;
|
||||
for (std::vector<int>::iterator it = iPins.begin(); it != iPins.end(); ++it)
|
||||
for (unsigned iPin=0; iPin<iPins.size(); ++iPin)
|
||||
{
|
||||
double pwmDutyCycle = 0.0;
|
||||
switch (_channelAssignment[*it])
|
||||
switch (_channelAssignment[iPin])
|
||||
{
|
||||
case 'r':
|
||||
pwmDutyCycle = ledValues[colorIdx].red / 255.0;
|
||||
@ -104,7 +104,7 @@ int LedDevicePiBlaster::write(const std::vector<ColorRgb> & ledValues)
|
||||
continue;
|
||||
}
|
||||
|
||||
fprintf(_fid, "%i=%f\n", iChannel, pwmDutyCycle);
|
||||
fprintf(_fid, "%i=%f\n", iPins[iPin], pwmDutyCycle);
|
||||
fflush(_fid);
|
||||
}
|
||||
|
||||
@ -121,11 +121,11 @@ int LedDevicePiBlaster::switchOff()
|
||||
|
||||
std::vector<int> iPins = {4, 17, 18, 21, 22, 23, 24, 25};
|
||||
|
||||
for (std::vector<int>::iterator it = iPins.begin(); it != iPins.end(); ++it)
|
||||
for (unsigned iPin=0; iPin<iPins.size(); ++iPin)
|
||||
{
|
||||
if (_channelAssignment[*it] != ' ')
|
||||
if (_channelAssignment[iPin] != ' ')
|
||||
{
|
||||
fprintf(_fid, "%i=%f\n", *it, 0.0);
|
||||
fprintf(_fid, "%i=%f\n", iPins[iPin], 0.0);
|
||||
fflush(_fid);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user