fonctionnel avec nvelle gestion images
6
.gitmodules
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
[submodule "components/littlefs"]
|
||||||
|
path = components/littlefs
|
||||||
|
url = https://github.com/littlefs-project/littlefs.git
|
||||||
|
[submodule "components/esp_littlefs"]
|
||||||
|
path = components/esp_littlefs
|
||||||
|
url = https://github.com/joltwallet/esp_littlefs.git
|
||||||
8
.vscode/settings.json
vendored
@ -7,6 +7,12 @@
|
|||||||
"esp_log.h": "c",
|
"esp_log.h": "c",
|
||||||
"esp_wifi.h": "c",
|
"esp_wifi.h": "c",
|
||||||
"esp_lvgl_port.h": "c",
|
"esp_lvgl_port.h": "c",
|
||||||
"mqtt.h": "c"
|
"mqtt.h": "c",
|
||||||
|
"stdio.h": "c",
|
||||||
|
"locale.h": "c",
|
||||||
|
"obtain_time.h": "c",
|
||||||
|
"i2c.h": "c",
|
||||||
|
"lv_global.h": "c",
|
||||||
|
"cstdint": "c"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
1
components/esp_littlefs
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 28639dd469af0b33df55d481da8383347e88067e
|
||||||
@ -1,3 +1,3 @@
|
|||||||
idf_component_register(SRCS "image_downloader.c"
|
idf_component_register(SRCS "image_downloader.c"
|
||||||
INCLUDE_DIRS "include"
|
INCLUDE_DIRS "include"
|
||||||
REQUIRES json esp_http_client esp-tls esp_timer fatfs sdmmc vfs)
|
REQUIRES json esp_http_client esp-tls esp_timer )
|
||||||
|
|||||||
@ -52,7 +52,7 @@ static const char *TAG = "ImgDwn";
|
|||||||
#define IMGDWN_WIDTH 600
|
#define IMGDWN_WIDTH 600
|
||||||
#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=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=300&height=200&scale=1&tz=Europe%2FParis") // 650 460
|
||||||
// As default is 512 without setting buffer_size property in esp_http_client_config_t
|
// As default is 512 without setting buffer_size property in esp_http_client_config_t
|
||||||
#define HTTP_RECEIVE_BUFFER_SIZE 1938
|
#define HTTP_RECEIVE_BUFFER_SIZE 1938
|
||||||
|
|
||||||
|
|||||||
1
components/littlefs
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit d01280e64934a09ba16cac60cf9d3a37e228bb66
|
||||||
@ -385,7 +385,7 @@ void initialise_weather_data_retrieval(unsigned long retreival_period)
|
|||||||
// http_client_on_process_chunk(&http_client, process_chunk);
|
// http_client_on_process_chunk(&http_client, process_chunk);
|
||||||
// http_client_on_disconnected(&http_client, disconnected);
|
// http_client_on_disconnected(&http_client, disconnected);
|
||||||
TaskHandle_t xHandle = NULL;
|
TaskHandle_t xHandle = NULL;
|
||||||
BaseType_t ret1 = xTaskCreate(&http_request_task, "http_request_task", 8 * 1024, NULL, 5, &xHandle);
|
BaseType_t ret1 = xTaskCreate(&http_request_task, "http_request_task", 5 * 1024, NULL, 5, &xHandle);
|
||||||
if(ret1!=pdPASS ){
|
if(ret1!=pdPASS ){
|
||||||
ESP_LOGE(TAG, "Impossible de creer la tache %i", ret1);
|
ESP_LOGE(TAG, "Impossible de creer la tache %i", ret1);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,8 +1,14 @@
|
|||||||
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)
|
REQUIRES heap esp_wifi nvs_flash mqtt meteofrance esp_netif image_downloader fatfs sdmmc vfs littlefs
|
||||||
lvgl_port_create_c_image("images/p13bisj.png" "images/" "ARGB8888" "NONE")
|
PRIV_REQUIRES littlefs)
|
||||||
#lvgl_port_create_c_image("images/esp_logo.png" "images/" "ARGB8888" "NONE")
|
|
||||||
|
lvgl_port_create_c_image("images/wifi_ok.png" "images/" "ARGB8888" "NONE")
|
||||||
|
lvgl_port_create_c_image("images/wifi_ko.png" "images/" "ARGB8888" "NONE")
|
||||||
|
lvgl_port_create_c_image("images/mqtt_ok.png" "images/" "AUTO" "NONE")
|
||||||
|
lvgl_port_create_c_image("images/mqtt_ko.png" "images/" "ARGB8888" "NONE")
|
||||||
|
# lvgl_port_create_c_image("images/p13bisj.png" "images/" "ARGB8888" "NONE")
|
||||||
|
# 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/p10j.png" "images/" "ARGB8888" "NONE")
|
||||||
# lvgl_port_create_c_image("images/p10n.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/p11j.png" "images/" "ARGB8888" "NONE")
|
||||||
@ -74,6 +80,9 @@ lvgl_port_create_c_image("images/p13bisj.png" "images/" "ARGB8888" "NONE")
|
|||||||
|
|
||||||
lvgl_port_add_images(${COMPONENT_LIB} "images/")
|
lvgl_port_add_images(${COMPONENT_LIB} "images/")
|
||||||
|
|
||||||
|
littlefs_create_partition_image(littlefs images_meteo FLASH_IN_PROJECT)
|
||||||
|
|
||||||
|
|
||||||
set_source_files_properties(
|
set_source_files_properties(
|
||||||
PROPERTIES COMPILE_OPTIONS
|
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) LV_FONT_DECLARE(montserrat_medium_24)"
|
"-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)"
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
dependencies:
|
dependencies:
|
||||||
|
joltwallet/littlefs: ^1.14.8
|
||||||
esp_lcd_touch_gt911:
|
esp_lcd_touch_gt911:
|
||||||
version: ^1
|
version: ^1
|
||||||
esp_lvgl_port:
|
esp_lvgl_port:
|
||||||
|
|||||||
BIN
main/images/mqtt_ko.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
main/images/mqtt_ok.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
main/images/wifi_ko.png
Normal file
|
After Width: | Height: | Size: 483 B |
BIN
main/images/wifi_ko_orig.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
main/images/wifi_ok.png
Normal file
|
After Width: | Height: | Size: 372 B |
BIN
main/images/wifi_ok_orig.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 551 B After Width: | Height: | Size: 551 B |
|
Before Width: | Height: | Size: 551 B After Width: | Height: | Size: 551 B |
|
Before Width: | Height: | Size: 930 B After Width: | Height: | Size: 930 B |
|
Before Width: | Height: | Size: 930 B After Width: | Height: | Size: 930 B |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
177
main/main.c
@ -1,5 +1,3 @@
|
|||||||
#include "wifi.h"
|
|
||||||
#include "mqtt.h"
|
|
||||||
#include "misc/lv_types.h"
|
#include "misc/lv_types.h"
|
||||||
#include "freertos/FreeRTOS.h"
|
#include "freertos/FreeRTOS.h"
|
||||||
#include "freertos/event_groups.h"
|
#include "freertos/event_groups.h"
|
||||||
@ -10,18 +8,24 @@
|
|||||||
#include "esp_lcd_panel_io.h"
|
#include "esp_lcd_panel_io.h"
|
||||||
#include "esp_lcd_panel_ops.h"
|
#include "esp_lcd_panel_ops.h"
|
||||||
#include "esp_lcd_panel_rgb.h"
|
#include "esp_lcd_panel_rgb.h"
|
||||||
|
#include "esp_lcd_touch_gt911.h"
|
||||||
#include "esp_lvgl_port.h"
|
#include "esp_lvgl_port.h"
|
||||||
#include "esp_event.h"
|
#include "esp_event.h"
|
||||||
#include "nvs_flash.h"
|
#include "nvs_flash.h"
|
||||||
#include "meteofrance.h"
|
|
||||||
#include "image_downloader.h"
|
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#include "fatfs.h"
|
|
||||||
#define DIR FF_DIR /* ESP IDF typedefs `DIR` as `FF_DIR` in its version of ff.h. Use `FF_DIR` in LVGL too */
|
|
||||||
#include "esp_vfs_fat.h"
|
#include "esp_vfs_fat.h"
|
||||||
#include "sdmmc_cmd.h"
|
#include "sdmmc_cmd.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
// Includes personnels
|
||||||
#include "obtain_time.h"
|
#include "obtain_time.h"
|
||||||
|
#include "fatfs.h"
|
||||||
|
#include "meteofrance.h"
|
||||||
|
#include "image_downloader.h"
|
||||||
|
#include "wifi.h"
|
||||||
|
#include "mqtt.h"
|
||||||
|
|
||||||
|
#include "esp_littlefs.h"
|
||||||
|
|
||||||
#define MOUNT_POINT "/sdcard"
|
#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.
|
||||||
@ -32,7 +36,6 @@
|
|||||||
#define PIN_NUM_CS 10
|
#define PIN_NUM_CS 10
|
||||||
|
|
||||||
|
|
||||||
#include "esp_lcd_touch_gt911.h"
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
LV_FONT_DECLARE(montserrat_medium_12)
|
LV_FONT_DECLARE(montserrat_medium_12)
|
||||||
LV_FONT_DECLARE(montserrat_medium_18)
|
LV_FONT_DECLARE(montserrat_medium_18)
|
||||||
@ -299,8 +302,6 @@ static void _app_button_cb(lv_event_t *e)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lv_subject_t wifiStatus;
|
|
||||||
lv_subject_t mqttStatus;
|
|
||||||
lv_subject_t meteoStatus;
|
lv_subject_t meteoStatus;
|
||||||
|
|
||||||
static lv_style_t no_padding;
|
static lv_style_t no_padding;
|
||||||
@ -313,6 +314,9 @@ static void app_main_display(void)
|
|||||||
lv_style_init(&no_padding);
|
lv_style_init(&no_padding);
|
||||||
lv_style_set_pad_all(&no_padding, 0);
|
lv_style_set_pad_all(&no_padding, 0);
|
||||||
|
|
||||||
|
lv_style_init(&style_font_18);
|
||||||
|
lv_style_set_text_font(&style_font_18, &montserrat_medium_18);
|
||||||
|
|
||||||
lv_obj_t *cont_status = lv_obj_create(lv_layer_top());
|
lv_obj_t *cont_status = lv_obj_create(lv_layer_top());
|
||||||
lv_obj_add_style(cont_status,&no_padding,0);
|
lv_obj_add_style(cont_status,&no_padding,0);
|
||||||
lv_obj_align(cont_status,LV_ALIGN_TOP_RIGHT,0,0);
|
lv_obj_align(cont_status,LV_ALIGN_TOP_RIGHT,0,0);
|
||||||
@ -332,23 +336,25 @@ static void app_main_display(void)
|
|||||||
sprintf(strftime_buf,"%s %d %s", days[timeinfo.tm_wday], timeinfo.tm_mday, months[timeinfo.tm_mon]);
|
sprintf(strftime_buf,"%s %d %s", days[timeinfo.tm_wday], timeinfo.tm_mday, months[timeinfo.tm_mon]);
|
||||||
|
|
||||||
lv_label_set_text(jour,strftime_buf);
|
lv_label_set_text(jour,strftime_buf);
|
||||||
lv_obj_align(jour, LV_ALIGN_CENTER,0,0);
|
|
||||||
|
lv_obj_refr_size(cont_status);
|
||||||
|
//lv_obj_align(jour, LV_ALIGN_CENTER,0,0);
|
||||||
|
|
||||||
lv_obj_t *meteoR = lv_label_create(cont_status);
|
lv_obj_t *meteoR = lv_label_create(cont_status);
|
||||||
lv_label_set_text(meteoR,"--");
|
lv_label_set_text(meteoR,"--");
|
||||||
lv_label_bind_text(meteoR, &meteoStatus, "Meteo %d");
|
lv_label_bind_text(meteoR, &meteoStatus, "Meteo %d");
|
||||||
|
|
||||||
lv_obj_t *wifi = lv_label_create(cont_status);
|
lv_obj_t *wifi = lv_image_create(cont_status);
|
||||||
lv_obj_set_style_bg_color(wifi, lv_palette_darken(LV_PALETTE_GREY, 3), 0);
|
//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_width(wifi,1,0);
|
||||||
lv_obj_set_style_border_color(wifi,lv_palette_darken(LV_PALETTE_GREY, 3),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_set_text(wifi,"Wifi Ok");
|
||||||
lv_label_bind_text(wifi, &wifiStatus, "Wifi %d");
|
//lv_label_bind_text(wifi, &wifiStatus, "Wifi %d");
|
||||||
|
|
||||||
|
|
||||||
lv_obj_t *mqtt = lv_label_create(cont_status);
|
lv_image_create(cont_status);
|
||||||
lv_label_set_text(mqtt,"Mqtt Ok");
|
//lv_label_set_text(mqtt,"Mqtt Ok");
|
||||||
lv_label_bind_text(mqtt, &mqttStatus, "Mqtt %d");
|
//lv_label_bind_text(mqtt, &mqttStatus, "Mqtt %d");
|
||||||
|
|
||||||
lv_obj_t *scr = lv_scr_act();
|
lv_obj_t *scr = lv_scr_act();
|
||||||
|
|
||||||
@ -426,7 +432,7 @@ static void event_handler(lv_event_t *e)
|
|||||||
}
|
}
|
||||||
LV_IMAGE_DECLARE(plan_rdc);
|
LV_IMAGE_DECLARE(plan_rdc);
|
||||||
LV_IMAGE_DECLARE(plan_etage);
|
LV_IMAGE_DECLARE(plan_etage);
|
||||||
|
/*
|
||||||
LV_IMAGE_DECLARE(p1j);
|
LV_IMAGE_DECLARE(p1j);
|
||||||
LV_IMAGE_DECLARE(p2j);
|
LV_IMAGE_DECLARE(p2j);
|
||||||
LV_IMAGE_DECLARE(p3j);
|
LV_IMAGE_DECLARE(p3j);
|
||||||
@ -443,6 +449,7 @@ LV_IMAGE_DECLARE(p26j);
|
|||||||
LV_IMAGE_DECLARE(p27j);
|
LV_IMAGE_DECLARE(p27j);
|
||||||
LV_IMAGE_DECLARE(p28j);
|
LV_IMAGE_DECLARE(p28j);
|
||||||
LV_IMAGE_DECLARE(p29j);
|
LV_IMAGE_DECLARE(p29j);
|
||||||
|
*/
|
||||||
|
|
||||||
struct lv_observer_t {
|
struct lv_observer_t {
|
||||||
lv_subject_t * subject; /**< The observed value */
|
lv_subject_t * subject; /**< The observed value */
|
||||||
@ -511,6 +518,11 @@ static void weatherdataH_obs_cb(lv_observer_t *observer, lv_subject_t *subject)
|
|||||||
void showMeteoIcon(const char *icon, lv_obj_t *desc_icon, int childNr)
|
void showMeteoIcon(const char *icon, lv_obj_t *desc_icon, int childNr)
|
||||||
{
|
{
|
||||||
lv_obj_t* img = lv_obj_get_child(desc_icon, childNr);
|
lv_obj_t* img = lv_obj_get_child(desc_icon, childNr);
|
||||||
|
char *str1= "A:/littlefs/";
|
||||||
|
char* result = malloc(strlen(str1) + strlen(icon) + 6);
|
||||||
|
sprintf(result, "%s%s.png", str1, icon);
|
||||||
|
lv_image_set_src(img, result);
|
||||||
|
/*
|
||||||
if (strcmp(icon, "p1j") == 0)
|
if (strcmp(icon, "p1j") == 0)
|
||||||
{
|
{
|
||||||
lv_image_set_src(img, &p1j);
|
lv_image_set_src(img, &p1j);
|
||||||
@ -579,6 +591,7 @@ void showMeteoIcon(const char *icon, lv_obj_t *desc_icon, int childNr)
|
|||||||
{
|
{
|
||||||
ESP_LOGE(TAG, "Image %s non connue", icon);
|
ESP_LOGE(TAG, "Image %s non connue", icon);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
/* Fragment meteo journaliere (date,icone, min et max) */
|
/* Fragment meteo journaliere (date,icone, min et max) */
|
||||||
@ -1026,10 +1039,7 @@ void draw_ihm()
|
|||||||
// keys.clear();
|
// keys.clear();
|
||||||
lv_obj_clean(lv_scr_act());
|
lv_obj_clean(lv_scr_act());
|
||||||
|
|
||||||
|
/*Create a Tab view object*/
|
||||||
|
|
||||||
|
|
||||||
/*Create a Tab view object*/
|
|
||||||
lv_obj_t * tabview;
|
lv_obj_t * tabview;
|
||||||
tabview = lv_tabview_create(lv_screen_active());
|
tabview = lv_tabview_create(lv_screen_active());
|
||||||
lv_tabview_set_tab_bar_position(tabview, LV_DIR_LEFT);
|
lv_tabview_set_tab_bar_position(tabview, LV_DIR_LEFT);
|
||||||
@ -1061,8 +1071,6 @@ void draw_ihm()
|
|||||||
static lv_style_t style_btn;
|
static lv_style_t style_btn;
|
||||||
lv_style_init(&style_btn);
|
lv_style_init(&style_btn);
|
||||||
|
|
||||||
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_init(&style_font_24);
|
||||||
lv_style_set_text_font(&style_font_24, &montserrat_medium_24);
|
lv_style_set_text_font(&style_font_24, &montserrat_medium_24);
|
||||||
@ -1303,19 +1311,39 @@ void mount_sd_card(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void app_main(void){
|
void app_main(void){
|
||||||
esp_log_level_set("wifi", ESP_LOG_ERROR);
|
printf("Minimum free heap size: %" PRIu32 " bytes\n", esp_get_minimum_free_heap_size());
|
||||||
|
printf("Free heap size: %" PRIu32 " bytes\n", esp_get_free_heap_size());
|
||||||
|
|
||||||
|
printf("1- Free heap after buffers allocation: %d\n", xPortGetFreeHeapSize());
|
||||||
|
|
||||||
|
esp_log_level_set("wifi", ESP_LOG_ERROR);
|
||||||
|
|
||||||
|
printf("2- Free heap after buffers allocation: %d\n", xPortGetFreeHeapSize());
|
||||||
|
|
||||||
mount_sd_card();
|
mount_sd_card();
|
||||||
|
|
||||||
|
|
||||||
|
esp_vfs_littlefs_conf_t conf = {
|
||||||
|
.base_path = "/littlefs",
|
||||||
|
.partition_label = "littlefs",
|
||||||
|
.format_if_mount_failed = true,
|
||||||
|
.dont_mount = false,
|
||||||
|
};
|
||||||
|
|
||||||
|
printf("3 - Free heap after buffers allocation: %d\n", xPortGetFreeHeapSize());
|
||||||
/* LCD HW initialization */
|
/* LCD HW initialization */
|
||||||
ESP_ERROR_CHECK(app_lcd_init());
|
ESP_ERROR_CHECK(app_lcd_init());
|
||||||
|
|
||||||
|
printf("4 - Free heap after buffers allocation: %d\n", xPortGetFreeHeapSize());
|
||||||
/* Touch initialization */
|
/* Touch initialization */
|
||||||
ESP_ERROR_CHECK(app_touch_init());
|
ESP_ERROR_CHECK(app_touch_init());
|
||||||
|
|
||||||
|
printf("5 - Free heap after buffers allocation: %d\n", xPortGetFreeHeapSize());
|
||||||
/* LVGL initialization */
|
/* LVGL initialization */
|
||||||
ESP_ERROR_CHECK(app_lvgl_init());
|
ESP_ERROR_CHECK(app_lvgl_init());
|
||||||
|
|
||||||
|
printf("6 - Free heap after buffers allocation: %d\n", xPortGetFreeHeapSize());
|
||||||
|
|
||||||
/* On affiche au plus tot l'ecran de démarrage */
|
/* On affiche au plus tot l'ecran de démarrage */
|
||||||
if(lvgl_port_lock(0)){
|
if(lvgl_port_lock(0)){
|
||||||
//ESP_ERROR_CHECK(esp_lcd_panel_mirror(lcd_panel,true,true));
|
//ESP_ERROR_CHECK(esp_lcd_panel_mirror(lcd_panel,true,true));
|
||||||
@ -1324,6 +1352,7 @@ void app_main(void){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
printf("7 - Free heap after buffers allocation: %d\n", xPortGetFreeHeapSize());
|
||||||
// Initialize NVS
|
// Initialize NVS
|
||||||
esp_err_t ret = nvs_flash_init();
|
esp_err_t ret = nvs_flash_init();
|
||||||
if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND)
|
if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND)
|
||||||
@ -1333,15 +1362,16 @@ void app_main(void){
|
|||||||
}
|
}
|
||||||
ESP_ERROR_CHECK(ret);
|
ESP_ERROR_CHECK(ret);
|
||||||
|
|
||||||
lv_subject_init_int(&wifiStatus,-1);
|
|
||||||
lv_subject_init_int(&mqttStatus,-1);
|
|
||||||
lv_subject_init_int(&meteoStatus,-1);
|
lv_subject_init_int(&meteoStatus,-1);
|
||||||
|
|
||||||
|
printf("8 - Free heap after buffers allocation: %d\n", xPortGetFreeHeapSize());
|
||||||
ESP_LOGI(TAG, "ESP_WIFI_MODE_STA");
|
ESP_LOGI(TAG, "ESP_WIFI_MODE_STA");
|
||||||
wifi_init_sta();
|
wifi_init_sta();
|
||||||
//mqtt_app_start();
|
printf("8b - Free heap after buffers allocation: %d\n", xPortGetFreeHeapSize());
|
||||||
|
mqtt_app_start();
|
||||||
|
|
||||||
time_t now;
|
printf("9 - Free heap after buffers allocation: %d\n", xPortGetFreeHeapSize());
|
||||||
|
time_t now;
|
||||||
struct tm timeinfo;
|
struct tm timeinfo;
|
||||||
time(&now);
|
time(&now);
|
||||||
localtime_r(&now, &timeinfo);
|
localtime_r(&now, &timeinfo);
|
||||||
@ -1361,24 +1391,26 @@ void app_main(void){
|
|||||||
localtime_r(&now, &timeinfo);
|
localtime_r(&now, &timeinfo);
|
||||||
strftime(strftime_buf, sizeof(strftime_buf), "%c", &timeinfo);
|
strftime(strftime_buf, sizeof(strftime_buf), "%c", &timeinfo);
|
||||||
|
|
||||||
printf("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_DEFAULT);
|
heap_caps_print_heap_info(MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
|
||||||
|
|
||||||
|
|
||||||
on_weather_data_retrieval(weather_data_retreived);
|
on_weather_data_retrieval(weather_data_retreived);
|
||||||
on_weather_data_retrieval_start(weather_data_retreived_start);
|
on_weather_data_retrieval_start(weather_data_retreived_start);
|
||||||
initialise_weather_data_retrieval(60000);
|
initialise_weather_data_retrieval(600000);
|
||||||
ESP_LOGW(TAG, "Weather data retrieval initialized");
|
ESP_LOGW(TAG, "Weather data retrieval initialized");
|
||||||
|
|
||||||
|
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 = xTaskCreate(&imgdwn, "imageDownload_task", 5 * 1024, NULL, 5, &xHandle);
|
BaseType_t ret1 = xTaskCreate(&imgdwn, "imageDownload_task", 3 * 1024, NULL, 5, &xHandle);
|
||||||
if(ret1!=pdPASS ){
|
if(ret1!=pdPASS ){
|
||||||
ESP_LOGE(TAG, "Impossiblke de creer la tache %i", ret1);
|
ESP_LOGE(TAG, "Impossiblke de creer la tache %i", ret1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
printf("12. Free heap after buffers allocation: %d\n", xPortGetFreeHeapSize());
|
||||||
/* Show LVGL objects */
|
/* Show LVGL objects */
|
||||||
if(lvgl_port_lock(0)){
|
if(lvgl_port_lock(0)){
|
||||||
draw_ihm();
|
draw_ihm();
|
||||||
@ -1386,6 +1418,81 @@ void app_main(void){
|
|||||||
|
|
||||||
lvgl_port_unlock();
|
lvgl_port_unlock();
|
||||||
}
|
}
|
||||||
|
printf("13. Free heap after buffers allocation: %d\n", xPortGetFreeHeapSize());
|
||||||
|
printf("Minimum free heap size: %" PRIu32 " bytes\n", esp_get_minimum_free_heap_size());
|
||||||
|
printf("Free heap size: %" PRIu32 " bytes\n", esp_get_free_heap_size());
|
||||||
|
LV_ASSERT_MEM_INTEGRITY();
|
||||||
|
|
||||||
|
lv_mem_monitor_t mon;
|
||||||
|
lv_mem_monitor(&mon);
|
||||||
|
printf("used: %6d (%3d %%), frag: %3d %%, biggest free: %6d\n",
|
||||||
|
(int)mon.total_size - mon.free_size, mon.used_pct, mon.frag_pct,
|
||||||
|
(int)mon.free_biggest_size);
|
||||||
|
|
||||||
|
ESP_LOGI(TAG, "Initializing LittleFS");
|
||||||
|
|
||||||
|
esp_vfs_littlefs_conf_t conflfs = {
|
||||||
|
.base_path = "/littlefs",
|
||||||
|
.partition_label = "littlefs",
|
||||||
|
.format_if_mount_failed = true,
|
||||||
|
.dont_mount = false,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Use settings defined above to initialize and mount LittleFS filesystem.
|
||||||
|
// Note: esp_vfs_littlefs_register is an all-in-one convenience function.
|
||||||
|
ret = esp_vfs_littlefs_register(&conflfs);
|
||||||
|
|
||||||
|
if (ret != ESP_OK)
|
||||||
|
{
|
||||||
|
if (ret == ESP_FAIL)
|
||||||
|
{
|
||||||
|
ESP_LOGE(TAG, "Failed to mount or format filesystem");
|
||||||
|
}
|
||||||
|
else if (ret == ESP_ERR_NOT_FOUND)
|
||||||
|
{
|
||||||
|
ESP_LOGE(TAG, "Failed to find LittleFS partition");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ESP_LOGE(TAG, "Failed to initialize LittleFS (%s)", esp_err_to_name(ret));
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t total = 0, used = 0;
|
||||||
|
ret = esp_littlefs_info(conflfs.partition_label, &total, &used);
|
||||||
|
if (ret != ESP_OK)
|
||||||
|
{
|
||||||
|
ESP_LOGE(TAG, "Failed to get LittleFS partition information (%s)", esp_err_to_name(ret));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
62
main/mqtt.c
@ -4,7 +4,8 @@
|
|||||||
#include "mqtt_client.h"
|
#include "mqtt_client.h"
|
||||||
|
|
||||||
esp_mqtt_client_handle_t client;
|
esp_mqtt_client_handle_t client;
|
||||||
extern lv_subject_t mqttStatus;
|
lv_subject_t mqttStatus;
|
||||||
|
|
||||||
extern lv_subject_t tempIntSubj;
|
extern lv_subject_t tempIntSubj;
|
||||||
extern lv_subject_t tempExtSubj;
|
extern lv_subject_t tempExtSubj;
|
||||||
extern lv_subject_t hauteurCuveSubj;
|
extern lv_subject_t hauteurCuveSubj;
|
||||||
@ -19,6 +20,50 @@ char *topicTempExt = "house/temp/282A802600008059";
|
|||||||
char *topicHauteurCuve = "house/cuve/hauteur";
|
char *topicHauteurCuve = "house/cuve/hauteur";
|
||||||
char *topicTempInt = "house/temp/287DCF1E00008020";
|
char *topicTempInt = "house/temp/287DCF1E00008020";
|
||||||
char *topicHauteurCuveEvol = "house/cuve/hauteurEvol";
|
char *topicHauteurCuveEvol = "house/cuve/hauteurEvol";
|
||||||
|
char *topicTest = "test";
|
||||||
|
|
||||||
|
LV_IMAGE_DECLARE(mqtt_ok);
|
||||||
|
LV_IMAGE_DECLARE(mqtt_ko);
|
||||||
|
|
||||||
|
static void mqttStatus_obs_cb(lv_observer_t * observer, lv_subject_t * subject);
|
||||||
|
|
||||||
|
static void mqttStatus_obs_cb(lv_observer_t * observer, lv_subject_t * subject)
|
||||||
|
{
|
||||||
|
ESP_LOGE(TAG, "On passe dans le callback de chgt de statut; %li", lv_subject_get_int(subject));
|
||||||
|
if(lvgl_port_lock(0)){
|
||||||
|
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)){
|
||||||
|
switch (lv_subject_get_int(subject))
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
lv_image_set_src(wifiSt,&mqtt_ko);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
lv_image_set_src(wifiSt,&mqtt_ok);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
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(wifiSt, color, 0);
|
||||||
|
vTaskDelay(2000 / portTICK_PERIOD_MS);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
lv_obj_set_style_image_recolor_opa(wifiSt, 0, 0);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
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 cur_v = lv_subject_get_int(subject);
|
||||||
|
|
||||||
|
//lv_obj_t * btn = lv_observer_get_target(observer);
|
||||||
|
}
|
||||||
|
|
||||||
static void log_error_if_nonzero(const char *message, int error_code)
|
static void log_error_if_nonzero(const char *message, int error_code)
|
||||||
{
|
{
|
||||||
@ -91,7 +136,10 @@ static void mqtt_event_handler(void *handler_args, esp_event_base_t base, int32_
|
|||||||
msg_id = esp_mqtt_client_subscribe(client, topicHauteurCuveEvol, 0);
|
msg_id = esp_mqtt_client_subscribe(client, topicHauteurCuveEvol, 0);
|
||||||
ESP_LOGI(TAG, "sent subscribe successful, msg_id=%d", msg_id);
|
ESP_LOGI(TAG, "sent subscribe successful, msg_id=%d", msg_id);
|
||||||
|
|
||||||
//msg_id = esp_mqtt_client_subscribe(client, "/topic/qos1", 1);
|
msg_id = esp_mqtt_client_subscribe(client, topicTest, 0);
|
||||||
|
ESP_LOGI(TAG, "sent subscribe successful, msg_id=%d", msg_id);
|
||||||
|
|
||||||
|
//msg_id = esp_mqtt_client_subscribe(client, "/topic/qos1", 1);
|
||||||
//ESP_LOGI(TAG, "sent subscribe successful, msg_id=%d", msg_id);
|
//ESP_LOGI(TAG, "sent subscribe successful, msg_id=%d", msg_id);
|
||||||
|
|
||||||
//msg_id = esp_mqtt_client_unsubscribe(client, "/topic/qos1");
|
//msg_id = esp_mqtt_client_unsubscribe(client, "/topic/qos1");
|
||||||
@ -118,6 +166,7 @@ static void mqtt_event_handler(void *handler_args, esp_event_base_t base, int32_
|
|||||||
ESP_LOGI(TAG, "MQTT_EVENT_PUBLISHED, msg_id=%d", event->msg_id);
|
ESP_LOGI(TAG, "MQTT_EVENT_PUBLISHED, msg_id=%d", event->msg_id);
|
||||||
break;
|
break;
|
||||||
case MQTT_EVENT_DATA:
|
case MQTT_EVENT_DATA:
|
||||||
|
lv_subject_set_int(&mqttStatus,2);
|
||||||
ESP_LOGI(TAG, "MQTT_EVENT_DATA");
|
ESP_LOGI(TAG, "MQTT_EVENT_DATA");
|
||||||
printf("TOPIC=%.*s\r\n", event->topic_len, event->topic);
|
printf("TOPIC=%.*s\r\n", event->topic_len, event->topic);
|
||||||
printf("DATA=%.*s\r\n", event->data_len, event->data);
|
printf("DATA=%.*s\r\n", event->data_len, event->data);
|
||||||
@ -166,11 +215,15 @@ static void mqtt_event_handler(void *handler_args, esp_event_base_t base, int32_
|
|||||||
lv_subject_copy_string(&hauteurCuveSubj, datas);
|
lv_subject_copy_string(&hauteurCuveSubj, datas);
|
||||||
free(datas);
|
free(datas);
|
||||||
lvgl_port_unlock();
|
lvgl_port_unlock();
|
||||||
|
}else if (strncmp(event->topic, topicTest, 4) == 0){
|
||||||
|
ESP_LOGE(TAG,"Msg reecu sur test");
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ESP_LOGE(TAG, "None match :-(");
|
ESP_LOGE(TAG, "None match :-(");
|
||||||
}
|
}
|
||||||
|
lv_subject_set_int(&mqttStatus,3);
|
||||||
break;
|
break;
|
||||||
case MQTT_EVENT_ERROR:
|
case MQTT_EVENT_ERROR:
|
||||||
ESP_LOGI(TAG, "MQTT_EVENT_ERROR");
|
ESP_LOGI(TAG, "MQTT_EVENT_ERROR");
|
||||||
@ -189,6 +242,11 @@ static void mqtt_event_handler(void *handler_args, esp_event_base_t base, int32_
|
|||||||
}
|
}
|
||||||
void mqtt_app_start(void)
|
void mqtt_app_start(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
lv_subject_init_int(&mqttStatus,-1);
|
||||||
|
lv_subject_add_observer_obj(&mqttStatus, mqttStatus_obs_cb, NULL, NULL);
|
||||||
|
|
||||||
|
|
||||||
esp_mqtt_client_config_t mqtt_cfg = {
|
esp_mqtt_client_config_t mqtt_cfg = {
|
||||||
.broker.address.uri = "mqtt://192.168.0.10",
|
.broker.address.uri = "mqtt://192.168.0.10",
|
||||||
.network.timeout_ms = 1000};
|
.network.timeout_ms = 1000};
|
||||||
|
|||||||
35
main/wifi.c
@ -24,7 +24,37 @@ static const char *TAG = "wifi";
|
|||||||
|
|
||||||
static int s_retry_num = 0;
|
static int s_retry_num = 0;
|
||||||
|
|
||||||
extern lv_subject_t wifiStatus;
|
static lv_subject_t wifiStatus;
|
||||||
|
LV_IMAGE_DECLARE(wifi_ok);
|
||||||
|
LV_IMAGE_DECLARE(wifi_ko);
|
||||||
|
|
||||||
|
static void wifiStatus_obs_cb(lv_observer_t * observer, lv_subject_t * subject);
|
||||||
|
|
||||||
|
|
||||||
|
static void wifiStatus_obs_cb(lv_observer_t * observer, lv_subject_t * subject)
|
||||||
|
{
|
||||||
|
ESP_LOGE(TAG, "On passe dans le callback de chgt de statut; %li", lv_subject_get_int(subject));
|
||||||
|
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)){
|
||||||
|
switch (lv_subject_get_int(subject))
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
lv_image_set_src(wifiSt,&wifi_ko);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
lv_image_set_src(wifiSt,&wifi_ok);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
ESP_LOGE(TAG, "L'objet recuip en semble pas etre du bon type");
|
||||||
|
}
|
||||||
|
//int32_t prev_v = lv_subject_get_previous_int(subject);
|
||||||
|
//int32_t cur_v = lv_subject_get_int(subject);
|
||||||
|
|
||||||
|
//lv_obj_t * btn = lv_observer_get_target(observer);
|
||||||
|
}
|
||||||
|
|
||||||
static void wifi_event_handler(void *arg, esp_event_base_t event_base, int32_t event_id, void *event_data)
|
static void wifi_event_handler(void *arg, esp_event_base_t event_base, int32_t event_id, void *event_data)
|
||||||
{
|
{
|
||||||
@ -108,6 +138,9 @@ void wifi_init_sta(void)
|
|||||||
ESP_ERROR_CHECK(esp_wifi_start());
|
ESP_ERROR_CHECK(esp_wifi_start());
|
||||||
|
|
||||||
ESP_LOGI(TAG, "wifi_init_sta finished.");
|
ESP_LOGI(TAG, "wifi_init_sta finished.");
|
||||||
|
lv_subject_init_int(&wifiStatus,0);
|
||||||
|
lv_subject_add_observer_obj(&wifiStatus, wifiStatus_obs_cb, NULL, NULL);
|
||||||
|
|
||||||
|
|
||||||
/* Waiting until either the connection is established (WIFI_CONNECTED_BIT) or connection failed for the maximum
|
/* Waiting until either the connection is established (WIFI_CONNECTED_BIT) or connection failed for the maximum
|
||||||
* number of re-tries (WIFI_FAIL_BIT). The bits are set by event_handler() (see above) */
|
* number of re-tries (WIFI_FAIL_BIT). The bits are set by event_handler() (see above) */
|
||||||
|
|||||||
@ -6,4 +6,4 @@ phy_init,data,phy,0x11000,4K,
|
|||||||
factory,app,factory,0x20000,3M,
|
factory,app,factory,0x20000,3M,
|
||||||
ota_0,app,ota_0,0x320000,3M,
|
ota_0,app,ota_0,0x320000,3M,
|
||||||
ota_1,app,ota_1,0x620000,3M,
|
ota_1,app,ota_1,0x620000,3M,
|
||||||
datas,data,spiffs,0x920000,1M,
|
littlefs,data,littlefs,0x920000,1M,
|
||||||
|
|||||||
|
@ -6,4 +6,4 @@ phy_init,data,phy,,0x1000,,
|
|||||||
factory,app,factory,,3M,,
|
factory,app,factory,,3M,,
|
||||||
ota_0,app,ota_0,,3M,,
|
ota_0,app,ota_0,,3M,,
|
||||||
ota_1,app,ota_1,,3M,,
|
ota_1,app,ota_1,,3M,,
|
||||||
datas,data,spiffs,,1M,,
|
littlefs,data,littlefs,,1M,,
|
||||||
|
|||||||
|
68
sdkconfig
@ -680,6 +680,7 @@ CONFIG_ESP_COEX_ENABLED=y
|
|||||||
# Common ESP-related
|
# Common ESP-related
|
||||||
#
|
#
|
||||||
CONFIG_ESP_ERR_TO_NAME_LOOKUP=y
|
CONFIG_ESP_ERR_TO_NAME_LOOKUP=y
|
||||||
|
CONFIG_ESP_ALLOW_BSS_SEG_EXTERNAL_MEMORY=y
|
||||||
# end of Common ESP-related
|
# end of Common ESP-related
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -952,14 +953,13 @@ CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY=y
|
|||||||
CONFIG_SPIRAM_CLK_IO=30
|
CONFIG_SPIRAM_CLK_IO=30
|
||||||
CONFIG_SPIRAM_CS_IO=26
|
CONFIG_SPIRAM_CS_IO=26
|
||||||
# CONFIG_SPIRAM_XIP_FROM_PSRAM is not set
|
# CONFIG_SPIRAM_XIP_FROM_PSRAM is not set
|
||||||
CONFIG_SPIRAM_FETCH_INSTRUCTIONS=y
|
# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set
|
||||||
CONFIG_SPIRAM_RODATA=y
|
# CONFIG_SPIRAM_RODATA is not set
|
||||||
CONFIG_SPIRAM_SPEED_80M=y
|
CONFIG_SPIRAM_SPEED_80M=y
|
||||||
# CONFIG_SPIRAM_SPEED_40M is not set
|
# CONFIG_SPIRAM_SPEED_40M is not set
|
||||||
CONFIG_SPIRAM_SPEED=80
|
CONFIG_SPIRAM_SPEED=80
|
||||||
# CONFIG_SPIRAM_ECC_ENABLE is not set
|
# CONFIG_SPIRAM_ECC_ENABLE is not set
|
||||||
CONFIG_SPIRAM_BOOT_INIT=y
|
CONFIG_SPIRAM_BOOT_INIT=y
|
||||||
# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set
|
|
||||||
# CONFIG_SPIRAM_USE_MEMMAP is not set
|
# CONFIG_SPIRAM_USE_MEMMAP is not set
|
||||||
# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set
|
# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set
|
||||||
CONFIG_SPIRAM_USE_MALLOC=y
|
CONFIG_SPIRAM_USE_MALLOC=y
|
||||||
@ -967,7 +967,7 @@ CONFIG_SPIRAM_MEMTEST=y
|
|||||||
CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=16384
|
CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=16384
|
||||||
# CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP is not set
|
# CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP is not set
|
||||||
CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=32768
|
CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=32768
|
||||||
# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set
|
CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY=y
|
||||||
# end of SPI RAM config
|
# end of SPI RAM config
|
||||||
# end of ESP PSRAM
|
# end of ESP PSRAM
|
||||||
|
|
||||||
@ -1040,7 +1040,7 @@ CONFIG_ESP_SYSTEM_MEMPROT_FEATURE_LOCK=y
|
|||||||
|
|
||||||
CONFIG_ESP_SYSTEM_EVENT_QUEUE_SIZE=32
|
CONFIG_ESP_SYSTEM_EVENT_QUEUE_SIZE=32
|
||||||
CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=4608
|
CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=4608
|
||||||
CONFIG_ESP_MAIN_TASK_STACK_SIZE=40000
|
CONFIG_ESP_MAIN_TASK_STACK_SIZE=30000
|
||||||
CONFIG_ESP_MAIN_TASK_AFFINITY_CPU0=y
|
CONFIG_ESP_MAIN_TASK_AFFINITY_CPU0=y
|
||||||
# CONFIG_ESP_MAIN_TASK_AFFINITY_CPU1 is not set
|
# CONFIG_ESP_MAIN_TASK_AFFINITY_CPU1 is not set
|
||||||
# CONFIG_ESP_MAIN_TASK_AFFINITY_NO_AFFINITY is not set
|
# CONFIG_ESP_MAIN_TASK_AFFINITY_NO_AFFINITY is not set
|
||||||
@ -1139,9 +1139,9 @@ CONFIG_ESP_WIFI_TASK_PINNED_TO_CORE_0=y
|
|||||||
# CONFIG_ESP_WIFI_TASK_PINNED_TO_CORE_1 is not set
|
# CONFIG_ESP_WIFI_TASK_PINNED_TO_CORE_1 is not set
|
||||||
CONFIG_ESP_WIFI_SOFTAP_BEACON_MAX_LEN=752
|
CONFIG_ESP_WIFI_SOFTAP_BEACON_MAX_LEN=752
|
||||||
CONFIG_ESP_WIFI_MGMT_SBUF_NUM=32
|
CONFIG_ESP_WIFI_MGMT_SBUF_NUM=32
|
||||||
CONFIG_ESP_WIFI_IRAM_OPT=y
|
# CONFIG_ESP_WIFI_IRAM_OPT is not set
|
||||||
# CONFIG_ESP_WIFI_EXTRA_IRAM_OPT is not set
|
# CONFIG_ESP_WIFI_EXTRA_IRAM_OPT is not set
|
||||||
CONFIG_ESP_WIFI_RX_IRAM_OPT=y
|
# CONFIG_ESP_WIFI_RX_IRAM_OPT is not set
|
||||||
CONFIG_ESP_WIFI_ENABLE_WPA3_SAE=y
|
CONFIG_ESP_WIFI_ENABLE_WPA3_SAE=y
|
||||||
CONFIG_ESP_WIFI_ENABLE_SAE_PK=y
|
CONFIG_ESP_WIFI_ENABLE_SAE_PK=y
|
||||||
CONFIG_ESP_WIFI_SOFTAP_SAE_SUPPORT=y
|
CONFIG_ESP_WIFI_SOFTAP_SAE_SUPPORT=y
|
||||||
@ -1646,25 +1646,21 @@ CONFIG_MBEDTLS_ERROR_STRINGS=y
|
|||||||
#
|
#
|
||||||
CONFIG_MQTT_PROTOCOL_311=y
|
CONFIG_MQTT_PROTOCOL_311=y
|
||||||
# CONFIG_MQTT_PROTOCOL_5 is not set
|
# CONFIG_MQTT_PROTOCOL_5 is not set
|
||||||
CONFIG_MQTT_TRANSPORT_SSL=y
|
# CONFIG_MQTT_TRANSPORT_SSL is not set
|
||||||
CONFIG_MQTT_TRANSPORT_WEBSOCKET=y
|
# CONFIG_MQTT_TRANSPORT_WEBSOCKET is not set
|
||||||
CONFIG_MQTT_TRANSPORT_WEBSOCKET_SECURE=y
|
|
||||||
# CONFIG_MQTT_MSG_ID_INCREMENTAL is not set
|
# CONFIG_MQTT_MSG_ID_INCREMENTAL is not set
|
||||||
# CONFIG_MQTT_SKIP_PUBLISH_IF_DISCONNECTED is not set
|
# CONFIG_MQTT_SKIP_PUBLISH_IF_DISCONNECTED is not set
|
||||||
# CONFIG_MQTT_REPORT_DELETED_MESSAGES is not set
|
# CONFIG_MQTT_REPORT_DELETED_MESSAGES is not set
|
||||||
CONFIG_MQTT_USE_CUSTOM_CONFIG=y
|
CONFIG_MQTT_USE_CUSTOM_CONFIG=y
|
||||||
CONFIG_MQTT_TCP_DEFAULT_PORT=1883
|
CONFIG_MQTT_TCP_DEFAULT_PORT=1883
|
||||||
CONFIG_MQTT_SSL_DEFAULT_PORT=8883
|
CONFIG_MQTT_BUFFER_SIZE=100
|
||||||
CONFIG_MQTT_WS_DEFAULT_PORT=80
|
CONFIG_MQTT_TASK_STACK_SIZE=4096
|
||||||
CONFIG_MQTT_WSS_DEFAULT_PORT=443
|
|
||||||
CONFIG_MQTT_BUFFER_SIZE=1024
|
|
||||||
CONFIG_MQTT_TASK_STACK_SIZE=6144
|
|
||||||
# CONFIG_MQTT_DISABLE_API_LOCKS is not set
|
# CONFIG_MQTT_DISABLE_API_LOCKS is not set
|
||||||
CONFIG_MQTT_TASK_PRIORITY=5
|
CONFIG_MQTT_TASK_PRIORITY=5
|
||||||
CONFIG_MQTT_POLL_READ_TIMEOUT_MS=10000
|
CONFIG_MQTT_POLL_READ_TIMEOUT_MS=10000
|
||||||
CONFIG_MQTT_EVENT_QUEUE_SIZE=1
|
CONFIG_MQTT_EVENT_QUEUE_SIZE=1
|
||||||
# CONFIG_MQTT_TASK_CORE_SELECTION_ENABLED is not set
|
# CONFIG_MQTT_TASK_CORE_SELECTION_ENABLED is not set
|
||||||
# CONFIG_MQTT_OUTBOX_DATA_ON_EXTERNAL_MEMORY is not set
|
CONFIG_MQTT_OUTBOX_DATA_ON_EXTERNAL_MEMORY=y
|
||||||
# CONFIG_MQTT_CUSTOM_OUTBOX is not set
|
# CONFIG_MQTT_CUSTOM_OUTBOX is not set
|
||||||
CONFIG_MQTT_OUTBOX_EXPIRED_TIMEOUT_MS=30000
|
CONFIG_MQTT_OUTBOX_EXPIRED_TIMEOUT_MS=30000
|
||||||
# end of ESP-MQTT Configurations
|
# end of ESP-MQTT Configurations
|
||||||
@ -1833,6 +1829,33 @@ CONFIG_ESP_LCD_TOUCH_MAX_POINTS=1
|
|||||||
CONFIG_ESP_LCD_TOUCH_MAX_BUTTONS=1
|
CONFIG_ESP_LCD_TOUCH_MAX_BUTTONS=1
|
||||||
# end of ESP LCD TOUCH
|
# end of ESP LCD TOUCH
|
||||||
|
|
||||||
|
#
|
||||||
|
# LittleFS
|
||||||
|
#
|
||||||
|
# CONFIG_LITTLEFS_SDMMC_SUPPORT is not set
|
||||||
|
CONFIG_LITTLEFS_MAX_PARTITIONS=3
|
||||||
|
CONFIG_LITTLEFS_PAGE_SIZE=256
|
||||||
|
CONFIG_LITTLEFS_OBJ_NAME_LEN=64
|
||||||
|
CONFIG_LITTLEFS_READ_SIZE=128
|
||||||
|
CONFIG_LITTLEFS_WRITE_SIZE=128
|
||||||
|
CONFIG_LITTLEFS_LOOKAHEAD_SIZE=128
|
||||||
|
CONFIG_LITTLEFS_CACHE_SIZE=512
|
||||||
|
CONFIG_LITTLEFS_BLOCK_CYCLES=512
|
||||||
|
CONFIG_LITTLEFS_USE_MTIME=y
|
||||||
|
# CONFIG_LITTLEFS_USE_ONLY_HASH is not set
|
||||||
|
# CONFIG_LITTLEFS_HUMAN_READABLE is not set
|
||||||
|
CONFIG_LITTLEFS_MTIME_USE_SECONDS=y
|
||||||
|
# CONFIG_LITTLEFS_MTIME_USE_NONCE is not set
|
||||||
|
# CONFIG_LITTLEFS_SPIFFS_COMPAT is not set
|
||||||
|
# CONFIG_LITTLEFS_FLUSH_FILE_EVERY_WRITE is not set
|
||||||
|
# CONFIG_LITTLEFS_FCNTL_GET_PATH is not set
|
||||||
|
# CONFIG_LITTLEFS_MULTIVERSION is not set
|
||||||
|
# CONFIG_LITTLEFS_MALLOC_STRATEGY_DISABLE is not set
|
||||||
|
CONFIG_LITTLEFS_MALLOC_STRATEGY_DEFAULT=y
|
||||||
|
# CONFIG_LITTLEFS_MALLOC_STRATEGY_INTERNAL is not set
|
||||||
|
CONFIG_LITTLEFS_ASSERTS=y
|
||||||
|
# end of LittleFS
|
||||||
|
|
||||||
#
|
#
|
||||||
# LVGL configuration
|
# LVGL configuration
|
||||||
#
|
#
|
||||||
@ -1853,8 +1876,8 @@ CONFIG_LV_COLOR_DEPTH=16
|
|||||||
#
|
#
|
||||||
# Memory Settings
|
# Memory Settings
|
||||||
#
|
#
|
||||||
CONFIG_LV_USE_BUILTIN_MALLOC=y
|
# CONFIG_LV_USE_BUILTIN_MALLOC is not set
|
||||||
# CONFIG_LV_USE_CLIB_MALLOC is not set
|
CONFIG_LV_USE_CLIB_MALLOC=y
|
||||||
# CONFIG_LV_USE_MICROPYTHON_MALLOC is not set
|
# CONFIG_LV_USE_MICROPYTHON_MALLOC is not set
|
||||||
# CONFIG_LV_USE_RTTHREAD_MALLOC is not set
|
# CONFIG_LV_USE_RTTHREAD_MALLOC is not set
|
||||||
# CONFIG_LV_USE_CUSTOM_MALLOC is not set
|
# CONFIG_LV_USE_CUSTOM_MALLOC is not set
|
||||||
@ -1864,9 +1887,6 @@ CONFIG_LV_USE_BUILTIN_STRING=y
|
|||||||
# CONFIG_LV_USE_BUILTIN_SPRINTF is not set
|
# CONFIG_LV_USE_BUILTIN_SPRINTF is not set
|
||||||
CONFIG_LV_USE_CLIB_SPRINTF=y
|
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_POOL_EXPAND_SIZE_KILOBYTES=0
|
|
||||||
CONFIG_LV_MEM_ADR=0x0
|
|
||||||
# end of Memory Settings
|
# end of Memory Settings
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -2294,7 +2314,7 @@ CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240=y
|
|||||||
CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ=240
|
CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ=240
|
||||||
CONFIG_SYSTEM_EVENT_QUEUE_SIZE=32
|
CONFIG_SYSTEM_EVENT_QUEUE_SIZE=32
|
||||||
CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE=4608
|
CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE=4608
|
||||||
CONFIG_MAIN_TASK_STACK_SIZE=40000
|
CONFIG_MAIN_TASK_STACK_SIZE=30000
|
||||||
CONFIG_CONSOLE_UART_DEFAULT=y
|
CONFIG_CONSOLE_UART_DEFAULT=y
|
||||||
# CONFIG_CONSOLE_UART_CUSTOM is not set
|
# CONFIG_CONSOLE_UART_CUSTOM is not set
|
||||||
# CONFIG_CONSOLE_UART_NONE is not set
|
# CONFIG_CONSOLE_UART_NONE is not set
|
||||||
@ -2354,8 +2374,8 @@ CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_0=y
|
|||||||
# CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_1 is not set
|
# CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_1 is not set
|
||||||
CONFIG_ESP32_WIFI_SOFTAP_BEACON_MAX_LEN=752
|
CONFIG_ESP32_WIFI_SOFTAP_BEACON_MAX_LEN=752
|
||||||
CONFIG_ESP32_WIFI_MGMT_SBUF_NUM=32
|
CONFIG_ESP32_WIFI_MGMT_SBUF_NUM=32
|
||||||
CONFIG_ESP32_WIFI_IRAM_OPT=y
|
# CONFIG_ESP32_WIFI_IRAM_OPT is not set
|
||||||
CONFIG_ESP32_WIFI_RX_IRAM_OPT=y
|
# CONFIG_ESP32_WIFI_RX_IRAM_OPT is not set
|
||||||
CONFIG_ESP32_WIFI_ENABLE_WPA3_SAE=y
|
CONFIG_ESP32_WIFI_ENABLE_WPA3_SAE=y
|
||||||
CONFIG_ESP32_WIFI_ENABLE_WPA3_OWE_STA=y
|
CONFIG_ESP32_WIFI_ENABLE_WPA3_OWE_STA=y
|
||||||
CONFIG_WPA_MBEDTLS_CRYPTO=y
|
CONFIG_WPA_MBEDTLS_CRYPTO=y
|
||||||
|
|||||||