diff --git a/include/led-matrix.h b/include/led-matrix.h index 5b90568..706e862 100644 --- a/include/led-matrix.h +++ b/include/led-matrix.h @@ -91,11 +91,6 @@ public: // Flag: --led-pwm-lsb-nanoseconds int pwm_lsb_nanoseconds; - // Allow to use the hardware subsystem to create pulses. This won't do - // anything if output enable is not connected to GPIO 18. - // Flag: --led-hardware-pulse - bool allow_hardware_pulsing; - // The initial brightness of the panel in percent. Valid range is 1..100 // Default: 100 // Flag: --led-brightness @@ -105,6 +100,14 @@ public: // Flag: --led-scan-mode int scan_mode; + // Disable the PWM hardware subsystem to create pulses. + // Typically, you don't want to disable hardware pulsing, this is mostly + // for debugging and figuring out if there is interference with the + // sound system. + // This won't do anything if output enable is not connected to GPIO 18 in + // non-standard wirings. + // Flag: --led-hardware-pulse + bool disable_hardware_pulsing; bool show_refresh_rate; // Flag: --led-show-refresh bool swap_green_blue; // Flag: --led-swap-green-blue bool inverse_colors; // Flag: --led-inverse diff --git a/lib/led-matrix.cc b/lib/led-matrix.cc index 079d0cc..86aa3fe 100644 --- a/lib/led-matrix.cc +++ b/lib/led-matrix.cc @@ -121,12 +121,6 @@ RGBMatrix::Options::Options() pwm_lsb_nanoseconds(130), #endif -#ifdef DISABLE_HARDWARE_PULSES - allow_hardware_pulsing(false), -#else - allow_hardware_pulsing(true), -#endif - brightness(100), #ifdef RGB_SCAN_INTERLACED @@ -135,6 +129,12 @@ RGBMatrix::Options::Options() scan_mode(0), #endif +#ifdef DISABLE_HARDWARE_PULSES + disable_hardware_pulsing(true), +#else + disable_hardware_pulsing(false), +#endif + #ifdef SHOW_REFRESH_RATE show_refresh_rate(true), #else @@ -197,7 +197,7 @@ void RGBMatrix::SetGPIO(GPIO *io, bool start_thread) { if (io != NULL && io_ == NULL) { io_ = io; internal::Framebuffer::InitGPIO(io_, params_.rows, params_.parallel, - params_.allow_hardware_pulsing, + !params_.disable_hardware_pulsing, params_.pwm_lsb_nanoseconds); } if (start_thread) { diff --git a/lib/options-initialize.cc b/lib/options-initialize.cc index 70070d6..e1bf31f 100644 --- a/lib/options-initialize.cc +++ b/lib/options-initialize.cc @@ -131,8 +131,11 @@ static bool FlagInit(int &argc, char **&argv, continue; if (ConsumeBoolFlag("swap-green-blue", it, &mopts->swap_green_blue)) continue; - if (ConsumeBoolFlag("hardware-pulse", it, &mopts->allow_hardware_pulsing)) + bool allow_hardware_pulsing = !mopts->disable_hardware_pulsing; + if (ConsumeBoolFlag("hardware-pulse", it, &allow_hardware_pulsing)) { + mopts->disable_hardware_pulsing = !allow_hardware_pulsing; continue; + } // Runtime options. if (ConsumeIntFlag("slowdown-gpio", it, end, &ropts->gpio_slowdown, &err)) @@ -296,8 +299,8 @@ void PrintMatrixFlags(FILE *out, const RGBMatrix::Options &d, d.inverse_colors ? "no-" : "", d.inverse_colors ? "off" : "on", d.swap_green_blue ? "no-" : "", d.swap_green_blue ? "off" : "on", d.pwm_lsb_nanoseconds, - d.allow_hardware_pulsing ? "no-" : "", - d.allow_hardware_pulsing ? "Don't u" : "U"); + !d.disable_hardware_pulsing ? "no-" : "", + !d.disable_hardware_pulsing ? "Don't u" : "U"); fprintf(out, "\t--led-slowdown-gpio=<0..2>: " "Slowdown GPIO. Needed for faster Pis and/or slower panels "