on deplace l'ihm dans domotic_display

This commit is contained in:
Marc Pasteur 2026-02-07 08:24:32 +01:00
parent 689d51b463
commit 43b32b8b68
5 changed files with 55 additions and 21 deletions

View File

@ -37,6 +37,14 @@ elseif(${IDF_TARGET} STREQUAL "linux")
idf_component_register(SRC_DIRS . fonts images
INCLUDE_DIRS "include"
REQUIRES ${comps})
message("Including SDL2 support")
find_package(SDL2 REQUIRED)
target_link_libraries(${COMPONENT_LIB} PUBLIC
-Wl,--no-as-needed
SDL2
-Wl,--as-needed
)
target_compile_options(${COMPONENT_LIB} PUBLIC -DLV_LVGL_H_INCLUDE_SIMPLE)
endif()

View File

@ -206,9 +206,23 @@ static void event_handler(lv_event_t *e)
}
}
#if CONFIG_IDF_TARGET_LINUX
static lv_display_t *display;
static lv_indev_t *mouse;
static lv_indev_t *mouse_wheel;
static lv_indev_t *keyboard;
#endif
void init_display_ihm(){
/*
lv_init();
#if CONFIG_IDF_TARGET_LINUX
printf("Hello from sim\n");
display = lv_sdl_window_create(1024, 600);
mouse = lv_sdl_mouse_create();
mouse_wheel = lv_sdl_mousewheel_create();
keyboard = lv_sdl_keyboard_create();
#else
lvgl_port_cfg_t lvgl_cfg = ESP_LVGL_PORT_INIT_CONFIG();
lvgl_cfg.task_priority=15;
bsp_display_cfg_t cfg = {
@ -227,6 +241,9 @@ void init_display_ihm(){
bsp_display_backlight_on();
bsp_display_brightness_set(50);
#endif
/*
*/
mainState.display_init=true;

View File

@ -20,13 +20,6 @@ elseif(${IDF_TARGET} STREQUAL "linux")
EMBED_TXTFILES ${PROJECT_DIR}/main/ca_cert.pem
EMBED_FILES "index.html")
message("Including SDL2 support")
find_package(SDL2 REQUIRED)
target_link_libraries(${COMPONENT_LIB} PUBLIC
-Wl,--no-as-needed
SDL2
-Wl,--as-needed
)
target_compile_options(${COMPONENT_LIB} PUBLIC --coverage -DLV_LVGL_H_INCLUDE_SIMPLE )

View File

@ -253,7 +253,7 @@ void wifi_init_sta(wifi_callback callback)
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
//ESP_ERROR_CHECK(esp_event_loop_create_default());
esp_netif_create_default_wifi_sta();
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();

View File

@ -895,34 +895,50 @@ void lightSensorTask(void *pvParameter){
}
*/
}
static lv_display_t *display;
static lv_indev_t *mouse;
static lv_indev_t *mouse_wheel;
static lv_indev_t *keyboard;
void app_main(void)
{
printf("Hello from sim\n");
lv_init();
display = lv_sdl_window_create(1024, 600);
mouse = lv_sdl_mouse_create();
mouse_wheel = lv_sdl_mousewheel_create();
keyboard = lv_sdl_keyboard_create();
ESP_ERROR_CHECK(esp_event_loop_create_default());
ihm_gateway_init();
startEvtManager();
boucleMeteo();
#if CONFIG_IDF_TARGET_LINUX
// en mode linux on simule l'obtention de la connexion wifi
xEventGroupSetBits(domotic_event_group, WIFI_CONNECTED_BIT);
drawIhm(NULL);
#else
xTaskCreatePinnedToCore(&drawIhm,"ihm_task",10000,getIHMQueueHandle(),10,NULL,0);
#endif
TaskHandle_t xHandle = NULL;
BaseType_t ret1;
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()
{
on_weather_data_retrieval(weather_data_retreived);
on_weather_data_retrieval_start(weather_data_retreived_start);
ESP_LOGW(TAG, "Weather data retrieval initialized");
initialise_weather_data_retrieval(600000, domotic_event_group);
}
void app_main1(void)
{
//esp_task_wdt_deinit(); // désactive le task watchdog
vTaskDelay(pdMS_TO_TICKS(10000)); // laisse le temps d'attacher GDB
//vTaskDelay(pdMS_TO_TICKS(10000)); // laisse le temps d'attacher GDB
//bh1750_measure_mode_t cmd_measure;