This commit is contained in:
marc 2025-03-31 07:44:12 +02:00
parent f7ac519c2e
commit 87a4e93e87
7 changed files with 258 additions and 241 deletions

View File

@ -28,13 +28,6 @@
#define EXAMPLE_MAX_CHAR_SIZE 64 #define EXAMPLE_MAX_CHAR_SIZE 64
// JPG decoder
#if ESP_IDF_VERSION_MAJOR >= 4 // IDF 4+
#include "esp32/rom/tjpgd.h"
#else // ESP32 Before IDF 4.0
#include "rom/tjpgd.h"
#endif
#include "esp_task_wdt.h" #include "esp_task_wdt.h"
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@ -49,9 +42,9 @@ static const char *TAG = "ImgDwn";
#define STR_HELPER(x) #x #define STR_HELPER(x) #x
#define STR(x) STR_HELPER(x) #define STR(x) STR_HELPER(x)
#define IMGDWN_WIDTH_STR "620" #define IMGDWN_WIDTH_STR "500"
#define IMGDWN_WIDTH 620 #define IMGDWN_WIDTH 620
#define IMGDWN_HEIGHT_STR "460" #define IMGDWN_HEIGHT_STR "300"
#define IMGDWN_HEIGHT 460 #define IMGDWN_HEIGHT 460
#define IMGDWN_URL2 ("http://vps-edf71efa.vps.ovh.net:3000/render/d-solo/7BtRMrv4k/temperatures?orgId=1&var-emplacement=entree_ECS&var-emplacement=entree_reseauSol&panelId=4&width=650&height=460&scale=1&tz=Europe%2FParis/") #define IMGDWN_URL2 ("http://vps-edf71efa.vps.ovh.net:3000/render/d-solo/7BtRMrv4k/temperatures?orgId=1&var-emplacement=entree_ECS&var-emplacement=entree_reseauSol&panelId=4&width=650&height=460&scale=1&tz=Europe%2FParis/")
#define IMGDWN_URL ("http://vps-edf71efa.vps.ovh.net:3000/render/d-solo/bOcPeysGz/hauteur-cuve?orgId=1&from=now-2d&refresh=1m&panelId=4&width=" IMGDWN_WIDTH_STR "&height=" IMGDWN_HEIGHT_STR "&scale=1&tz=Europe%2FParis") // 650 460 #define IMGDWN_URL ("http://vps-edf71efa.vps.ovh.net:3000/render/d-solo/bOcPeysGz/hauteur-cuve?orgId=1&from=now-2d&refresh=1m&panelId=4&width=" IMGDWN_WIDTH_STR "&height=" IMGDWN_HEIGHT_STR "&scale=1&tz=Europe%2FParis") // 650 460

View File

