Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
Open-Cube FW
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Open Cube
Open-Cube FW
Commits
52ffc785
Commit
52ffc785
authored
6 months ago
by
Václav Jelínek
Browse files
Options
Downloads
Patches
Plain Diff
Reduce wait time after changing sensor mode for ev3-like sensors
parent
de1a8c0e
No related branches found
No related tags found
No related merge requests found
Pipeline
#103058
passed
6 months ago
Stage: build
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
micropython/modules/ev3_sensors/micropython_api.c
+3
-3
3 additions, 3 deletions
micropython/modules/ev3_sensors/micropython_api.c
with
3 additions
and
3 deletions
micropython/modules/ev3_sensors/micropython_api.c
+
3
−
3
View file @
52ffc785
...
...
@@ -5,7 +5,7 @@
#include
"ev3_sensor.h"
#define COMMAND_SIZE_LIMIT 16
#define SENSOR_SWITCH_DELAY 1
00
#define SENSOR_SWITCH_DELAY 1
#define SENSOR_SWITCH_MAX_ATTEMPTS 20
#define DEFAULT_WAIT_TIMEOUT_MS 3000
#define DISABLE_ID_CHECKS (-2) // -1 is returned from ev3_sensor_identify() when no sensor is present
...
...
@@ -205,11 +205,11 @@ STATIC mp_obj_t ev3_api_read_mode(mp_obj_t self_in, mp_obj_t mode_in) {
break
;
}
if
(
ev3_sensor_is_connected
(
&
self
->
impl
))
{
(
void
)
ev3_sensor_set_mode
(
&
self
->
impl
,
mode
);
// ignore: even if wq is full, in 100ms it shouldn't be
mp_hal_delay_ms
(
SENSOR_SWITCH_DELAY
);
(
void
)
ev3_sensor_set_mode
(
&
self
->
impl
,
mode
);
// ignore: even if wq is full, try 1 ms later again to reduce wait time
}
else
{
mp_raise_msg
(
&
mp_type_SensorNotReadyError
,
"Sensor has been unplugged"
);
}
mp_hal_delay_ms
(
SENSOR_SWITCH_DELAY
);
}
if
(
!
done
)
{
mp_raise_msg
(
&
mp_type_SensorNotReadyError
,
"Sensor mode switch timed out"
);
...
...
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