Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
François Revol
firmware
Commits
d189f48e
Commit
d189f48e
authored
Nov 19, 2019
by
fuchsi*
Committed by
Ben Huber
Nov 19, 2019
Browse files
fix(bhi, leds): fixed faulty error handling due to always-false unsigned comparisons
parent
87bccda8
Changes
3
Hide whitespace changes
Inline
Side-by-side
epicardium/modules/bhi.c
View file @
d189f48e
...
...
@@ -131,7 +131,7 @@ int epic_bhi160_enable_sensor(
int
result
=
0
;
bhy_virtual_sensor_t
vs_id
=
bhi160_lookup_vs_id
(
sensor_type
);
if
(
vs_id
<
0
)
{
if
(
vs_id
==
(
bhy_virtual_sensor_t
)
-
1
)
{
return
-
ENODEV
;
}
...
...
@@ -188,7 +188,7 @@ int epic_bhi160_disable_sensor(enum bhi160_sensor_type sensor_type)
int
result
=
0
;
bhy_virtual_sensor_t
vs_id
=
bhi160_lookup_vs_id
(
sensor_type
);
if
(
vs_id
<
0
)
{
if
(
vs_id
==
(
bhy_virtual_sensor_t
)
-
1
)
{
return
-
ENODEV
;
}
...
...
pycardium/modules/sys_leds.c
View file @
d189f48e
...
...
@@ -202,8 +202,8 @@ static MP_DEFINE_CONST_FUN_OBJ_2(leds_set_rocket_obj, mp_leds_set_rocket);
static
mp_obj_t
mp_leds_get_rocket
(
mp_obj_t
led_in
)
{
int
led
=
mp_obj_get_int
(
led_in
);
u
int
8_t
ret
=
epic_leds_get_rocket
(
led
);
int
led
=
mp_obj_get_int
(
led_in
);
int
ret
=
epic_leds_get_rocket
(
led
);
if
(
ret
==
-
EINVAL
)
{
mp_raise_ValueError
(
"invalid value: maybe the led does not exists"
...
...
pycardium/mphalport.c
View file @
d189f48e
...
...
@@ -112,7 +112,7 @@ void epic_isr_ctrl_c(void)
void
mp_hal_set_interrupt_char
(
char
c
)
{
if
(
c
!=
-
1
)
{
if
(
c
!=
'\xFF'
)
{
mp_obj_exception_clear_traceback
(
MP_OBJ_FROM_PTR
(
&
MP_STATE_VM
(
mp_kbd_exception
))
);
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment