diff --git a/README.md b/README.md
index 9cf1f058..b5f7dddd 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
# Squeezelite-esp32
## Supported Hardware
### SqueezeAMP
-Works with the SqueezeAMP see [here](https://forums.slimdevices.com/showthread.php?110926-pre-ANNOUNCE-SqueezeAMP-and-SqueezeliteESP32) and [here](https://github.com/philippe44/SqueezeAMP/blob/master/README.md)
+Works with the SqueezeAMP see [here](https://forums.slimdevices.com/showthread.php?110926-pre-ANNOUNCE-SqueezeAMP-and-SqueezeliteESP32) and [here](https://github.com/philippe44/SqueezeAMP/blob/master/README.md). Add repository https://raw.githubusercontent.com/sle118/squeezelite-esp32/master/plugin/repo.xml to LMS if you want to have a display
Use the `squeezelite-esp32-SqueezeAmp-sdkconfig.defaults` configuration file.
diff --git a/components/display/display.c b/components/display/display.c
index 38228cf2..b94206a1 100644
--- a/components/display/display.c
+++ b/components/display/display.c
@@ -26,17 +26,19 @@
#include "embedded.h"
#include "display.h"
-#define TAG "display"
+static const char *TAG = "display";
static bool (*slimp_handler_chain)(u8_t *data, int len);
static struct display_handle_s *handle;
+static void (*chained_notify)(in_addr_t ip, u16_t hport, u16_t cport);
+static void server_attach(in_addr_t ip, u16_t hport, u16_t cport);
static bool display_handler(u8_t *data, int len);
/****************************************************************************************
*
*/
-void display_init(void) {
+void display_init(char *welcome) {
char *item = config_alloc_get(NVS_TYPE_STR, "display_config");
if (item && *item) {
@@ -52,15 +54,27 @@ void display_init(void) {
}
}else {
ESP_LOGE(TAG,"Unknown display driver name in display config: %s",item);
-
}
} else {
ESP_LOGW(TAG, "no display");
}
+
+ chained_notify = server_notify;
+ server_notify = server_attach;
if (item) free(item);
}
+/****************************************************************************************
+ *
+ */
+static void server_attach(in_addr_t ip, u16_t hport, u16_t cport) {
+ char msg[32];
+ sprintf(msg, "%s:%hu", inet_ntoa(ip), hport);
+ handle->print_message(msg);
+ if (chained_notify) (*chained_notify)(ip, hport, cport);
+}
+
/****************************************************************************************
* Process graphic display data
*/
diff --git a/components/display/display.h b/components/display/display.h
index 058121da..a2ea64ca 100644
--- a/components/display/display.h
+++ b/components/display/display.h
@@ -19,7 +19,8 @@
#pragma once
struct display_handle_s {
- bool (*init)(char *config);
+ bool (*init)(char *config, char* welcome);
+ void (*print_message)(char *msg);
void (*vfdc_handler)(u8_t *data, int len);
void (*grfe_handler)(u8_t *data, int len);
void (*grfb_handler)(u8_t *data, int len);
diff --git a/components/display/driver_SSD1306.c b/components/display/driver_SSD1306.c
index 4b5dc797..d3bd050f 100644
--- a/components/display/driver_SSD1306.c
+++ b/components/display/driver_SSD1306.c
@@ -32,14 +32,16 @@
#define I2C_PORT 1
#define I2C_ADDRESS 0x3C
#define LINELEN 40
-#define TAG "display"
+static const char *TAG = "display";
static void vfdc_handler( u8_t *_data, int bytes_read);
-void grfe_handler( u8_t *data, int len);
-static bool display_init(char *config);
+static void grfe_handler( u8_t *data, int len);
+static bool display_init(char *config, char *welcome);
+static void print_message(char *msg);
struct display_handle_s SSD1306_handle = {
display_init,
+ print_message,
vfdc_handler,
grfe_handler,
NULL, NULL,
@@ -71,7 +73,7 @@ static const unsigned char BitReverseTable256[] =
/****************************************************************************************
*
*/
-static bool display_init(char *config) {
+static bool display_init(char *config, char *welcome) {
bool res = false;
if (strstr(config, "I2C")) {
@@ -105,6 +107,7 @@ static bool display_init(char *config) {
}
}
if(res){
+ print_message(welcome);
ESP_LOGI(TAG, "Initialized I2C display %dx%d (sda:%d, scl:%d, address:%02x)", width, height, sda, scl, address);
} else {
ESP_LOGE(TAG, "Cannot initialized I2C display %s [%dx%d sda:%d, scl:%d, address:%02x]", config, width, height, sda, scl, address);
@@ -116,6 +119,19 @@ static bool display_init(char *config) {
return res;
}
+/****************************************************************************************
+ *
+ */
+static void print_message(char *msg) {
+ if (!msg) return;
+ SSD1306_AddressMode Mode = AddressMode;
+ SSD1306_Clear( &I2CDisplay, SSD_COLOR_BLACK );
+ SSD1306_SetDisplayAddressMode( &I2CDisplay, AddressMode_Horizontal );
+ SSD1306_FontDrawAnchoredString( &I2CDisplay, TextAnchor_Center, msg, SSD_COLOR_WHITE );
+ SSD1306_Update( &I2CDisplay );
+ SSD1306_SetDisplayAddressMode( &I2CDisplay, Mode );
+}
+
/****************************************************************************************
* Change special LCD chars to something more printable on screen
*/
diff --git a/components/display/tarablessd1306/ssd1306.c b/components/display/tarablessd1306/ssd1306.c
index c2ef7865..c94fed83 100644
--- a/components/display/tarablessd1306/ssd1306.c
+++ b/components/display/tarablessd1306/ssd1306.c
@@ -200,7 +200,8 @@ static bool SSD1306_Init( struct SSD1306_Device* DeviceHandle, int Width, int He
DeviceHandle->Height = Height;
DeviceHandle->FramebufferSize = ( DeviceHandle->Width * Height ) / 8;
- DeviceHandle->Framebuffer = heap_caps_calloc( 1, DeviceHandle->FramebufferSize, MALLOC_CAP_DMA | MALLOC_CAP_8BIT );
+ // DeviceHandle->Framebuffer = heap_caps_calloc( 1, DeviceHandle->FramebufferSize, MALLOC_CAP_INTERNAL );
+ DeviceHandle->Framebuffer = calloc( 1, DeviceHandle->FramebufferSize );
NullCheck( DeviceHandle->Framebuffer, return false );
diff --git a/components/services/battery.c b/components/services/battery.c
index 8406ef78..0eb78f59 100644
--- a/components/services/battery.c
+++ b/components/services/battery.c
@@ -19,7 +19,7 @@
#define BATTERY_TIMER (10*1000)
-static const char TAG[] = "battery";
+static const char *TAG = "battery";
static struct {
float sum, avg;
diff --git a/components/services/led.c b/components/services/led.c
index bddb882e..372c60d1 100644
--- a/components/services/led.c
+++ b/components/services/led.c
@@ -21,7 +21,7 @@
#define MAX_LED 8
#define BLOCKTIME 10 // up to portMAX_DELAY
-static const char TAG[] = "led";
+static const char *TAG = "led";
static struct led_s {
gpio_num_t gpio;
diff --git a/components/services/monitor.c b/components/services/monitor.c
index 7d0768fe..341714d1 100644
--- a/components/services/monitor.c
+++ b/components/services/monitor.c
@@ -26,7 +26,7 @@
#define MONITOR_TIMER (10*1000)
-static const char TAG[] = "monitor";
+static const char *TAG = "monitor";
static TimerHandle_t monitor_timer;
diff --git a/components/squeezelite/slimproto.c b/components/squeezelite/slimproto.c
index b53a1961..7a45b6ac 100644
--- a/components/squeezelite/slimproto.c
+++ b/components/squeezelite/slimproto.c
@@ -134,6 +134,8 @@ static void sendHELO(bool reconnect, const char *fixed_cap, const char *var_cap,
base_cap = BASE_CAP;
#endif
+ if (!reconnect) player_id = PLAYER_ID;
+
memset(&pkt, 0, sizeof(pkt));
memcpy(&pkt.opcode, "HELO", 4);
pkt.length = htonl(sizeof(struct HELO_packet) - 8 + strlen(base_cap) + strlen(fixed_cap) + strlen(var_cap));
diff --git a/main/esp_app_main.c b/main/esp_app_main.c
index 1470ada8..dc775c44 100644
--- a/main/esp_app_main.c
+++ b/main/esp_app_main.c
@@ -71,7 +71,7 @@ extern const uint8_t server_cert_pem_start[] asm("_binary_github_pem_start");
extern const uint8_t server_cert_pem_end[] asm("_binary_github_pem_end");
extern void services_init(void);
-extern void display_init(void);
+extern void display_init(char *welcome);
/* brief this is an exemple of a callback that you can setup in your own app to get notified of wifi manager event */
void cb_connection_got_ip(void *pvParameter){
@@ -337,7 +337,7 @@ void app_main()
services_init();
ESP_LOGD(TAG,"Initializing display");
- display_init();
+ display_init("SqueezeESP32");
#if !RECOVERY_APPLICATION
ESP_LOGI(TAG,"Checking if certificates need to be updated");
diff --git a/plugin/SqueezeESP32/Graphics.pm b/plugin/SqueezeESP32/Graphics.pm
index e5733ed6..dadd335a 100644
--- a/plugin/SqueezeESP32/Graphics.pm
+++ b/plugin/SqueezeESP32/Graphics.pm
@@ -4,6 +4,47 @@ use strict;
use base qw(Slim::Display::Squeezebox2);
+my $VISUALIZER_NONE = 0;
+
+my @modes = (
+ # mode 0
+ { desc => ['BLANK'],
+ bar => 0, secs => 0, width => 128,
+ params => [$VISUALIZER_NONE] },
+ # mode 1
+ { desc => ['PROGRESS_BAR'],
+ bar => 1, secs => 0, width => 128,
+ params => [$VISUALIZER_NONE] },
+ # mode 2
+ { desc => ['ELAPSED'],
+ bar => 0, secs => 1, width => 128,
+ params => [$VISUALIZER_NONE] },
+ # mode 3
+ { desc => ['ELAPSED', 'AND', 'PROGRESS_BAR'],
+ bar => 1, secs => 1, width => 128,
+ params => [$VISUALIZER_NONE] },
+ # mode 4
+ { desc => ['REMAINING'],
+ bar => 0, secs => -1, width => 128,
+ params => [$VISUALIZER_NONE] },
+ # mode 5
+ { desc => ['CLOCK'],
+ bar => 0, secs => 0, width => 128, clock => 1,
+ params => [$VISUALIZER_NONE] },
+ # mode 6
+ { desc => ['SETUP_SHOWBUFFERFULLNESS'],
+ bar => 0, secs => 0, width => 128, fullness => 1,
+ params => [$VISUALIZER_NONE] },
+);
+
+sub modes {
+ return \@modes;
+}
+
+sub nmodes {
+ return $#modes;
+}
+
=comment
sub bytesPerColumn {
return 4;
diff --git a/plugin/SqueezeESP32/Plugin.pm b/plugin/SqueezeESP32/Plugin.pm
index 623ebbea..80a074fa 100644
--- a/plugin/SqueezeESP32/Plugin.pm
+++ b/plugin/SqueezeESP32/Plugin.pm
@@ -20,7 +20,7 @@ sub initPlugin {
my $class = shift;
$class->SUPER::initPlugin(@_);
- Slim::Networking::Slimproto::addPlayerClass($class, 100, 'squeeze2esp32', { client => 'Plugins::SqueezeESP32::Player', display => 'Plugins::SqueezeESP32::Graphics' });
+ Slim::Networking::Slimproto::addPlayerClass($class, 100, 'squeezeesp32', { client => 'Plugins::SqueezeESP32::Player', display => 'Plugins::SqueezeESP32::Graphics' });
$log->info("Added class 100 for SqueezeESP32");
}
diff --git a/plugin/SqueezeESP32/SqueezeESP32.zip b/plugin/SqueezeESP32/SqueezeESP32.zip
new file mode 100644
index 00000000..15126a7d
Binary files /dev/null and b/plugin/SqueezeESP32/SqueezeESP32.zip differ
diff --git a/plugin/SqueezeESP32/install.xml b/plugin/SqueezeESP32/install.xml
index a5a92772..626fd90d 100644
--- a/plugin/SqueezeESP32/install.xml
+++ b/plugin/SqueezeESP32/install.xml
@@ -7,7 +7,9 @@
*.*
SlimServer
+ PLUGIN_SQUEEZEESP32
+ PLUGIN_SQUEEZEESP32_DESC
Plugins::SqueezeESP32::Plugin
- 0.1
+ 0.3
Philippe
diff --git a/plugin/SqueezeESP32/strings.txt b/plugin/SqueezeESP32/strings.txt
index 539ed1ac..2009781f 100644
--- a/plugin/SqueezeESP32/strings.txt
+++ b/plugin/SqueezeESP32/strings.txt
@@ -1,2 +1,9 @@
WELCOME_TO_SQUEEZEESP32
- EN Welcome to SqueezeESP32
\ No newline at end of file
+ EN Welcome to SqueezeESP32
+
+PLUGIN_SQUEEZEESP32
+ SqueezeESP32
+
+PLUGIN_SQUEEZEESP32_DESC
+ Adds a new player id (100) to enable display with SqueezeESP32
+
\ No newline at end of file
diff --git a/plugin/repo.xml b/plugin/repo.xml
new file mode 100644
index 00000000..ee9b377f
--- /dev/null
+++ b/plugin/repo.xml
@@ -0,0 +1,17 @@
+
+
+
+
+ https://github.com/sle118/squeezelite-esp32
+ Philippe
+ 799ae4860f9c009ac25c2ec35eb4070c5f474659
+ philippe_44@outlook.com
+ SqueezeESP32 additional player id (100)
+ http://github.com/sle118/squeezelite-esp32/raw/master/plugin/SqueezeESP32/SqueezeESP32.zip
+ SqueezeESP32
+
+
+
+ SqueezeESP32 related plugins
+
+