Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
card10
firmware
Commits
f8a80011
Commit
f8a80011
authored
5 years ago
by
Nikolay Amiantov
Browse files
Options
Downloads
Patches
Plain Diff
Fix off-by-one error in display pixel handling
parent
ea85141f
No related branches found
No related tags found
1 merge request
!204
Fix off-by-one error in display pixel handling
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pycardium/modules/sys_display.c
+12
-12
12 additions, 12 deletions
pycardium/modules/sys_display.c
with
12 additions
and
12 deletions
pycardium/modules/sys_display.c
+
12
−
12
View file @
f8a80011
...
...
@@ -61,12 +61,12 @@ static mp_obj_t mp_display_pixel(size_t n_args, const mp_obj_t *args)
uint16_t
col
=
get_color
(
args
[
2
]);
//TODO: Move sanity checks to epicardium
if
(
x
>
160
||
x
<
0
)
{
mp_raise_ValueError
(
"X-Coords have to be 0 < x < 160"
);
if
(
x
>
=
160
||
x
<
0
)
{
mp_raise_ValueError
(
"X-Coords have to be 0 <
=
x < 160"
);
}
if
(
y
>
80
||
y
<
0
)
{
mp_raise_ValueError
(
"Y-Coords have to be 0 < y < 80"
);
if
(
y
>
=
80
||
y
<
0
)
{
mp_raise_ValueError
(
"Y-Coords have to be 0 <
=
y < 80"
);
}
int
res
=
epic_disp_pixel
(
x
,
y
,
col
);
...
...
@@ -91,12 +91,12 @@ static mp_obj_t mp_display_line(size_t n_args, const mp_obj_t *args)
uint16_t
ps
=
mp_obj_get_int
(
args
[
6
]);
//TODO: Move sanity checks to epicardium
if
(
xs
>
160
||
xs
<
0
||
xe
>
160
||
xe
<
0
)
{
mp_raise_ValueError
(
"X-Coords have to be 0 < x < 160"
);
if
(
xs
>
=
160
||
xs
<
0
||
xe
>
=
160
||
xe
<
0
)
{
mp_raise_ValueError
(
"X-Coords have to be 0 <
=
x < 160"
);
}
if
(
ys
>
80
||
ys
<
0
||
ye
>
80
||
ye
<
0
)
{
mp_raise_ValueError
(
"Y-Coords have to be 0 < x < 80"
);
if
(
ys
>
=
80
||
ys
<
0
||
ye
>
=
80
||
ye
<
0
)
{
mp_raise_ValueError
(
"Y-Coords have to be 0 <
=
x < 80"
);
}
if
(
ls
>
1
||
ls
<
0
)
{
...
...
@@ -125,12 +125,12 @@ static mp_obj_t mp_display_rect(size_t n_args, const mp_obj_t *args)
uint16_t
ps
=
mp_obj_get_int
(
args
[
6
]);
//TODO: Move sanity checks to epicardium
if
(
xs
>
160
||
xs
<
0
||
xe
>
160
||
xe
<
0
)
{
mp_raise_ValueError
(
"X-Coords have to be 0 < x < 160"
);
if
(
xs
>
=
160
||
xs
<
0
||
xe
>
=
160
||
xe
<
0
)
{
mp_raise_ValueError
(
"X-Coords have to be 0 <
=
x < 160"
);
}
if
(
ys
>
80
||
ys
<
0
||
ye
>
80
||
ye
<
0
)
{
mp_raise_ValueError
(
"Y-Coords have to be 0 < x < 80"
);
if
(
ys
>
=
80
||
ys
<
0
||
ye
>
=
80
||
ye
<
0
)
{
mp_raise_ValueError
(
"Y-Coords have to be 0 <
=
x < 80"
);
}
if
(
fs
>
1
||
fs
<
0
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment