Important: unclear posts may not receive useful answers.
Before posting
- Get familiar with Markdown to format and structure your post
- Be sure to update lvgl from the latest version from the
master
branch.- Be sure you have checked the FAQ and read the relevant part of the documentation.
- If applicable use the Simulator to eliminate hardware related issues.
Delete this section if you read and applied the mentioned points.
Description
What MCU/Processor/Board and compiler are you using?
ESP32S3 (Waveshare 7" touch screen monitor)
What LVGL version are you using?
v8.4
What do you want to achieve?
How can I update meter indicator position in main.ino code with signal from ADS?
What have you tried so far?
Any online help and LVGL widgets meter documentation.
How can I update indicator position in main.ino code?
I’m following this ( lv_meter_set_indicator_value(meter, indic, value)
sets the value of the indicator.) in lvgl documentation, in my code eez created like ( lv_meter_set_indicator_value(obj, indicator, 0)
Code to reproduce
Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.
The code block(s) should be formatted like:
/*Code generated by EEZ v 0.22.0*/
#include <string.h>
#include "screens.h"
#include "images.h"
#include "fonts.h"
#include "actions.h"
#include "vars.h"
#include "styles.h"
#include "ui.h"
#include <string.h>
objects_t objects;
lv_obj_t *tick_value_change_obj;
static lv_meter_scale_t * scale0;
static lv_meter_indicator_t * indicator1;
static lv_meter_indicator_t * indicator2;
static lv_meter_scale_t * scale3;
static lv_meter_indicator_t * indicator4;
static lv_meter_indicator_t * indicator5;
static lv_meter_indicator_t * indicator6;
static lv_meter_indicator_t * indicator7;
void create_screen_main() {
lv_obj_t *obj = lv_obj_create(0);
objects.main = obj;
lv_obj_set_pos(obj, 0, 0);
lv_obj_set_size(obj, 800, 480);
lv_obj_set_style_bg_color(obj, lv_color_hex(0xff2e2929), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_bg_opa(obj, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
{
lv_obj_t *parent_obj = obj;
{
// amp_rotator
lv_obj_t *obj = lv_meter_create(parent_obj);
objects.amp_rotator = obj;
lv_obj_set_pos(obj, 230, 80);
lv_obj_set_size(obj, 340, 340);
{
lv_meter_scale_t *scale = lv_meter_add_scale(obj);
scale0 = scale;
lv_meter_set_scale_ticks(obj, scale, 61, 2, 4, lv_color_hex(0xffffffff));
lv_meter_set_scale_major_ticks(obj, scale, 2, 3, 5, lv_color_hex(0xffb1fdf9), -16);
lv_meter_set_scale_range(obj, scale, 0, 60, 270, 135);
{
lv_meter_indicator_t *indicator = lv_meter_add_needle_line(obj, scale, 4, lv_color_hex(0xffb3faf7), -8);
indicator1 = indicator;
lv_meter_set_indicator_value(obj, indicator, 0);
}
{
lv_meter_indicator_t *indicator = lv_meter_add_arc(obj, scale, 14, lv_color_hex(0xff45667d), -8);
indicator2 = indicator;
lv_meter_set_indicator_start_value(obj, indicator, 0);
lv_meter_set_indicator_end_value(obj, indicator, 0);
}
}
lv_obj_set_style_min_width(obj, 100, LV_PART_TICKS | LV_STATE_DEFAULT);
lv_obj_set_style_bg_color(obj, lv_color_hex(0xff2e2929), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_text_color(obj, lv_color_hex(0xffb3faf7), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_text_font(obj, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_radius(obj, 32767, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_outline_width(obj, 2, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_outline_color(obj, lv_color_hex(0xffffffff), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_outline_pad(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_outline_opa(obj, 100, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_border_color(obj, lv_color_hex(0xffe0e0e0), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_border_width(obj, 2, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_text_opa(obj, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_transform_width(obj, 5, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_transform_height(obj, 5, LV_PART_MAIN | LV_STATE_DEFAULT);
}
Screenshot and/or video
If possible, add screenshots and/or videos about the current state.