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" },
|
// { "gpio" : 4, "ledindex" : 0, "ledcolor" : "r" },
|
||||||
#define TABLE_SZ sizeof(_gpio_to_led)/sizeof(_gpio_to_led[0])
|
#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_led[i] = -1;
|
||||||
_gpio_to_color[i] = 'z';
|
_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();
|
const std::string ledcolor = gpioMap.get("ledcolor","z").asString();
|
||||||
// printf ("got gpio %d ledindex %d color %c\n", gpio,ledindex, ledcolor[0]);
|
// printf ("got gpio %d ledindex %d color %c\n", gpio,ledindex, ledcolor[0]);
|
||||||
// ignore missing/invalid settings
|
// 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_led[gpio] = ledindex;
|
||||||
_gpio_to_color[gpio] = ledcolor[0]; // 1st char of string
|
_gpio_to_color[gpio] = ledcolor[0]; // 1st char of string
|
||||||
} else {
|
} else {
|
||||||
|
@ -17,7 +17,7 @@ struct addrinfo hints, *servinfo, *p;
|
|||||||
//char udpbuffer[1024];
|
//char udpbuffer[1024];
|
||||||
int sockfd;
|
int sockfd;
|
||||||
int ledprotocol;
|
int ledprotocol;
|
||||||
int leds_per_pkt;
|
unsigned leds_per_pkt;
|
||||||
int update_number;
|
int update_number;
|
||||||
int fragment_number;
|
int fragment_number;
|
||||||
|
|
||||||
|
@ -666,15 +666,15 @@ void LedDeviceWS2812b::initHardware()
|
|||||||
// Allocate memory for the DMA control block & data to be sent
|
// Allocate memory for the DMA control block & data to be sent
|
||||||
// ---------------------------------------------------------------
|
// ---------------------------------------------------------------
|
||||||
virtbase = (uint8_t *) mmap(
|
virtbase = (uint8_t *) mmap(
|
||||||
NULL, // Address
|
NULL, // Address
|
||||||
NUM_PAGES * PAGE_SIZE, // Length
|
NUM_PAGES * PAGE_SIZE, // Length
|
||||||
PROT_READ | PROT_WRITE, // Protection
|
PROT_READ | PROT_WRITE, // Protection
|
||||||
MAP_SHARED | // Shared
|
MAP_SHARED | // Shared
|
||||||
MAP_ANONYMOUS | // Not file-based, init contents to 0
|
MAP_ANONYMOUS | // Not file-based, init contents to 0
|
||||||
MAP_NORESERVE | // Don't reserve swap space
|
MAP_NORESERVE | // Don't reserve swap space
|
||||||
MAP_LOCKED, // Lock in RAM (don't swap)
|
MAP_LOCKED, // Lock in RAM (don't swap)
|
||||||
-1, // File descriptor
|
-1, // File descriptor
|
||||||
0); // Offset
|
0); // Offset
|
||||||
|
|
||||||
if (virtbase == MAP_FAILED)
|
if (virtbase == MAP_FAILED)
|
||||||
{
|
{
|
||||||
|
@ -13,7 +13,14 @@
|
|||||||
|
|
||||||
LedDeviceWs2812SPI::LedDeviceWs2812SPI(const std::string& outputDevice, const unsigned baudrate) :
|
LedDeviceWs2812SPI::LedDeviceWs2812SPI(const std::string& outputDevice, const unsigned baudrate) :
|
||||||
LedSpiDevice(outputDevice, baudrate, 0),
|
LedSpiDevice(outputDevice, baudrate, 0),
|
||||||
mLedCount(0)
|
mLedCount(0),
|
||||||
|
bitpair_to_byte {
|
||||||
|
0b10001000,
|
||||||
|
0b10001100,
|
||||||
|
0b11001000,
|
||||||
|
0b11001100,
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
// empty
|
// empty
|
||||||
}
|
}
|
||||||
|
@ -42,11 +42,5 @@ private:
|
|||||||
size_t mLedCount;
|
size_t mLedCount;
|
||||||
std::vector<uint8_t> _spiBuffer;
|
std::vector<uint8_t> _spiBuffer;
|
||||||
|
|
||||||
uint8_t bitpair_to_byte[4] = {
|
uint8_t bitpair_to_byte[4];
|
||||||
0b10001000,
|
|
||||||
0b10001100,
|
|
||||||
0b11001000,
|
|
||||||
0b11001100,
|
|
||||||
};
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user