mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
Fixed minor issue and removed unsued includes
Former-commit-id: 87c86459a7a1be1705a837ee0f73e88c8de2ae53
This commit is contained in:
parent
0823ba4513
commit
888239e910
@ -1,21 +1,15 @@
|
||||
|
||||
// STL includes
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <iostream>
|
||||
|
||||
// Linux includes
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
// hyperion local includes
|
||||
#include "LedDeviceAtmo.h"
|
||||
|
||||
LedDeviceAtmo::LedDeviceAtmo(const std::string& outputDevice, const unsigned baudrate) :
|
||||
LedRs232Device(outputDevice, baudrate),
|
||||
_ledBuffer(0)
|
||||
_ledBuffer(4 + 5*3) // 4-byte header, 5 RGB values
|
||||
{
|
||||
_ledBuffer.resize(4 + 3*5);
|
||||
_ledBuffer[0] = 0xFF; // Startbyte
|
||||
_ledBuffer[1] = 0x00; // StartChannel(Low)
|
||||
_ledBuffer[2] = 0x00; // StartChannel(High)
|
||||
@ -28,12 +22,12 @@ int LedDeviceAtmo::write(const std::vector<ColorRgb> &ledValues)
|
||||
// (19 bytes) for the hardware to recognize the data
|
||||
if (ledValues.size() != 5)
|
||||
{
|
||||
printf("AtmoLight: %d channels configured. This should always be 5!\n", ledValues.size());
|
||||
std::cerr << "AtmoLight: " << ledValues.size() << " channels configured. This should always be 5!" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// write data
|
||||
memcpy(4 + _ledBuffer.data(), ledValues.data(), ledValues.size() * 3);
|
||||
memcpy(4 + _ledBuffer.data(), ledValues.data(), ledValues.size() * sizeof(ColorRgb));
|
||||
return writeBytes(_ledBuffer.size(), _ledBuffer.data());
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ 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 (std::vector<int>::iterator it = iPins.begin(); it != iPins.end(); ++it)
|
||||
{
|
||||
double pwmDutyCycle = 0.0;
|
||||
switch (_channelAssignment[*it])
|
||||
@ -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", iChannel, pwmDutyCycle);
|
||||
fflush(_fid);
|
||||
}
|
||||
|
||||
@ -121,7 +121,7 @@ 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 (std::vector<int>::iterator it = iPins.begin(); it != iPins.end(); ++it)
|
||||
{
|
||||
if (_channelAssignment[*it] != ' ')
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user