Temp-Scala soweit OK
This commit is contained in:
@@ -18,7 +18,7 @@ void setup_grafik(void) {
|
||||
disp = lv_tft_espi_create(SCREEN_WIDTH, SCREEN_HEIGHT, draw_buf, sizeof(draw_buf));
|
||||
for (int i = 0; i < MAXREADINGS; i++) {
|
||||
bmewert[i] = 0;
|
||||
bmewert_hum[i] = 25;
|
||||
bmewert_hum[i] = 30;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,17 +144,29 @@ void setValuetoArc(ARC arc, float value) {
|
||||
|
||||
void drawChart() {
|
||||
Serial.println("draw_chart ");
|
||||
|
||||
// Create a container to display the chart and scale
|
||||
lv_obj_t * container_row = lv_obj_create(lv_screen_active());
|
||||
lv_obj_set_size(container_row, SCREEN_WIDTH-10, SCREEN_HEIGHT-145);
|
||||
lv_obj_align(container_row, LV_ALIGN_BOTTOM_MID, 0, -10);
|
||||
// Set the container in a flexbox row layout aligned center
|
||||
lv_obj_set_flex_flow(container_row, LV_FLEX_FLOW_ROW);
|
||||
lv_obj_set_flex_align(container_row, LV_FLEX_ALIGN_CENTER,LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);
|
||||
lv_obj_set_scrollbar_mode(container_row, LV_SCROLLBAR_MODE_OFF);
|
||||
|
||||
|
||||
// Create a chart in lower third of screen
|
||||
// lv_obj_t * chart;
|
||||
chart = lv_chart_create(lv_screen_active());
|
||||
lv_obj_set_size(chart, 300, 90);
|
||||
chart = lv_chart_create(container_row);
|
||||
lv_obj_set_size(chart, SCREEN_WIDTH-45, SCREEN_HEIGHT-150);
|
||||
lv_obj_align(chart, LV_ALIGN_BOTTOM_MID, 0, -5);
|
||||
lv_chart_set_type(chart, LV_CHART_TYPE_LINE); /*Show lines and points too*/
|
||||
lv_chart_set_point_count(chart, MAXREADINGS);
|
||||
lv_chart_set_range(chart, LV_CHART_AXIS_PRIMARY_Y, 0, 100);
|
||||
lv_chart_set_range(chart, LV_CHART_AXIS_SECONDARY_Y, 10, 30);
|
||||
lv_obj_set_style_size(chart, 0, 0, LV_PART_INDICATOR); // No points on line
|
||||
|
||||
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
|
||||
/*Add data series*/
|
||||
lv_chart_series_t * ser1 = lv_chart_add_series(chart, lv_palette_main(LV_PALETTE_RED), LV_CHART_AXIS_PRIMARY_Y);
|
||||
lv_chart_set_point_count(chart, MAXREADINGS);
|
||||
@@ -167,22 +179,20 @@ void setValuetoArc(ARC arc, float value) {
|
||||
lv_chart_refresh(chart); /*Required after direct set*/
|
||||
|
||||
// Axen
|
||||
lv_obj_t * scale = lv_scale_create(chart);
|
||||
lv_obj_set_size(scale, lv_pct(80), 70);
|
||||
Serial.printf("lv_pct(80) %d\n", lv_pct(80));
|
||||
lv_scale_set_mode(scale, LV_SCALE_MODE_VERTICAL_LEFT);
|
||||
lv_obj_align(scale, LV_ALIGN_BOTTOM_LEFT, -215, 0);
|
||||
lv_obj_t * scale = lv_scale_create(container_row);
|
||||
lv_obj_set_size(scale, 15, 75);
|
||||
lv_scale_set_mode(scale, LV_SCALE_MODE_VERTICAL_RIGHT);
|
||||
|
||||
lv_scale_set_label_show(scale, true);
|
||||
|
||||
lv_scale_set_total_tick_count(scale, 21);
|
||||
lv_scale_set_major_tick_every(scale, 5);
|
||||
|
||||
lv_obj_set_style_length(scale, 3, LV_PART_ITEMS);
|
||||
lv_obj_set_style_length(scale, 6, LV_PART_INDICATOR);
|
||||
lv_obj_set_style_line_width(scale, 1, LV_PART_ITEMS);
|
||||
lv_obj_set_style_length(scale, 0, LV_PART_ITEMS);
|
||||
lv_obj_set_style_length(scale, 0, LV_PART_INDICATOR);
|
||||
lv_obj_set_style_line_width(scale, 0, LV_PART_ITEMS);
|
||||
lv_obj_set_style_line_width(scale, 1, LV_PART_INDICATOR);
|
||||
lv_obj_set_style_line_width(scale, 1, LV_PART_MAIN);
|
||||
lv_obj_set_style_line_width(scale, 0, LV_PART_MAIN);
|
||||
lv_scale_set_range(scale, 10, 30);
|
||||
|
||||
static lv_style_t style_scale;
|
||||
|
||||
Reference in New Issue
Block a user