mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
More logging migration. (#74)
Cleaned up old commented out printf statements. The piblaster stuff probably needs to be moved out of the devicefactory but Ill have to do that later
This commit is contained in:
parent
6327a38582
commit
faf5110558
@ -226,7 +226,7 @@ LedDevice * LedDeviceFactory::construct(const Json::Value & deviceConfig)
|
|||||||
const Json::Value gpioMapping = deviceConfig.get("gpiomap", Json::nullValue);
|
const Json::Value gpioMapping = deviceConfig.get("gpiomap", Json::nullValue);
|
||||||
|
|
||||||
if (assignment.length() > 0) {
|
if (assignment.length() > 0) {
|
||||||
std::cout << "ERROR: Sorry, the configuration syntax has changed in this version." << std::endl;
|
Error(log, "Piblaster: The piblaster configuration syntax has changed in this version.");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
if (! gpioMapping.isNull() ) {
|
if (! gpioMapping.isNull() ) {
|
||||||
@ -235,7 +235,7 @@ LedDevice * LedDeviceFactory::construct(const Json::Value & deviceConfig)
|
|||||||
|
|
||||||
device = devicePiBlaster;
|
device = devicePiBlaster;
|
||||||
} else {
|
} else {
|
||||||
std::cout << "ERROR: no gpiomap defined." << std::endl;
|
Error(log, "Piblaster: no gpiomap defined.");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,8 +22,6 @@ int update_number;
|
|||||||
int fragment_number;
|
int fragment_number;
|
||||||
|
|
||||||
LedDeviceUdp::LedDeviceUdp(const std::string& output, const unsigned baudrate, const unsigned protocol, const unsigned maxPacket)
|
LedDeviceUdp::LedDeviceUdp(const std::string& output, const unsigned baudrate, const unsigned protocol, const unsigned maxPacket)
|
||||||
//LedDeviceUdp::LedDeviceUdp(const std::string& output, const unsigned baudrate) :
|
|
||||||
// _ofs(output.empty()?"/home/pi/LedDevice.out":output.c_str())
|
|
||||||
{
|
{
|
||||||
std::string hostname;
|
std::string hostname;
|
||||||
std::string port;
|
std::string port;
|
||||||
@ -33,7 +31,6 @@ LedDeviceUdp::LedDeviceUdp(const std::string& output, const unsigned baudrate, c
|
|||||||
leds_per_pkt = 200;
|
leds_per_pkt = 200;
|
||||||
}
|
}
|
||||||
|
|
||||||
//printf ("leds_per_pkt is %d\n", leds_per_pkt);
|
|
||||||
int got_colon=0;
|
int got_colon=0;
|
||||||
for (unsigned int i=0; i<output.length(); i++) {
|
for (unsigned int i=0; i<output.length(); i++) {
|
||||||
if (output[i] == ':') {
|
if (output[i] == ':') {
|
||||||
@ -44,7 +41,6 @@ LedDeviceUdp::LedDeviceUdp(const std::string& output, const unsigned baudrate, c
|
|||||||
port+=output[i];
|
port+=output[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//std::cout << "output " << output << " hostname " << hostname << " port " << port <<std::endl;
|
|
||||||
assert(got_colon==1);
|
assert(got_colon==1);
|
||||||
|
|
||||||
int rv;
|
int rv;
|
||||||
@ -62,7 +58,8 @@ LedDeviceUdp::LedDeviceUdp(const std::string& output, const unsigned baudrate, c
|
|||||||
for(p = servinfo; p != NULL; p = p->ai_next) {
|
for(p = servinfo; p != NULL; p = p->ai_next) {
|
||||||
if ((sockfd = socket(p->ai_family, p->ai_socktype,
|
if ((sockfd = socket(p->ai_family, p->ai_socktype,
|
||||||
p->ai_protocol)) == -1) {
|
p->ai_protocol)) == -1) {
|
||||||
perror("talker: socket");
|
Error(_log,"talker: socket %s", strerror(errno));
|
||||||
|
// perror("talker: socket");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,7 +95,6 @@ int LedDeviceUdp::write(const std::vector<ColorRgb> & ledValues)
|
|||||||
udpbuffer[i++] = color.green;
|
udpbuffer[i++] = color.green;
|
||||||
udpbuffer[i++] = color.blue;
|
udpbuffer[i++] = color.blue;
|
||||||
}
|
}
|
||||||
//printf ("c.red %d sz c.red %d\n", color.red, sizeof(color.red));
|
|
||||||
}
|
}
|
||||||
sendto(sockfd, udpbuffer, i, 0, p->ai_addr, p->ai_addrlen);
|
sendto(sockfd, udpbuffer, i, 0, p->ai_addr, p->ai_addrlen);
|
||||||
}
|
}
|
||||||
|
@ -313,7 +313,6 @@ int LedDeviceWS2812b::write(const std::vector<ColorRgb> &ledValues)
|
|||||||
unsigned int wireBit = 1; // Holds the current bit we will set in PWMWaveform, start with 1 and skip the other two for speed
|
unsigned int wireBit = 1; // Holds the current bit we will set in PWMWaveform, start with 1 and skip the other two for speed
|
||||||
|
|
||||||
// Copy PWM waveform to DMA's data buffer
|
// Copy PWM waveform to DMA's data buffer
|
||||||
//printf("Copying %d words to DMA data buffer\n", NUM_DATA_WORDS);
|
|
||||||
struct control_data_s *ctl = (struct control_data_s *)virtbase;
|
struct control_data_s *ctl = (struct control_data_s *)virtbase;
|
||||||
dma_cb_t *cbp = ctl->cb;
|
dma_cb_t *cbp = ctl->cb;
|
||||||
|
|
||||||
@ -335,10 +334,7 @@ int LedDeviceWS2812b::write(const std::vector<ColorRgb> &ledValues)
|
|||||||
for(size_t i=0; i<mLedCount; i++)
|
for(size_t i=0; i<mLedCount; i++)
|
||||||
{
|
{
|
||||||
// Create bits necessary to represent one color triplet (in GRB, not RGB, order)
|
// Create bits necessary to represent one color triplet (in GRB, not RGB, order)
|
||||||
//printf("RGB: %d, %d, %d\n", ledValues[i].red, ledValues[i].green, ledValues[i].blue);
|
|
||||||
colorBits = ((unsigned int)ledValues[i].red << 8) | ((unsigned int)ledValues[i].green << 16) | ledValues[i].blue;
|
colorBits = ((unsigned int)ledValues[i].red << 8) | ((unsigned int)ledValues[i].green << 16) | ledValues[i].blue;
|
||||||
//printBinary(colorBits, 24);
|
|
||||||
//printf(" (binary, GRB order)\n");
|
|
||||||
|
|
||||||
// Iterate through color bits to get wire bits
|
// Iterate through color bits to get wire bits
|
||||||
for(int j=23; j>=0; j--) {
|
for(int j=23; j>=0; j--) {
|
||||||
@ -380,7 +376,6 @@ int LedDeviceWS2812b::write(const std::vector<ColorRgb> &ledValues)
|
|||||||
#ifdef WS2812_ASM_OPTI
|
#ifdef WS2812_ASM_OPTI
|
||||||
// calculate the bits manually since it is not needed with asm
|
// calculate the bits manually since it is not needed with asm
|
||||||
//wireBit += mLedCount * 24 *3;
|
//wireBit += mLedCount * 24 *3;
|
||||||
//printf(" %d\n", wireBit);
|
|
||||||
#endif
|
#endif
|
||||||
//remove one to undo optimization
|
//remove one to undo optimization
|
||||||
wireBit --;
|
wireBit --;
|
||||||
@ -390,9 +385,6 @@ int LedDeviceWS2812b::write(const std::vector<ColorRgb> &ledValues)
|
|||||||
startbitPattern = (1 << (rest-1)); // set new bitpattern to start at the benigining of one bit (3 bit in wave form)
|
startbitPattern = (1 << (rest-1)); // set new bitpattern to start at the benigining of one bit (3 bit in wave form)
|
||||||
rest += 32; // add one int extra for pwm
|
rest += 32; // add one int extra for pwm
|
||||||
|
|
||||||
// printBinary(startbitPattern, 32);
|
|
||||||
// printf(" startbit\n");
|
|
||||||
|
|
||||||
unsigned int oldwireBitValue = wireBit;
|
unsigned int oldwireBitValue = wireBit;
|
||||||
unsigned int oldbitPattern = startbitPattern;
|
unsigned int oldbitPattern = startbitPattern;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user