Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Skyward Boardcore
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
Emilio Corigliano
Skyward Boardcore
Commits
b5046959
Commit
b5046959
authored
3 years ago
by
Matteo Pignataro
Browse files
Options
Downloads
Patches
Plain Diff
[BME280] Driver adjustments related to timing issues
parent
23633195
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/shared/sensors/BME280/BME280.cpp
+28
-8
28 additions, 8 deletions
src/shared/sensors/BME280/BME280.cpp
with
28 additions
and
8 deletions
src/shared/sensors/BME280/BME280.cpp
+
28
−
8
View file @
b5046959
...
...
@@ -84,19 +84,39 @@ bool BME280::init()
setConfiguration
();
BME280Config
readBackConfig
=
readConfiguration
();
// Set a sleep time to allow the sensor to change internally the data
miosix
::
Thread
::
sleep
(
100
);
// I create the config state which represents the logic or of all the
// 5 readConfiguration controls (We perform 5 checks to avoid that the
// sensor is busy implicating in wrong responses)
bool
readConfigResult
=
false
;
BME280Config
readBackConfig
;
for
(
int
i
=
0
;
i
<
5
;
i
++
)
{
readBackConfig
=
readConfiguration
();
// Check if the configration on the device matches ours
if
(
config
.
bytes
.
ctrlHumidity
!=
readBackConfig
.
bytes
.
ctrlHumidity
||
config
.
bytes
.
ctrlPressureAndTemperature
!=
readBackConfig
.
bytes
.
ctrlPressureAndTemperature
||
config
.
bytes
.
config
!=
readBackConfig
.
bytes
.
config
)
if
(
config
.
bytes
.
ctrlHumidity
==
readBackConfig
.
bytes
.
ctrlHumidity
&&
config
.
bytes
.
ctrlPressureAndTemperature
==
readBackConfig
.
bytes
.
ctrlPressureAndTemperature
&&
config
.
bytes
.
config
==
readBackConfig
.
bytes
.
config
)
{
readConfigResult
=
true
;
break
;
}
// After the check i sleep 100 milliseconds
miosix
::
Thread
::
sleep
(
100
);
}
// If after the 5 iterations the sensor didn't report the configuration set
// I can report the init error
if
(
readConfigResult
)
{
LOG_ERR
(
logger
,
"Device configuration incorrect, setup failed"
);
lastError
=
SensorErrors
::
NOT_INIT
;
return
false
;
}
initialized
=
true
;
...
...
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