work on host and device

This commit is contained in:
Marc Pasteur 2026-02-15 17:43:06 +01:00
parent 58378ea2cf
commit c3f0c148ba
15 changed files with 259 additions and 180 deletions

View File

@ -15,6 +15,7 @@ if(SIMULATION_QEMU)
components/domotic_display
managed_components/lvgl_lvgl
main
esp-timer
$ENV{IDF_PATH}/examples/protocols/linux_stubs/esp_stubs
)
@ -29,7 +30,7 @@ else()
# $ENV{IDF_PATH}/examples/protocols/linux_stubs/esp_stubs
# )
endif()
list(APPEND EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/tools/mocks/esp_timer")
#list(APPEND EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/tools/mocks/esp_timer")
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(rgb_lcd)
@ -50,5 +51,13 @@ if(CONFIG_SIMULATION_QEMU)
#)
else()
message(STATUS "Compilation standard")
add_link_options("-Wl,--disable-non-contiguous-regions -lSDL2")
#add_link_options("-Wl,--disable-non-contiguous-regions")
add_compile_options(
-fsanitize=address
-fno-omit-frame-pointer
-O0
-g
)
add_link_options(-fsanitize=address)
endif()

View File

@ -24,7 +24,7 @@ if(${IDF_TARGET} STREQUAL "esp32p4" OR ${IDF_TARGET} STREQUAL "esp32s3")
#esp32_p4_function_ev_board
idf_component_register(SRC_DIRS . fonts
INCLUDE_DIRS "include"
REQUIRES ${comps} esp_lvgl_port)
REQUIRES ${comps} esp_lvgl_port esp32_p4_function_ev_board )
target_compile_options(${COMPONENT_LIB} PUBLIC -DLV_LVGL_H_INCLUDE_SIMPLE)
lvgl_port_create_c_image("images/wifi_ok.png" "images/" "ARGB8888" "NONE")

View File

