diff --git a/README.md b/README.md
index af5ce96..c01519b 100644
--- a/README.md
+++ b/README.md
@@ -1,19 +1,7 @@
-# ESP LVGL RGB Screen Example
+18px Montserrat + Home de FontAwesome
-Very simple example for demonstration of initialization and usage of the `esp_lvgl_port` component with RGB LCD. This example contains four main parts:
+``` docker run -v $PWD:/app -w /app lvfontconv lv_font_conv --bpp 4 --size 18 --no-compress --font Montserrat-Medium.ttf --symbols "0123456789.°éûCABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz '" --format lvgl -o montserrat_medium_18.c --font fa-solid-900.ttf --range 61461 ```
-## 1. LCD HW initialization - `app_lcd_init()`
+12px Montserrat
-Standard HW initialization of the LCD using [`esp_lcd`](https://github.com/espressif/esp-idf/tree/master/components/esp_lcd) component. Settings of this example are fully compatible with [ESP32-S3-LCD-EV-Board-2](https://github.com/espressif/esp-bsp/tree/master/bsp/esp32_s3_lcd_ev_board) board.
-
-## 2. Touch HW initialization - `app_touch_init()`
-
-Standard HW initialization of the LCD touch using [`esp_lcd_touch`](https://github.com/espressif/esp-bsp/tree/master/components/lcd_touch/esp_lcd_touch) component. Settings of this example are fully compatible with [ESP32-S3-LCD-EV-Board-2](https://github.com/espressif/esp-bsp/tree/master/bsp/esp32_s3_lcd_ev_board) board.
-
-## 3. LVGL port initialization - `app_lvgl_init()`
-
-Initialization of the LVGL port.
-
-## 4. LVGL objects example usage - `app_main_display()`
-
-Very simple demonstration code of using LVGL objects after LVGL port initialization.
+``` docker run -v $PWD:/app -w /app lvfontconv lv_font_conv --bpp 4 --size 12 --no-compress --font Montserrat-Medium.ttf --symbols "0123456789.°èéêûCABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz '" --format lvgl -o montserrat_medium_12.c ```
\ No newline at end of file
diff --git a/components/meteofrance/include/meteofrance.h b/components/meteofrance/include/meteofrance.h
index b469446..1e8c444 100644
--- a/components/meteofrance/include/meteofrance.h
+++ b/components/meteofrance/include/meteofrance.h
@@ -14,7 +14,7 @@ struct forecast_temp{
float min;
float max;
char desc[25];
- char icon[8];
+ char icon[9];
};
struct meteoforecast_data{
diff --git a/components/meteofrance/meteofrance.c b/components/meteofrance/meteofrance.c
index f13913f..0d69106 100644
--- a/components/meteofrance/meteofrance.c
+++ b/components/meteofrance/meteofrance.c
@@ -186,7 +186,7 @@ void JSON_Parse(const cJSON * const root) {
cJSON *weather12=cJSON_GetObjectItem(current_element,"weather12H");
strncpy(datasT.previsions.desc,cJSON_GetObjectItem(weather12,"desc")->valuestring,24);
- strncpy(datasT.previsions.icon,cJSON_GetObjectItem(weather12,"icon")->valuestring,7);
+ strncpy(datasT.previsions.icon,cJSON_GetObjectItem(weather12,"icon")->valuestring,8);
datasT.isValid=true;
//ESP_LOGE(TAG,"Donnees lues");
//printffd(&datasT);
@@ -245,8 +245,7 @@ static void http_request_task(void *pvParameter)
}
//ESP_LOGE(TAG, "%s",local_response_buffer);
- bool weather_data_phrased = false;
- weather_data_phrased = process_response_body(local_response_buffer);
+ process_response_body(local_response_buffer);
weather.data_retreived_cb(datas);
esp_http_client_cleanup(client);
diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt
index 1830cf8..02bdb1c 100644
--- a/main/CMakeLists.txt
+++ b/main/CMakeLists.txt
@@ -1,13 +1,13 @@
idf_component_register(SRC_DIRS . fonts
INCLUDE_DIRS "."
REQUIRES esp_wifi nvs_flash mqtt meteofrance esp_netif)
-
lvgl_port_create_c_image("images/esp_logo.png" "images/" "ARGB8888" "NONE")
lvgl_port_create_c_image("images/p10j.png" "images/" "ARGB8888" "NONE")
lvgl_port_create_c_image("images/p10n.png" "images/" "ARGB8888" "NONE")
lvgl_port_create_c_image("images/p11j.png" "images/" "ARGB8888" "NONE")
lvgl_port_create_c_image("images/p11n.png" "images/" "ARGB8888" "NONE")
lvgl_port_create_c_image("images/p12j.png" "images/" "ARGB8888" "NONE")
+lvgl_port_create_c_image("images/p12bisj.png" "images/" "ARGB8888" "NONE")
lvgl_port_create_c_image("images/p12n.png" "images/" "ARGB8888" "NONE")
lvgl_port_create_c_image("images/p13j.png" "images/" "ARGB8888" "NONE")
lvgl_port_create_c_image("images/p13n.png" "images/" "ARGB8888" "NONE")
@@ -75,5 +75,5 @@ lvgl_port_add_images(${COMPONENT_LIB} "images/")
set_source_files_properties(
PROPERTIES COMPILE_OPTIONS
- "-DLV_LVGL_H_INCLUDE_SIMPLE;-Wno-format;-DLV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(montserrat_medium_12) LV_FONT_DECLARE(montserrat_medium_18)"
+ "-DLV_LVGL_H_INCLUDE_SIMPLE;-Wno-format;-DLV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(montserrat_medium_12) LV_FONT_DECLARE(montserrat_medium_18) LV_FONT_DECLARE(montserrat_medium_24)"
)
diff --git a/main/idf_component.yml b/main/idf_component.yml
index b7f4645..f95c326 100644
--- a/main/idf_component.yml
+++ b/main/idf_component.yml
@@ -4,4 +4,4 @@ dependencies:
esp_lvgl_port:
version: '*'
idf:
- version: '>=5.0'
+ version: '>=5.0'
\ No newline at end of file
diff --git a/main/images/p12bisj.png b/main/images/p12bisj.png
new file mode 100644
index 0000000..c8364d3
Binary files /dev/null and b/main/images/p12bisj.png differ
diff --git a/main/images/p12bisj.svg b/main/images/p12bisj.svg
new file mode 100644
index 0000000..79d49c1
--- /dev/null
+++ b/main/images/p12bisj.svg
@@ -0,0 +1,49 @@
+
+
+
diff --git a/main/main.c b/main/main.c
index 0d20d27..7988c87 100644
--- a/main/main.c
+++ b/main/main.c
@@ -18,9 +18,11 @@
#include "esp_sntp.h"
#include
+
#include "esp_lcd_touch_gt911.h"
LV_FONT_DECLARE(montserrat_medium_12)
LV_FONT_DECLARE(montserrat_medium_18)
+LV_FONT_DECLARE(montserrat_medium_24)
char *days[7]={"Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi"};
char *months[12]={"Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Décembre"};
@@ -72,19 +74,20 @@ char *months[12]={"Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Ao
#define EXAMPLE_LCD_PANEL_35HZ_RGB_TIMING() \
{ \
- .pclk_hz = 18 * 1000 * 1000, \
+ .pclk_hz = 16 * 1000 * 1000, \
.h_res = EXAMPLE_LCD_H_RES, \
.v_res = EXAMPLE_LCD_V_RES, \
- .hsync_pulse_width = 40, \
- .hsync_back_porch = 40, \
- .hsync_front_porch = 48, \
- .vsync_pulse_width = 23, \
- .vsync_back_porch = 32, \
- .vsync_front_porch = 13, \
+ .hsync_pulse_width = 4, \
+ .hsync_back_porch = 8, \
+ .hsync_front_porch = 8, \
+ .vsync_pulse_width = 4, \
+ .vsync_back_porch = 8, \
+ .vsync_front_porch = 8, \
.flags.pclk_active_neg = true, \
+ .flags.hsync_idle_low =true, \
}
-static const char *TAG = "EXAMPLE";
+static const char *TAG = "domoTic";
// LVGL image declare
LV_IMG_DECLARE(esp_logo)
@@ -280,6 +283,8 @@ lv_subject_t wifiStatus;
lv_subject_t mqttStatus;
lv_subject_t meteoStatus;
+ static lv_style_t no_padding;
+
static void app_main_display(void)
{
@@ -288,7 +293,11 @@ static void app_main_display(void)
lv_subject_init_int(&mqttStatus,-1);
lv_subject_init_int(&meteoStatus,-1);
+ lv_style_init(&no_padding);
+ lv_style_set_pad_all(&no_padding, 0);
+
lv_obj_t *cont_status = lv_obj_create(lv_layer_top());
+ lv_obj_add_style(cont_status,&no_padding,0);
lv_obj_align(cont_status,LV_ALIGN_TOP_RIGHT,0,0);
lv_obj_set_flex_flow(cont_status, LV_FLEX_FLOW_ROW);
lv_obj_set_height(cont_status,LV_SIZE_CONTENT);
@@ -299,6 +308,9 @@ static void app_main_display(void)
lv_label_bind_text(meteoR, &meteoStatus, "Meteo %d");
lv_obj_t *wifi = lv_label_create(cont_status);
+ lv_obj_set_style_bg_color(wifi, lv_palette_darken(LV_PALETTE_GREY, 3), 0);
+ lv_obj_set_style_border_width(wifi,1,0);
+ lv_obj_set_style_border_color(wifi,lv_palette_darken(LV_PALETTE_GREY, 3),0);
lv_label_set_text(wifi,"Wifi Ok");
lv_label_bind_text(wifi, &wifiStatus, "Wifi %d");
@@ -384,27 +396,45 @@ static void event_handler(lv_event_t *e)
break;
}
}
+LV_IMAGE_DECLARE(plan_rdc);
+LV_IMAGE_DECLARE(plan_etage);
+
LV_IMAGE_DECLARE(p1j);
LV_IMAGE_DECLARE(p2j);
LV_IMAGE_DECLARE(p3j);
LV_IMAGE_DECLARE(p5bisj);
+LV_IMAGE_DECLARE(p12j);
+LV_IMAGE_DECLARE(p12bisj);
LV_IMAGE_DECLARE(p14j);
LV_IMAGE_DECLARE(p24j);
LV_IMAGE_DECLARE(p25j);
LV_IMAGE_DECLARE(p26j);
LV_IMAGE_DECLARE(p27j);
+LV_IMAGE_DECLARE(p28j);
LV_IMAGE_DECLARE(p29j);
+struct lv_observer_t {
+ lv_subject_t * subject; /**< The observed value */
+ lv_observer_cb_t cb; /**< Callback that should be called when the value changes*/
+ void * target; /**< A target for the observer, e.g. a widget or style*/
+ void * user_data; /**< Additional parameter supplied when subscribing*/
+ uint32_t auto_free_user_data : 1; /**< Automatically free user data when the observer is removed */
+ uint32_t notified : 1; /**< Mark if this observer was already notified*/
+ uint32_t for_obj : 1; /**< `target` is an `lv_obj_t *`*/
+};
+
static void weatherdata_obs_cb(lv_observer_t *observer, lv_subject_t *subject)
{
// Retrieve weatherdata
struct meteoforecast_data *data = subject->value.pointer;
- printffd(data);
+ //printffd(data);
char buff[40] = {};
// sprintf(buff,"%s %.1f %.1f", data->previsions.desc, data->previsions.min, data->previsions.max);
+
lv_obj_t *parent = (lv_obj_t *)(observer->target);
lv_obj_t *desc_icon = lv_obj_get_child(parent, 0);
lv_obj_t *temps = lv_obj_get_child(parent, 1);
+ ESP_LOGE(TAG, "Affichagfe de l'image %s",data->previsions.icon);
if (strcmp(data->previsions.icon, "p1j") == 0)
{
lv_image_set_src(lv_obj_get_child(desc_icon, 0), &p1j);
@@ -417,6 +447,12 @@ static void weatherdata_obs_cb(lv_observer_t *observer, lv_subject_t *subject)
}else if (strcmp(data->previsions.icon, "p5bisj") == 0)
{
lv_image_set_src(lv_obj_get_child(desc_icon, 0), &p5bisj);
+ }else if (strcmp(data->previsions.icon, "p12j") == 0)
+ {
+ lv_image_set_src(lv_obj_get_child(desc_icon, 0), &p12j);
+ }else if (strcmp(data->previsions.icon, "p12bisj") == 0)
+ {
+ lv_image_set_src(lv_obj_get_child(desc_icon, 0), &p12bisj);
}else if (strcmp(data->previsions.icon, "p14j") == 0)
{
lv_image_set_src(lv_obj_get_child(desc_icon, 0), &p14j);
@@ -432,6 +468,9 @@ static void weatherdata_obs_cb(lv_observer_t *observer, lv_subject_t *subject)
}else if (strcmp(data->previsions.icon, "p27j") == 0)
{
lv_image_set_src(lv_obj_get_child(desc_icon, 0), &p27j);
+ }else if (strcmp(data->previsions.icon, "p28j") == 0)
+ {
+ lv_image_set_src(lv_obj_get_child(desc_icon, 0), &p28j);
}else if (strcmp(data->previsions.icon, "p29j") == 0)
{
lv_image_set_src(lv_obj_get_child(desc_icon, 0), &p29j);
@@ -449,45 +488,47 @@ struct weatherDay_fragment_t
lv_fragment_t base;
/* States, object references and data fields for this fragment */
int dayNr;
+ bool showTitle;
const char *title;
float minTemp;
float maxTemp;
};
-static void weatherDay_fragment_ctor(lv_fragment_t *self, int args)
+static void weatherDay_fragment_ctor(lv_fragment_t *self, void * args)
{
- ((struct weatherDay_fragment_t *)self)->dayNr = args;
+ int dayNo = ((int *)args)[0];
+ //bool showDate = ((int*)args)[1];
+ ((struct weatherDay_fragment_t *)self)->dayNr = dayNo;
+ //ESP_LOGI(TAG, "Fragment initialisé avec le jour n°%d - Afficher la date %d",dayNo, showDate);
}
-static lv_style_t style_font_16;
+static lv_style_t style_font_18;
+static lv_style_t style_font_24;
static lv_style_t style_font_12;
+
static lv_obj_t *weatherDay_fragment_create_obj(lv_fragment_t *self, lv_obj_t *parent)
{
- lvgl_port_lock(0);
lv_obj_t *sup = lv_obj_create(parent);
lv_obj_set_flex_flow(sup, LV_FLEX_FLOW_ROW);
lv_obj_add_style(sup, &style_container, 0);
lv_obj_set_size(sup, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
- static lv_style_t no_padding;
- lv_style_init(&no_padding);
- lv_style_set_pad_all(&no_padding, 0);
lv_obj_t *container = lv_obj_create(sup);
lv_obj_set_flex_flow(container, LV_FLEX_FLOW_COLUMN);
lv_obj_set_flex_align(container,LV_FLEX_ALIGN_CENTER,LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);
lv_obj_add_style(container, &no_padding, 0);
lv_obj_set_width(container, 100);
- lv_obj_set_height(container, 90);
+ lv_obj_set_height(container, 80);
lv_obj_t *img1 = lv_image_create(container);
lv_obj_add_style(img1, &no_padding, 0);
lv_obj_set_style_bg_color(img1,lv_palette_lighten(LV_PALETTE_BLUE_GREY, 4),0);
lv_image_set_inner_align(img1, LV_IMAGE_ALIGN_TOP_LEFT);
lv_image_set_offset_y(img1, -8);
- lv_image_set_offset_x(img1, -8);
- lv_obj_set_size(img1,40,40);
+ lv_image_set_offset_x(img1, -5);
+ lv_obj_set_size(img1,40,32);
lv_image_set_src(img1,LV_SYMBOL_DUMMY);
//lv_obj_set_style_border_width(img1,2,0);
//lv_obj_set_style_border_color(img1, lv_palette_main(LV_PALETTE_BLUE_GREY), 0);
@@ -499,7 +540,7 @@ static lv_obj_t *weatherDay_fragment_create_obj(lv_fragment_t *self, lv_obj_t *p
lv_obj_t *container2 = lv_obj_create(sup);
lv_obj_set_width(container2, LV_SIZE_CONTENT);
- lv_obj_set_height(container2, 90);
+ lv_obj_set_height(container2, 80);
lv_obj_add_style(container2, &no_padding, 0);
lv_obj_set_style_pad_top(container2,5,0);
lv_obj_set_style_pad_bottom(container2,5,0);
@@ -513,15 +554,18 @@ static lv_obj_t *weatherDay_fragment_create_obj(lv_fragment_t *self, lv_obj_t *p
lv_obj_t *max = lv_label_create(container2);
lv_label_set_text(max,"--");
lv_obj_add_style(max, &tempStyle,0);
- lv_obj_add_style(max, &style_font_16, 0);
+ lv_obj_add_style(max, &style_font_18, 0);
lv_obj_set_style_text_color(max,lv_color_hex(0xFF0000),0);
+ lv_obj_add_style(max, &style_font_18, 0);
+
lv_obj_t *min = lv_label_create(container2);
lv_label_set_text(min,"--");
lv_obj_add_style(min, &tempStyle,0);
- lv_obj_add_style(min, &style_font_16, 0);
+ lv_obj_add_style(min, &style_font_18, 0);
lv_obj_set_style_text_color(min,lv_color_hex(0x3000FF),0);
+ lv_obj_add_style(min, &style_font_18, 0);
+
lv_subject_add_observer_obj(tmpSubj[((struct weatherDay_fragment_t *)self)->dayNr], weatherdata_obs_cb, sup, NULL);
- lvgl_port_unlock();
return container;
}
const lv_fragment_class_t sample_cls = {
@@ -533,6 +577,27 @@ const lv_fragment_class_t sample_cls = {
.instance_size = sizeof(struct weatherDay_fragment_t),
};
+static void meteoforecast_fragment_ctor(lv_fragment_t * self, void * args);
+static lv_obj_t * meteoforecast_fragment_create_obj(lv_fragment_t * self, lv_obj_t * parent);
+static void sample_container_delete(lv_event_t * e);
+
+struct meteoforecast_fragment_t {
+ /* IMPORTANT: don't miss this part */
+ lv_fragment_t base;
+ /* States, object references and data fields for this fragment */
+ const char *title;
+ bool showDate;
+};
+
+const lv_fragment_class_t meteoforecast_cls = {
+ /* Initialize something needed */
+ .constructor_cb = meteoforecast_fragment_ctor,
+ /* Create view objects */
+ .create_obj_cb = meteoforecast_fragment_create_obj,
+ /* IMPORTANT: size of your fragment struct */
+ .instance_size = sizeof(struct meteoforecast_fragment_t),
+};
+
void draw_ihm()
{
lv_subject_init_string(&tempExtSubj, tempExtStr, NULL, 6, "--");
@@ -567,20 +632,23 @@ void draw_ihm()
/*Add 3 tabs (the tabs are page (lv_page) and can be scrolled*/
lv_obj_t * tab1 = lv_tabview_add_tab(tabview, LV_SYMBOL_HOME);
- lv_obj_t * tab2 = lv_tabview_add_tab(tabview, "Volets");
+ lv_obj_t * tab2b = lv_tabview_add_tab(tabview, "Volets");
lv_obj_t * tab3 = lv_tabview_add_tab(tabview, "Météo");
lv_obj_t * tab4 = lv_tabview_add_tab(tabview, "Cuve");
lv_obj_t * tab5 = lv_tabview_add_tab(tabview, "Réglages");
- lv_obj_set_style_bg_color(tab2, lv_palette_lighten(LV_PALETTE_AMBER, 3), 0);
- lv_obj_set_style_bg_opa(tab2, LV_OPA_COVER, 0);
+ lv_obj_set_style_bg_color(tab2b, lv_palette_lighten(LV_PALETTE_AMBER, 3), 0);
+ lv_obj_set_style_bg_opa(tab2b, LV_OPA_COVER, 0);
static lv_style_t style_btn;
lv_style_init(&style_btn);
- lv_style_init(&style_font_16);
- lv_style_set_text_font(&style_font_16, &montserrat_medium_18);
+ lv_style_init(&style_font_18);
+ lv_style_set_text_font(&style_font_18, &montserrat_medium_18);
+
+ lv_style_init(&style_font_24);
+ lv_style_set_text_font(&style_font_24, &montserrat_medium_24);
lv_style_init(&style_font_12);
lv_style_set_text_font(&style_font_12, &montserrat_medium_12);
@@ -614,7 +682,7 @@ void draw_ihm()
lv_obj_set_flex_flow(supmain, LV_FLEX_FLOW_COLUMN);
lv_obj_t *jour = lv_label_create(supmain);
- lv_obj_add_style(jour,&style_font_16,0);
+ lv_obj_add_style(jour,&style_font_18,0);
setlocale(LC_ALL, "fr_FR");
char strftime_buf[64];
@@ -754,15 +822,96 @@ void draw_ihm()
lv_subject_add_observer_obj(&tempD3Subj, weatherdata_obs_cb, tempD3, NULL);
*/
lv_fragment_manager_t *manager = lv_fragment_manager_create(NULL);
-
- lv_fragment_t *fragment = lv_fragment_create(&sample_cls, 0);
+ lv_fragment_t *fragment = lv_fragment_create(&meteoforecast_cls, 0);
lv_fragment_manager_add(manager, fragment, &cont_col3);
- fragment = lv_fragment_create(&sample_cls, 1);
- lv_fragment_manager_add(manager, fragment, &cont_col3);
+ lv_obj_t * tab2=lv_obj_create(tab2b);
+ lv_obj_set_size(tab2, lv_pct(75),lv_pct(100));
- fragment = lv_fragment_create(&sample_cls, 2);
- lv_fragment_manager_add(manager, fragment, &cont_col3);
+ lv_obj_set_flex_flow(tab2b, LV_FLEX_FLOW_ROW);
+
+ lv_obj_set_flex_flow(tab2, LV_FLEX_FLOW_COLUMN);
+ lv_obj_t * cont_rdc=lv_obj_create(tab2);
+ lv_obj_set_size(cont_rdc,lv_pct(100), lv_pct(100));
+ lv_obj_add_style(cont_rdc,&no_padding,0);
+ lv_obj_add_style(tab2,&no_padding,0);
+ lv_point_t positions_rdc[]={
+ {5,105},
+ {55,45},
+ {110,20},
+ {155,25},
+ {225,45},
+ {275,115},
+ {295,185}};
+ lv_obj_t * img=lv_image_create(cont_rdc);
+ lv_img_set_src(img, &plan_rdc);
+ float coef=1.5;
+ for (size_t i = 1; i < 8; i++)
+ {
+ lv_obj_t * btnVolet = lv_checkbox_create(cont_rdc);
+ ESP_LOGI(TAG,"Recup pos %d", i-1);
+ lv_obj_set_pos(btnVolet,positions_rdc[i-1].x*coef,positions_rdc[i-1].y*coef);
+ lv_obj_add_style(btnVolet,&style_font_24,0);
+ //lv_obj_set_size(btnVolet,100,24);
+
+ //char *nom[10];
+ //sprintf(nom,"%d", i);
+ lv_checkbox_set_text(btnVolet,"");
+ }
+
+
+ lv_obj_t * cont_btn_volets=lv_obj_create(tab2b);
+ lv_obj_set_size(cont_btn_volets,lv_pct(20), lv_pct(100));
+
+ lv_obj_set_layout(cont_btn_volets, LV_LAYOUT_GRID);
+ static int32_t column_dsc[] = {LV_GRID_CONTENT, LV_GRID_TEMPLATE_LAST}; /*2 columns */
+ static int32_t row_dsc[] = {LV_GRID_FR(1),LV_GRID_FR(1),LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
+ lv_obj_set_grid_dsc_array(cont_btn_volets, column_dsc, row_dsc);
+
+ lv_obj_t * btnUp_bis = lv_button_create(cont_btn_volets);
+ lv_obj_t * lblButtonUp = lv_label_create(btnUp_bis);
+ lv_label_set_text(lblButtonUp,LV_SYMBOL_UP);
+
+ lv_obj_t * btnDwn_bis = lv_button_create(cont_btn_volets);
+ lv_obj_t * lblButtonDwn = lv_label_create(btnDwn_bis);
+ lv_label_set_text(lblButtonDwn,LV_SYMBOL_DOWN);
+
+ lv_obj_set_grid_cell(btnUp_bis, LV_GRID_ALIGN_STRETCH, 0, 1,
+ LV_GRID_ALIGN_STRETCH, 0, 1);
+ lv_obj_set_grid_cell(btnDwn_bis, LV_GRID_ALIGN_STRETCH, 0, 1,
+ LV_GRID_ALIGN_STRETCH, 1, 1);
+
+ lv_obj_t * cont_etage=lv_obj_create(tab2);
+ lv_obj_set_size(cont_etage,lv_pct(100), lv_pct(100));
+ lv_obj_add_style(cont_etage,&no_padding,0);
+
+ img=lv_image_create(cont_etage);
+ lv_img_set_src(img, &plan_etage);
+
+ lv_point_t positions_etage[]={
+ {100,15},
+ {250,15},
+ {400,15},
+ {480,300},
+ {460,360},
+ {320,415}};
+ for (size_t i = 1; i < 7; i++)
+ {
+ lv_obj_t * btnVolet = lv_checkbox_create(cont_etage);
+ ESP_LOGI(TAG,"Recup pos %d", i-1);
+ lv_obj_set_pos(btnVolet,positions_etage[i-1].x,positions_etage[i-1].y);
+ lv_obj_add_style(btnVolet,&style_font_24,0);
+ //lv_obj_set_size(btnVolet,100,24);
+
+ //char *nom[10];
+ //sprintf(nom,"%d", i);
+ lv_checkbox_set_text(btnVolet,"");
+ }
+
+ lv_obj_set_flex_flow(tab3, LV_FLEX_FLOW_COLUMN);
+ lv_fragment_manager_t *manager2 = lv_fragment_manager_create(NULL);
+ lv_fragment_t *fragment2 = lv_fragment_create(&meteoforecast_cls, 1);
+ lv_fragment_manager_add(manager2, fragment2, &tab3);
}
/* The examples use WiFi configuration that you can set via project configuration menu
@@ -1136,7 +1285,6 @@ static void mqtt_app_start(void)
void weather_data_retreived_start()
{
- ESP_LOGE(TAG,"Début recup méteo");
if(lvgl_port_lock(0)){
lv_subject_set_int(&meteoStatus,1);
lvgl_port_unlock();
@@ -1145,8 +1293,7 @@ void weather_data_retreived_start()
void weather_data_retreived(struct meteoforecast_data datas[3])
{
- // struct meteoforecast_data* weather = (meteoforecast_data*) args;
- struct meteoforecast_data j1 = {};
+ /*
ESP_LOGE(TAG, "debut debug");
printf("%lld\n", datas[0].datetime);
printf("%s\n", datas[0].previsions.desc);
@@ -1158,16 +1305,16 @@ void weather_data_retreived(struct meteoforecast_data datas[3])
printf("%s\n", datas[2].previsions.desc);
printf("%f\n", datas[2].previsions.min);
ESP_LOGE(TAG, "fin debug");
-
+ */
if (lvgl_port_lock(0))
{
- ESP_LOGE(TAG, "------------------------------------- Set des subjects --------------------------------");
+ //ESP_LOGE(TAG, "------------------------------------- Set des subjects --------------------------------");
lv_subject_set_pointer(&tempD1Subj, &datas[0]);
lv_subject_set_pointer(&tempD2Subj, &datas[1]);
lv_subject_set_pointer(&tempD3Subj, &datas[2]);
lv_subject_set_int(&meteoStatus,0);
lvgl_port_unlock();
- ESP_LOGE(TAG, "------------------------------------- Fin Set des subjects --------------------------------");
+ //ESP_LOGE(TAG, "------------------------------------- Fin Set des subjects --------------------------------");
}
}
static void obtain_time(void);
@@ -1187,8 +1334,8 @@ void app_main(void)
/* LVGL initialization */
ESP_ERROR_CHECK(app_lvgl_init());
-
- // Initialize NVS
+
+ // Initialize NVS
esp_err_t ret = nvs_flash_init();
if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND)
{
@@ -1200,6 +1347,7 @@ void app_main(void)
/* Show LVGL objects */
if(lvgl_port_lock(0)){
+ //ESP_ERROR_CHECK(esp_lcd_panel_mirror(lcd_panel,true,true));
app_main_display();
lvgl_port_unlock();
}
@@ -1236,6 +1384,8 @@ void app_main(void)
if(lvgl_port_lock(0)){
// app_main_display();
draw_ihm();
+ //lv_disp_set_rotation(lvgl_disp, LV_DISPLAY_ROTATION_180);
+
lvgl_port_unlock();
}
}
@@ -1261,3 +1411,30 @@ static void obtain_time(void)
esp_netif_sntp_deinit();
}
+
+static void meteoforecast_fragment_ctor(lv_fragment_t * self, void * args){
+ struct meteoforecast_fragment_t *myself=((struct meteoforecast_fragment_t *) self);
+ myself->showDate = args;
+}
+
+
+static lv_obj_t * meteoforecast_fragment_create_obj(lv_fragment_t * self, lv_obj_t * parent)
+{
+
+ lv_fragment_manager_t *manager = lv_fragment_manager_create(NULL);
+
+ int args[2]={0,((struct meteoforecast_fragment_t*)self)->showDate};
+ lv_fragment_t *fragment = lv_fragment_create(&sample_cls, args);
+ lv_fragment_manager_add(manager, fragment, &parent);
+
+ args[0]=1;
+ fragment = lv_fragment_create(&sample_cls, args);
+ lv_fragment_manager_add(manager, fragment, &parent);
+
+ args[0]=2;
+ fragment = lv_fragment_create(&sample_cls, args);
+ lv_fragment_manager_add(manager, fragment, &parent);
+
+ return parent;
+}
+