fonctionne qemu + linux host

This commit is contained in:
Marc PASTEUR 2025-12-15 07:05:50 +01:00
parent e55b74b0a2
commit bf85c544f5
8 changed files with 108 additions and 12 deletions

13
.devcontainer/Dockerfile Normal file
View File

@ -0,0 +1,13 @@
ARG DOCKER_TAG=latest
FROM espressif/idf:${DOCKER_TAG}
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8
RUN apt-get update -y && apt-get install udev -y
RUN echo "source /opt/esp/idf/export.sh > /dev/null 2>&1" >> ~/.bashrc
ENTRYPOINT [ "/opt/esp/entrypoint.sh" ]
CMD ["/bin/bash", "-c"]

View File

@ -0,0 +1,21 @@
{
"name": "ESP-IDF QEMU",
"build": {
"dockerfile": "Dockerfile"
},
"customizations": {
"vscode": {
"settings": {
"terminal.integrated.defaultProfile.linux": "bash",
"idf.espIdfPath": "/opt/esp/idf",
"idf.toolsPath": "/opt/esp",
"idf.gitPath": "/usr/bin/git"
},
"extensions": [
"espressif.esp-idf-extension",
"espressif.esp-idf-web"
]
}
},
"runArgs": ["--privileged"]
}

View File

