corrections meteo + timecb
This commit is contained in:
parent
6f338020ab
commit
c87cc69b9e
@ -48,7 +48,7 @@ lv_subject_t hauteurCuveEvolSubj;
|
|||||||
lv_subject_t forecastD1Subj;
|
lv_subject_t forecastD1Subj;
|
||||||
lv_subject_t forecastD2Subj;
|
lv_subject_t forecastD2Subj;
|
||||||
lv_subject_t forecastD3Subj;
|
lv_subject_t forecastD3Subj;
|
||||||
lv_subject_t *tmpSubj[3] = {&forecastD1Subj, &forecastD2Subj, &forecastD3Subj};
|
lv_subject_t *tmpDSubj[3] = {&forecastD1Subj, &forecastD2Subj, &forecastD3Subj};
|
||||||
lv_subject_t forecastH1Subj;
|
lv_subject_t forecastH1Subj;
|
||||||
lv_subject_t forecastH2Subj;
|
lv_subject_t forecastH2Subj;
|
||||||
lv_subject_t forecastH3Subj;
|
lv_subject_t forecastH3Subj;
|
||||||
@ -165,6 +165,7 @@ static void create_ui(void*)
|
|||||||
|
|
||||||
// Création des écrans / widgets
|
// Création des écrans / widgets
|
||||||
app_main_display(); // ton écran principal
|
app_main_display(); // ton écran principal
|
||||||
|
initHome(); // écran Home
|
||||||
drawHome(); // écran Home
|
drawHome(); // écran Home
|
||||||
// chart, labels, boutons, etc.
|
// chart, labels, boutons, etc.
|
||||||
// par exemple : lblEtatMachine, lblHauteurCuve, myChart, ser...
|
// par exemple : lblEtatMachine, lblHauteurCuve, myChart, ser...
|
||||||
@ -499,7 +500,7 @@ static void weatherdataJour_obs_cb(lv_observer_t *observer, lv_subject_t *subjec
|
|||||||
{
|
{
|
||||||
|
|
||||||
// Retrieve weatherdata
|
// Retrieve weatherdata
|
||||||
struct meteodailyforecast_data *data = subject->value.pointer;
|
const struct meteodailyforecast_data *data = subject->value.pointer;
|
||||||
|
|
||||||
bool isMinimal = observer->user_data;
|
bool isMinimal = observer->user_data;
|
||||||
ESP_LOGI(TAG, "CB meteo jour declenché. Meteo valide : %d - Mode minimal : %d", data->isValid, isMinimal);
|
ESP_LOGI(TAG, "CB meteo jour declenché. Meteo valide : %d - Mode minimal : %d", data->isValid, isMinimal);
|
||||||
@ -548,17 +549,31 @@ static void weatherdataJour_obs_cb(lv_observer_t *observer, lv_subject_t *subjec
|
|||||||
// On pointe sur un tableau de meteoforecast_data
|
// On pointe sur un tableau de meteoforecast_data
|
||||||
static void weatherdataHeure_obs_cb(lv_observer_t *observer, lv_subject_t *subject)
|
static void weatherdataHeure_obs_cb(lv_observer_t *observer, lv_subject_t *subject)
|
||||||
{
|
{
|
||||||
ESP_LOGV("MeteoFrance", "CB meteo horaire declenché");
|
|
||||||
// Retrieve weatherdata
|
// Retrieve weatherdata
|
||||||
struct meteoforecast_data *data = subject->value.pointer;
|
const struct meteoforecast_data *data = subject->value.pointer;
|
||||||
|
bool isMinimal = observer->user_data;
|
||||||
|
//ESP_LOGE(TAG, "CB meteo horaire declenché. Meteo valide : %d - Mode minimal : %d", data->isValid, isMinimal);
|
||||||
|
|
||||||
if(data->isValid){
|
if(data->isValid){
|
||||||
|
|
||||||
//printffd(data);
|
//printffd(data);
|
||||||
char buff[40] = {};
|
char buff[40] = {};
|
||||||
snprintf(buff,sizeof(buff),"%.1f", data->previsions.value);
|
snprintf(buff,sizeof(buff),"%.1f", data->previsions.value);
|
||||||
ESP_LOGV(TAG, "On a recu [%s]", buff);
|
//ESP_LOGE(TAG, "On a recu %s - [%s] - %s", data->type, buff, data->previsions.icon);
|
||||||
|
|
||||||
|
if(isMinimal){
|
||||||
lv_obj_t *parent = (lv_obj_t *)(lv_observer_get_target(observer));
|
lv_obj_t *parent = (lv_obj_t *)(lv_observer_get_target(observer));
|
||||||
|
//lv_obj_dump_tree(parent);
|
||||||
|
lv_obj_t *descfld = lv_obj_get_child(parent, 1);
|
||||||
|
showMeteoIcon(data->previsions.icon, parent, 0);
|
||||||
|
lv_label_set_text(descfld, data->previsions.desc);
|
||||||
|
lv_obj_t *valuefld = lv_obj_get_child(parent, 2);
|
||||||
|
lv_label_set_text_fmt(valuefld, "%.1f°C", data->previsions.value);
|
||||||
|
|
||||||
|
}else{
|
||||||
|
lv_obj_t *parent = (lv_obj_t *)(lv_observer_get_target(observer));
|
||||||
|
lv_obj_dump_tree(parent);
|
||||||
lv_obj_t *datefld = lv_obj_get_child(parent, 0);
|
lv_obj_t *datefld = lv_obj_get_child(parent, 0);
|
||||||
lv_obj_t *temp_desc_icon = lv_obj_get_child(parent, 1);
|
lv_obj_t *temp_desc_icon = lv_obj_get_child(parent, 1);
|
||||||
showMeteoIcon(data->previsions.icon, temp_desc_icon, 1);
|
showMeteoIcon(data->previsions.icon, temp_desc_icon, 1);
|
||||||
@ -569,6 +584,7 @@ static void weatherdataHeure_obs_cb(lv_observer_t *observer, lv_subject_t *subje
|
|||||||
lv_label_set_text(datefld, buffer);
|
lv_label_set_text(datefld, buffer);
|
||||||
lv_label_set_text(lv_obj_get_child(temp_desc_icon, 2), data->previsions.desc);
|
lv_label_set_text(lv_obj_get_child(temp_desc_icon, 2), data->previsions.desc);
|
||||||
lv_label_set_text_fmt(lv_obj_get_child(temp_desc_icon, 0), "%.1f°C", data->previsions.value);
|
lv_label_set_text_fmt(lv_obj_get_child(temp_desc_icon, 0), "%.1f°C", data->previsions.value);
|
||||||
|
}
|
||||||
//free(data);
|
//free(data);
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
@ -600,7 +616,6 @@ static lv_style_t tempStyle;
|
|||||||
static void weatherDay_fragment_create_obj(int dayNr, lv_obj_t *parent, bool minimal)
|
static void weatherDay_fragment_create_obj(int dayNr, lv_obj_t *parent, bool minimal)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
if (minimal)
|
if (minimal)
|
||||||
{
|
{
|
||||||
//lv_obj_set_flex_flow(sup, LV_FLEX_FLOW_COLUMN);
|
//lv_obj_set_flex_flow(sup, LV_FLEX_FLOW_COLUMN);
|
||||||
@ -609,6 +624,7 @@ static void weatherDay_fragment_create_obj(int dayNr, lv_obj_t *parent, bool min
|
|||||||
//lv_obj_set_style_border_width(sup, 1, 0);
|
//lv_obj_set_style_border_width(sup, 1, 0);
|
||||||
//lv_obj_set_style_border_color(sup, lv_color_white(), 0);
|
//lv_obj_set_style_border_color(sup, lv_color_white(), 0);
|
||||||
|
|
||||||
|
lv_obj_set_flex_flow(parent, LV_FLEX_FLOW_COLUMN);
|
||||||
lv_obj_t *container = lv_obj_create(parent);
|
lv_obj_t *container = lv_obj_create(parent);
|
||||||
lv_obj_set_align(container, LV_ALIGN_CENTER);
|
lv_obj_set_align(container, LV_ALIGN_CENTER);
|
||||||
lv_obj_set_name(container, "container_meteo");
|
lv_obj_set_name(container, "container_meteo");
|
||||||
@ -651,7 +667,7 @@ static void weatherDay_fragment_create_obj(int dayNr, lv_obj_t *parent, bool min
|
|||||||
|
|
||||||
// On positionne un observer sur le subjet correspondant au jour du widget
|
// On positionne un observer sur le subjet correspondant au jour du widget
|
||||||
bool isMinimal = true;
|
bool isMinimal = true;
|
||||||
lv_subject_add_observer_obj(tmpSubj[dayNr], weatherdataJour_obs_cb, parent, &isMinimal);
|
lv_subject_add_observer_obj(tmpDSubj[dayNr], weatherdataJour_obs_cb, parent, &isMinimal);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -717,7 +733,7 @@ static void weatherDay_fragment_create_obj(int dayNr, lv_obj_t *parent, bool min
|
|||||||
lv_obj_set_style_text_font(min, lv_theme_get_font_normal(max), 0);
|
lv_obj_set_style_text_font(min, lv_theme_get_font_normal(max), 0);
|
||||||
//lv_obj_set_style_text_color(min, lv_color_hex(0x3000FF), 0);
|
//lv_obj_set_style_text_color(min, lv_color_hex(0x3000FF), 0);
|
||||||
// On positionne un observer sur le subjet correspondant au jour du widget
|
// On positionne un observer sur le subjet correspondant au jour du widget
|
||||||
lv_subject_add_observer_obj(tmpSubj[dayNr], weatherdataJour_obs_cb, sup, NULL);
|
lv_subject_add_observer_obj(tmpDSubj[dayNr], weatherdataJour_obs_cb, sup, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
//return container;
|
//return container;
|
||||||
@ -726,9 +742,71 @@ static void weatherDay_fragment_create_obj(int dayNr, lv_obj_t *parent, bool min
|
|||||||
static lv_style_t tempStyle;
|
static lv_style_t tempStyle;
|
||||||
|
|
||||||
// Ce fragment affiche une prévision horaire (date,icone, temp moyenne)
|
// Ce fragment affiche une prévision horaire (date,icone, temp moyenne)
|
||||||
static lv_obj_t* weatherH_fragment_create_obj(int horaireNr, lv_obj_t *parent)
|
static lv_obj_t* weatherH_fragment_create_obj(int horaireNr, lv_obj_t *parent, bool minimal)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
lv_obj_t *container = lv_obj_create(parent);
|
||||||
|
if (minimal)
|
||||||
|
{
|
||||||
|
lv_obj_set_flex_flow(parent, LV_FLEX_FLOW_ROW);
|
||||||
|
//lv_obj_set_flex_flow(sup, LV_FLEX_FLOW_COLUMN);
|
||||||
|
lv_obj_set_size(parent, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||||
|
//lv_obj_set_flex_align(sup, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);
|
||||||
|
//lv_obj_set_style_border_width(sup, 1, 0);
|
||||||
|
//lv_obj_set_style_border_color(sup, lv_color_white(), 0);
|
||||||
|
|
||||||
|
lv_obj_set_align(container, LV_ALIGN_CENTER);
|
||||||
|
char name[17];
|
||||||
|
snprintf(name, 17,"%s%d","container_meteo", horaireNr);
|
||||||
|
lv_obj_set_name(container, name);
|
||||||
|
// lv_obj_remove_style_all(container);
|
||||||
|
// lv_obj_set_style_border_width(container, 1, 0);
|
||||||
|
// lv_obj_set_style_border_color(container, lv_color_make(0, 255, 0), 0);
|
||||||
|
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_size(container, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||||
|
lv_obj_add_flag(container, LV_OBJ_FLAG_EVENT_BUBBLE);
|
||||||
|
|
||||||
|
lv_obj_t *img1 = lv_image_create(container);
|
||||||
|
lv_obj_set_name(img1, "meteo_img");
|
||||||
|
lv_obj_add_flag(img1, LV_OBJ_FLAG_EVENT_BUBBLE);
|
||||||
|
|
||||||
|
lv_obj_remove_style_all(img1);
|
||||||
|
//lv_obj_set_style_bg_color(img1, lv_color_white(),0);
|
||||||
|
//lv_obj_set_style_border_width(img1,1,0);
|
||||||
|
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, -5);
|
||||||
|
lv_obj_set_size(img1, 40, 35);
|
||||||
|
lv_image_set_src(img1, LV_SYMBOL_DUMMY);
|
||||||
|
//lv_obj_set_style_image_recolor_opa(img1, 100, 0);
|
||||||
|
//lv_obj_set_style_image_recolor(img1, lv_color_black(), 0);
|
||||||
|
// lv_obj_set_style_border_width(img1,2,0);
|
||||||
|
// lv_obj_set_style_border_color(img1, lv_palette_main(LV_PALETTE_BLUE_GREY), 0);
|
||||||
|
lv_obj_align(img1, LV_ALIGN_CENTER, 0, 0);
|
||||||
|
|
||||||
|
lv_obj_t *desc = lv_label_create(container);
|
||||||
|
lv_obj_set_name(desc, "meteo_desc");
|
||||||
|
lv_label_set_long_mode(desc, LV_LABEL_LONG_MODE_WRAP);
|
||||||
|
lv_obj_set_size(desc, 85, LV_SIZE_CONTENT);
|
||||||
|
//lv_obj_set_style_text_color(desc, lv_color_white(), 0);
|
||||||
|
lv_label_set_text(desc, name);
|
||||||
|
lv_obj_set_style_text_align(desc, LV_TEXT_ALIGN_CENTER, 0);
|
||||||
|
|
||||||
|
lv_obj_t *temp = lv_label_create(container);
|
||||||
|
lv_label_set_text(temp, "--");
|
||||||
|
lv_obj_add_style(temp, &tempStyle, 0);
|
||||||
|
lv_obj_set_style_text_font(temp,lv_theme_get_font_normal(temp),0);
|
||||||
|
|
||||||
|
|
||||||
|
// On positionne un observer sur le subjet correspondant a l'horaire du widget
|
||||||
|
bool isMinimal = true;
|
||||||
|
//ESP_LOGE(TAG, "on positionne obs sur horaire %d", horaireNr);
|
||||||
|
lv_subject_add_observer_obj(tmpHSubj[horaireNr], weatherdataHeure_obs_cb, container, &isMinimal);
|
||||||
|
}else{
|
||||||
lv_obj_t *sup = lv_obj_create(parent);
|
lv_obj_t *sup = lv_obj_create(parent);
|
||||||
|
|
||||||
lv_obj_t *title = lv_label_create(sup);
|
lv_obj_t *title = lv_label_create(sup);
|
||||||
@ -771,8 +849,9 @@ static lv_obj_t* weatherH_fragment_create_obj(int horaireNr, lv_obj_t *parent)
|
|||||||
lv_obj_set_style_text_font(desc, lv_theme_get_font_normal(desc), 0);
|
lv_obj_set_style_text_font(desc, lv_theme_get_font_normal(desc), 0);
|
||||||
|
|
||||||
// On positionne un observer sur le subjet correspondant a l'horaire du widget
|
// On positionne un observer sur le subjet correspondant a l'horaire du widget
|
||||||
ESP_LOGV(TAG, "on positionne obs sur horaire %d", horaireNr);
|
//ESP_LOGV(TAG, "on positionne obs sur horaire %d", horaireNr);
|
||||||
lv_subject_add_observer_obj(tmpHSubj[horaireNr], weatherdataHeure_obs_cb, sup, NULL);
|
lv_subject_add_observer_obj(tmpHSubj[horaireNr], weatherdataHeure_obs_cb, sup, NULL);
|
||||||
|
}
|
||||||
return container;
|
return container;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1058,9 +1137,9 @@ void draw_tabHome(lv_obj_t* parent){
|
|||||||
lv_label_set_text(label, LV_SYMBOL_DOWN);
|
lv_label_set_text(label, LV_SYMBOL_DOWN);
|
||||||
lv_obj_center(label);
|
lv_obj_center(label);
|
||||||
|
|
||||||
weatherH_fragment_create_obj(0, cont_col3);
|
weatherH_fragment_create_obj(0, cont_col3,false);
|
||||||
weatherH_fragment_create_obj(1, cont_col3);
|
weatherH_fragment_create_obj(1, cont_col3,false);
|
||||||
weatherH_fragment_create_obj(2, cont_col3);
|
weatherH_fragment_create_obj(2, cont_col3,false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw_tabCuve(lv_obj_t* parent)
|
void draw_tabCuve(lv_obj_t* parent)
|
||||||
@ -1190,13 +1269,21 @@ 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");
|
||||||
|
|
||||||
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);
|
||||||
if (!ctx) return;
|
if (!ctx){
|
||||||
|
ESP_LOGE(TAG,"################### Contexte non positionné");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
struct tm *t = (struct tm *)lv_subject_get_pointer(subject);
|
struct tm *t = (struct tm *)lv_subject_get_pointer(subject);
|
||||||
if (!t) return;
|
if (!t){
|
||||||
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,"################### Pas de struct tm");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
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;
|
||||||
@ -1208,20 +1295,22 @@ static void time_observer_cb(lv_observer_t *observer, lv_subject_t *subject)
|
|||||||
u8_to_2digits(buf, t->tm_mday);
|
u8_to_2digits(buf, t->tm_mday);
|
||||||
buf[2] = '/';
|
buf[2] = '/';
|
||||||
buf[3] = '\0';
|
buf[3] = '\0';
|
||||||
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) {
|
||||||
ctx->last_month = t->tm_mon + 1;
|
ctx->last_month = t->tm_mon + 1;
|
||||||
u8_to_2digits(buf, ctx->last_month);
|
u8_to_2digits(buf, ctx->last_month);
|
||||||
ESP_LOGE(TAG,"Mois %s",buf);
|
//ESP_LOGE(TAG,"Mois %s",buf);
|
||||||
lv_span_set_text(ctx->date_month, buf);
|
lv_span_set_text(ctx->date_month, buf);
|
||||||
refresh_date = true;
|
refresh_date = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (refresh_date) {
|
if (true || refresh_date) {
|
||||||
lv_spangroup_refresh(ctx->date_group);
|
lv_spangroup_refresh(ctx->date_group);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1229,7 +1318,7 @@ static void time_observer_cb(lv_observer_t *observer, lv_subject_t *subject)
|
|||||||
if (t->tm_hour != ctx->last_hour) {
|
if (t->tm_hour != ctx->last_hour) {
|
||||||
ctx->last_hour = t->tm_hour;
|
ctx->last_hour = t->tm_hour;
|
||||||
u8_to_2digits(buf, t->tm_hour);
|
u8_to_2digits(buf, t->tm_hour);
|
||||||
ESP_LOGE(TAG,"Heure %s",buf);
|
//ESP_LOGE(TAG,"Heure %s",buf);
|
||||||
lv_span_set_text(ctx->time_hour, buf);
|
lv_span_set_text(ctx->time_hour, buf);
|
||||||
refresh_time = true;
|
refresh_time = true;
|
||||||
}
|
}
|
||||||
@ -1240,7 +1329,7 @@ static void time_observer_cb(lv_observer_t *observer, lv_subject_t *subject)
|
|||||||
buf[1] = '0' + (t->tm_min / 10);
|
buf[1] = '0' + (t->tm_min / 10);
|
||||||
buf[2] = '0' + (t->tm_min % 10);
|
buf[2] = '0' + (t->tm_min % 10);
|
||||||
buf[3] = '\0';
|
buf[3] = '\0';
|
||||||
ESP_LOGE(TAG,"Minutes %s",buf);
|
//ESP_LOGE(TAG,"Minutes %s",buf);
|
||||||
lv_span_set_text(ctx->time_min, buf);
|
lv_span_set_text(ctx->time_min, buf);
|
||||||
refresh_time = true;
|
refresh_time = true;
|
||||||
}
|
}
|
||||||
@ -1446,7 +1535,9 @@ void messageCardContent(lv_obj_t *cont_messages)
|
|||||||
{
|
{
|
||||||
// lv_obj_t *txt = lv_label_create(container);
|
// lv_obj_t *txt = lv_label_create(container);
|
||||||
// lv_label_set_text(txt, "Meteo");
|
// lv_label_set_text(txt, "Meteo");
|
||||||
weatherDay_fragment_create_obj(0, container, true);
|
weatherH_fragment_create_obj(0, container,true);
|
||||||
|
weatherH_fragment_create_obj(1, container,true);
|
||||||
|
weatherH_fragment_create_obj(2, container,true);
|
||||||
// lv_subject_add_observer_obj(&forecastD1Subj, weatherdata_obs_cb, container, NULL);
|
// lv_subject_add_observer_obj(&forecastD1Subj, weatherdata_obs_cb, container, NULL);
|
||||||
}
|
}
|
||||||
void minuteurCardContent(lv_obj_t * container)
|
void minuteurCardContent(lv_obj_t * container)
|
||||||
@ -1625,21 +1716,29 @@ void messageCardContent(lv_obj_t *cont_messages)
|
|||||||
lv_obj_set_user_data(dateTimeObj, ctx);
|
lv_obj_set_user_data(dateTimeObj, ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void initHome(){
|
||||||
void drawHome()
|
|
||||||
{
|
|
||||||
|
|
||||||
/*Initialize the styles*/
|
/*Initialize the styles*/
|
||||||
lv_style_init(&style_btn);
|
lv_style_init(&style_btn);
|
||||||
// lv_style_set_bg_color(&style_btn, lv_palette_main(LV_PALETTE_GREEN));
|
// lv_style_set_bg_color(&style_btn, lv_palette_main(LV_PALETTE_GREEN));
|
||||||
// lv_style_set_border_color(&style_btn, lv_palette_darken(LV_PALETTE_GREEN, 3));
|
// lv_style_set_border_color(&style_btn, lv_palette_darken(LV_PALETTE_GREEN, 3));
|
||||||
// lv_style_set_border_width(&style_btn, 3);
|
// lv_style_set_border_width(&style_btn, 3);
|
||||||
|
|
||||||
|
lv_style_init(&objstyle);
|
||||||
|
lv_style_set_bg_color(&objstyle, accent);
|
||||||
|
lv_style_set_outline_color(&objstyle, accent);
|
||||||
|
|
||||||
|
|
||||||
lv_subject_init_string(&tempExtSubj, tempExtStr, NULL, 6, "--");
|
lv_subject_init_string(&tempExtSubj, tempExtStr, NULL, 6, "--");
|
||||||
lv_subject_init_string(&tempIntSubj, tempIntStr, NULL, 6, "--");
|
lv_subject_init_string(&tempIntSubj, tempIntStr, NULL, 6, "--");
|
||||||
lv_subject_init_string(&hauteurCuveSubj, hauteurCuveStr, NULL, 9, "--");
|
lv_subject_init_string(&hauteurCuveSubj, hauteurCuveStr, NULL, 9, "--");
|
||||||
lv_subject_init_string(&hauteurCuveEvolSubj, hauteurCuveEvolStr, NULL, 9, "--");
|
lv_subject_init_string(&hauteurCuveEvolSubj, hauteurCuveEvolStr, NULL, 9, "--");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void drawHome()
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
// keys.clear();
|
// keys.clear();
|
||||||
lv_obj_clean(lv_scr_act());
|
lv_obj_clean(lv_scr_act());
|
||||||
|
|
||||||
@ -1654,9 +1753,6 @@ void messageCardContent(lv_obj_t *cont_messages)
|
|||||||
lv_obj_set_style_pad_top(bg_cont, 5, 0);
|
lv_obj_set_style_pad_top(bg_cont, 5, 0);
|
||||||
lv_obj_set_style_bg_color(bg_cont, bgColor, 0);
|
lv_obj_set_style_bg_color(bg_cont, bgColor, 0);
|
||||||
|
|
||||||
lv_style_init(&objstyle);
|
|
||||||
lv_style_set_bg_color(&objstyle, accent);
|
|
||||||
lv_style_set_outline_color(&objstyle, accent);
|
|
||||||
|
|
||||||
/* info area */
|
/* info area */
|
||||||
|
|
||||||
@ -1706,9 +1802,10 @@ void messageCardContent(lv_obj_t *cont_messages)
|
|||||||
lv_style_set_line_color(lv_span_get_style(minute), accent);
|
lv_style_set_line_color(lv_span_get_style(minute), accent);
|
||||||
lv_style_set_text_font(lv_span_get_style(minute), &super_malibu_80);
|
lv_style_set_text_font(lv_span_get_style(minute), &super_malibu_80);
|
||||||
//lv_subject_add_observer_obj(&c->th, theme_observer_accent_span_cb, time, minute);
|
//lv_subject_add_observer_obj(&c->th, theme_observer_accent_span_cb, time, minute);
|
||||||
|
|
||||||
lv_subject_add_observer_obj(&timeSubj, time_observer_cb, date_and_time, NULL);
|
|
||||||
datetime_ctx_init(date_and_time);
|
datetime_ctx_init(date_and_time);
|
||||||
|
lv_subject_add_observer_obj(&timeSubj, time_observer_cb, date_and_time, NULL);
|
||||||
|
|
||||||
|
|
||||||
lv_obj_t * subContent = lv_obj_create(info_area);
|
lv_obj_t * subContent = lv_obj_create(info_area);
|
||||||
lv_obj_set_flex_flow(subContent, LV_FLEX_FLOW_COLUMN);
|
lv_obj_set_flex_flow(subContent, LV_FLEX_FLOW_COLUMN);
|
||||||
lv_obj_set_size(subContent, LV_PCT(70), LV_PCT(100));
|
lv_obj_set_size(subContent, LV_PCT(70), LV_PCT(100));
|
||||||
|
|||||||
@ -120,12 +120,15 @@ void traiteEvt(void *arg)
|
|||||||
// On ne veut liberer la memoire que lorsque l'evenement aura été traité!
|
// On ne veut liberer la memoire que lorsque l'evenement aura été traité!
|
||||||
evt->bNeedToFreeData=false;
|
evt->bNeedToFreeData=false;
|
||||||
meteo_event_payload_t *datas = (meteo_event_payload_t *) evt->pvData;
|
meteo_event_payload_t *datas = (meteo_event_payload_t *) evt->pvData;
|
||||||
ESP_LOGE(TAG,"Est valide : %d - %s", datas->daily[0].isValid, datas->daily[0].previsions.desc);
|
for (size_t i = 0; i < 3; i++)
|
||||||
ESP_LOGE(TAG,"Est valide : %d - %s", datas->daily[1].isValid, datas->daily[1].previsions.desc);
|
{
|
||||||
ESP_LOGE(TAG,"Est valide : %d - %s", datas->daily[2].isValid, datas->daily[2].previsions.desc);
|
ESP_LOGE(TAG,"Type: %s - Valide : %d - %s", datas->daily[i].type, datas->daily[i].isValid, datas->daily[i].previsions.desc);
|
||||||
ESP_LOGE(TAG,"Est valide : %d - %s", datas->forecast[0].isValid, datas->forecast[0].previsions.desc);
|
}
|
||||||
ESP_LOGE(TAG,"Est valide : %d - %s", datas->forecast[1].isValid, datas->forecast[1].previsions.desc);
|
for (size_t i = 0; i < 3; i++)
|
||||||
ESP_LOGE(TAG,"Est valide : %d - %s", datas->forecast[2].isValid, datas->forecast[2].previsions.desc);
|
{
|
||||||
|
ESP_LOGE(TAG,"Type: %s - Valide : %d - %s - %s - %f", datas->forecast[i].type, datas->forecast[i].isValid, datas->forecast[i].previsions.desc, datas->forecast[i].previsions.icon, datas->forecast[i].previsions.value);
|
||||||
|
}
|
||||||
|
|
||||||
draw_meteo(datas);
|
draw_meteo(datas);
|
||||||
//lv_subject_set_int(&meteoStatus, 0);
|
//lv_subject_set_int(&meteoStatus, 0);
|
||||||
//display_unlock("weather_data_retreived");
|
//display_unlock("weather_data_retreived");
|
||||||
|
|||||||
@ -19,6 +19,7 @@ void showMeteoIcon(const char *icon, lv_obj_t *desc_icon, int childNr);
|
|||||||
|
|
||||||
void draw_tabVolets();
|
void draw_tabVolets();
|
||||||
void meteoCb(lv_obj_t *base_obj);
|
void meteoCb(lv_obj_t *base_obj);
|
||||||
|
void initHome();
|
||||||
void drawHome();
|
void drawHome();
|
||||||
|
|
||||||
void draw_time(struct tm *dateHeure);
|
void draw_time(struct tm *dateHeure);
|
||||||
|
|||||||
@ -31,6 +31,7 @@
|
|||||||
|
|
||||||
typedef struct meteodailyforecast_data // Meteo "par jour"
|
typedef struct meteodailyforecast_data // Meteo "par jour"
|
||||||
{
|
{
|
||||||
|
char *type;
|
||||||
time_t datetime;
|
time_t datetime;
|
||||||
bool isValid;
|
bool isValid;
|
||||||
struct dailyforecast_prev previsions;
|
struct dailyforecast_prev previsions;
|
||||||
@ -38,6 +39,7 @@
|
|||||||
|
|
||||||
typedef struct meteoforecast_data // Meteo "par heure"
|
typedef struct meteoforecast_data // Meteo "par heure"
|
||||||
{
|
{
|
||||||
|
char *type;
|
||||||
time_t datetime;
|
time_t datetime;
|
||||||
bool isValid;
|
bool isValid;
|
||||||
struct forecast_prev previsions;
|
struct forecast_prev previsions;
|
||||||
|
|||||||
@ -248,6 +248,7 @@ void JSON_Parse(const cJSON *const root)
|
|||||||
cJSON *dt = cJSON_GetObjectItem(current_element, "dt");
|
cJSON *dt = cJSON_GetObjectItem(current_element, "dt");
|
||||||
if (cJSON_IsNumber(dt))
|
if (cJSON_IsNumber(dt))
|
||||||
{
|
{
|
||||||
|
datasT.type="Daily";
|
||||||
datasT.datetime = dt->valueint;
|
datasT.datetime = dt->valueint;
|
||||||
cJSON *temps = cJSON_GetObjectItem(current_element, "T");
|
cJSON *temps = cJSON_GetObjectItem(current_element, "T");
|
||||||
datasT.previsions.min = cJSON_GetObjectItem(temps, "min")->valuedouble;
|
datasT.previsions.min = cJSON_GetObjectItem(temps, "min")->valuedouble;
|
||||||
@ -279,6 +280,7 @@ void JSON_Parse(const cJSON *const root)
|
|||||||
cJSON *dt = cJSON_GetObjectItem(current_element, "dt");
|
cJSON *dt = cJSON_GetObjectItem(current_element, "dt");
|
||||||
if (cJSON_IsNumber(dt))
|
if (cJSON_IsNumber(dt))
|
||||||
{
|
{
|
||||||
|
datasT.type="Hourly";
|
||||||
datasT.datetime = dt->valueint;
|
datasT.datetime = dt->valueint;
|
||||||
struct tm timeinfo = {0};
|
struct tm timeinfo = {0};
|
||||||
localtime_r(&(datasT.datetime), &timeinfo);
|
localtime_r(&(datasT.datetime), &timeinfo);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user