mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
fix LedDeviceWs2812SPI to compile on gcc 4.6 (#643)
* Removed -HUP so the default -TERM signal is sent instead. - hyperiond only listens for TERM and INT. HUP is often used to get an exe to reread its config Changed pgrep to add '-x' so it wont partial match on the exe name. - I have multiple instances with multiple hyperiond-instance1 names - this ensures the service script only kills the right process * reversing errant change to hyperion.systemd.sh * cleaned up a couple of compiler warnings * moved bitpair_to_byte initialiser to (hopefully) work with older GCC * compiler warning in udp driver removed some tabs in ws2812b.cpp * formatting - spaces to tabs Former-commit-id: 42cc7325177c9fcc3d1bd29cbfe72f02118d3233
This commit is contained in:
parent
82f3fbdb20
commit
c179b86b8d
@ -27,7 +27,7 @@ LedDevicePiBlaster::LedDevicePiBlaster(const std::string & deviceName, const Jso
|
||||
// { "gpio" : 4, "ledindex" : 0, "ledcolor" : "r" },
|
||||
#define TABLE_SZ sizeof(_gpio_to_led)/sizeof(_gpio_to_led[0])
|
||||
|
||||
for (int i=0; i < TABLE_SZ; i++ )
|
||||
for (unsigned i=0; i < TABLE_SZ; i++ )
|
||||
{
|
||||
_gpio_to_led[i] = -1;
|
||||
_gpio_to_color[i] = 'z';
|
||||
@ -41,7 +41,7 @@ LedDevicePiBlaster::LedDevicePiBlaster(const std::string & deviceName, const Jso
|
||||
const std::string ledcolor = gpioMap.get("ledcolor","z").asString();
|
||||
// printf ("got gpio %d ledindex %d color %c\n", gpio,ledindex, ledcolor[0]);
|
||||
// ignore missing/invalid settings
|
||||
if ( (gpio >= 0) && (gpio < TABLE_SZ) && (ledindex >= 0) ){
|
||||
if ( (gpio >= 0) && (gpio < signed(TABLE_SZ)) && (ledindex >= 0) ){
|
||||
_gpio_to_led[gpio] = ledindex;
|
||||
_gpio_to_color[gpio] = ledcolor[0]; // 1st char of string
|
||||
} else {
|
||||
|
@ -17,7 +17,7 @@ struct addrinfo hints, *servinfo, *p;
|
||||
//char udpbuffer[1024];
|
||||
int sockfd;
|
||||
int ledprotocol;
|
||||
int leds_per_pkt;
|
||||
unsigned leds_per_pkt;
|
||||
int update_number;
|
||||
int fragment_number;
|
||||
|
||||
|
@ -13,7 +13,14 @@
|
||||
|
||||
LedDeviceWs2812SPI::LedDeviceWs2812SPI(const std::string& outputDevice, const unsigned baudrate) :
|
||||
LedSpiDevice(outputDevice, baudrate, 0),
|
||||
mLedCount(0)
|
||||
mLedCount(0),
|
||||
bitpair_to_byte {
|
||||
0b10001000,
|
||||
0b10001100,
|
||||
0b11001000,
|
||||
0b11001100,
|
||||
}
|
||||
|
||||
{
|
||||
// empty
|
||||
}
|
||||
|
@ -42,11 +42,5 @@ private:
|
||||
size_t mLedCount;
|
||||
std::vector<uint8_t> _spiBuffer;
|
||||
|
||||
uint8_t bitpair_to_byte[4] = {
|
||||
0b10001000,
|
||||
0b10001100,
|
||||
0b11001000,
|
||||
0b11001100,
|
||||
};
|
||||
|
||||
uint8_t bitpair_to_byte[4];
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user