zwei arcs werden angezeigt
This commit is contained in:
@@ -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_obj_add_style(arc.arc, &style_arc, LV_PART_INDICATOR);
|
||||
lv_style_set_arc_color(&st_arc, lv_palette_main(LV_PALETTE_RED));
|
||||
Serial.println("red");
|
||||
}
|
||||
lv_obj_add_style(arc.arc, &st_arc, LV_PART_INDICATOR);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -46,8 +46,8 @@ void setup() {
|
||||
lv_create_main_gui();
|
||||
Serial.println("Main GUI created");
|
||||
|
||||
setValuetoArc(arcTemp, 25.3);
|
||||
setValuetoArc(arcHum, 45.0);
|
||||
setValuetoArc(arcTemp, 25.3);
|
||||
// setValuetoArc(arcHum, 45.0);
|
||||
delay(1000);
|
||||
// Start WiFi
|
||||
connectToWifi();
|
||||
|
||||
Reference in New Issue
Block a user