From 63fc95509bdb9fddc8bb469c04c8ebaf3d04a73d Mon Sep 17 00:00:00 2001 From: rxf Date: Wed, 10 Jul 2024 16:06:48 +0200 Subject: [PATCH] Erste (fast) komplette Version --- src/grafik.cpp | 24 ++++++++++++++++++++++-- src/main.cpp | 8 +++++--- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/src/grafik.cpp b/src/grafik.cpp index 09221cf..48a506e 100644 --- a/src/grafik.cpp +++ b/src/grafik.cpp @@ -108,6 +108,26 @@ void lv_create_main_gui(void) { lv_obj_align(refresh_label, LV_ALIGN_CENTER, 0, -45); */ + // Text als Überschrift an die Axen + lv_obj_t * feuchte_label = lv_label_create(lv_screen_active()); + lv_label_set_text(feuchte_label, "Feuchte"); + lv_obj_align(feuchte_label, LV_ALIGN_RIGHT_MID, -3, 20); + + // Set font type and font size. More information: https://docs.lvgl.io/master/overview/font.html + static lv_style_t style_feuchte_label; + lv_style_init(&style_feuchte_label); + lv_style_set_text_font(&style_feuchte_label, &lv_font_montserrat_10); + lv_obj_add_style(feuchte_label, &style_feuchte_label, 0); + + lv_obj_t * temp_label = lv_label_create(lv_screen_active()); + lv_label_set_text(temp_label, "Temperatur"); + lv_obj_align(temp_label, LV_ALIGN_LEFT_MID, 3, 20); + + // Set font type and font size. More information: https://docs.lvgl.io/master/overview/font.html + static lv_style_t style_temp_label; + lv_style_init(&style_temp_label); + lv_style_set_text_font(&style_temp_label, &lv_font_montserrat_10); + lv_obj_add_style(temp_label, &style_temp_label, 0); /*Create an Arc*/ lv_obj_t * aTemp = lv_arc_create(lv_screen_active()); @@ -195,7 +215,7 @@ void setValuetoArc(ARC arc, float value) { // lv_obj_t * chart; chart = lv_chart_create(container_row); lv_obj_set_size(chart, CHART_WIDTH, CHART_HEIGHT); - lv_obj_align(chart, LV_ALIGN_BOTTOM_MID, 0, -5); + // lv_obj_align(chart, LV_ALIGN_BOTTOM_MID, 0, 0); lv_chart_set_type(chart, LV_CHART_TYPE_LINE); /*Show lines and points too*/ lv_chart_set_point_count(chart, MAXREADINGS); lv_chart_set_div_line_count(chart, 5, 5); @@ -218,7 +238,7 @@ void setValuetoArc(ARC arc, float value) { // rechte Axe lv_obj_t * scale = lv_scale_create(container_row); - lv_obj_set_size(scale, 40, 75); + lv_obj_set_size(scale, 30, 75); lv_scale_set_mode(scale, LV_SCALE_MODE_VERTICAL_RIGHT); static const char * scale_labels[5] = {"40%", "55%", "70%", "85%", "100%"}; diff --git a/src/main.cpp b/src/main.cpp index 7036baa..7855f74 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -28,6 +28,8 @@ #include "grafik.h" #include "main.h" +#include + #define BMWREADTIME 10000 #define NTPREADTIME 1000 @@ -41,10 +43,10 @@ int currentSecond = -1; void showDateTime(struct tm tinfo); void setup() { -// String LVGL_Arduino = String("LVGL Library Version: ") + lv_version_major() + "." + lv_version_minor() + "." + lv_version_patch(); - delay (1000); - String LVGL_Arduino = String("LVGL Library Version: ") + "9.0.0"; + setlocale(LC_ALL, "de_DE"); + String LVGL_Arduino = String("LVGL Library Version: ") + lv_version_major() + "." + lv_version_minor() + "." + lv_version_patch(); Serial.begin(115200); + delay (1000); Serial.println(LVGL_Arduino); initBME280();