From faf511055864d6bbde05491d7f49ae74ea2f2a6e Mon Sep 17 00:00:00 2001 From: penfold42 Date: Thu, 30 Jun 2016 00:49:05 +1000 Subject: [PATCH] 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 --- libsrc/leddevice/LedDeviceFactory.cpp | 4 ++-- libsrc/leddevice/LedDeviceUdp.cpp | 8 ++------ libsrc/leddevice/LedDeviceWS2812b.cpp | 8 -------- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/libsrc/leddevice/LedDeviceFactory.cpp b/libsrc/leddevice/LedDeviceFactory.cpp index 068eb98b..8ebbd99e 100755 --- a/libsrc/leddevice/LedDeviceFactory.cpp +++ b/libsrc/leddevice/LedDeviceFactory.cpp @@ -226,7 +226,7 @@ LedDevice * LedDeviceFactory::construct(const Json::Value & deviceConfig) const Json::Value gpioMapping = deviceConfig.get("gpiomap", Json::nullValue); 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); } if (! gpioMapping.isNull() ) { @@ -235,7 +235,7 @@ LedDevice * LedDeviceFactory::construct(const Json::Value & deviceConfig) device = devicePiBlaster; } else { - std::cout << "ERROR: no gpiomap defined." << std::endl; + Error(log, "Piblaster: no gpiomap defined."); exit(EXIT_FAILURE); } } diff --git a/libsrc/leddevice/LedDeviceUdp.cpp b/libsrc/leddevice/LedDeviceUdp.cpp index 42a858ce..480e6e29 100644 --- a/libsrc/leddevice/LedDeviceUdp.cpp +++ b/libsrc/leddevice/LedDeviceUdp.cpp @@ -22,8 +22,6 @@ int update_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) : -// _ofs(output.empty()?"/home/pi/LedDevice.out":output.c_str()) { std::string hostname; std::string port; @@ -33,7 +31,6 @@ LedDeviceUdp::LedDeviceUdp(const std::string& output, const unsigned baudrate, c leds_per_pkt = 200; } -//printf ("leds_per_pkt is %d\n", leds_per_pkt); int got_colon=0; for (unsigned int i=0; iai_next) { if ((sockfd = socket(p->ai_family, p->ai_socktype, p->ai_protocol)) == -1) { - perror("talker: socket"); + Error(_log,"talker: socket %s", strerror(errno)); +// perror("talker: socket"); continue; } @@ -98,7 +95,6 @@ int LedDeviceUdp::write(const std::vector & ledValues) udpbuffer[i++] = color.green; 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); } diff --git a/libsrc/leddevice/LedDeviceWS2812b.cpp b/libsrc/leddevice/LedDeviceWS2812b.cpp index c012639b..0fff95d6 100644 --- a/libsrc/leddevice/LedDeviceWS2812b.cpp +++ b/libsrc/leddevice/LedDeviceWS2812b.cpp @@ -313,7 +313,6 @@ int LedDeviceWS2812b::write(const std::vector &ledValues) 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 - //printf("Copying %d words to DMA data buffer\n", NUM_DATA_WORDS); struct control_data_s *ctl = (struct control_data_s *)virtbase; dma_cb_t *cbp = ctl->cb; @@ -335,10 +334,7 @@ int LedDeviceWS2812b::write(const std::vector &ledValues) for(size_t i=0; i=0; j--) { @@ -380,7 +376,6 @@ int LedDeviceWS2812b::write(const std::vector &ledValues) #ifdef WS2812_ASM_OPTI // calculate the bits manually since it is not needed with asm //wireBit += mLedCount * 24 *3; - //printf(" %d\n", wireBit); #endif //remove one to undo optimization wireBit --; @@ -390,9 +385,6 @@ int LedDeviceWS2812b::write(const std::vector &ledValues) 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 -// printBinary(startbitPattern, 32); -// printf(" startbit\n"); - unsigned int oldwireBitValue = wireBit; unsigned int oldbitPattern = startbitPattern;