zwei arcs werden angezeigt

This commit is contained in:
rxf
2024-07-06 08:18:00 +02:00
parent 346abc2415
commit 87eb2a30d4
3 changed files with 15 additions and 9 deletions

View File

@@ -117,16 +117,19 @@ void setValuetoArc(ARC arc, float value) {
sprintf(s,"name: %s, value: %.1f, green: %d, yellow: %d", arc.name, arc.value, arc.green, arc.yellow);
Serial.println(s);
static lv_style_t style_arc;
lv_style_init(&style_arc);
static lv_style_t st_arc;
lv_style_init(&st_arc);
if (arc.value < arc.green) {
lv_style_set_arc_color(&style_arc, lv_palette_main(LV_PALETTE_GREEN));
lv_style_set_arc_color(&st_arc, lv_palette_main(LV_PALETTE_GREEN));
Serial.println("green");
} else if (arc.value < arc.yellow) {
lv_style_set_arc_color(&style_arc, lv_palette_main(LV_PALETTE_YELLOW));
lv_style_set_arc_color(&st_arc, lv_palette_main(LV_PALETTE_YELLOW));
Serial.println("yellow");
} else {
lv_style_set_arc_color(&style_arc, lv_palette_main(LV_PALETTE_RED));
lv_style_set_arc_color(&st_arc, lv_palette_main(LV_PALETTE_RED));
Serial.println("red");
}
lv_obj_add_style(arc.arc, &style_arc, LV_PART_INDICATOR);
lv_obj_add_style(arc.arc, &st_arc, LV_PART_INDICATOR);
}

View File

@@ -26,6 +26,9 @@ typedef struct {
int highvalue;
int green;
int yellow;
lv_style_t style_arc;
lv_style_t style_label;
lv_style_t lv_style_value_label;
} ARC;

View File

@@ -47,7 +47,7 @@ void setup() {
Serial.println("Main GUI created");
setValuetoArc(arcTemp, 25.3);
setValuetoArc(arcHum, 45.0);
// setValuetoArc(arcHum, 45.0);
delay(1000);
// Start WiFi
connectToWifi();