@ -1105,6 +1105,45 @@ static lv_style_t no_padding;
static lv_style_t objstyle; static lv_style_t objstyle;
static lv_style_t txtstyle; static lv_style_t txtstyle;
void coverCardContent(lv_obj_t *cont_colVolets)
{
lv_obj_set_style_pad_all(cont_colVolets, 5, 0);
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(60), lv_pct(70));
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);
lv_obj_t *btnUp = lv_button_create(cont_colVolets);
lv_obj_add_style(btnUp, &style_btn, 0);
lv_obj_add_event_cb(btnUp, event_handler, LV_EVENT_ALL, upEvent);
//lv_obj_align(btnUp, LV_ALIGN_CENTER, 0, -40);
lv_obj_remove_flag(btnUp, LV_OBJ_FLAG_PRESS_LOCK);
lv_obj_t *label = lv_label_create(btnUp);
lv_obj_add_style(label, &style_lbvValue, 0);
lv_label_set_text(label, LV_SYMBOL_UP);
lv_obj_center(label);
lv_obj_t *btnDwn = lv_button_create(cont_colVolets);
lv_obj_add_style(btnDwn, &style_btn, 0);
lv_obj_add_event_cb(btnDwn, event_handler, LV_EVENT_ALL, downEvent);
//lv_obj_align(btnDwn, LV_ALIGN_CENTER, 0, -40);
lv_obj_remove_flag(btnDwn, LV_OBJ_FLAG_PRESS_LOCK);
label = lv_label_create(btnDwn);
lv_obj_add_style(label, &style_lbvValue, 0);
lv_label_set_text(label, LV_SYMBOL_DOWN);
lv_obj_center(label);
}
void meteoCardContent(lv_obj_t *container)
{
lv_obj_t *txt = lv_label_create(container);
lv_label_set_text(txt, "Meteo");
}
void minuteurCardContent(lv_obj_t *container)
{
lv_obj_t *txt = lv_label_create(container);
lv_label_set_text(txt, "Minuteur");
}
void draw_ihm() void draw_ihm()
{ {
@ -1197,11 +1236,11 @@ void draw_ihm()
lv_obj_set_style_pad_column(apps,6, 0); lv_obj_set_style_pad_column(apps,6, 0);
create_card(apps, "Météo"); create_card(apps, "Météo", meteoCardContent);
create_card(apps, "Volets"); create_card(apps, "Volets", coverCardContent);
create_card(apps,"Minuteur"); create_card(apps, "Minuteur", minuteurCardContent);
create_card(apps,"Messagerie"); create_card(apps, "Messagerie", coverCardContent);
return; return;
// *************************************************************************************************** // ***************************************************************************************************
@ -1268,7 +1307,8 @@ void draw_ihm()
lv_obj_set_flex_flow(tabMeteo, LV_FLEX_FLOW_COLUMN); lv_obj_set_flex_flow(tabMeteo, LV_FLEX_FLOW_COLUMN);
} }
void create_card(lv_obj_t *parent, char *lbl)
void create_card(lv_obj_t *parent, char *lbl, void(*contentFct)(lv_obj_t*))
{ {
//lv_style_init(&objstyle); //lv_style_init(&objstyle);
//lv_style_init(&txtstyle); //lv_style_init(&txtstyle);
@ -1301,6 +1341,9 @@ void create_card(lv_obj_t *parent, char *lbl)
lv_obj_set_style_radius(icon, LV_COORD_MAX, 0); lv_obj_set_style_radius(icon, LV_COORD_MAX, 0);
// lv_obj_add_style(icon, &c->styles[STYLE_COLOR_ACCENT][STYLE_TYPE_A8_IMG], 0); // lv_obj_add_style(icon, &c->styles[STYLE_COLOR_ACCENT][STYLE_TYPE_A8_IMG], 0);
lv_obj_add_flag(icon, LV_OBJ_FLAG_EVENT_BUBBLE); lv_obj_add_flag(icon, LV_OBJ_FLAG_EVENT_BUBBLE);
lv_obj_t *content = lv_obj_create(app_card);
contentFct(content);
} }
void log_cb(lv_log_level_t level, const char * buf){ void log_cb(lv_log_level_t level, const char * buf){

View File

@ -4,6 +4,6 @@ lv_subject_t hourSubj;
lv_subject_t minuteSubj; lv_subject_t minuteSubj;
lv_subject_t timeGroup; lv_subject_t timeGroup;
lv_color_t base = LV_COLOR_MAKE(126, 94, 133); //lv_color_t base = LV_COLOR_MAKE(126, 94, 133);
lv_color_t accent = LV_COLOR_MAKE(204, 16, 16); //lv_color_t accent = LV_COLOR_MAKE(204, 16, 16);
lv_color_t bgColor = LV_COLOR_MAKE(235, 199, 158); //lv_color_t bgColor = LV_COLOR_MAKE(235, 199, 158);

View File

@ -10,6 +10,8 @@ idf_component_register(SRCS
"../../fonts/montserrat_medium_24.c" "../../fonts/montserrat_medium_24.c"
"../../fonts/roboto_medium_36.c" "../../fonts/roboto_medium_36.c"
"../../fonts/roboto_medium_72.c" "../../fonts/roboto_medium_72.c"
"../../images/wifi_ko.c"
"../../images/wifi_ok.c"
INCLUDE_DIRS INCLUDE_DIRS
"../../include" "../../include"
WHOLE_ARCHIVE WHOLE_ARCHIVE

View File

@ -11,7 +11,10 @@
#include "simulator_util.h" #include "simulator_util.h"
#include "simulator_settings.h" #include "simulator_settings.h"
#include "esp_log.h" #include "esp_log.h"
#include "eventsManager.h"
esp_mqtt_client_handle_t client; esp_mqtt_client_handle_t client;
SemaphoreHandle_t lvgl_mux;
/* contains the name of the selected backend if user /* contains the name of the selected backend if user
* has specified one on the command line */ * has specified one on the command line */
@ -138,6 +141,10 @@ int app_main(int argc, char *argv[])
{ {
/* code */ /* code */
printf("hello\n"); printf("hello\n");
lvgl_mux = xSemaphoreCreateRecursiveMutex();
assert(lvgl_mux);
init_display_ihm(); init_display_ihm();
/* Initialize LVGL. */ /* Initialize LVGL. */
@ -163,10 +170,14 @@ int app_main(int argc, char *argv[])
/*lv_timer_t *clock_timer = */lv_timer_create(clock_timer_cb, 1000, NULL); /*lv_timer_t *clock_timer = */lv_timer_create(clock_timer_cb, 1000, NULL);
//draw_ihm(); //draw_ihm();
drawIhm(NULL); startEvtManager();
xTaskCreate(drawIhm, "LVGL", 128 * 1024, getIHMQueueHandle(), 3, NULL);
/* Enter the run loop of the selected backend */ /* Enter the run loop of the selected backend */
driver_backends_run_loop(); driver_backends_run_loop();
//drawIhm(getIHMQueueHandle());
return 0; return 0;
} }

View File

@ -12,11 +12,17 @@ menu "Domotic Configuration"
help help
WiFi password (WPA or WPA2) for the example to use. WiFi password (WPA or WPA2) for the example to use.
#config GPIO_INPUT_CAPTEUR_PIR config EXAMPLE_QEMU_RGB_PANEL_DEDIC_FB
bool "Use QEMU RGB panel dedicated framebuffer"
default "n"
help
Use QEMU RGB panel dedicated framebuffer as the framebuffer for LVGL.
#config GPIO_INPUT_CAPTEUR_PIR
# int "GPIO PIN Capteur PIR" # int "GPIO PIN Capteur PIR"
# range ENV_GPIO_RANGE_MIN ENV_GPIO_IN_RANGE_MAX # range ENV_GPIO_RANGE_MIN ENV_GPIO_IN_RANGE_MAX
# default 4 # default 4
# help # help
# GPIO pin à utiliser pour le capteur de présence IR. # GPIO pin à utiliser pour le capteur de présence IR.
endmenu endmenu

View File

@ -8,7 +8,7 @@ CONFIG_PARTITION_TABLE_CUSTOM=y
CONFIG_COMPILER_OPTIMIZATION_SIZE=y CONFIG_COMPILER_OPTIMIZATION_SIZE=y
CONFIG_COMPILER_ORPHAN_SECTIONS_PLACE=y CONFIG_COMPILER_ORPHAN_SECTIONS_PLACE=y
CONFIG_SPIRAM=y CONFIG_SPIRAM=y
CONFIG_SPIRAM_MODE_QUAD=y CONFIG_SPIRAM_MODE_OCT=y
CONFIG_SPIRAM_IGNORE_NOTFOUND=y CONFIG_SPIRAM_IGNORE_NOTFOUND=y
# CONFIG_SPIRAM_MEMTEST is not set # CONFIG_SPIRAM_MEMTEST is not set