@ -86,7 +86,7 @@ void printff(struct meteoforecast_data *tmp)
strftime(buffer, MAX_SIZE, "%c", &timeinfo); strftime(buffer, MAX_SIZE, "%c", &timeinfo);
char strftime_buf[64]; char strftime_buf[64];
sprintf(strftime_buf, "%d %d %d", timeinfo.tm_wday, timeinfo.tm_mday, timeinfo.tm_mon + 1); sprintf(strftime_buf, "%d %d %d", timeinfo.tm_wday, timeinfo.tm_mday, timeinfo.tm_mon + 1);
ESP_LOGE(TAG, "%s", strftime_buf); ESP_LOGV(TAG, "%s", strftime_buf);
printf("IsValid:%s date:%s, Temp:%.1f Desc:%s\n", tmp->isValid ? "true" : "false", buffer, tmp->previsions.value, tmp->previsions.desc); printf("IsValid:%s date:%s, Temp:%.1f Desc:%s\n", tmp->isValid ? "true" : "false", buffer, tmp->previsions.value, tmp->previsions.desc);
} }
@ -317,7 +317,7 @@ static void http_request_task(void *pvParameter)
{ {
while (1) while (1)
{ {
ESP_LOGE(TAG, "Début recup méteo --------------------------"); ESP_LOGV(TAG, "Début recup méteo --------------------------");
weather.data_retreived_cb_start(NULL); weather.data_retreived_cb_start(NULL);
char *local_response_buffer = heap_caps_malloc((MAX_HTTP_OUTPUT_BUFFER + 1) * (sizeof(char)), MALLOC_CAP_SPIRAM); char *local_response_buffer = heap_caps_malloc((MAX_HTTP_OUTPUT_BUFFER + 1) * (sizeof(char)), MALLOC_CAP_SPIRAM);
// char local_response_buffer[MAX_HTTP_OUTPUT_BUFFER + 1] = {0}; // char local_response_buffer[MAX_HTTP_OUTPUT_BUFFER + 1] = {0};
@ -340,13 +340,13 @@ static void http_request_task(void *pvParameter)
esp_http_client_handle_t client = esp_http_client_init(&config); esp_http_client_handle_t client = esp_http_client_init(&config);
char url[50]; char url[50];
esp_http_client_get_url(client, url, 50); esp_http_client_get_url(client, url, 50);
ESP_LOGE(TAG, "%s", url); ESP_LOGV(TAG, "%s", url);
// GET // GET
esp_err_t err = esp_http_client_perform(client); esp_err_t err = esp_http_client_perform(client);
if (err == ESP_OK) if (err == ESP_OK)
{ {
ESP_LOGI(TAG, "HTTP GET Status = %d, content_length = %" PRId64, ESP_LOGV(TAG, "HTTP GET Status = %d, content_length = %" PRId64,
esp_http_client_get_status_code(client), esp_http_client_get_status_code(client),
esp_http_client_get_content_length(client)); esp_http_client_get_content_length(client));
} }
@ -360,10 +360,12 @@ static void http_request_task(void *pvParameter)
heap_caps_free(local_response_buffer); heap_caps_free(local_response_buffer);
esp_http_client_cleanup(client); esp_http_client_cleanup(client);
if(dailydatas->isValid){ if(dailydatas->isValid){
ESP_LOGV(TAG, "Données valides on appelle le cb");
weather.data_retreived_cb(dailydatas, forecastdatas); weather.data_retreived_cb(dailydatas, forecastdatas);
vTaskDelay(weather.retreival_period / portTICK_PERIOD_MS); vTaskDelay(weather.retreival_period / portTICK_PERIOD_MS);
}else{ }else{
//Ca a échoué on recommence dans 30 secondes //Ca a échoué on recommence dans 30 secondes
ESP_LOGI(TAG, "Données non valides on attend avant de retenter");
vTaskDelay(30000 / portTICK_PERIOD_MS); vTaskDelay(30000 / portTICK_PERIOD_MS);
} }

View File

@ -3,7 +3,6 @@ set(EXTRA_COMPONENT_DIRS ../components)
idf_component_register(SRC_DIRS . fonts idf_component_register(SRC_DIRS . fonts
INCLUDE_DIRS "." INCLUDE_DIRS "."
REQUIRES heap esp_wifi nvs_flash mqtt meteofrance esp_netif image_downloader fatfs sdmmc vfs littlefs wifi_logger protocol_examples_common app_update esp_https_ota bsp_extra esp32_p4_function_ev_board REQUIRES heap esp_wifi nvs_flash mqtt meteofrance esp_netif image_downloader fatfs sdmmc vfs littlefs wifi_logger protocol_examples_common app_update esp_https_ota bsp_extra esp32_p4_function_ev_board
PRIV_REQUIRES littlefs
EMBED_TXTFILES ${project_dir}/main/ca_cert.pem) EMBED_TXTFILES ${project_dir}/main/ca_cert.pem)

View File

@ -14,6 +14,7 @@
#include "nvs_flash.h" #include "nvs_flash.h"
#include <locale.h> #include <locale.h>
#include "esp_vfs_fat.h" #include "esp_vfs_fat.h"
#include "sdmmc_cmd.h"
#include <stdio.h> #include <stdio.h>
#include "bsp/esp-bsp.h" #include "bsp/esp-bsp.h"
#include "bsp/display.h" #include "bsp/display.h"
@ -29,7 +30,7 @@
#include "wifi_logger.h" #include "wifi_logger.h"
#include "obtain_time.h" #include "obtain_time.h"
#include "meteofrance.h" #include "meteofrance.h"
//#include "image_downloader.h" #include "image_downloader.h"
#include "wifi.h" #include "wifi.h"
#include "mqtt.h" #include "mqtt.h"
@ -38,9 +39,9 @@
// GPIO assignment // GPIO assignment
#define AM2302_GPIO 19 #define AM2302_GPIO 19
#include "esp_littlefs.h" #include "esp_littlefs.h"
#define MOUNT_POINT "/sdcard"
// Pin assignments can be set in menuconfig, see "SD SPI Example Configuration" menu. // Pin assignments can be set in menuconfig, see "SD SPI Example Configuration" menu.
// You can also change the pin assignments here by changing the following 4 lines. // You can also change the pin assignments here by changing the following 4 lines.
#define PIN_NUM_MISO 13 #define PIN_NUM_MISO 13
@ -80,6 +81,21 @@ static lv_style_t no_padding;
static lv_style_t style_font_18; static lv_style_t style_font_18;
static lv_style_t style_font_24; static lv_style_t style_font_24;
bool display_lock(const char* TAG){
ESP_LOGI(TAG,"Obtention mutexx");
if(bsp_display_lock(5000)){
ESP_LOGI(TAG, "Mutex obtenu");
return true;
}else{
ESP_LOGE(TAG, "Impossible d'obtenir le mutex");
return false;
}
}
void display_unlock(const char* TAG){
ESP_LOGI(TAG,"Libération mutexx");
bsp_display_unlock();
}
struct lv_observer_t struct lv_observer_t
{ {
lv_subject_t *subject; /**< The observed value */ lv_subject_t *subject; /**< The observed value */
@ -91,10 +107,11 @@ struct lv_observer_t
uint32_t for_obj : 1; /**< `target` is an `lv_obj_t *`*/ uint32_t for_obj : 1; /**< `target` is an `lv_obj_t *`*/
}; };
// Ce callback est applé lorsque meteoStatus change
static void meteo_obs_cb(lv_observer_t *observer, lv_subject_t *subject) static void meteo_obs_cb(lv_observer_t *observer, lv_subject_t *subject)
{ {
ESP_LOGV("MeteoFrance", "On passe dans le callback de chgt de statut meteo; %li", lv_subject_get_int(subject)); ESP_LOGI(TAG, "On passe dans le callback de chgt de statut meteo; %li", lv_subject_get_int(subject));
if (lvgl_port_lock(0)) if (display_lock("meteo_obs_cb"))
{ {
lv_obj_t *meteoSt = observer->target; lv_obj_t *meteoSt = observer->target;
switch (lv_subject_get_int(subject)) switch (lv_subject_get_int(subject))
@ -106,7 +123,9 @@ static void meteo_obs_cb(lv_observer_t *observer, lv_subject_t *subject)
lv_obj_set_style_text_color(meteoSt, lv_color_make(0xff, 0x00, 0x00), 0); lv_obj_set_style_text_color(meteoSt, lv_color_make(0xff, 0x00, 0x00), 0);
break; break;
} }
lvgl_port_unlock(); display_unlock("meteo_obs_cb");
}else{
ESP_LOGE(TAG,"Impossible d'obtenir le mutex dans meteo_obs_cb");
} }
} }
@ -167,12 +186,7 @@ static void app_main_display(void)
lv_obj_t *label = lv_label_create(scr); lv_obj_t *label = lv_label_create(scr);
lv_obj_set_width(label, lv_pct(100)); lv_obj_set_width(label, lv_pct(100));
lv_obj_set_style_text_align(label, LV_TEXT_ALIGN_CENTER, 0); lv_obj_set_style_text_align(label, LV_TEXT_ALIGN_CENTER, 0);
#if LVGL_VERSION_MAJOR == 8
lv_label_set_recolor(label, true);
lv_label_set_text(label, "#FF0000 " LV_SYMBOL_BELL " Hello world Espressif and LVGL " LV_SYMBOL_BELL "#\n#FF9400 " LV_SYMBOL_WARNING " For simplier initialization, use BSP " LV_SYMBOL_WARNING " #");
#else
lv_label_set_text(label, LV_SYMBOL_BELL "Bienvenue sur DomoTIC !" LV_SYMBOL_BELL); lv_label_set_text(label, LV_SYMBOL_BELL "Bienvenue sur DomoTIC !" LV_SYMBOL_BELL);
#endif
lv_obj_align(label, LV_ALIGN_CENTER, 0, 20); lv_obj_align(label, LV_ALIGN_CENTER, 0, 20);
} }
@ -277,9 +291,12 @@ static void weatherdataH_obs_cb(lv_observer_t *observer, lv_subject_t *subject)
ESP_LOGV("MeteoFrance", "CB meteo horaire declenché"); ESP_LOGV("MeteoFrance", "CB meteo horaire declenché");
// Retrieve weatherdata // Retrieve weatherdata
const struct meteoforecast_data *data = subject->value.pointer; const struct meteoforecast_data *data = subject->value.pointer;
// printffd(data); if(data->isValid){
// char buff[40] = {};
// sprintf(buff,"%s %.1f %.1f", data->previsions.desc, data->previsions.min, data->previsions.max); //printffd(data);
char buff[40] = {};
sprintf(buff,"%.1f", data->previsions.value);
ESP_LOGV(TAG, "On a recu [%s]", buff);
lv_obj_t *parent = (lv_obj_t *)(observer->target); lv_obj_t *parent = (lv_obj_t *)(observer->target);
lv_obj_t *datefld = lv_obj_get_child(parent, 0); lv_obj_t *datefld = lv_obj_get_child(parent, 0);
@ -292,6 +309,11 @@ static void weatherdataH_obs_cb(lv_observer_t *observer, lv_subject_t *subject)
lv_label_set_text(datefld, buffer); lv_label_set_text(datefld, buffer);
lv_label_set_text(lv_obj_get_child(temp_desc_icon, 2), data->previsions.desc); lv_label_set_text(lv_obj_get_child(temp_desc_icon, 2), data->previsions.desc);
lv_label_set_text_fmt(lv_obj_get_child(temp_desc_icon, 0), "%.1f°C", data->previsions.value); lv_label_set_text_fmt(lv_obj_get_child(temp_desc_icon, 0), "%.1f°C", data->previsions.value);
}else{
ESP_LOGE(TAG, "Pas de odnnées valides");
}
} }
void showMeteoIcon(const char *icon, lv_obj_t *desc_icon, int childNr) void showMeteoIcon(const char *icon, lv_obj_t *desc_icon, int childNr)
@ -301,76 +323,6 @@ void showMeteoIcon(const char *icon, lv_obj_t *desc_icon, int childNr)
char *result = malloc(strlen(str1) + strlen(icon) + 6); char *result = malloc(strlen(str1) + strlen(icon) + 6);
sprintf(result, "%s%s.png", str1, icon); sprintf(result, "%s%s.png", str1, icon);
lv_image_set_src(img, result); lv_image_set_src(img, result);
/*
if (strcmp(icon, "p1j") == 0)
{
lv_image_set_src(img, &p1j);
}
else if (strcmp(icon, "p2j") == 0)
{
lv_image_set_src(img, &p2j);
}
else if (strcmp(icon, "p3j") == 0)
{
lv_image_set_src(img, &p3j);
}
else if (strcmp(icon, "p4j") == 0)
{
lv_image_set_src(img, &p4j);
}
else if (strcmp(icon, "p5bisj") == 0)
{
lv_image_set_src(img, &p5bisj);
}
else if (strcmp(icon, "p12j") == 0)
{
lv_image_set_src(img, &p12j);
}
else if (strcmp(icon, "p12bisj") == 0)
{
lv_image_set_src(img, &p12bisj);
}
else if (strcmp(icon, "p13j") == 0)
{
lv_image_set_src(img, &p13j);
}
else if (strcmp(icon, "p13bisj") == 0)
{
lv_image_set_src(img, &p13bisj);
}
else if (strcmp(icon, "p14j") == 0)
{
lv_image_set_src(img, &p14j);
}
else if (strcmp(icon, "p24j") == 0)
{
lv_image_set_src(img, &p24j);
}
else if (strcmp(icon, "p25j") == 0)
{
lv_image_set_src(img, &p25j);
}
else if (strcmp(icon, "p26j") == 0)
{
lv_image_set_src(img, &p26j);
}
else if (strcmp(icon, "p27j") == 0)
{
lv_image_set_src(img, &p27j);
}
else if (strcmp(icon, "p28j") == 0)
{
lv_image_set_src(img, &p28j);
}
else if (strcmp(icon, "p29j") == 0)
{
lv_image_set_src(img, &p29j);
}
else
{
ESP_LOGE(TAG, "Image %s non connue", icon);
}
*/
} }
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/* Fragment meteo journaliere (date,icone, min et max) */ /* Fragment meteo journaliere (date,icone, min et max) */
@ -798,44 +750,43 @@ void draw_tabHome(){
lv_obj_t *main = lv_obj_create(supmain); lv_obj_t *main = lv_obj_create(supmain);
lv_obj_add_style(main, &no_padding, 0); lv_obj_add_style(main, &no_padding, 0);
lv_obj_set_size(main, LV_SIZE_CONTENT, LV_SIZE_CONTENT); lv_obj_set_size(main, lv_pct(100), lv_pct(100));
lv_obj_set_flex_flow(main, LV_FLEX_FLOW_ROW); lv_obj_set_flex_flow(main, LV_FLEX_FLOW_ROW);
lv_obj_set_style_pad_column(main, 1, 0); lv_obj_set_style_pad_column(main, 1, 0);
/*Create a container with COLUMN flex direction*/ /*Conteneur Colonne: Températures*/
lv_obj_t *cont_col = lv_obj_create(main); lv_obj_t *cont_colTemp = lv_obj_create(main);
lv_obj_set_style_pad_all(cont_col, 5, 0); lv_obj_set_style_pad_all(cont_colTemp, 5, 0);
lv_obj_set_size(cont_col, 250, 400); lv_obj_set_size(cont_colTemp, lv_pct(40), lv_pct(100));
lv_obj_align(cont_col, LV_ALIGN_TOP_LEFT, 0, 0); lv_obj_align(cont_colTemp, LV_ALIGN_TOP_LEFT, 0, 0);
lv_obj_set_flex_flow(cont_col, LV_FLEX_FLOW_COLUMN); lv_obj_set_flex_flow(cont_colTemp, LV_FLEX_FLOW_COLUMN);
lv_obj_set_flex_align(cont_col, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); lv_obj_set_flex_align(cont_colTemp, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);
/*Create a container with COLUMN flex direction*/ /*Create a container with COLUMN flex direction*/
lv_obj_t *cont_col2 = lv_obj_create(main); lv_obj_t *cont_colVolets = lv_obj_create(main);
lv_obj_set_style_pad_all(cont_col2, 5, 0); lv_obj_set_style_pad_all(cont_colVolets, 5, 0);
lv_obj_set_flex_align(cont_col2, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); lv_obj_set_flex_align(cont_colVolets, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);
lv_obj_set_size(cont_colVolets, lv_pct(20), lv_pct(100));
lv_obj_align_to(cont_colVolets, cont_colTemp, LV_ALIGN_OUT_TOP_RIGHT, 0, 0);
lv_obj_set_flex_flow(cont_colVolets, LV_FLEX_FLOW_COLUMN);
lv_obj_set_flex_align(cont_colVolets, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_SPACE_BETWEEN, LV_FLEX_ALIGN_CENTER);
/*Create a container with COLUMN flex direction*/ /*Conteneur Colonne: Meteo*/
lv_obj_t *cont_col3 = lv_obj_create(main); lv_obj_t *cont_col3 = lv_obj_create(main);
lv_obj_set_style_pad_all(cont_col3, 5, 0); lv_obj_set_style_pad_all(cont_col3, 5, 0);
lv_obj_set_size(cont_col3, 300, 400); lv_obj_set_size(cont_col3, lv_pct(40), lv_pct(100));
lv_obj_set_flex_flow(cont_col3, LV_FLEX_FLOW_COLUMN); lv_obj_set_flex_flow(cont_col3, LV_FLEX_FLOW_COLUMN);
lv_obj_set_flex_align(cont_col3, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); lv_obj_set_flex_align(cont_col3, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);
lv_obj_set_height(cont_col2, 400);
lv_obj_set_width(cont_col2, LV_SIZE_CONTENT);
lv_obj_align_to(cont_col2, cont_col, LV_ALIGN_OUT_TOP_RIGHT, 0, 0);
lv_obj_set_flex_flow(cont_col2, LV_FLEX_FLOW_COLUMN);
lv_obj_set_flex_align(cont_col2, LV_FLEX_ALIGN_END, LV_FLEX_ALIGN_SPACE_BETWEEN, LV_FLEX_ALIGN_SPACE_BETWEEN);
lv_obj_t *label1 = lv_label_create(cont_col); lv_obj_t *label1 = lv_label_create(cont_colTemp);
lv_obj_set_style_text_font(label1, &montserrat_medium_18, 0); lv_obj_set_style_text_font(label1, &montserrat_medium_18, 0);
lv_label_set_text(label1, "Températures"); lv_label_set_text(label1, "Températures");
lv_obj_set_pos(label1, 0, 0); lv_obj_set_pos(label1, 0, 0);
//Create a container with COLUMN flex direction //Create a container with COLUMN flex direction
lv_obj_t *cont_tempExt = lv_obj_create(cont_col); lv_obj_t *cont_tempExt = lv_obj_create(cont_colTemp);
lv_obj_add_style(cont_tempExt, &style_container, 0); lv_obj_add_style(cont_tempExt, &style_container, 0);
// lv_obj_set_height(cont_tempExt,50); // lv_obj_set_height(cont_tempExt,50);
lv_obj_set_flex_flow(cont_tempExt, LV_FLEX_FLOW_ROW); lv_obj_set_flex_flow(cont_tempExt, LV_FLEX_FLOW_ROW);
@ -848,7 +799,7 @@ void draw_tabHome(){
lv_label_bind_text(lblTempExt, &tempExtSubj, "%s °C"); lv_label_bind_text(lblTempExt, &tempExtSubj, "%s °C");
//Create a container with COLUMN flex direction //Create a container with COLUMN flex direction
lv_obj_t *cont_tempInt = lv_obj_create(cont_col); lv_obj_t *cont_tempInt = lv_obj_create(cont_colTemp);
lv_obj_add_style(cont_tempInt, &style_container, 0); lv_obj_add_style(cont_tempInt, &style_container, 0);
// lv_obj_set_height(cont_tempInt,50); // lv_obj_set_height(cont_tempInt,50);
lv_obj_set_flex_flow(cont_tempInt, LV_FLEX_FLOW_ROW); lv_obj_set_flex_flow(cont_tempInt, LV_FLEX_FLOW_ROW);
@ -860,7 +811,7 @@ void draw_tabHome(){
lv_label_bind_text(lblTempInt, &tempIntSubj, "%s °C"); lv_label_bind_text(lblTempInt, &tempIntSubj, "%s °C");
//Create a container with COLUMN flex direction //Create a container with COLUMN flex direction
lv_obj_t *cont_tempInt2 = lv_obj_create(cont_col); lv_obj_t *cont_tempInt2 = lv_obj_create(cont_colTemp);
lv_obj_add_style(cont_tempInt2, &style_container, 0); lv_obj_add_style(cont_tempInt2, &style_container, 0);
// lv_obj_set_height(cont_tempInt,50); // lv_obj_set_height(cont_tempInt,50);
lv_obj_set_flex_flow(cont_tempInt2, LV_FLEX_FLOW_ROW); lv_obj_set_flex_flow(cont_tempInt2, LV_FLEX_FLOW_ROW);
@ -873,7 +824,7 @@ void draw_tabHome(){
lv_label_set_text(lblTempInt2, ""); lv_label_set_text(lblTempInt2, "");
//Create a container with COLUMN flex direction //Create a container with COLUMN flex direction
lv_obj_t *cont_Cuve = lv_obj_create(cont_col); lv_obj_t *cont_Cuve = lv_obj_create(cont_colTemp);
lv_obj_add_style(cont_Cuve, &style_container, 0); lv_obj_add_style(cont_Cuve, &style_container, 0);
lv_obj_set_flex_flow(cont_Cuve, LV_FLEX_FLOW_ROW_WRAP); lv_obj_set_flex_flow(cont_Cuve, LV_FLEX_FLOW_ROW_WRAP);
// lv_obj_set_height(cont_Cuve,80); // lv_obj_set_height(cont_Cuve,80);
@ -884,7 +835,7 @@ void draw_tabHome(){
lv_obj_add_style(lblHauteurCuve, &style_lbvValue, 0); lv_obj_add_style(lblHauteurCuve, &style_lbvValue, 0);
lv_label_bind_text(lblHauteurCuve, &hauteurCuveSubj, "%s cm"); lv_label_bind_text(lblHauteurCuve, &hauteurCuveSubj, "%s cm");
lv_obj_t *btnUp = lv_button_create(cont_col2); lv_obj_t *btnUp = lv_button_create(cont_colVolets);
lv_obj_add_style(btnUp, &style_btn, 0); lv_obj_add_style(btnUp, &style_btn, 0);
lv_obj_add_event_cb(btnUp, event_handler, LV_EVENT_ALL, upEvent); lv_obj_add_event_cb(btnUp, event_handler, LV_EVENT_ALL, upEvent);
lv_obj_align(btnUp, LV_ALIGN_CENTER, 0, -40); lv_obj_align(btnUp, LV_ALIGN_CENTER, 0, -40);
@ -894,7 +845,7 @@ void draw_tabHome(){
lv_label_set_text(label, LV_SYMBOL_UP); lv_label_set_text(label, LV_SYMBOL_UP);
lv_obj_center(label); lv_obj_center(label);
lv_obj_t *btnDwn = lv_button_create(cont_col2); lv_obj_t *btnDwn = lv_button_create(cont_colVolets);
lv_obj_add_style(btnDwn, &style_btn, 0); lv_obj_add_style(btnDwn, &style_btn, 0);
lv_obj_add_event_cb(btnDwn, event_handler, LV_EVENT_ALL, downEvent); lv_obj_add_event_cb(btnDwn, event_handler, LV_EVENT_ALL, downEvent);
lv_obj_align(btnDwn, LV_ALIGN_CENTER, 0, -40); lv_obj_align(btnDwn, LV_ALIGN_CENTER, 0, -40);
@ -1102,30 +1053,34 @@ void draw_ihm()
void weather_data_retreived_start() void weather_data_retreived_start()
{ {
if (lvgl_port_lock(0)) //if (display_lock("weather_data_retreived_start"))
{ //{
//ESP_LOGE(TAG,"Mutex obtenu dans weather_data_retreived_start");
lv_subject_set_int(&meteoStatus, 1); lv_subject_set_int(&meteoStatus, 1);
lvgl_port_unlock(); ESP_LOGE(TAG,"Subject setted weather_data_retreived_start");
} //display_unlock("weather_data_retreived_start");
//}else{
// ESP_LOGE(TAG,"Impossible d'obtenir le mutex dans weather_data_retreived_start");
//}
} }
void weather_data_retreived(struct meteodailyforecast_data dailyDatas[3], struct meteoforecast_data datas[3]) void weather_data_retreived(struct meteodailyforecast_data dailyDatas[3], struct meteoforecast_data datas[3])
{ {
/*
ESP_LOGE(TAG, "debut debug"); /* ESP_LOGE(TAG, "debut debug");
printf("%lld\n", datas[0].datetime); printf("%lld\n", datas[0].datetime);
printf("%s\n", datas[0].previsions.desc); printf("%s\n", datas[0].previsions.desc);
printf("%f\n", datas[0].previsions.min); printf("%f\n", datas[0].previsions.value);
printf("%lld\n", datas[1].datetime); printf("%lld\n", datas[1].datetime);
printf("%s\n", datas[1].previsions.desc); printf("%s\n", datas[1].previsions.desc);
printf("%f\n", datas[1].previsions.min); printf("%f\n", datas[1].previsions.value);
printf("%lld\n", datas[2].datetime); printf("%lld\n", datas[2].datetime);
printf("%s\n", datas[2].previsions.desc); printf("%s\n", datas[2].previsions.desc);
printf("%f\n", datas[2].previsions.min); printf("%f\n", datas[2].previsions.value);
ESP_LOGE(TAG, "fin debug"); ESP_LOGE(TAG, "fin debug");
*/ */
if (bsp_display_lock(0)) //if (display_lock("weather_data_retreived"))
{ //{
ESP_LOGV("MeteoFrance", "------------------------------------- Set des subjects J --------------------------------"); ESP_LOGV("MeteoFrance", "------------------------------------- Set des subjects J --------------------------------");
// Prévisions des 3 prochains jours // Prévisions des 3 prochains jours
lv_subject_set_pointer(&forecastD1Subj, &dailyDatas[0]); lv_subject_set_pointer(&forecastD1Subj, &dailyDatas[0]);
@ -1140,13 +1095,72 @@ void weather_data_retreived(struct meteodailyforecast_data dailyDatas[3], struct
lv_subject_set_pointer(&forecastH3Subj, &datas[2]); lv_subject_set_pointer(&forecastH3Subj, &datas[2]);
lv_subject_set_int(&meteoStatus, 0); lv_subject_set_int(&meteoStatus, 0);
lvgl_port_unlock(); //display_unlock("weather_data_retreived");
// ESP_LOGE(TAG, "------------------------------------- Fin Set des subjects --------------------------------"); ESP_LOGV(TAG, "------------------------------------- Fin Set des subjects --------------------------------");
}else{ //}else{
ESP_LOGE(TAG, "Impossible d'obtenir le mutex"); // ESP_LOGE(TAG, "Impossible d'obtenir le mutex dans weather_data_retreived");
} //}
} }
void mount_sd_card()
{
// Options for mounting the filesystem.
// If format_if_mount_failed is set to true, SD card will be partitioned and
// formatted in case when mounting fails.
esp_vfs_fat_sdmmc_mount_config_t mount_config = {
.format_if_mount_failed = false,
.max_files = 5,
.allocation_unit_size = 16 * 1024};
sdmmc_card_t *card;
const char mount_point[] = MOUNT_POINT;
ESP_LOGI(TAG, "Initializing SD card");
ESP_LOGI(TAG, "Using SPI peripheral");
sdmmc_host_t host = SDSPI_HOST_DEFAULT();
spi_bus_config_t bus_cfg = {
.mosi_io_num = PIN_NUM_MOSI,
.miso_io_num = PIN_NUM_MISO,
.sclk_io_num = PIN_NUM_CLK,
.quadwp_io_num = -1,
.quadhd_io_num = -1,
.max_transfer_sz = 4000,
};
esp_err_t ret = spi_bus_initialize(host.slot, &bus_cfg, SDSPI_DEFAULT_DMA);
if (ret != ESP_OK)
{
ESP_LOGE(TAG, "Failed to initialize bus.");
return;
}
sdspi_device_config_t slot_config = SDSPI_DEVICE_CONFIG_DEFAULT();
slot_config.gpio_cs = PIN_NUM_CS;
slot_config.host_id = host.slot;
ESP_LOGI(TAG, "Mounting filesystem");
ret = esp_vfs_fat_sdspi_mount(mount_point, &host, &slot_config, &mount_config, &card);
if (ret != ESP_OK)
{
if (ret == ESP_FAIL)
{
ESP_LOGE(TAG, "Failed to mount filesystem. "
"If you want the card to be formatted, set the CONFIG_EXAMPLE_FORMAT_IF_MOUNT_FAILED menuconfig option.");
}
else
{
ESP_LOGE(TAG, "Failed to initialize the card (%s). "
"Make sure SD card lines have pull-up resistors in place.",
esp_err_to_name(ret));
}
return;
}
ESP_LOGI(TAG, "Filesystem mounted");
// Card has been initialized, print its properties
sdmmc_card_print_info(stdout, card);
}
extern char *days[7]; extern char *days[7];
extern char *months[12]; extern char *months[12];
@ -1162,9 +1176,9 @@ static void updateTime(void *pvParameter)
struct tm timeinfo = {0}; struct tm timeinfo = {0};
localtime_r(&now, &timeinfo); localtime_r(&now, &timeinfo);
sprintf(strftime_buf, "%s %d %s %02d:%02d", days[timeinfo.tm_wday], timeinfo.tm_mday, months[timeinfo.tm_mon], timeinfo.tm_hour, timeinfo.tm_min); sprintf(strftime_buf, "%s %d %s %02d:%02d", days[timeinfo.tm_wday], timeinfo.tm_mday, months[timeinfo.tm_mon], timeinfo.tm_hour, timeinfo.tm_min);
if(lvgl_port_lock(0)){ if(display_lock("updateTime")){
lv_subject_copy_string(&dateHeureSubj, strftime_buf); lv_subject_copy_string(&dateHeureSubj, strftime_buf);
lvgl_port_unlock(); display_unlock("updateTime");
} }
/* /*
lv_obj_refr_size(lv_obj_get_child(lv_obj_get_child(lv_layer_top(),0),0)); lv_obj_refr_size(lv_obj_get_child(lv_obj_get_child(lv_layer_top(),0),0));
@ -1279,7 +1293,7 @@ void readTempHumid(void *pvParameter)
char buff[40]; char buff[40];
ESP_LOGI(TAG, "Temperature: %.1f °C, Humidity: %.1f %%", temperature, humidity); ESP_LOGI(TAG, "Temperature: %.1f °C, Humidity: %.1f %%", temperature, humidity);
sprintf(buff,"%.1f °C, %.1f %%", temperature, humidity); sprintf(buff,"%.1f °C, %.1f %%", temperature, humidity);
if(lvgl_port_lock(0)){ if(lvgl_port_lock(5)){
lv_label_set_text(lblTempInt2,buff); lv_label_set_text(lblTempInt2,buff);
lvgl_port_unlock(); lvgl_port_unlock();
} }
@ -1296,10 +1310,12 @@ void app_main(void)
printf("1- Free heap after buffers allocation: %d\n", xPortGetFreeHeapSize()); printf("1- Free heap after buffers allocation: %d\n", xPortGetFreeHeapSize());
esp_log_level_set("wifi", ESP_LOG_ERROR); esp_log_level_set("wifi", ESP_LOG_ERROR);
esp_log_level_set(TAG, ESP_LOG_VERBOSE);
printf("2- Free heap after buffers allocation: %d\n", xPortGetFreeHeapSize()); printf("2- Free heap after buffers allocation: %d\n", xPortGetFreeHeapSize());
printf("3 - Free heap after buffers allocation: %d\n", xPortGetFreeHeapSize()); //mount_sd_card();
bsp_sdcard_mount();
bsp_display_cfg_t cfg = { bsp_display_cfg_t cfg = {
.lvgl_port_cfg = ESP_LVGL_PORT_INIT_CONFIG(), .lvgl_port_cfg = ESP_LVGL_PORT_INIT_CONFIG(),
@ -1314,12 +1330,6 @@ void app_main(void)
bsp_display_start_with_config(&cfg); bsp_display_start_with_config(&cfg);
bsp_display_backlight_on(); bsp_display_backlight_on();
bsp_display_lock(0);
//lv_demo_music();
//lv_demo_benchmark();
//lv_demo_widgets();
// LCD HW initialization // LCD HW initialization
//ESP_ERROR_CHECK(app_lcd_init()); //ESP_ERROR_CHECK(app_lcd_init());
@ -1338,8 +1348,9 @@ void app_main(void)
// On affiche au plus tot l'ecran de démarrage // On affiche au plus tot l'ecran de démarrage
// ESP_ERROR_CHECK(esp_lcd_panel_mirror(lcd_panel,true,true)); // ESP_ERROR_CHECK(esp_lcd_panel_mirror(lcd_panel,true,true));
app_main_display(); display_lock("app_main");
bsp_display_unlock(); app_main_display();
display_unlock("app_main");
printf("7 - Free heap after buffers allocation: %d\n", xPortGetFreeHeapSize()); printf("7 - Free heap after buffers allocation: %d\n", xPortGetFreeHeapSize());
// Initialize NVS // Initialize NVS
@ -1358,7 +1369,6 @@ void app_main(void)
//wifi_log_e("test", "%s %d %f", "hello world wifi logger", 43, 45.341223242); // write log over wifi with log level -> ERROR //wifi_log_e("test", "%s %d %f", "hello world wifi logger", 43, 45.341223242); // write log over wifi with log level -> ERROR
esp_log_level_set("tcp_handler", ESP_LOG_NONE); esp_log_level_set("tcp_handler", ESP_LOG_NONE);
printf("8b - Free heap after buffers allocation: %d\n", xPortGetFreeHeapSize()); printf("8b - Free heap after buffers allocation: %d\n", xPortGetFreeHeapSize());
mqtt_app_start();
printf("9 - Free heap after buffers allocation: %d\n", xPortGetFreeHeapSize()); printf("9 - Free heap after buffers allocation: %d\n", xPortGetFreeHeapSize());
@ -1386,34 +1396,39 @@ void app_main(void)
printf("10. Free heap after buffers allocation: %d\n", xPortGetFreeHeapSize()); printf("10. Free heap after buffers allocation: %d\n", xPortGetFreeHeapSize());
heap_caps_print_heap_info(MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT); heap_caps_print_heap_info(MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
on_weather_data_retrieval(weather_data_retreived);
on_weather_data_retrieval_start(weather_data_retreived_start);
initialise_weather_data_retrieval(600000);
ESP_LOGW(TAG, "Weather data retrieval initialized");
printf("11. Free heap after buffers allocation: %d\n", xPortGetFreeHeapSize()); printf("11. Free heap after buffers allocation: %d\n", xPortGetFreeHeapSize());
ESP_LOGW(TAG, "On telecharge l'image cuve"); ESP_LOGW(TAG, "On telecharge l'image cuve");
TaskHandle_t xHandle = NULL; TaskHandle_t xHandle = NULL;
BaseType_t ret1; BaseType_t ret1;
/*ret1 = xTaskCreate(&imgdwn, "imageDownload_task", 3 * 1024, NULL, 5, &xHandle); ret1 = xTaskCreate(&imgdwn, "imageDownload_task", 3 * 1024, NULL, 5, &xHandle);
if (ret1 != pdPASS) if (ret1 != pdPASS)
{ {
ESP_LOGE(TAG, "Impossiblke de creer la tache imageDownload_task %i", ret1); ESP_LOGE(TAG, "Impossiblke de creer la tache imageDownload_task %i", ret1);
}*/ }
/*
BaseType_t ret2 = xTaskCreate(&updateTime, "updateTimeTask", 3 * 1024, NULL, 5, NULL); BaseType_t ret2 = xTaskCreate(&updateTime, "updateTimeTask", 3 * 1024, NULL, 5, NULL);
if (ret2 != pdPASS) if (ret2 != pdPASS)
{ {
ESP_LOGE(TAG, "Impossiblke de creer la tache updateTimeTask %i", ret2); ESP_LOGE(TAG, "Impossiblke de creer la tache updateTimeTask %i", ret2);
} }
*/
printf("12. Free heap after buffers allocation: %d\n", xPortGetFreeHeapSize()); printf("12. Free heap after buffers allocation: %d\n", xPortGetFreeHeapSize());
// Show LVGL objects // Show LVGL objects
bsp_display_lock(0); if(display_lock("draw_ihm")){
draw_ihm(); draw_ihm();
// lv_disp_set_rotation(lvgl_disp, LV_DISPLAY_ROTATION_180); display_unlock("draw_ihm");
bsp_display_unlock(); }else{
ESP_LOGE(TAG,"Impossible d'obtenir le mutex pour draw_ihm");
}
mqtt_app_start();
on_weather_data_retrieval(weather_data_retreived);
on_weather_data_retrieval_start(weather_data_retreived_start);
initialise_weather_data_retrieval(600000);
ESP_LOGW(TAG, "Weather data retrieval initialized");
printf("13. Free heap after buffers allocation: %d\n", xPortGetFreeHeapSize()); printf("13. Free heap after buffers allocation: %d\n", xPortGetFreeHeapSize());
@ -1434,18 +1449,12 @@ void app_main(void)
// Note: esp_vfs_littlefs_register is an all-in-one convenience function. // Note: esp_vfs_littlefs_register is an all-in-one convenience function.
ret = esp_vfs_littlefs_register(&conflfs); ret = esp_vfs_littlefs_register(&conflfs);
if (ret != ESP_OK) if (ret != ESP_OK){
{ if (ret == ESP_FAIL){
if (ret == ESP_FAIL)
{
ESP_LOGE(TAG, "Failed to mount or format filesystem"); ESP_LOGE(TAG, "Failed to mount or format filesystem");
} }else if (ret == ESP_ERR_NOT_FOUND){
else if (ret == ESP_ERR_NOT_FOUND)
{
ESP_LOGE(TAG, "Failed to find LittleFS partition"); ESP_LOGE(TAG, "Failed to find LittleFS partition");
} }else{
else
{
ESP_LOGE(TAG, "Failed to initialize LittleFS (%s)", esp_err_to_name(ret)); ESP_LOGE(TAG, "Failed to initialize LittleFS (%s)", esp_err_to_name(ret));
} }
return; return;
@ -1462,26 +1471,6 @@ void app_main(void)
ESP_LOGI(TAG, "Partition size: total: %d, used: %d", total, used); ESP_LOGI(TAG, "Partition size: total: %d, used: %d", total, used);
} }
ESP_LOGI(TAG, "Reading file");
FILE *f = fopen("/littlefs/p1j.png", "r");
if (f == NULL)
{
ESP_LOGE(TAG, "Failed to open file for reading");
return;
}
char line[128];
char *pos;
fgets(line, sizeof(line), f);
fclose(f);
// strip newline
pos = strchr(line, '\n');
if (pos)
{
*pos = '\0';
}
ESP_LOGI(TAG, "Read from file: '%s'", line);
/* // Configuration de la sonde Temp/Humid. /* // Configuration de la sonde Temp/Humid.
am2302_config_t am2302_config = { am2302_config_t am2302_config = {

View File

@ -32,33 +32,33 @@ static void mqttStatus_obs_cb(lv_observer_t * observer, lv_subject_t * subject)
{ {
ESP_LOGV(TAG, "On passe dans le callback de chgt de statut; %li", lv_subject_get_int(subject)); ESP_LOGV(TAG, "On passe dans le callback de chgt de statut; %li", lv_subject_get_int(subject));
if(lvgl_port_lock(0)){ if(lvgl_port_lock(0)){
lv_obj_t * wifiSt = lv_obj_get_child(lv_obj_get_child(lv_layer_top(), 0),3); lv_obj_t * wifiSt = lv_obj_get_child(lv_obj_get_child(lv_layer_top(), 0),3);
if(lv_obj_check_type(wifiSt, &lv_image_class)){ if(lv_obj_check_type(wifiSt, &lv_image_class)){
switch (lv_subject_get_int(subject)) switch (lv_subject_get_int(subject))
{ {
case 0: case 0:
lv_image_set_src(wifiSt,&mqtt_ko); lv_image_set_src(wifiSt,&mqtt_ko);
break; break;
case 1: case 1:
lv_image_set_src(wifiSt,&mqtt_ok); lv_image_set_src(wifiSt,&mqtt_ok);
break; break;
case 2: case 2:
lv_color_t color = lv_color_make(255, 0, 0); lv_color_t color = lv_color_make(255, 0, 0);
lv_obj_set_style_image_recolor_opa(wifiSt, 125, 0); lv_obj_set_style_image_recolor_opa(wifiSt, 125, 0);
lv_obj_set_style_image_recolor(wifiSt, color, 0); lv_obj_set_style_image_recolor(wifiSt, color, 0);
vTaskDelay(2000 / portTICK_PERIOD_MS); vTaskDelay(2000 / portTICK_PERIOD_MS);
break; break;
case 3: case 3:
lv_obj_set_style_image_recolor_opa(wifiSt, 0, 0); lv_obj_set_style_image_recolor_opa(wifiSt, 0, 0);
break; break;
default: default:
break; break;
}
}else{
ESP_LOGE(TAG, "L'objet recuip en semble pas etre du bon type");
} }
}else{ lvgl_port_unlock();
ESP_LOGE(TAG, "L'objet recuip en semble pas etre du bon type");
}
lvgl_port_unlock();
} }
//int32_t prev_v = lv_subject_get_previous_int(subject); //int32_t prev_v = lv_subject_get_previous_int(subject);
//int32_t cur_v = lv_subject_get_int(subject); //int32_t cur_v = lv_subject_get_int(subject);
@ -116,7 +116,7 @@ static void mqtt_event_handler(void *handler_args, esp_event_base_t base, int32_
switch ((esp_mqtt_event_id_t)event_id) switch ((esp_mqtt_event_id_t)event_id)
{ {
case MQTT_EVENT_CONNECTED: case MQTT_EVENT_CONNECTED:
if(lvgl_port_lock(0)){ if(lvgl_port_lock(50)){
ESP_LOGV(TAG,"Statut mqttStatus 1"); ESP_LOGV(TAG,"Statut mqttStatus 1");
lv_subject_set_int(&mqttStatus,1); lv_subject_set_int(&mqttStatus,1);
lvgl_port_unlock(); lvgl_port_unlock();
@ -150,7 +150,7 @@ static void mqtt_event_handler(void *handler_args, esp_event_base_t base, int32_
//ESP_LOGI(TAG, "sent unsubscribe successful, msg_id=%d", msg_id); //ESP_LOGI(TAG, "sent unsubscribe successful, msg_id=%d", msg_id);
break; break;
case MQTT_EVENT_DISCONNECTED: case MQTT_EVENT_DISCONNECTED:
if(lvgl_port_lock(0)){ if(lvgl_port_lock(50)){
ESP_LOGE(TAG,"Statut mqttStatus 0"); ESP_LOGE(TAG,"Statut mqttStatus 0");
lv_subject_set_int(&mqttStatus,0); lv_subject_set_int(&mqttStatus,0);
lvgl_port_unlock(); lvgl_port_unlock();
@ -176,23 +176,25 @@ static void mqtt_event_handler(void *handler_args, esp_event_base_t base, int32_
ESP_LOGD(TAG, "DATA=%.*s\n", event->data_len, event->data); ESP_LOGD(TAG, "DATA=%.*s\n", event->data_len, event->data);
if (strncmp(event->topic, topicTempExt, 27) == 0) if (strncmp(event->topic, topicTempExt, 27) == 0)
{ {
lvgl_port_lock(0); if(lvgl_port_lock(50)){
// on retransforme en float pour ne garder que la partie entiere de la température // on retransforme en float pour ne garder que la partie entiere de la température
float temp = strtof(event->data, NULL); float temp = strtof(event->data, NULL);
char buff[5]; char buff[5];
sprintf(buff,"%.1f",temp); sprintf(buff,"%.1f",temp);
lv_subject_copy_string(&tempExtSubj, buff); lv_subject_copy_string(&tempExtSubj, buff);
lvgl_port_unlock(); lvgl_port_unlock();
}
} }
else if (strncmp(event->topic, topicTempInt, 27) == 0) else if (strncmp(event->topic, topicTempInt, 27) == 0)
{ {
lvgl_port_lock(0); if(lvgl_port_lock(0)){
// on retransforme en float pour ne garder que la partie entiere de la température // on retransforme en float pour ne garder que la partie entiere de la température
float temp = strtof(event->data, NULL); float temp = strtof(event->data, NULL);
char buff[5]; char buff[5];
sprintf(buff,"%.1f",temp); sprintf(buff,"%.1f",temp);
lv_subject_copy_string(&tempIntSubj, buff); lv_subject_copy_string(&tempIntSubj, buff);
lvgl_port_unlock(); lvgl_port_unlock();
}
} }
else if (strncmp(event->topic, topicHauteurCuveEvol, 22) == 0) else if (strncmp(event->topic, topicHauteurCuveEvol, 22) == 0)
{ {
@ -211,14 +213,13 @@ static void mqtt_event_handler(void *handler_args, esp_event_base_t base, int32_
} }
else if (strncmp(event->topic, topicHauteurCuve, 18) == 0) else if (strncmp(event->topic, topicHauteurCuve, 18) == 0)
{ {
lvgl_port_lock(0); if (lvgl_port_lock(50)){
char *datas = NULL; float temp = strtof(event->data, NULL);
datas = (char *)malloc(event->data_len * sizeof(char)); char buff[5];
stpncpy(datas, event->data, event->data_len); sprintf(buff,"%.0f",temp);
datas[event->data_len] = '\0'; lv_subject_copy_string(&hauteurCuveSubj, buff);
lv_subject_copy_string(&hauteurCuveSubj, datas); lvgl_port_unlock();
free(datas); }
lvgl_port_unlock();
}else if (strncmp(event->topic, topicTest, 4) == 0){ }else if (strncmp(event->topic, topicTest, 4) == 0){
ESP_LOGD(TAG,"Msg reecu sur test"); ESP_LOGD(TAG,"Msg reecu sur test");
}else if (strncmp(event->topic, topicdomoticCommand, 11) == 0){ }else if (strncmp(event->topic, topicdomoticCommand, 11) == 0){
@ -231,7 +232,10 @@ static void mqtt_event_handler(void *handler_args, esp_event_base_t base, int32_
{ {
ESP_LOGE(TAG, "None match :-( %s", event->topic); ESP_LOGE(TAG, "None match :-( %s", event->topic);
} }
lv_subject_set_int(&mqttStatus,3); if (lvgl_port_lock(50)){
lv_subject_set_int(&mqttStatus,3);
lvgl_port_unlock();
}
break; break;
case MQTT_EVENT_ERROR: case MQTT_EVENT_ERROR:
ESP_LOGI(TAG, "MQTT_EVENT_ERROR"); ESP_LOGI(TAG, "MQTT_EVENT_ERROR");

View File

@ -2513,8 +2513,8 @@ CONFIG_LV_USE_BUILTIN_MALLOC=y
CONFIG_LV_USE_BUILTIN_STRING=y CONFIG_LV_USE_BUILTIN_STRING=y
# CONFIG_LV_USE_CLIB_STRING is not set # CONFIG_LV_USE_CLIB_STRING is not set
# CONFIG_LV_USE_CUSTOM_STRING is not set # CONFIG_LV_USE_CUSTOM_STRING is not set
CONFIG_LV_USE_BUILTIN_SPRINTF=y # CONFIG_LV_USE_BUILTIN_SPRINTF is not set
# CONFIG_LV_USE_CLIB_SPRINTF is not set CONFIG_LV_USE_CLIB_SPRINTF=y
# CONFIG_LV_USE_CUSTOM_SPRINTF is not set # CONFIG_LV_USE_CUSTOM_SPRINTF is not set
CONFIG_LV_MEM_SIZE_KILOBYTES=64 CONFIG_LV_MEM_SIZE_KILOBYTES=64
CONFIG_LV_MEM_POOL_EXPAND_SIZE_KILOBYTES=0 CONFIG_LV_MEM_POOL_EXPAND_SIZE_KILOBYTES=0
@ -2585,7 +2585,26 @@ CONFIG_LV_USE_DRAW_SW_ASM=0
# #
# Logging # Logging
# #
# CONFIG_LV_USE_LOG is not set CONFIG_LV_USE_LOG=y
# CONFIG_LV_LOG_LEVEL_TRACE is not set
# CONFIG_LV_LOG_LEVEL_INFO is not set
CONFIG_LV_LOG_LEVEL_WARN=y
# CONFIG_LV_LOG_LEVEL_ERROR is not set
# CONFIG_LV_LOG_LEVEL_USER is not set
# CONFIG_LV_LOG_LEVEL_NONE is not set
CONFIG_LV_LOG_LEVEL=2
CONFIG_LV_LOG_PRINTF=y
CONFIG_LV_LOG_USE_TIMESTAMP=y
CONFIG_LV_LOG_USE_FILE_LINE=y
CONFIG_LV_LOG_TRACE_MEM=y
CONFIG_LV_LOG_TRACE_TIMER=y
CONFIG_LV_LOG_TRACE_INDEV=y
CONFIG_LV_LOG_TRACE_DISP_REFR=y
CONFIG_LV_LOG_TRACE_EVENT=y
CONFIG_LV_LOG_TRACE_OBJ_CREATE=y
CONFIG_LV_LOG_TRACE_LAYOUT=y
CONFIG_LV_LOG_TRACE_ANIM=y
CONFIG_LV_LOG_TRACE_CACHE=y
# end of Logging # end of Logging
# #
@ -2593,7 +2612,7 @@ CONFIG_LV_USE_DRAW_SW_ASM=0
# #
CONFIG_LV_USE_ASSERT_NULL=y CONFIG_LV_USE_ASSERT_NULL=y
CONFIG_LV_USE_ASSERT_MALLOC=y CONFIG_LV_USE_ASSERT_MALLOC=y
# CONFIG_LV_USE_ASSERT_STYLE is not set CONFIG_LV_USE_ASSERT_STYLE=y
# CONFIG_LV_USE_ASSERT_MEM_INTEGRITY is not set # CONFIG_LV_USE_ASSERT_MEM_INTEGRITY is not set
# CONFIG_LV_USE_ASSERT_OBJ is not set # CONFIG_LV_USE_ASSERT_OBJ is not set
CONFIG_LV_ASSERT_HANDLER_INCLUDE="assert.h" CONFIG_LV_ASSERT_HANDLER_INCLUDE="assert.h"
@ -2779,7 +2798,10 @@ CONFIG_LV_USE_GRID=y
# 3rd Party Libraries # 3rd Party Libraries
# #
CONFIG_LV_FS_DEFAULT_DRIVE_LETTER=0 CONFIG_LV_FS_DEFAULT_DRIVE_LETTER=0
# CONFIG_LV_USE_FS_STDIO is not set CONFIG_LV_USE_FS_STDIO=y
CONFIG_LV_FS_STDIO_LETTER=65
CONFIG_LV_FS_STDIO_PATH=""
CONFIG_LV_FS_STDIO_CACHE_SIZE=0
# CONFIG_LV_USE_FS_POSIX is not set # CONFIG_LV_USE_FS_POSIX is not set
# CONFIG_LV_USE_FS_WIN32 is not set # CONFIG_LV_USE_FS_WIN32 is not set
# CONFIG_LV_USE_FS_FATFS is not set # CONFIG_LV_USE_FS_FATFS is not set
@ -2787,7 +2809,7 @@ CONFIG_LV_FS_DEFAULT_DRIVE_LETTER=0
# CONFIG_LV_USE_FS_LITTLEFS is not set # CONFIG_LV_USE_FS_LITTLEFS is not set
# CONFIG_LV_USE_FS_ARDUINO_ESP_LITTLEFS is not set # CONFIG_LV_USE_FS_ARDUINO_ESP_LITTLEFS is not set
# CONFIG_LV_USE_FS_ARDUINO_SD is not set # CONFIG_LV_USE_FS_ARDUINO_SD is not set
# CONFIG_LV_USE_LODEPNG is not set CONFIG_LV_USE_LODEPNG=y
# CONFIG_LV_USE_LIBPNG is not set # CONFIG_LV_USE_LIBPNG is not set
# CONFIG_LV_USE_BMP is not set # CONFIG_LV_USE_BMP is not set
# CONFIG_LV_USE_TJPGD is not set # CONFIG_LV_USE_TJPGD is not set
@ -2851,12 +2873,11 @@ CONFIG_LV_BUILD_EXAMPLES=y
# #
# Demos # Demos
# #
CONFIG_LV_USE_DEMO_WIDGETS=y # CONFIG_LV_USE_DEMO_WIDGETS is not set
# CONFIG_LV_USE_DEMO_KEYPAD_AND_ENCODER is not set # CONFIG_LV_USE_DEMO_KEYPAD_AND_ENCODER is not set
CONFIG_LV_USE_DEMO_BENCHMARK=y
# CONFIG_LV_USE_DEMO_RENDER is not set # CONFIG_LV_USE_DEMO_RENDER is not set
# CONFIG_LV_USE_DEMO_SCROLL is not set # CONFIG_LV_USE_DEMO_SCROLL is not set
CONFIG_LV_USE_DEMO_STRESS=y # CONFIG_LV_USE_DEMO_STRESS is not set
# CONFIG_LV_USE_DEMO_TRANSFORM is not set # CONFIG_LV_USE_DEMO_TRANSFORM is not set
# CONFIG_LV_USE_DEMO_MUSIC is not set # CONFIG_LV_USE_DEMO_MUSIC is not set
# CONFIG_LV_USE_DEMO_FLEX_LAYOUT is not set # CONFIG_LV_USE_DEMO_FLEX_LAYOUT is not set

View File

@ -67,3 +67,12 @@ CONFIG_LV_USE_DEMO_WIDGETS=y
CONFIG_LV_USE_DEMO_BENCHMARK=y CONFIG_LV_USE_DEMO_BENCHMARK=y
CONFIG_LV_USE_DEMO_STRESS=y CONFIG_LV_USE_DEMO_STRESS=y
CONFIG_IDF_EXPERIMENTAL_FEATURES=y CONFIG_IDF_EXPERIMENTAL_FEATURES=y
#Necessaire pour lire les fichiers depuis littlefs
CONFIG_LV_USE_FS_STDIO=y
CONFIG_LV_FS_STDIO_LETTER=65
CONFIG_LV_FS_STDIO_PATH=""
CONFIG_LV_FS_STDIO_CACHE_SIZE=0
# Necessaire pour lire le png
CONFIG_LV_USE_LODEPNG=y