|
|
|
@@ -83,7 +83,7 @@ void lv_create_main_gui(void) {
|
|
|
|
// Create a text label aligned on top: https://docs.lvgl.io/master/widgets/label.html
|
|
|
|
// Create a text label aligned on top: https://docs.lvgl.io/master/widgets/label.html
|
|
|
|
time_label = lv_label_create(lv_screen_active());
|
|
|
|
time_label = lv_label_create(lv_screen_active());
|
|
|
|
lv_label_set_text(time_label, "17:30");
|
|
|
|
lv_label_set_text(time_label, "17:30");
|
|
|
|
lv_obj_align(time_label, LV_ALIGN_TOP_MID, 0, 10);
|
|
|
|
lv_obj_align(time_label, LV_ALIGN_TOP_MID, 0, 8);
|
|
|
|
|
|
|
|
|
|
|
|
// Set font type and font size. More information: https://docs.lvgl.io/master/overview/font.html
|
|
|
|
// Set font type and font size. More information: https://docs.lvgl.io/master/overview/font.html
|
|
|
|
static lv_style_t style_time_label;
|
|
|
|
static lv_style_t style_time_label;
|
|
|
|
@@ -94,7 +94,7 @@ void lv_create_main_gui(void) {
|
|
|
|
// Create a text label aligned on top: https://docs.lvgl.io/master/widgets/label.html
|
|
|
|
// Create a text label aligned on top: https://docs.lvgl.io/master/widgets/label.html
|
|
|
|
date_label = lv_label_create(lv_screen_active());
|
|
|
|
date_label = lv_label_create(lv_screen_active());
|
|
|
|
lv_label_set_text(date_label, "Dienstag, 12. Dezember 2024");
|
|
|
|
lv_label_set_text(date_label, "Dienstag, 12. Dezember 2024");
|
|
|
|
lv_obj_align(date_label, LV_ALIGN_TOP_MID, 0, 40);
|
|
|
|
lv_obj_align(date_label, LV_ALIGN_TOP_MID, 0, 38);
|
|
|
|
|
|
|
|
|
|
|
|
// Set font type and font size. More information: https://docs.lvgl.io/master/overview/font.html
|
|
|
|
// Set font type and font size. More information: https://docs.lvgl.io/master/overview/font.html
|
|
|
|
static lv_style_t style_date_label;
|
|
|
|
static lv_style_t style_date_label;
|
|
|
|
@@ -186,52 +186,49 @@ void setValuetoArc(ARC arc, float value) {
|
|
|
|
lv_obj_set_style_border_side(container_row, LV_BORDER_SIDE_BOTTOM, LV_PART_MAIN);
|
|
|
|
lv_obj_set_style_border_side(container_row, LV_BORDER_SIDE_BOTTOM, LV_PART_MAIN);
|
|
|
|
|
|
|
|
|
|
|
|
// linke Axe
|
|
|
|
// linke Axe
|
|
|
|
lv_obj_t * sclaeT = lv_scale_create(container_row);
|
|
|
|
lv_obj_t * scaleT = lv_scale_create(container_row);
|
|
|
|
lv_obj_set_size(sclaeT, 30, 75);
|
|
|
|
lv_obj_set_size(scaleT, 30, 75);
|
|
|
|
lv_scale_set_mode(sclaeT, LV_SCALE_MODE_VERTICAL_LEFT);
|
|
|
|
lv_scale_set_mode(scaleT, LV_SCALE_MODE_VERTICAL_LEFT);
|
|
|
|
|
|
|
|
|
|
|
|
static const char * sclaeT_labels[5] = {"10°C", "15°C", "20°C", "25°C", "30°C"};
|
|
|
|
static const char * scaleT_labels[5] = {"10°C", "15°C", "20°C", "25°C", "30°C"};
|
|
|
|
lv_scale_set_text_src(sclaeT, sclaeT_labels);
|
|
|
|
lv_scale_set_text_src(scaleT, scaleT_labels);
|
|
|
|
lv_scale_set_label_show(sclaeT, true);
|
|
|
|
lv_scale_set_label_show(scaleT, true);
|
|
|
|
|
|
|
|
|
|
|
|
lv_scale_set_total_tick_count(sclaeT, 21);
|
|
|
|
lv_scale_set_total_tick_count(scaleT, 21);
|
|
|
|
lv_scale_set_major_tick_every(sclaeT, 5);
|
|
|
|
lv_scale_set_major_tick_every(scaleT, 5);
|
|
|
|
|
|
|
|
|
|
|
|
lv_obj_set_style_length(sclaeT, 0, LV_PART_ITEMS);
|
|
|
|
lv_obj_set_style_length(scaleT, 0, LV_PART_ITEMS);
|
|
|
|
lv_obj_set_style_length(sclaeT, 0, LV_PART_INDICATOR);
|
|
|
|
lv_obj_set_style_length(scaleT, 0, LV_PART_INDICATOR);
|
|
|
|
lv_obj_set_style_line_width(sclaeT, 0, LV_PART_ITEMS);
|
|
|
|
lv_obj_set_style_line_width(scaleT, 0, LV_PART_ITEMS);
|
|
|
|
lv_obj_set_style_line_width(sclaeT, 1, LV_PART_INDICATOR);
|
|
|
|
lv_obj_set_style_line_width(scaleT, 0, LV_PART_INDICATOR);
|
|
|
|
lv_obj_set_style_line_width(sclaeT, 0, LV_PART_MAIN);
|
|
|
|
lv_obj_set_style_line_width(scaleT, 0, LV_PART_MAIN);
|
|
|
|
lv_scale_set_range(sclaeT, 10, 30);
|
|
|
|
lv_scale_set_range(scaleT, 10, 30);
|
|
|
|
|
|
|
|
|
|
|
|
static lv_style_t style_sclaeT;
|
|
|
|
static lv_style_t style_scaleT;
|
|
|
|
lv_style_init(&style_sclaeT);
|
|
|
|
lv_style_init(&style_scaleT);
|
|
|
|
lv_style_set_text_font(&style_sclaeT, &lv_font_montserrat_10);
|
|
|
|
lv_style_set_text_font(&style_scaleT, &lv_font_montserrat_10);
|
|
|
|
lv_style_set_text_color(&style_sclaeT, lv_color_hex(0x0000FF));
|
|
|
|
lv_style_set_text_color(&style_scaleT, lv_color_hex(0x0000FF));
|
|
|
|
lv_obj_add_style(sclaeT, &style_sclaeT, 0);
|
|
|
|
lv_obj_add_style(scaleT, &style_scaleT, 0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Create a chart
|
|
|
|
// Create a chart
|
|
|
|
// lv_obj_t * chart;
|
|
|
|
|
|
|
|
chart = lv_chart_create(container_row);
|
|
|
|
chart = lv_chart_create(container_row);
|
|
|
|
lv_obj_set_size(chart, CHART_WIDTH, CHART_HEIGHT);
|
|
|
|
lv_obj_set_size(chart, CHART_WIDTH, CHART_HEIGHT);
|
|
|
|
// 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_type(chart, LV_CHART_TYPE_LINE); /*Show lines and points too*/
|
|
|
|
lv_chart_set_point_count(chart, MAXREADINGS);
|
|
|
|
lv_chart_set_point_count(chart, MAXREADINGS);
|
|
|
|
lv_chart_set_div_line_count(chart, 5, 5);
|
|
|
|
lv_chart_set_div_line_count(chart, 5, 5);
|
|
|
|
lv_chart_set_range(chart, LV_CHART_AXIS_SECONDARY_Y, 40, 100);
|
|
|
|
lv_chart_set_range(chart, LV_CHART_AXIS_SECONDARY_Y, 40, 100);
|
|
|
|
lv_chart_set_range(chart, LV_CHART_AXIS_PRIMARY_Y, 10, 30);
|
|
|
|
lv_chart_set_range(chart, LV_CHART_AXIS_PRIMARY_Y, 10, 30);
|
|
|
|
lv_obj_set_style_size(chart, 0, 0, LV_PART_INDICATOR); // No points on line
|
|
|
|
lv_obj_set_style_size(chart, 0, 0, LV_PART_INDICATOR); // No points on line
|
|
|
|
|
|
|
|
lv_obj_set_scrollbar_mode(chart, LV_SCROLLBAR_MODE_OFF);
|
|
|
|
lv_obj_set_style_border_width(chart, 0, LV_PART_MAIN); // No border
|
|
|
|
lv_obj_set_style_border_width(chart, 0, LV_PART_MAIN); // No border
|
|
|
|
// lv_obj_set_style_pad_right(chart, -10, LV_PART_MAIN); // No border
|
|
|
|
// lv_obj_set_style_pad_right(chart, -10, LV_PART_MAIN); // No border
|
|
|
|
|
|
|
|
|
|
|
|
/*Add data series*/
|
|
|
|
/*Add data series*/
|
|
|
|
lv_chart_series_t * ser1 = lv_chart_add_series(chart, lv_palette_main(LV_PALETTE_BLUE), LV_CHART_AXIS_PRIMARY_Y);
|
|
|
|
lv_chart_series_t * ser1 = lv_chart_add_series(chart, lv_palette_main(LV_PALETTE_BLUE), LV_CHART_AXIS_PRIMARY_Y);
|
|
|
|
lv_chart_set_point_count(chart, MAXREADINGS);
|
|
|
|
|
|
|
|
lv_chart_set_ext_y_array(chart, ser1, (lv_coord_t *)bmewert);
|
|
|
|
lv_chart_set_ext_y_array(chart, ser1, (lv_coord_t *)bmewert);
|
|
|
|
|
|
|
|
|
|
|
|
lv_chart_series_t * ser2 = lv_chart_add_series(chart, lv_palette_main(LV_PALETTE_RED), LV_CHART_AXIS_SECONDARY_Y);
|
|
|
|
lv_chart_series_t * ser2 = lv_chart_add_series(chart, lv_palette_main(LV_PALETTE_RED), LV_CHART_AXIS_SECONDARY_Y);
|
|
|
|
lv_chart_set_point_count(chart, MAXREADINGS);
|
|
|
|
|
|
|
|
lv_chart_set_ext_y_array(chart, ser2, (lv_coord_t *)bmewert_hum);
|
|
|
|
lv_chart_set_ext_y_array(chart, ser2, (lv_coord_t *)bmewert_hum);
|
|
|
|
|
|
|
|
|
|
|
|
lv_chart_refresh(chart); /*Required after direct set*/
|
|
|
|
lv_chart_refresh(chart); /*Required after direct set*/
|
|
|
|
@@ -270,7 +267,19 @@ void setValuetoArc(ARC arc, float value) {
|
|
|
|
lv_style_set_text_font(&style_unitxAx_label, &lv_font_montserrat_12);
|
|
|
|
lv_style_set_text_font(&style_unitxAx_label, &lv_font_montserrat_12);
|
|
|
|
lv_obj_add_style(unitxAx_label, &style_unitxAx_label, 0);
|
|
|
|
lv_obj_add_style(unitxAx_label, &style_unitxAx_label, 0);
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* ganz rechts unten die Version anzeigen */
|
|
|
|
|
|
|
|
lv_obj_t * version_label = lv_label_create(chart);
|
|
|
|
|
|
|
|
char ver[20];
|
|
|
|
|
|
|
|
sprintf(ver, "V %s %s", VERSION, VDATE);
|
|
|
|
|
|
|
|
lv_label_set_text(version_label, ver);
|
|
|
|
|
|
|
|
lv_obj_align(version_label, LV_ALIGN_BOTTOM_RIGHT, 0, 9);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Set font type and font size. More information: https://docs.lvgl.io/master/overview/font.html
|
|
|
|
|
|
|
|
static lv_style_t style_version_label;
|
|
|
|
|
|
|
|
lv_style_init(&style_version_label);
|
|
|
|
|
|
|
|
lv_style_set_text_font(&style_version_label, &lv_font_montserrat_8);
|
|
|
|
|
|
|
|
lv_style_set_text_color(&style_version_label, lv_palette_main(LV_PALETTE_GREY));
|
|
|
|
|
|
|
|
lv_obj_add_style(version_label, &style_version_label, LV_PART_MAIN);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|