meteo colors

This commit is contained in:
Marc Pasteur 2026-02-23 20:43:39 +01:00
parent d9ac74a595
commit 6f338020ab

View File

@ -342,10 +342,9 @@ void app_main_display()
struct meteodailyforecast_data d; struct meteodailyforecast_data d;
struct dailyforecast_prev p; struct dailyforecast_prev p={.desc="", .max=31, .min=12};
lv_strcpy(p.desc, "");
d.previsions = p; d.previsions = p;
d.isValid=false; d.isValid=true;
ESP_LOGI(TAG, "Init forecastD1Subj"); ESP_LOGI(TAG, "Init forecastD1Subj");
lv_subject_init_pointer(&forecastD1Subj, &d); lv_subject_init_pointer(&forecastD1Subj, &d);
@ -502,13 +501,8 @@ static void weatherdataJour_obs_cb(lv_observer_t *observer, lv_subject_t *subjec
// Retrieve weatherdata // Retrieve weatherdata
struct meteodailyforecast_data *data = subject->value.pointer; struct meteodailyforecast_data *data = subject->value.pointer;
ESP_LOGE(TAG,"Est valide : %d - %s", data->isValid, data->previsions.desc);
ESP_LOGE(TAG,"Est valide : %d - %s", data->isValid, data->previsions.desc);
ESP_LOGE(TAG,"Est valide : %d - %s", data->isValid, data->previsions.desc);
bool isMinimal = observer->user_data; bool isMinimal = observer->user_data;
ESP_LOGI(TAG, "CB meteo jour declenché. Meteo valide : %b - Mode minimal : %d", data->isValid, isMinimal); ESP_LOGI(TAG, "CB meteo jour declenché. Meteo valide : %d - Mode minimal : %d", data->isValid, isMinimal);
if(!data->isValid){ if(!data->isValid){
ESP_LOGI(TAG,"Données meteo non valides"); ESP_LOGI(TAG,"Données meteo non valides");
return; return;
@ -518,9 +512,9 @@ static void weatherdataJour_obs_cb(lv_observer_t *observer, lv_subject_t *subjec
{ {
char buff[40] = {}; char buff[40] = {};
snprintf(buff,sizeof(buff),"%s %.1f %.1f", data->previsions.desc, data->previsions.min, data->previsions.max); snprintf(buff,sizeof(buff),"%s %.1f %.1f", data->previsions.desc, data->previsions.min, data->previsions.max);
ESP_LOGI(TAG, "CB meteo jour declenché. Meteo valide : %s", buff); ESP_LOGI(TAG, "meteo jour declenché. Meteo valide : %s", buff);
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->parent); //lv_obj_dump_tree(parent->parent);
ESP_LOGI(TAG, "On accede au parent %p %s", (void*)parent, lv_obj_get_name(parent)); ESP_LOGI(TAG, "On accede au parent %p %s", (void*)parent, lv_obj_get_name(parent));
if(parent!=NULL){ if(parent!=NULL){
if(isMinimal){ if(isMinimal){
@ -715,13 +709,13 @@ static void weatherDay_fragment_create_obj(int dayNr, lv_obj_t *parent, bool min
lv_label_set_text(max, "--"); lv_label_set_text(max, "--");
lv_obj_add_style(max, &tempStyle, 0); lv_obj_add_style(max, &tempStyle, 0);
lv_obj_set_style_text_font(max, lv_theme_get_font_normal(max), 0); lv_obj_set_style_text_font(max, lv_theme_get_font_normal(max), 0);
lv_obj_set_style_text_color(max, lv_color_hex(0xFF0000), 0); //lv_obj_set_style_text_color(max, lv_color_hex(0xFF0000), 0);
lv_obj_t *min = lv_label_create(container2); lv_obj_t *min = lv_label_create(container2);
lv_label_set_text(min, "--"); lv_label_set_text(min, "--");
lv_obj_add_style(min, &tempStyle, 0); lv_obj_add_style(min, &tempStyle, 0);
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(tmpSubj[dayNr], weatherdataJour_obs_cb, sup, NULL);
} }