From 667b90fafc0e875476605e6264a1c6260a566231 Mon Sep 17 00:00:00 2001 From: Wizmo2 Date: Mon, 30 Oct 2023 19:24:23 -0400 Subject: [PATCH 1/4] ledvu-update-clean --- README.md | 20 +++---- components/led_strip/led_strip.c | 3 - components/led_strip/led_vu.c | 29 +++++----- components/led_strip/led_vu.h | 1 + components/platform_console/cmd_config.c | 7 ++- components/services/accessors.c | 13 ++--- components/services/accessors.h | 1 + components/squeezelite/displayer.c | 16 +++--- plugin/SqueezeESP32/Plugin.pm | 3 + plugin/SqueezeESP32/RgbLed.pm | 72 ++++++++++++++++++++++++ 10 files changed, 123 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index b5d08da6..4a575dbf 100644 --- a/README.md +++ b/README.md @@ -321,18 +321,18 @@ See [set_GPIO](#set-gpio) for how to set the green and red LEDs (including addre NB: For named configuration, GPIO affected to green and red LED cannot be changed but brightness option applies ### LED Strip -One LED strip with up to 255 addressable LEDs can be configured to offer enhanced visualizations. The LED strip can also be controlled remotely though the LMS server (using the CLI interface). Currently only WS2812B LEDs are supported. Set the LED Strip configuration (or NVS led_vu_config) to `WS2812,length=,gpio=, where is the number of leds in the strip (1..255), and is the data pin.` - -The latest LMS plugin update is required to set the visualizer mode and brightness, in the ESP32 settings page for the player. The plugin also adds the following CLI command options +One LED strip with up to 255 addressable LEDs can be configured to offer enhanced visualizations. The VU Meter visualizer includes a battery status indicator (see Battery). Currently only WS2812B LEDs are supported. Set the LED Strip hardware configuration, or the NVS led_vu_config syntax is ``` - led_visual [] [brightness(1-255)] - Toggles or selects the visulaizer mode. - The visualizer brighness can be controled using the optional tag. - - dmx [] - Sets the LED at position "offset" to any RGB color where "R"(red),"G"(green), and "B"(blue) are values from 0(off) to 255(max brightness). - Add additional RGB values to the delimited string to set multiple LEDs. +type=[WS2812],length=,gpio=[,scale=] ``` +where `` is the number of LEDs in the strip (1..255). A `` gain value (percentage) can be added to enhance effect responses. + +The latest LMS plugin update is required to set the visualizer mode and brightness in the ESP32 Settings page for the player, or a controllable display (see Extra/SqueezeESP32 menus). The plugin adds additional LMS CLI commands. + +| Command | Notes | +| -------------------------------------------------- | ----------- | +| \ led_visual \[\\] \[\\] | Toggles or selects the visualizer "mode".
The visualizer brightness(0..255) can be controlled using the "brightness" tag. | +| \ dmx \ \[\\] | Sets the LED color starting at position "offset"
with "R"(red),"G"(green),and "B"(blue) color sequences.
Add additional RGB values to the delimited string to set multiple LEDs.
| ### Rotary Encoder One rotary encoder is supported, quadrature shift with press. Such encoders usually have 2 pins for encoders (A and B), and common C that must be set to ground and an optional SW pin for press. A, B and SW must be pulled up, so automatic pull-up is provided by ESP32, but you can add your own resistors. A bit of filtering on A and B (~470nF) helps for debouncing which is not made by software. diff --git a/components/led_strip/led_strip.c b/components/led_strip/led_strip.c index 89f9f466..f3c983c9 100644 --- a/components/led_strip/led_strip.c +++ b/components/led_strip/led_strip.c @@ -293,11 +293,8 @@ bool led_strip_init(struct led_strip_t *led_strip) static EXT_RAM_ATTR StackType_t xStack[LED_STRIP_TASK_SIZE] __attribute__ ((aligned (4))); if ((led_strip == NULL) || - (led_strip->rmt_channel >= RMT_CHANNEL_MAX) || - (led_strip->gpio > GPIO_NUM_33) || (led_strip->led_strip_working == NULL) || (led_strip->led_strip_showing == NULL) || - (led_strip->led_strip_length == 0) || (led_strip->access_semaphore == NULL)) { return false; } diff --git a/components/led_strip/led_vu.c b/components/led_strip/led_vu.c index 1db3449c..b1680823 100644 --- a/components/led_strip/led_vu.c +++ b/components/led_strip/led_vu.c @@ -55,6 +55,7 @@ static EXT_RAM_ATTR struct { int vu_start_l; int vu_start_r; int vu_status; + int vu_scale; } strip; static int led_addr(int pos ) { @@ -76,25 +77,17 @@ static void battery_svc(float value, int cells) { */ void led_vu_init() { - char* p; char* config = config_alloc_get_str("led_vu_config", NULL, "N/A"); - // Initialize led VU strip - char* drivername = strcasestr(config, "WS2812"); - - if ((p = strcasestr(config, "length")) != NULL) { - strip.length = atoi(strchr(p, '=') + 1); - } // else 0 - if ((p = strcasestr(config, "gpio")) != NULL) { - strip.gpio = atoi(strchr(p, '=') + 1); - } else { - strip.gpio = LED_VU_DEFAULT_GPIO; - } + PARSE_PARAM(config, "length",'=', strip.length); + PARSE_PARAM(config, "gpio",'=', strip.gpio); // check for valid configuration - if (!drivername || !strip.gpio) { + if (!strip.gpio) { ESP_LOGI(TAG, "led_vu configuration invalid"); goto done; } + strip.vu_scale = 100; + PARSE_PARAM(config, "scale",'=',strip.vu_scale); battery_handler_chain = battery_handler_svc; battery_handler_svc = battery_svc; @@ -114,7 +107,7 @@ void led_vu_init() strip.vu_start_r = strip.vu_length + 1; strip.vu_status = strip.vu_length; } - ESP_LOGI(TAG, "vu meter using length:%d left:%d right:%d status:%d", strip.vu_length, strip.vu_start_l, strip.vu_start_r, strip.vu_status); + ESP_LOGI(TAG, "vu meter using length:%d left:%d right:%d status:%d scale:%d", strip.vu_length, strip.vu_start_l, strip.vu_start_r, strip.vu_status, strip.vu_scale); // create driver configuration led_strip_config.rgb_led_type = RGB_LED_TYPE_WS2812; @@ -157,6 +150,14 @@ uint16_t led_vu_string_length() { return (uint16_t)strip.length; } +/**************************************************************************************** + * Returns a user defined scale (percent) + */ +uint16_t led_vu_scale() { + if (!led_display) return 0; + return (uint16_t)strip.vu_scale; +} + /**************************************************************************************** * Turns all LEDs off (Black) */ diff --git a/components/led_strip/led_vu.h b/components/led_strip/led_vu.h index eedf3b38..ff07fe7a 100644 --- a/components/led_strip/led_vu.h +++ b/components/led_strip/led_vu.h @@ -21,6 +21,7 @@ extern struct led_strip_t* led_display; uint16_t led_vu_string_length(); +uint16_t led_vu_scale(); void led_vu_progress_bar(int pct, int bright); void led_vu_display(int vu_l, int vu_r, int bright, bool comet); void led_vu_spin_dial(int gain, int rate, int speed, bool comet); diff --git a/components/platform_console/cmd_config.c b/components/platform_console/cmd_config.c index e2db2c9c..3861b192 100644 --- a/components/platform_console/cmd_config.c +++ b/components/platform_console/cmd_config.c @@ -115,6 +115,7 @@ static struct { struct arg_str *type; struct arg_int *length; struct arg_int *gpio; + struct arg_int * scale; struct arg_lit *clear; struct arg_end *end; } ledvu_args; @@ -657,7 +658,7 @@ static int do_cspot_config(int argc, char **argv) { #endif static int do_ledvu_cmd(int argc, char **argv) { - ledvu_struct_t ledvu = {.type = "WS2812", .gpio = -1, .length = 0}; + ledvu_struct_t ledvu = {.type = "WS2812", .gpio = -1, .length = 0, .scale = 100}; esp_err_t err = ESP_OK; int nerrors = arg_parse(argc, argv, (void **)&ledvu_args); if (ledvu_args.clear->count) { @@ -685,6 +686,8 @@ static int do_ledvu_cmd(int argc, char **argv) { } else { ledvu.length = ledvu_args.length->count > 0 ? ledvu_args.length->ival[0] : 0; } + ledvu.scale = ledvu_args.scale->count>0?ledvu_args.scale->ival[0]:ledvu.scale; + if (!nerrors) { fprintf(f, "Storing ledvu parameters.\n"); @@ -914,6 +917,7 @@ cJSON *ledvu_cb() { } else { cJSON_AddStringToObject(values, "type", "WS2812"); } + cJSON_AddNumberToObject(values,"scale",ledvu->scale); return values; } @@ -1314,6 +1318,7 @@ void register_ledvu_config(void) { ledvu_args.type = arg_str1(NULL, "type", "|WS2812", "Led type (supports one rgb strip to display built in effects and allow remote control through 'dmx' messaging)"); ledvu_args.length = arg_int1(NULL, "length", "<1..255>", "Strip length (1-255 supported)"); ledvu_args.gpio = arg_int1(NULL, "gpio", "gpio", "Data pin"); + ledvu_args.scale = arg_int0(NULL,"scale","","Gain scale (precent)"); ledvu_args.clear = arg_lit0(NULL, "clear", "Clear configuration"); ledvu_args.end = arg_end(4); diff --git a/components/services/accessors.c b/components/services/accessors.c index a633db32..f8d8d647 100644 --- a/components/services/accessors.c +++ b/components/services/accessors.c @@ -329,7 +329,7 @@ esp_err_t config_ledvu_set(ledvu_struct_t * config){ esp_err_t err=ESP_OK; char * config_buffer=malloc_init_external(buffer_size); if(config_buffer) { - snprintf(config_buffer,buffer_size,"%s,length=%i,gpio=%i",config->type, config->length, config->gpio); + snprintf(config_buffer,buffer_size,"%s,length=%i,gpio=%i,scale=%i",config->type, config->length, config->gpio, config->scale); log_send_messaging(MESSAGING_INFO,"Updating ledvu configuration to %s",config_buffer); err = config_set_value(NVS_TYPE_STR, "led_vu_config", config_buffer); if(err!=ESP_OK){ @@ -761,14 +761,13 @@ const rotary_struct_t * config_rotary_get() { */ const ledvu_struct_t * config_ledvu_get() { - static ledvu_struct_t ledvu={ .type = "WS2812", .gpio = -1, .length = 0}; + static ledvu_struct_t ledvu={ .type = "WS2812", .gpio = -1, .length = 0, .scale= 100 }; char *config = config_alloc_get_default(NVS_TYPE_STR, "led_vu_config", NULL, 0); if (config && *config) { - char *p; - - // ToDo: Add code for future support of alternate led types - if ((p = strcasestr(config, "gpio")) != NULL) ledvu.gpio = atoi(strchr(p, '=') + 1); - if ((p = strcasestr(config, "length")) != NULL) ledvu.length = atoi(strchr(p, '=') + 1); + PARSE_PARAM_STR(config, "type", '=', ledvu.type, 15); + PARSE_PARAM(config, "gpio", '=', ledvu.gpio); + PARSE_PARAM(config, "length", '=', ledvu.length); + PARSE_PARAM(config, "scale", '=', ledvu.scale); free(config); } return &ledvu; diff --git a/components/services/accessors.h b/components/services/accessors.h index 67360f2f..f554c3aa 100644 --- a/components/services/accessors.h +++ b/components/services/accessors.h @@ -89,6 +89,7 @@ typedef struct { char type[16]; int length; int gpio; + int scale; } ledvu_struct_t; typedef struct { diff --git a/components/squeezelite/displayer.c b/components/squeezelite/displayer.c index e2cf1bf6..7096827b 100644 --- a/components/squeezelite/displayer.c +++ b/components/squeezelite/displayer.c @@ -216,7 +216,7 @@ static EXT_RAM_ATTR struct { static EXT_RAM_ATTR struct { int mode; - int n, style, max; + int n, style, max, gain; u16_t config; struct bar_s bars[MAX_BARS] ; } led_visu; @@ -1089,10 +1089,10 @@ static void displayer_update(void) { if (led_display && led_visu.mode) { // run built in visualizer effects if (led_visu.mode == VISU_VUMETER) { - vu_scale(led_visu.bars, led_visu.max, meters.levels); + vu_scale(led_visu.bars, led_visu.gain, meters.levels); led_vu_display(led_visu.bars[0].current, led_visu.bars[1].current, led_visu.max, led_visu.style); } else if (led_visu.mode == VISU_SPECTRUM) { - spectrum_scale(led_visu.n, led_visu.bars, led_visu.max, meters.samples); + spectrum_scale(led_visu.n, led_visu.bars, led_visu.gain, meters.samples); uint8_t* p = (uint8_t*) led_data; for (int i = 0; i < led_visu.n; i++) { *p = led_visu.bars[i].current; @@ -1100,7 +1100,7 @@ static void displayer_update(void) { } led_vu_spectrum(led_data, led_visu.max, led_visu.n, led_visu.style); } else if (led_visu.mode == VISU_WAVEFORM) { - spectrum_scale(led_visu.n, led_visu.bars, led_visu.max, meters.samples); + spectrum_scale(led_visu.n, led_visu.bars, led_visu.gain, meters.samples); led_vu_spin_dial( led_visu.bars[led_visu.n-2].current, led_visu.bars[(led_visu.n/2)+1].current * 50 / led_visu.max, @@ -1277,9 +1277,9 @@ static void ledv_handler( u8_t *data, int len) { led_visu.mode = pkt->which; led_visu.style = pkt->style; led_visu.max = pkt->bright; +led_visu.gain = led_visu.max * led_vu_scale() / 100; - led_vu_clear(); - if (led_visu.mode) { + if (led_visu.mode) { if (led_visu.mode == VISU_SPECTRUM) { led_visu.n = (led_visu.config < MAX_BARS) ? led_visu.config : MAX_BARS; spectrum_limits(led_visu.bars, 0, led_visu.n, 0, 0.25); @@ -1293,8 +1293,10 @@ static void ledv_handler( u8_t *data, int len) { // reset bars maximum for (int i = led_visu.n; --i >= 0;) led_visu.bars[i].max = 0; - LOG_INFO("LED Visualizer mode %u with bars:%u max:%u style:%d", led_visu.mode, led_visu.n, led_visu.max, led_visu.style); + LOG_INFO("LED Visualizer mode %u with bars:%u max:%u style:%d gain:%u", led_visu.mode, led_visu.n, led_visu.max, led_visu.style, led_visu.gain); } else { +led_vu_clear(); + LOG_INFO("Stopping led visualizer"); } diff --git a/plugin/SqueezeESP32/Plugin.pm b/plugin/SqueezeESP32/Plugin.pm index 628d31cf..fd46c61d 100644 --- a/plugin/SqueezeESP32/Plugin.pm +++ b/plugin/SqueezeESP32/Plugin.pm @@ -64,6 +64,9 @@ sub initPlugin { Slim::Control::Request::subscribe( sub { onNotification(@_) }, [ ['newmetadata'] ] ); Slim::Control::Request::subscribe( sub { onNotification(@_) }, [ ['playlist'], ['open', 'newsong'] ]); Slim::Control::Request::subscribe( \&onStopClear, [ ['playlist'], ['stop', 'clear'] ]); + + # Add menu item to extras + Slim::Buttons::Home::addSubMenu('PLUGINS', 'PLUGIN_SQUEEZEESP32', { 'useMode' => 'squeezeesp32_mode', }); } sub onStopClear { diff --git a/plugin/SqueezeESP32/RgbLed.pm b/plugin/SqueezeESP32/RgbLed.pm index a04c3741..278336c4 100644 --- a/plugin/SqueezeESP32/RgbLed.pm +++ b/plugin/SqueezeESP32/RgbLed.pm @@ -174,6 +174,20 @@ sub setLEDVisu { } updateLED($client); + + # display name + my $modes = ledVisualizerModes; + my $desc = $modes->[$visu]{'desc'}; + my $name = ''; + for (my $j = 0; $j < scalar @$desc; $j++) { + $name .= ' ' if ($j > 0); + $name .= $client->string(@{$desc}[$j]) || @{$desc}[$j]; + } + + $client->showBriefly( { + 'line1' => $client->string('PLUGIN_SQUEEZEESP32_LED_VISUALIZER'), + 'line2' => $name, + }); } sub onNotification { @@ -186,4 +200,62 @@ sub onNotification { } } +sub setMainMode { + my $client = shift; + my $method = shift; + if ($method eq 'pop') { + Slim::Buttons::Common::popMode($client); + $client->update(); + return; + } + + Slim::Buttons::Common::pushModeLeft($client, 'INPUT.Choice', { + 'listRef' => [ + { + name => string('PLUGIN_SQUEEZEESP32_LED_VISUALIZER'), + onPlay => sub { Slim::Control::Request::executeRequest($client, ['led_visual']); }, + }, + { + name => string('PLUGIN_SQUEEZEESP32_LED_BRIGHTNESS'), + onPlay => sub { Slim::Buttons::Common::pushModeLeft($client, 'squeezeesp32_ledvu_bright'); }, + }, + ], + 'header' => string('PLUGIN_SQUEEZEESP32'), + 'headerAddCount' => 1, + 'overlayRef' => sub { return (undef, shift->symbols('rightarrow')) }, + }); +} + +sub setLedvuBrightMode { + my $client = shift; + my $method = shift; + if ($method eq 'pop') { + Slim::Buttons::Common::popMode($client); + $client->update(); + return; + } + + my $bright = $prefs->client($client)->get('led_brightness'); + + Slim::Control::Request::executeRequest($client, ['led_visual',1,$bright]); + Slim::Buttons::Common::pushMode($client, 'INPUT.Bar', { + 'header' => 'PLUGIN_SQUEEZEESP32_LED_BRIGHTNESS', + 'stringHeader' => 1, + 'headerValue' => 'unscaled', + 'min' => 1, + 'max' => 255, + 'increment' => 1, + 'onChange' => sub { + my ($client, $value) = @_; + + $bright = $bright + $value; + if ($bright > 0 && $bright <= 255) { + $prefs->client($client)->set('led_brightness', $bright); + updateLED($client); + } + }, + 'valueRef' => $bright, + }); +} + 1; From f9d7e15d4be512044508b2a8b4dfe8b4d0346995 Mon Sep 17 00:00:00 2001 From: Wizmo2 Date: Sat, 4 Nov 2023 22:55:53 -0400 Subject: [PATCH 2/4] add suspend service --- components/led_strip/led_vu.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/components/led_strip/led_vu.c b/components/led_strip/led_vu.c index b1680823..db47c3a2 100644 --- a/components/led_strip/led_vu.c +++ b/components/led_strip/led_vu.c @@ -24,6 +24,7 @@ #include "monitor.h" #include "led_strip.h" #include "platform_config.h" +#include "services.h" #include "led_vu.h" static const char *TAG = "led_vu"; @@ -71,6 +72,8 @@ static void battery_svc(float value, int cells) { if (battery_handler_chain) battery_handler_chain(value, cells); } +static void led_vu_sleep(void) { led_vu_clear(led_display); } + /**************************************************************************************** * Initialize the led vu strip if configured. * @@ -131,6 +134,8 @@ void led_vu_init() // reserver max memory for remote management systems rmt_set_mem_block_num(led_strip_config.rmt_channel, 7); + services_sleep_setsuspend(led_vu_sleep); + led_vu_clear(led_display); done: From fc8d15f58df1d74b8723e63c52eacf4e79897bab Mon Sep 17 00:00:00 2001 From: Wizmo2 Date: Sat, 4 Nov 2023 23:07:25 -0400 Subject: [PATCH 3/4] formating changes --- components/platform_console/cmd_config.c | 6 +++--- components/squeezelite/displayer.c | 6 +++--- components/wifi-manager/webapp/src/bootswatch | 1 + 3 files changed, 7 insertions(+), 6 deletions(-) create mode 160000 components/wifi-manager/webapp/src/bootswatch diff --git a/components/platform_console/cmd_config.c b/components/platform_console/cmd_config.c index 3861b192..5599e83a 100644 --- a/components/platform_console/cmd_config.c +++ b/components/platform_console/cmd_config.c @@ -115,7 +115,7 @@ static struct { struct arg_str *type; struct arg_int *length; struct arg_int *gpio; - struct arg_int * scale; + struct arg_int * scale; struct arg_lit *clear; struct arg_end *end; } ledvu_args; @@ -686,7 +686,7 @@ static int do_ledvu_cmd(int argc, char **argv) { } else { ledvu.length = ledvu_args.length->count > 0 ? ledvu_args.length->ival[0] : 0; } - ledvu.scale = ledvu_args.scale->count>0?ledvu_args.scale->ival[0]:ledvu.scale; + ledvu.scale = ledvu_args.scale->count>0?ledvu_args.scale->ival[0]:ledvu.scale; if (!nerrors) { @@ -1318,7 +1318,7 @@ void register_ledvu_config(void) { ledvu_args.type = arg_str1(NULL, "type", "|WS2812", "Led type (supports one rgb strip to display built in effects and allow remote control through 'dmx' messaging)"); ledvu_args.length = arg_int1(NULL, "length", "<1..255>", "Strip length (1-255 supported)"); ledvu_args.gpio = arg_int1(NULL, "gpio", "gpio", "Data pin"); - ledvu_args.scale = arg_int0(NULL,"scale","","Gain scale (precent)"); + ledvu_args.scale = arg_int0(NULL,"scale","","Gain scale (precent)"); ledvu_args.clear = arg_lit0(NULL, "clear", "Clear configuration"); ledvu_args.end = arg_end(4); diff --git a/components/squeezelite/displayer.c b/components/squeezelite/displayer.c index 7096827b..99940cc8 100644 --- a/components/squeezelite/displayer.c +++ b/components/squeezelite/displayer.c @@ -1277,9 +1277,9 @@ static void ledv_handler( u8_t *data, int len) { led_visu.mode = pkt->which; led_visu.style = pkt->style; led_visu.max = pkt->bright; -led_visu.gain = led_visu.max * led_vu_scale() / 100; + led_visu.gain = led_visu.max * led_vu_scale() / 100; - if (led_visu.mode) { + if (led_visu.mode) { if (led_visu.mode == VISU_SPECTRUM) { led_visu.n = (led_visu.config < MAX_BARS) ? led_visu.config : MAX_BARS; spectrum_limits(led_visu.bars, 0, led_visu.n, 0, 0.25); @@ -1295,7 +1295,7 @@ led_visu.gain = led_visu.max * led_vu_scale() / 100; LOG_INFO("LED Visualizer mode %u with bars:%u max:%u style:%d gain:%u", led_visu.mode, led_visu.n, led_visu.max, led_visu.style, led_visu.gain); } else { -led_vu_clear(); + led_vu_clear(); LOG_INFO("Stopping led visualizer"); } diff --git a/components/wifi-manager/webapp/src/bootswatch b/components/wifi-manager/webapp/src/bootswatch new file mode 160000 index 00000000..3038872b --- /dev/null +++ b/components/wifi-manager/webapp/src/bootswatch @@ -0,0 +1 @@ +Subproject commit 3038872b8389763b64857bac00e102a71251a331 From e8c6169e09cfb6676ab4eaa6561f59b2a50140cb Mon Sep 17 00:00:00 2001 From: Wizmo2 Date: Sun, 5 Nov 2023 14:27:45 -0500 Subject: [PATCH 4/4] formating changes --- components/led_strip/led_vu.c | 8 +++++++- components/platform_console/cmd_config.c | 6 +++--- components/squeezelite/displayer.c | 6 +++--- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/components/led_strip/led_vu.c b/components/led_strip/led_vu.c index db47c3a2..0df24708 100644 --- a/components/led_strip/led_vu.c +++ b/components/led_strip/led_vu.c @@ -72,7 +72,13 @@ static void battery_svc(float value, int cells) { if (battery_handler_chain) battery_handler_chain(value, cells); } -static void led_vu_sleep(void) { led_vu_clear(led_display); } +/**************************************************************************************** + * Suspend. + * + */ +static void led_vu_sleep(void) { + led_vu_clear(led_display); +} /**************************************************************************************** * Initialize the led vu strip if configured. diff --git a/components/platform_console/cmd_config.c b/components/platform_console/cmd_config.c index 3861b192..5599e83a 100644 --- a/components/platform_console/cmd_config.c +++ b/components/platform_console/cmd_config.c @@ -115,7 +115,7 @@ static struct { struct arg_str *type; struct arg_int *length; struct arg_int *gpio; - struct arg_int * scale; + struct arg_int * scale; struct arg_lit *clear; struct arg_end *end; } ledvu_args; @@ -686,7 +686,7 @@ static int do_ledvu_cmd(int argc, char **argv) { } else { ledvu.length = ledvu_args.length->count > 0 ? ledvu_args.length->ival[0] : 0; } - ledvu.scale = ledvu_args.scale->count>0?ledvu_args.scale->ival[0]:ledvu.scale; + ledvu.scale = ledvu_args.scale->count>0?ledvu_args.scale->ival[0]:ledvu.scale; if (!nerrors) { @@ -1318,7 +1318,7 @@ void register_ledvu_config(void) { ledvu_args.type = arg_str1(NULL, "type", "|WS2812", "Led type (supports one rgb strip to display built in effects and allow remote control through 'dmx' messaging)"); ledvu_args.length = arg_int1(NULL, "length", "<1..255>", "Strip length (1-255 supported)"); ledvu_args.gpio = arg_int1(NULL, "gpio", "gpio", "Data pin"); - ledvu_args.scale = arg_int0(NULL,"scale","","Gain scale (precent)"); + ledvu_args.scale = arg_int0(NULL,"scale","","Gain scale (precent)"); ledvu_args.clear = arg_lit0(NULL, "clear", "Clear configuration"); ledvu_args.end = arg_end(4); diff --git a/components/squeezelite/displayer.c b/components/squeezelite/displayer.c index 7096827b..3d07af51 100644 --- a/components/squeezelite/displayer.c +++ b/components/squeezelite/displayer.c @@ -1277,9 +1277,9 @@ static void ledv_handler( u8_t *data, int len) { led_visu.mode = pkt->which; led_visu.style = pkt->style; led_visu.max = pkt->bright; -led_visu.gain = led_visu.max * led_vu_scale() / 100; + led_visu.gain = led_visu.max * led_vu_scale() / 100; - if (led_visu.mode) { + if (led_visu.mode) { if (led_visu.mode == VISU_SPECTRUM) { led_visu.n = (led_visu.config < MAX_BARS) ? led_visu.config : MAX_BARS; spectrum_limits(led_visu.bars, 0, led_visu.n, 0, 0.25); @@ -1295,7 +1295,7 @@ led_visu.gain = led_visu.max * led_vu_scale() / 100; LOG_INFO("LED Visualizer mode %u with bars:%u max:%u style:%d gain:%u", led_visu.mode, led_visu.n, led_visu.max, led_visu.style, led_visu.gain); } else { -led_vu_clear(); + led_vu_clear(); LOG_INFO("Stopping led visualizer"); }