Merge with master

This commit is contained in:
Sebastien
2020-01-15 12:23:55 -05:00
16 changed files with 119 additions and 18 deletions

View File

@@ -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
*/