BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lvgl
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
lvgl
Commits
7b24b47a
Commit
7b24b47a
authored
Oct 11, 2017
by
Gabor Kiss-Vamosi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lv_bar: bugfix to handle negative range correctly
parent
bf8cf9fb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
lv_bar.c
lv_objx/lv_bar.c
+7
-3
No files found.
lv_objx/lv_bar.c
View file @
7b24b47a
...
...
@@ -179,11 +179,15 @@ void lv_bar_set_range(lv_obj_t * bar, int16_t min, int16_t max)
{
lv_bar_ext_t
*
ext
=
lv_obj_get_ext
(
bar
);
ext
->
max_value
=
max
;
ext
->
m
ax_value
=
max
;
ext
->
m
in_value
=
min
;
if
(
ext
->
act_value
>
max
)
{
ext
->
act_value
=
max
;
lv_bar_set_value
(
bar
,
ext
->
act_value
);
}
if
(
ext
->
act_value
<
min
)
{
ext
->
act_value
=
min
;
lv_bar_set_value
(
bar
,
ext
->
act_value
);
}
lv_obj_inv
(
bar
);
}
...
...
@@ -290,10 +294,10 @@ static bool lv_bar_design(lv_obj_t * bar, const area_t * mask, lv_design_mode_t
cord_t
h
=
area_get_height
(
&
indic_area
);
if
(
w
>=
h
)
{
indic_area
.
x2
=
(
int32_t
)
((
int32_t
)
w
*
ext
->
act_value
)
/
(
ext
->
max_value
-
ext
->
min_value
);
indic_area
.
x2
=
(
int32_t
)
((
int32_t
)
w
*
(
ext
->
act_value
-
ext
->
min_value
)
)
/
(
ext
->
max_value
-
ext
->
min_value
);
indic_area
.
x2
+=
indic_area
.
x1
;
}
else
{
indic_area
.
y1
=
(
int32_t
)
((
int32_t
)
h
*
ext
->
act_value
)
/
(
ext
->
max_value
-
ext
->
min_value
);
indic_area
.
y1
=
(
int32_t
)
((
int32_t
)
h
*
(
ext
->
act_value
-
ext
->
min_value
)
)
/
(
ext
->
max_value
-
ext
->
min_value
);
indic_area
.
y1
=
indic_area
.
y2
-
indic_area
.
y1
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment