ajout temp ext
This commit is contained in:
parent
1d91bac9e9
commit
f32cad2987
@ -36,7 +36,8 @@ LV_IMAGE_DECLARE(mqtt_ok);
|
|||||||
LV_IMAGE_DECLARE(mqtt_ko);
|
LV_IMAGE_DECLARE(mqtt_ko);
|
||||||
|
|
||||||
lv_subject_t dateHeureSubj;
|
lv_subject_t dateHeureSubj;
|
||||||
lv_obj_t *lblTempInt2;
|
lv_obj_t *lblTempInt;
|
||||||
|
lv_obj_t *lblTempExt;
|
||||||
char tempExtStr[6];
|
char tempExtStr[6];
|
||||||
char tempIntStr[6];
|
char tempIntStr[6];
|
||||||
char hauteurCuveStr[9];
|
char hauteurCuveStr[9];
|
||||||
@ -109,12 +110,18 @@ void draw_time(struct tm *dateHeure){
|
|||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void draw_tempExt(char * tempHumid){
|
||||||
|
//if(display_lock("draw_temp")){
|
||||||
|
lv_label_set_text_fmt(lblTempExt,LV_SYMBOL_HOME "\xEF\x8B\x8A : %.1f°C", atof(tempHumid));
|
||||||
|
// display_unlock("draw_temp");
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
|
||||||
void draw_temp(char * tempHumid){
|
void draw_temp(char * tempHumid){
|
||||||
if(display_lock("draw_temp")){
|
//if(display_lock("draw_temp")){
|
||||||
lv_label_set_text(lblTempInt2,tempHumid);
|
lv_label_set_text(lblTempInt,tempHumid);
|
||||||
display_unlock("draw_temp");
|
// display_unlock("draw_temp");
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw_meteo(meteo_event_payload_t *meteo){
|
void draw_meteo(meteo_event_payload_t *meteo){
|
||||||
@ -1024,6 +1031,7 @@ static void cuve_click_cb(lv_event_t * e){
|
|||||||
lv_tabview_set_active(tabview, 3, false);
|
lv_tabview_set_active(tabview, 3, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
void draw_tabHome(lv_obj_t* parent){
|
void draw_tabHome(lv_obj_t* parent){
|
||||||
lv_obj_t *supmain = parent;
|
lv_obj_t *supmain = parent;
|
||||||
lv_obj_set_flex_flow(supmain, LV_FLEX_FLOW_COLUMN);
|
lv_obj_set_flex_flow(supmain, LV_FLEX_FLOW_COLUMN);
|
||||||
@ -1035,7 +1043,7 @@ void draw_tabHome(lv_obj_t* parent){
|
|||||||
lv_obj_set_flex_flow(main, LV_FLEX_FLOW_ROW);
|
lv_obj_set_flex_flow(main, LV_FLEX_FLOW_ROW);
|
||||||
lv_obj_set_style_pad_column(main, 1, 0);
|
lv_obj_set_style_pad_column(main, 1, 0);
|
||||||
|
|
||||||
/*Conteneur Colonne: Températures*/
|
//Conteneur Colonne: Températures
|
||||||
lv_obj_t *cont_colTemp = lv_obj_create(main);
|
lv_obj_t *cont_colTemp = lv_obj_create(main);
|
||||||
lv_obj_set_style_pad_all(cont_colTemp, 5, 0);
|
lv_obj_set_style_pad_all(cont_colTemp, 5, 0);
|
||||||
lv_obj_set_size(cont_colTemp, lv_pct(40), lv_pct(100));
|
lv_obj_set_size(cont_colTemp, lv_pct(40), lv_pct(100));
|
||||||
@ -1043,7 +1051,7 @@ void draw_tabHome(lv_obj_t* parent){
|
|||||||
lv_obj_set_flex_flow(cont_colTemp, LV_FLEX_FLOW_COLUMN);
|
lv_obj_set_flex_flow(cont_colTemp, LV_FLEX_FLOW_COLUMN);
|
||||||
lv_obj_set_flex_align(cont_colTemp, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);
|
lv_obj_set_flex_align(cont_colTemp, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);
|
||||||
|
|
||||||
/*Create a container with COLUMN flex direction*/
|
//Create a container with COLUMN flex direction
|
||||||
lv_obj_t *cont_colVolets = lv_obj_create(main);
|
lv_obj_t *cont_colVolets = lv_obj_create(main);
|
||||||
lv_obj_set_style_pad_all(cont_colVolets, 5, 0);
|
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_flex_align(cont_colVolets, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);
|
||||||
@ -1052,7 +1060,7 @@ void draw_tabHome(lv_obj_t* parent){
|
|||||||
lv_obj_set_flex_flow(cont_colVolets, LV_FLEX_FLOW_COLUMN);
|
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_set_flex_align(cont_colVolets, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_SPACE_BETWEEN, LV_FLEX_ALIGN_CENTER);
|
||||||
|
|
||||||
/*Conteneur Colonne: Meteo*/
|
// Conteneur Colonne: Meteo
|
||||||
lv_obj_t *cont_col3 = lv_obj_create(main);
|
lv_obj_t *cont_col3 = lv_obj_create(main);
|
||||||
lv_obj_set_style_pad_all(cont_col3, 5, 0);
|
lv_obj_set_style_pad_all(cont_col3, 5, 0);
|
||||||
lv_obj_set_size(cont_col3, lv_pct(40), lv_pct(100));
|
lv_obj_set_size(cont_col3, lv_pct(40), lv_pct(100));
|
||||||
@ -1079,7 +1087,7 @@ void draw_tabHome(lv_obj_t* parent){
|
|||||||
lv_label_bind_text(lblTempExt, &tempExtSubj, "%s °C");
|
lv_label_bind_text(lblTempExt, &tempExtSubj, "%s °C");
|
||||||
|
|
||||||
//Create a container with COLUMN flex direction
|
//Create a container with COLUMN flex direction
|
||||||
/*
|
//
|
||||||
lv_obj_t *cont_tempInt = lv_obj_create(cont_colTemp);
|
lv_obj_t *cont_tempInt = lv_obj_create(cont_colTemp);
|
||||||
lv_obj_add_style(cont_tempInt, &style_container, 0);
|
lv_obj_add_style(cont_tempInt, &style_container, 0);
|
||||||
// lv_obj_set_height(cont_tempInt,50);
|
// lv_obj_set_height(cont_tempInt,50);
|
||||||
@ -1090,7 +1098,7 @@ void draw_tabHome(lv_obj_t* parent){
|
|||||||
lv_obj_add_style(lblTempInt, &style_lbvValue, 0);
|
lv_obj_add_style(lblTempInt, &style_lbvValue, 0);
|
||||||
lv_label_set_text(lblTempInt, "");
|
lv_label_set_text(lblTempInt, "");
|
||||||
lv_label_bind_text(lblTempInt, &tempIntSubj, "%s °C");
|
lv_label_bind_text(lblTempInt, &tempIntSubj, "%s °C");
|
||||||
*/
|
//
|
||||||
|
|
||||||
//Create a container with COLUMN flex direction
|
//Create a container with COLUMN flex direction
|
||||||
lv_obj_t *cont_tempInt2 = lv_obj_create(cont_colTemp);
|
lv_obj_t *cont_tempInt2 = lv_obj_create(cont_colTemp);
|
||||||
@ -1099,11 +1107,11 @@ void draw_tabHome(lv_obj_t* parent){
|
|||||||
lv_obj_set_flex_flow(cont_tempInt2, LV_FLEX_FLOW_ROW);
|
lv_obj_set_flex_flow(cont_tempInt2, LV_FLEX_FLOW_ROW);
|
||||||
lv_obj_t * lblInt = lv_label_create(cont_tempInt2);
|
lv_obj_t * lblInt = lv_label_create(cont_tempInt2);
|
||||||
lv_label_set_text(lblInt, "int.");
|
lv_label_set_text(lblInt, "int.");
|
||||||
lblTempInt2 = lv_label_create(cont_tempInt2);
|
//lblTempInt2 = lv_label_create(cont_tempInt2);
|
||||||
lv_obj_add_style(lblTempInt2, &style_lbvValue, 0);
|
//lv_obj_add_style(lblTempInt2, &style_lbvValue, 0);
|
||||||
lv_obj_set_style_text_font(lblTempInt2,lv_theme_get_font_large(lblTempInt2),0);
|
//lv_obj_set_style_text_font(lblTempInt2,lv_theme_get_font_large(lblTempInt2),0);
|
||||||
|
|
||||||
lv_label_set_text(lblTempInt2, "");
|
//lv_label_set_text(lblTempInt2, "");
|
||||||
|
|
||||||
//Create a container with COLUMN flex direction
|
//Create a container with COLUMN flex direction
|
||||||
lv_obj_t *cont_Cuve = lv_obj_create(cont_colTemp);
|
lv_obj_t *cont_Cuve = lv_obj_create(cont_colTemp);
|
||||||
@ -1149,15 +1157,8 @@ void draw_tabCuve(lv_obj_t* parent)
|
|||||||
lv_image_set_src(imgGraf, "A:/sdcard/hello2.png");
|
lv_image_set_src(imgGraf, "A:/sdcard/hello2.png");
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw_tabMeteo(lv_obj_t * parent)
|
|
||||||
{
|
*/
|
||||||
weatherDay_fragment_create_obj(0,parent, false);
|
|
||||||
weatherDay_fragment_create_obj(1,parent, false);
|
|
||||||
weatherDay_fragment_create_obj(2,parent, false);
|
|
||||||
//manager2 = lv_fragment_manager_create(NULL);
|
|
||||||
//fragment2 = lv_fragment_create(&meteodailyforecast_cls, (void *)1);
|
|
||||||
//lv_fragment_manager_add(manager2, fragment2, &parent);
|
|
||||||
}
|
|
||||||
|
|
||||||
void draw_tabVolets(lv_obj_t* parent)
|
void draw_tabVolets(lv_obj_t* parent)
|
||||||
{
|
{
|
||||||
@ -1199,7 +1200,7 @@ void draw_tabVolets(lv_obj_t* parent)
|
|||||||
lv_obj_set_size(cont_btn_volets, lv_pct(15), lv_pct(100));
|
lv_obj_set_size(cont_btn_volets, lv_pct(15), lv_pct(100));
|
||||||
|
|
||||||
lv_obj_set_layout(cont_btn_volets, LV_LAYOUT_GRID);
|
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 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_FR(1), LV_GRID_FR(1), LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST};
|
static int32_t row_dsc[] = {LV_GRID_FR(1), LV_GRID_FR(1), LV_GRID_FR(1), 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_set_grid_dsc_array(cont_btn_volets, column_dsc, row_dsc);
|
||||||
|
|
||||||
@ -1243,6 +1244,16 @@ void draw_tabVolets(lv_obj_t* parent)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void draw_tabMeteo(lv_obj_t * parent)
|
||||||
|
{
|
||||||
|
weatherDay_fragment_create_obj(0,parent, false);
|
||||||
|
weatherDay_fragment_create_obj(1,parent, false);
|
||||||
|
weatherDay_fragment_create_obj(2,parent, false);
|
||||||
|
//manager2 = lv_fragment_manager_create(NULL);
|
||||||
|
//fragment2 = lv_fragment_create(&meteodailyforecast_cls, (void *)1);
|
||||||
|
//lv_fragment_manager_add(manager2, fragment2, &parent);
|
||||||
|
}
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
lv_obj_t *date_group;
|
lv_obj_t *date_group;
|
||||||
lv_span_t *date_day;
|
lv_span_t *date_day;
|
||||||
@ -1270,7 +1281,7 @@ static void time_observer_cb(lv_observer_t *observer, lv_subject_t *subject)
|
|||||||
{
|
{
|
||||||
LV_UNUSED(observer);
|
LV_UNUSED(observer);
|
||||||
|
|
||||||
ESP_LOGE(TAG,"################### On passe dans le cb time");
|
//ESP_LOGE(TAG,"################### On passe dans le cb time");
|
||||||
|
|
||||||
lv_obj_t *dateTimeObj = lv_observer_get_target_obj(observer);
|
lv_obj_t *dateTimeObj = lv_observer_get_target_obj(observer);
|
||||||
datetime_ctx_t *ctx = lv_obj_get_user_data(dateTimeObj);
|
datetime_ctx_t *ctx = lv_obj_get_user_data(dateTimeObj);
|
||||||
@ -1284,7 +1295,7 @@ static void time_observer_cb(lv_observer_t *observer, lv_subject_t *subject)
|
|||||||
ESP_LOGE(TAG,"################### Pas de struct tm");
|
ESP_LOGE(TAG,"################### Pas de struct tm");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ESP_LOGE(TAG,"################################# %d %d %d %02d:%02d", t->tm_wday, t->tm_mday, t->tm_mon, t->tm_hour, t->tm_min);
|
//ESP_LOGE(TAG,"################################# %d %d %d %02d:%02d", t->tm_wday, t->tm_mday, t->tm_mon, t->tm_hour, t->tm_min);
|
||||||
|
|
||||||
char buf[4];
|
char buf[4];
|
||||||
bool refresh_date = false;
|
bool refresh_date = false;
|
||||||
@ -1299,8 +1310,6 @@ static void time_observer_cb(lv_observer_t *observer, lv_subject_t *subject)
|
|||||||
//ESP_LOGE(TAG,"Jour %s",buf);
|
//ESP_LOGE(TAG,"Jour %s",buf);
|
||||||
lv_span_set_text(ctx->date_day, buf);
|
lv_span_set_text(ctx->date_day, buf);
|
||||||
refresh_date = true;
|
refresh_date = true;
|
||||||
}else{
|
|
||||||
ESP_LOGE(TAG, "########################### Meme date !");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((t->tm_mon + 1) != ctx->last_month) {
|
if ((t->tm_mon + 1) != ctx->last_month) {
|
||||||
@ -1822,7 +1831,7 @@ void messageCardContent(lv_obj_t *cont_messages)
|
|||||||
lv_obj_t *lblTempInt = lv_label_create(subContent);
|
lv_obj_t *lblTempInt = lv_label_create(subContent);
|
||||||
lv_label_set_text(lblTempInt, "\xEE\x86\xB0\xEF\x8B\x8A : 21°C");
|
lv_label_set_text(lblTempInt, "\xEE\x86\xB0\xEF\x8B\x8A : 21°C");
|
||||||
lv_obj_set_style_text_font(lblTempInt, lv_theme_get_font_large(lblTempInt),0);
|
lv_obj_set_style_text_font(lblTempInt, lv_theme_get_font_large(lblTempInt),0);
|
||||||
lv_obj_t *lblTempExt = lv_label_create(subContent);
|
lblTempExt = lv_label_create(subContent);
|
||||||
lv_label_set_text(lblTempExt, LV_SYMBOL_HOME "\xEF\x8B\x8A : 12°C");
|
lv_label_set_text(lblTempExt, LV_SYMBOL_HOME "\xEF\x8B\x8A : 12°C");
|
||||||
lv_obj_set_style_text_font(lblTempExt, lv_theme_get_font_large(lblTempExt),0);
|
lv_obj_set_style_text_font(lblTempExt, lv_theme_get_font_large(lblTempExt),0);
|
||||||
|
|
||||||
|
|||||||
@ -76,6 +76,10 @@ void traiteEvt(void *arg)
|
|||||||
draw_temp((char *)evt->pvData);
|
draw_temp((char *)evt->pvData);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case IHM_EVT_TEMP_RECUE:
|
||||||
|
draw_tempExt((char *)evt->pvData);
|
||||||
|
break;
|
||||||
|
|
||||||
case IHM_EVT_PUISSANCE_EMISE:
|
case IHM_EVT_PUISSANCE_EMISE:
|
||||||
{
|
{
|
||||||
int val = *(int *)evt->pvData;
|
int val = *(int *)evt->pvData;
|
||||||
@ -133,7 +137,7 @@ void traiteEvt(void *arg)
|
|||||||
}
|
}
|
||||||
// Nettoyage mémoire sécurisé
|
// Nettoyage mémoire sécurisé
|
||||||
if (evt->bNeedToFreeData && evt->pvData){
|
if (evt->bNeedToFreeData && evt->pvData){
|
||||||
ESP_LOGE(TAG, "Libération mémoire");
|
//ESP_LOGE(TAG, "Libération mémoire");
|
||||||
free(evt->pvData);
|
free(evt->pvData);
|
||||||
}
|
}
|
||||||
free(evt);
|
free(evt);
|
||||||
|
|||||||
@ -23,6 +23,7 @@ void initHome();
|
|||||||
void drawHome();
|
void drawHome();
|
||||||
|
|
||||||
void draw_time(struct tm *dateHeure);
|
void draw_time(struct tm *dateHeure);
|
||||||
|
void draw_tempExt(char *tempHumid);
|
||||||
void draw_minuteur(char *txt);
|
void draw_minuteur(char *txt);
|
||||||
void draw_temp(char *tempHumid);
|
void draw_temp(char *tempHumid);
|
||||||
|
|
||||||
|
|||||||
@ -111,6 +111,20 @@ void send_event(domo_events evt, void* pDatas) {
|
|||||||
ihmEvt->bNeedToFreeData = true;
|
ihmEvt->bNeedToFreeData = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case EVT_TEMP_EXT:
|
||||||
|
const char *msg3 = (const char *)pDatas;
|
||||||
|
char *msg_copy3 = malloc(strlen(msg3) + 1);
|
||||||
|
if (!msg_copy3) {
|
||||||
|
ESP_LOGE(TAG, "malloc failed for message string");
|
||||||
|
free(ihmEvt);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
strcpy(msg_copy3, msg3);
|
||||||
|
ihmEvt->eEventType = IHM_EVT_TEMP_RECUE;
|
||||||
|
ihmEvt->pvData = msg_copy3;
|
||||||
|
ihmEvt->bNeedToFreeData = true;
|
||||||
|
break;
|
||||||
|
|
||||||
case EVT_HAUTEUR_CUVE: {
|
case EVT_HAUTEUR_CUVE: {
|
||||||
float *data = malloc(sizeof(float));
|
float *data = malloc(sizeof(float));
|
||||||
if (!data) {
|
if (!data) {
|
||||||
|
|||||||
@ -14,7 +14,8 @@ typedef enum eIHMEvent_t{
|
|||||||
IHM_EVT_PUISSANCE_EMISE,
|
IHM_EVT_PUISSANCE_EMISE,
|
||||||
IHM_EVT_ETAT_MACHINE,
|
IHM_EVT_ETAT_MACHINE,
|
||||||
IHM_EVT_HAUTEUR_CUVE,
|
IHM_EVT_HAUTEUR_CUVE,
|
||||||
IHM_EVT_METEO_RECUE
|
IHM_EVT_METEO_RECUE,
|
||||||
|
IHM_EVT_TEMP_RECUE
|
||||||
} eIHMEvent_t;
|
} eIHMEvent_t;
|
||||||
|
|
||||||
typedef struct IHM_EVENT
|
typedef struct IHM_EVENT
|
||||||
@ -31,7 +32,8 @@ typedef enum domo_events{
|
|||||||
EVT_PUISSANCE_RECUE,
|
EVT_PUISSANCE_RECUE,
|
||||||
EVT_ETAT_MACHINE,
|
EVT_ETAT_MACHINE,
|
||||||
EVT_HAUTEUR_CUVE,
|
EVT_HAUTEUR_CUVE,
|
||||||
EVT_METEO_RECUE
|
EVT_METEO_RECUE,
|
||||||
|
EVT_TEMP_EXT
|
||||||
} domo_events;
|
} domo_events;
|
||||||
void startEvtManager();
|
void startEvtManager();
|
||||||
QueueHandle_t getIHMQueueHandle();
|
QueueHandle_t getIHMQueueHandle();
|
||||||
|
|||||||
@ -136,6 +136,7 @@ void mqtt_cb(mqtt_evt evt, esp_mqtt_event_handle_t event){
|
|||||||
float temp = strtof(event->data, NULL);
|
float temp = strtof(event->data, NULL);
|
||||||
char buff[5];
|
char buff[5];
|
||||||
sprintf(buff,"%.1f",temp);
|
sprintf(buff,"%.1f",temp);
|
||||||
|
send_event(EVT_TEMP_EXT, buff);
|
||||||
//lv_subject_copy_string(&tempExtSubj, buff);
|
//lv_subject_copy_string(&tempExtSubj, buff);
|
||||||
|
|
||||||
//lvgl_port_unlock();
|
//lvgl_port_unlock();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user