@ -5,10 +5,20 @@
#include "meteofrance.h"
#include "cJSON.h"
#include "eventsManager.h"
#ifndef CONFIG_IDF_TARGET_LINUX
#include "bsp/esp-bsp.h"
#include "bsp/esp32_p4_function_ev_board.h"
#include "esp_lvgl_port.h"
#else
#include "esp-bsp-mock.h"
#endif
#include "lvgl_private.h"
#include "lv_examples.h"
#include "lv_theme_domotic.h"
@ -22,6 +32,9 @@ LV_FONT_DECLARE(roboto_medium_36);
LV_FONT_DECLARE(roboto_medium_72);
LV_FONT_DECLARE(super_malibu_80);
LV_IMAGE_DECLARE(mqtt_ok);
LV_IMAGE_DECLARE(mqtt_ko);
lv_subject_t dateHeureSubj;
lv_obj_t *lblTempInt2;
char tempExtStr[6];
@ -55,7 +68,10 @@ LV_IMAGE_DECLARE(wifi_ko);
static void wifiStatus_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));
#ifndef CONFIG_IDF_TARGET_LINUX
bsp_display_lock(0);
#endif
if(lv_layer_top()!=NULL && lv_obj_get_child_cnt(lv_layer_top())){
lv_obj_t * wifiSt = lv_obj_get_child(lv_obj_get_child(lv_layer_top(), 0),2);
if(lv_obj_check_type(wifiSt, &lv_image_class)){
@ -76,8 +92,9 @@ static void wifiStatus_obs_cb(lv_observer_t * observer, lv_subject_t * subject)
}else{
ESP_LOGI(TAG,"Pour le moment l'icone de statut n'existe pas");
}
#ifndef CONFIG_IDF_TARGET_LINUX
bsp_display_unlock();
#endif
//int32_t prev_v = lv_subject_get_previous_int(subject);
//int32_t cur_v = lv_subject_get_int(subject);
@ -122,7 +139,7 @@ void lv_theme_copy(lv_theme_t *dst, const lv_theme_t *src)
}
lv_memcpy(dst, src, sizeof(*src));
}
static void create_ui(void)
static void create_ui(void*)
{
// Initialisation du thème
lv_theme_t *th_new = lv_theme_domotic_init(lv_display_get_default());
@ -139,15 +156,6 @@ static void create_ui(void)
// par exemple : lblEtatMachine, lblHauteurCuve, myChart, ser...
}
static void ihm_process_queue(QueueHandle_t xIHMEventQueue)
{
xIHMEvent_t *xReceivedEvent = NULL;
while (xQueueReceive(xIHMEventQueue, &xReceivedEvent, 0) == pdTRUE && xReceivedEvent) {
}
}
// draw_ihm.c
#include "ihm_gateway.h"
#include <unistd.h> // usleep
@ -157,26 +165,19 @@ void drawIhm(void *param) {
// Init display + LVGL
init_display_ihm();
//lv_init();
lv_theme_t *th_new = lv_theme_domotic_init(lv_display_get_default());
lv_display_set_theme(lv_display_get_default(), th_new);
// Init queue
//ihm_gateway_init();
create_ui();
lv_async_call(create_ui,NULL);
// Loop unifiée
while (1) {
ihm_gateway_process_queue();
uint32_t idle_time = lv_timer_handler();
if (platform_is_pc()) {
// SDL backend
usleep(idle_time * 1000);
} else {
// ESP32 : task FreeRTOS
vTaskDelay(pdMS_TO_TICKS(idle_time));
}
vTaskDelay(500 / portTICK_PERIOD_MS);
}
}
@ -215,8 +216,8 @@ static void event_handler(lv_event_t *e)
void init_display_ihm(){
lv_init();
#if CONFIG_IDF_TARGET_LINUX
lv_init();
printf("Hello from sim\n");
display = lv_sdl_window_create(1024, 600);
mouse = lv_sdl_mouse_create();
@ -224,11 +225,14 @@ void init_display_ihm(){
keyboard = lv_sdl_keyboard_create();
#else
lvgl_port_cfg_t lvgl_cfg = ESP_LVGL_PORT_INIT_CONFIG();
lvgl_cfg.task_priority=15;
lvgl_cfg.task_priority=4;
bsp_display_cfg_t cfg = {
.lvgl_port_cfg = lvgl_cfg,
.buffer_size = 1024*600,//BSP_LCD_DRAW_BUFF_SIZE,
.double_buffer = 1,
.hw_cfg = {
.dsi_bus.lane_bit_rate_mbps= 1000
},
.flags = {
.buff_dma = false,
.buff_spiram = false,
@ -236,7 +240,8 @@ void init_display_ihm(){
}
};
ESP_LOGE(TAG,"On demarre le display");
lv_display_t *dsp = bsp_display_start_with_config(&cfg);
bsp_display_start();
//lv_display_t *dsp = bsp_display_start_with_config(&cfg);
//bsp_display_rotate(dsp,LV_DISP_ROTATION_180);
bsp_display_backlight_on();
@ -1129,39 +1134,92 @@ void draw_tabVolets(lv_obj_t* parent)
}
}
typedef struct {
lv_obj_t *date_group;
lv_span_t *date_day;
lv_span_t *date_month;
lv_obj_t *time_group;
lv_span_t *time_hour;
lv_span_t *time_min;
int last_day;
int last_month;
int last_hour;
int last_min;
} datetime_ctx_t;
static inline void u8_to_2digits(char *buf, uint8_t v)
{
buf[0] = '0' + (v / 10);
buf[1] = '0' + (v % 10);
buf[2] = '\0';
}
static void time_observer_cb(lv_observer_t *observer, lv_subject_t *subject)
{
LV_UNUSED(subject);
LV_UNUSED(observer);
lv_obj_t *dateTimeObj = lv_observer_get_target_obj(observer);
datetime_ctx_t *ctx = lv_obj_get_user_data(dateTimeObj);
if (!ctx) return;
//char buf[16];
struct tm *t = (struct tm *)lv_subject_get_pointer(subject);
if (!t) return;
ESP_LOGE(TAG,"%d %d %d %02d:%02d", t->tm_wday, t->tm_mday, t->tm_mon, t->tm_hour, t->tm_min);
lv_obj_t *spangroup = lv_obj_find_by_name(dateTimeObj, "date"); //lv_obj_get_child_by_id(dateTimeObj, "date");
char buf[4];
bool refresh_date = false;
bool refresh_time = false;
// lv_span_set_text(lv_spangroup_get_child(spangroup, 2), lv_subject_get_string(lv_subject_get_group_element(subject, 0)));
if (display_lock("updateTime"))
{
struct tm *dateHeure = (struct tm *)lv_subject_get_pointer(subject);
char buff[13];
snprintf(buff, 8, "%02" LV_PRIu32 "/", (uint32_t)dateHeure->tm_mday);
ESP_LOGE(TAG, "%s", buff);
lv_span_set_text(lv_spangroup_get_child(spangroup, 0), buff);
snprintf(buff, 4, "%02" LV_PRIu32, (uint32_t)((dateHeure->tm_mon) + 1));
lv_span_set_text(lv_spangroup_get_child(spangroup, 1), buff);
lv_spangroup_refresh(spangroup);
spangroup = lv_obj_find_by_name(dateTimeObj, "time");
snprintf(buff,sizeof(buff), "%02" LV_PRId32, (uint32_t)dateHeure->tm_hour);
lv_span_set_text(lv_spangroup_get_child(spangroup, 0), buff);
snprintf(buff,sizeof(buff), ":%02" LV_PRId32, (uint32_t)dateHeure->tm_min);
lv_span_set_text(lv_spangroup_get_child(spangroup, 1), buff);
lv_spangroup_refresh(spangroup);
display_unlock("updateTime");
// ---- DATE ----
if (t->tm_mday != ctx->last_day) {
ctx->last_day = t->tm_mday;
u8_to_2digits(buf, t->tm_mday);
buf[2] = '/';
buf[3] = '\0';
ESP_LOGE(TAG,"Jour %s",buf);
lv_span_set_text(ctx->date_day, buf);
refresh_date = true;
}
if ((t->tm_mon + 1) != ctx->last_month) {
ctx->last_month = t->tm_mon + 1;
u8_to_2digits(buf, ctx->last_month);
ESP_LOGE(TAG,"Mois %s",buf);
lv_span_set_text(ctx->date_month, buf);
refresh_date = true;
}
if (refresh_date) {
lv_spangroup_refresh(ctx->date_group);
}
// ---- TIME ----
if (t->tm_hour != ctx->last_hour) {
ctx->last_hour = t->tm_hour;
u8_to_2digits(buf, t->tm_hour);
ESP_LOGE(TAG,"Heure %s",buf);
lv_span_set_text(ctx->time_hour, buf);
refresh_time = true;
}
if (t->tm_min != ctx->last_min) {
ctx->last_min = t->tm_min;
buf[0] = ':';
buf[1] = '0' + (t->tm_min / 10);
buf[2] = '0' + (t->tm_min % 10);
buf[3] = '\0';
ESP_LOGE(TAG,"Minutes %s",buf);
lv_span_set_text(ctx->time_min, buf);
refresh_time = true;
}
if (refresh_time) {
lv_spangroup_refresh(ctx->time_group);
}
}
/* ------------------------------------------------------------ */
@ -1293,11 +1351,11 @@ void blink_start(lv_obj_t *obj, uint32_t period_ms)
}
static void anim_opa_cb(void *obj, int32_t v)
{
if (display_lock_logChoose("msg fade", false))
{
//if (display_lock_logChoose("msg fade", false))
//{
lv_obj_set_style_opa(obj, v, 0);
display_unlock_logChoose("msg fade",false);
}
// display_unlock_logChoose("msg fade",false);
//}
}
void blink_fade(lv_obj_t *obj)
{
@ -1520,6 +1578,25 @@ void messageCardContent(lv_obj_t *cont_messages)
drawMeteo(base_obj);
}
void datetime_ctx_init(lv_obj_t *dateTimeObj)
{
datetime_ctx_t *ctx = lv_malloc(sizeof(datetime_ctx_t));
LV_ASSERT_MALLOC(ctx);
memset(ctx, -1, sizeof(datetime_ctx_t)); // force 1ère mise à jour
ctx->date_group = lv_obj_find_by_name(dateTimeObj, "date");
ctx->time_group = lv_obj_find_by_name(dateTimeObj, "time");
ctx->date_day = lv_spangroup_get_child(ctx->date_group, 0);
ctx->date_month = lv_spangroup_get_child(ctx->date_group, 1);
ctx->time_hour = lv_spangroup_get_child(ctx->time_group, 0);
ctx->time_min = lv_spangroup_get_child(ctx->time_group, 1);
lv_obj_set_user_data(dateTimeObj, ctx);
}
void drawHome()
{
@ -1602,7 +1679,7 @@ void messageCardContent(lv_obj_t *cont_messages)
//lv_subject_add_observer_obj(&c->th, theme_observer_accent_span_cb, time, minute);
lv_subject_add_observer_obj(&timeSubj, time_observer_cb, date_and_time, NULL);
datetime_ctx_init(date_and_time);
lv_obj_t * subContent = lv_obj_create(info_area);
lv_obj_set_flex_flow(subContent, LV_FLEX_FLOW_COLUMN);
lv_obj_set_size(subContent, LV_PCT(70), LV_PCT(100));

View File

@ -39,15 +39,26 @@ void ihm_gateway_process_queue(void) {
xIHMEvent_t *evt = NULL;
if (platform_is_pc()) {
if (xQueueReceive(xIHMEventQueue, &evt, 0) != pdTRUE) return;
} else {
if (xQueueReceive(xIHMEventQueue, &evt, pdMS_TO_TICKS(10)) != pdTRUE) return;
}
#if CONFIG_IDF_TARGET_LINUX
while (xQueueReceive(xIHMEventQueue, &evt, pdMS_TO_TICKS(0)) == pdTRUE)
#else
while (xQueueReceive(xIHMEventQueue, &evt, pdMS_TO_TICKS(10)) == pdTRUE)
#endif
{
if (!evt) return;
switch (evt->eEventType) {
UBaseType_t pending = uxQueueMessagesWaiting(xIHMEventQueue);
ESP_LOGV(TAG,"Evt recu %d. La queue comporte %d éléments à traiter", evt->eEventType, pending);
lv_async_call(traiteEvt, evt);
}
}
void traiteEvt(void *arg)
{
xIHMEvent_t *evt = (xIHMEvent_t *)arg;
switch (evt->eEventType)
{
case IHM_EVT_WIFI_STATUS:
lv_subject_set_int(&wifiStatus, *(bool *)evt->pvData);
break;
@ -64,14 +75,16 @@ void ihm_gateway_process_queue(void) {
draw_temp((char *)evt->pvData);
break;
case IHM_EVT_PUISSANCE_EMISE: {
case IHM_EVT_PUISSANCE_EMISE:
{
int val = *(int *)evt->pvData;
// if(val == 0) lv_chart_set_next_value(myChart, ser, LV_CHART_POINT_NONE);
// else lv_chart_set_next_value(myChart, ser, val);
break;
}
case IHM_EVT_ETAT_MACHINE: {
case IHM_EVT_ETAT_MACHINE:
{
char *etatMachine = evt->pvData;
cJSON *root = cJSON_Parse(etatMachine);
bool enRoute = cJSON_GetObjectItem(root, "state")->valueint;
@ -92,7 +105,8 @@ void ihm_gateway_process_queue(void) {
break;
}
case IHM_EVT_HAUTEUR_CUVE: {
case IHM_EVT_HAUTEUR_CUVE:
{
float hauteur = *(float *)evt->pvData;
// lv_label_set_text_fmt(lblHauteurCuve, "%.0f cm", hauteur);
break;
@ -102,9 +116,9 @@ void ihm_gateway_process_queue(void) {
ESP_LOGE(TAG, "Evt inconnu");
break;
}
// Nettoyage mémoire sécurisé
if (evt->bNeedToFreeData && evt->pvData) free(evt->pvData);
if (evt->bNeedToFreeData && evt->pvData)
free(evt->pvData);
free(evt);
ESP_LOGV(TAG, "Evt traité");
}

View File

@ -1,17 +0,0 @@
#include "lvgl.h"
extern SemaphoreHandle_t lvgl_mux;
static const char* TAG_BSP="bsp";
bool bsp_display_lock(int timeout_ms)
{
//ESP_LOGI(TAG_BSP, "Obtention mutex");
// Convert timeout in milliseconds to FreeRTOS ticks
// If `timeout_ms` is set to -1, the program will block until the condition is met
//const TickType_t timeout_ticks = (timeout_ms == -1) ? portMAX_DELAY : pdMS_TO_TICKS(timeout_ms);
//return xSemaphoreTakeRecursive(lvgl_mux, timeout_ticks) == pdTRUE;
//lv_lock();
return true;
}
void bsp_display_unlock() {
//xSemaphoreGiveRecursive(lvgl_mux);
//lv_unlock();
}

View File

@ -0,0 +1,2 @@
bool bsp_display_lock(int timeout_ms){return true;};
void bsp_display_unlock(){};

View File

@ -10,3 +10,5 @@ QueueHandle_t getIHMQueueHandle(void);
void ihm_gateway_init(void);
void ihm_gateway_post_event(xIHMEvent_t *evt);
void ihm_gateway_process_queue(void);
void traiteEvt(void * evt);

View File

@ -6,7 +6,7 @@
static inline bool platform_is_pc(void) {
#if CONFIG_IDF_TARGET_LINUX
return true;
return false;
#else
return false;
#endif

View File

@ -26,7 +26,7 @@ void startEvtManager(){
}
void send_event(domo_events evt, void* pDatas) {
ESP_LOGE(TAG,"On est dans l'event handler %i", evt);
ESP_LOGV(TAG,"On est dans l'event handler %i", evt);
xIHMEvent_t *ihmEvt = malloc(sizeof(xIHMEvent_t));
if (!ihmEvt) {
@ -70,6 +70,7 @@ void send_event(domo_events evt, void* pDatas) {
return;
}
*msg_copy = *msg;
ihmEvt->eEventType = IHM_EVT_TIME_SETTED;
ihmEvt->pvData = msg_copy;
@ -130,8 +131,8 @@ void send_event(domo_events evt, void* pDatas) {
return;
}
ESP_LOGE(TAG, "Envoi d'un evt %i a l'IHM", ihmEvt->eEventType);
if( ihm_queue != NULL ){
if (ihmEvt && xQueueSendToFront(ihm_queue, &ihmEvt, pdMS_TO_TICKS(10)) != pdPASS)
if( ihm_queue != NULL && ihmEvt){
if (xQueueSendToFront(ihm_queue, &ihmEvt, pdMS_TO_TICKS(10)) != pdPASS)
{
ESP_LOGE(TAG, "La queue est pleine");
if (ihmEvt->bNeedToFreeData && ihmEvt->pvData)

View File

@ -27,9 +27,9 @@ void updateTime(void *pvParameter)
// strftime(strftime_buf, sizeof(strftime_buf), "%c", &timeinfo);
snprintf(strftime_buf,sizeof(strftime_buf), "%s %d %s %02d:%02d", days[timeinfo.tm_wday], timeinfo.tm_mday, months[timeinfo.tm_mon], timeinfo.tm_hour, timeinfo.tm_min);
localtime_r(&now, &timeinfo);
ESP_LOGE(TAG, "%s", strftime_buf);
//ESP_LOGE(TAG, "%s", strftime_buf);
send_event(EVT_TIME_SETTED, &timeinfo);
vTaskDelay(10000 / portTICK_PERIOD_MS);
vTaskDelay(1000 / portTICK_PERIOD_MS);
}
}
#else
@ -45,8 +45,9 @@ void time_sync_notification_cb(struct timeval *tv)
localtime_r(&now, &timeinfo);
// strftime(strftime_buf, sizeof(strftime_buf), "%c", &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);
ESP_LOGE(TAG, "%s", strftime_buf);
localtime_r(&now, &timeinfo);
send_event(EVT_TIME_SETTED, &strftime_buf);
send_event(EVT_TIME_SETTED, &timeinfo);
}
void updateTime(void *pvParameter)
@ -77,7 +78,8 @@ void updateTime(void *pvParameter)
struct tm timeinfo = {0};
localtime_r(&now, &timeinfo);
sprintf(strftime_buf, "%s %d %s %02d:%02d (%lli mn depuis reboot)", days[timeinfo.tm_wday], timeinfo.tm_mday, months[timeinfo.tm_mon], timeinfo.tm_hour, timeinfo.tm_min, (esp_timer_get_time() / 1000 / 1000 / 60));
send_event(EVT_TIME_SETTED, &strftime_buf);
ESP_LOGE(TAG, "%s", strftime_buf);
send_event(EVT_TIME_SETTED, &timeinfo);
vTaskDelay(60000 / portTICK_PERIOD_MS);
}
}

View File

@ -1,11 +1,5 @@
set(requires json esp_http_client esp-tls esp_timer)
idf_build_get_property(target IDF_TARGET)
if(${target} STREQUAL "linux")
list(APPEND EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/tools/mocks/esp_timer" )
else()
list(APPEND requires esp_timer)
endif()
idf_component_register(SRCS "image_downloader.c"
INCLUDE_DIRS "include"
REQUIRES ${requires})

View File

@ -320,7 +320,7 @@ static bool process_response_body(const char *body)
return true;
}
static void http_request_task(void* domotic_event_group)
static void meteo_task(void* domotic_event_group)
{
while (1)
{
@ -385,7 +385,7 @@ static void http_request_task(void* domotic_event_group)
}else{
//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(10000 / portTICK_PERIOD_MS);
}
}else{
@ -412,7 +412,7 @@ void initialise_weather_data_retrieval(unsigned long retreival_period, void* dom
// http_client_on_process_chunk(&http_client, process_chunk);
// http_client_on_disconnected(&http_client, disconnected);
TaskHandle_t xHandle = NULL;
BaseType_t ret1 = xTaskCreatePinnedToCore(&http_request_task, "http_meteof", 5 * 1024, domotic_event_group, 5, &xHandle, 0);
BaseType_t ret1 = xTaskCreate(&meteo_task, "http_meteof", 20 * 1024, domotic_event_group, configMAX_PRIORITIES-2, &xHandle);
if(ret1!=pdPASS ){
ESP_LOGE(TAG, "Impossible de creer la tache %"PRIi16, ret1);
}

View File

@ -1,7 +1,7 @@
idf_build_get_property(python SIMULATION_QEMU)
message(STATUS "The Python interpreter is: ${python}")
set(comps heap nvs_flash esp_netif image_downloader fatfs protocol_examples_common mqtt meteofrance domotic_display RemindMe)
set(comps heap nvs_flash esp_netif image_downloader fatfs protocol_examples_common mqtt meteofrance domotic_display RemindMe esp_timer)
if(${IDF_TARGET} STREQUAL "esp32p4")
message(STATUS "SIMULATION_QEMU = OOF --> main standard")

View File

@ -21,8 +21,6 @@ dependencies:
- if: target in ["esp32p4"]
idf:
version: 5.5.*
lvgl/lvgl:
version: 9.4.0
#espressif/esp32_p4_function_ev_board:
# version: "4.1.*"
espressif/esp32_p4_function_ev_board:

View File

@ -768,7 +768,7 @@ void weather_data_retreived(struct meteodailyforecast_data dailyDatas[3], struct
//display_unlock("weather_data_retreived");
ESP_LOGV(TAG, "------------------------------------- Fin Set des subjects --------------------------------");
//}else{
ESP_LOGE(TAG, "Impossible d'obtenir le mutex dans weather_data_retreived");
//ESP_LOGE(TAG, "Impossible d'obtenir le mutex dans weather_data_retreived");
//}
}
@ -785,9 +785,6 @@ void weather_data_retreived_start()
//}
}
LV_IMAGE_DECLARE(mqtt_ok);
LV_IMAGE_DECLARE(mqtt_ko);
/* 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));
@ -904,27 +901,30 @@ void app_main(void)
ihm_gateway_init();
startEvtManager();
boucleMeteo();
//boucleMeteo();
#if CONFIG_IDF_TARGET_LINUX
// en mode linux on simule l'obtention de la connexion wifi
xEventGroupSetBits(domotic_event_group, WIFI_CONNECTED_BIT);
xTaskCreate(&drawIhm,"ihm_task",10000,getIHMQueueHandle(),10,NULL);
//drawIhm(getIHMQueueHandle());
drawIhm(NULL);
#else
xTaskCreatePinnedToCore(&drawIhm,"ihm_task",10000,getIHMQueueHandle(),10,NULL,0);
xTaskCreate(&drawIhm,"ihm_task",10000,getIHMQueueHandle(),10,NULL);
//et sinon on se connecte
ESP_LOGI(TAG, "ESP_WIFI_MODE_STA");
wifi_init_sta(wifi_cb);
//start_wifi_logger();
#endif
TaskHandle_t xHandle = NULL;
BaseType_t ret1;
ret1 = xTaskCreate(&imgdwn, "imageDownload_task", 3 * 1024, domotic_event_group, 5, &xHandle);
/*ret1 = xTaskCreate(&imgdwn, "imageDownload_task", 3 * 1024, domotic_event_group, 5, &xHandle);
if (ret1 != pdPASS)
{
ESP_LOGE(TAG, "Impossiblke de creer la tache imageDownload_task %i", ret1);
}
}*/
/* Create widgets on the screen */
//lv_demo_widgets();
}
void boucleMeteo()
@ -1012,9 +1012,6 @@ void app_main1(void)
}
ESP_ERROR_CHECK(ret);
ESP_LOGI(TAG, "ESP_WIFI_MODE_STA");
//wifi_init_sta(wifi_cb);
//start_wifi_logger();
//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);
printf("8b - Free heap after buffers allocation: %zu\n", xPortGetFreeHeapSize());