diff --git a/components/display/display.c b/components/display/display.c index 33bf0b40..4a9fed68 100644 --- a/components/display/display.c +++ b/components/display/display.c @@ -106,6 +106,8 @@ static bool display_handler(u8_t *data, int len){ handle->vfdc_handler(data, len); } else if (!strncmp((char*) data, "grfe", 4)) { handle->grfe_handler(data, len); + } else if (!strncmp((char*) data, "grfb", 4)) { + handle->grfb_handler(data, len); } else { res = false; } diff --git a/components/display/driver_SSD1306.c b/components/display/driver_SSD1306.c index f2405e98..aa2d7290 100644 --- a/components/display/driver_SSD1306.c +++ b/components/display/driver_SSD1306.c @@ -36,6 +36,7 @@ static const char *TAG = "display"; static void vfdc_handler( u8_t *_data, int bytes_read); static void grfe_handler( u8_t *data, int len); +static void grfb_handler( u8_t *data, int len); static bool display_init(char *config, char *welcome); static void print_message(char *msg); @@ -44,6 +45,7 @@ struct display_handle_s SSD1306_handle = { print_message, vfdc_handler, grfe_handler, + grfb_handler, NULL, NULL, }; @@ -243,7 +245,7 @@ static void vfdc_handler( u8_t *_data, int bytes_read) { /**************************************************************************************** * Process graphic display data */ -void grfe_handler( u8_t *data, int len) { +static void grfe_handler( u8_t *data, int len) { data += 8; len -= 8; @@ -293,4 +295,20 @@ void grfe_handler( u8_t *data, int len) { #endif } +/**************************************************************************************** + * Process graphic display data + */ +static void grfb_handler(u8_t *data, int len) { + s16_t brightness = htons(*(uint16_t*) (data + 4)); + + ESP_LOGI(TAG, "brightness %hx", brightness); + if (brightness < 0) { + SSD1306_DisplayOff( &Display ); + } else { + SSD1306_DisplayOn( &Display ); + SSD1306_SetContrast( &Display, brightness * 256 / 4 - 1); + } +} + + diff --git a/plugin/SqueezeESP32.zip b/plugin/SqueezeESP32.zip index ddffccc8..e8aba5c1 100644 Binary files a/plugin/SqueezeESP32.zip and b/plugin/SqueezeESP32.zip differ diff --git a/plugin/SqueezeESP32/Graphics.pm b/plugin/SqueezeESP32/Graphics.pm index e1a61f9e..bb890606 100644 --- a/plugin/SqueezeESP32/Graphics.pm +++ b/plugin/SqueezeESP32/Graphics.pm @@ -57,6 +57,10 @@ sub nmodes { # pattern than the 32 pixels version, where one would have expected bytes 4..7 # to be empty +sub brightnessMap { + return (65535, 1, 2, 3, 4); +} + =comment sub bytesPerColumn { return 4; diff --git a/plugin/SqueezeESP32/install.xml b/plugin/SqueezeESP32/install.xml index 544f5917..ca9cf22b 100644 --- a/plugin/SqueezeESP32/install.xml +++ b/plugin/SqueezeESP32/install.xml @@ -10,6 +10,6 @@ PLUGIN_SQUEEZEESP32 PLUGIN_SQUEEZEESP32_DESC Plugins::SqueezeESP32::Plugin - 0.4 + 0.5 Philippe diff --git a/plugin/repo.xml b/plugin/repo.xml index 9467e48f..6b784f47 100644 --- a/plugin/repo.xml +++ b/plugin/repo.xml @@ -1,10 +1,10 @@ - + https://github.com/sle118/squeezelite-esp32 Philippe - cec20d0489ed120d56ea2de836c616c7d970c0d5 + 479c0a88d9c3b645abd98a6b8075f33e048ce4ce philippe_44@outlook.com SqueezeESP32 additional player id (100) http://github.com/sle118/squeezelite-esp32/raw/master/plugin/SqueezeESP32.zip