Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Melroy van den Berg
AIR Quality Meter
Commits
7595b0db
Commit
7595b0db
authored
May 12, 2019
by
Melroy van den Berg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Select sensor during reading
parent
4a25616f
Pipeline
#1072
passed with stages
in 15 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
src/controller.cc
src/controller.cc
+7
-3
No files found.
src/controller.cc
View file @
7595b0db
...
...
@@ -121,7 +121,6 @@ void Controller::InitDustSensor() {
void
Controller
::
InitGasSensor
(
int
i2c_fd
)
{
this
->
sgp
=
new
SGP30
(
i2c_fd
);
// Select the sensor on the bus
if
(
!
sgp
->
Select
())
{
throw
std
::
runtime_error
(
"Could not select the gas sensor!
\n
"
);
...
...
@@ -158,6 +157,9 @@ void Controller::SetAbsoluteHumidity() {
* \return true if everything went successfully
*/
bool
Controller
::
TempHumidPressReading
()
{
if
(
!
bme
->
Select
())
{
throw
std
::
runtime_error
(
"Could not select the temp/humid/pressure sensor!
\n
"
);
}
int
counter
=
0
;
while
(
counter
<
60
)
{
...
...
@@ -222,7 +224,10 @@ bool Controller::DustReading() {
bool
Controller
::
GasReading
()
{
// IMPORTANT: According to the specs we need to sent regular internals of 1s to ensure proper dynamic baseline compensation algo.
// This time interval needs to be done forever.
if
(
!
sgp
->
Select
())
{
throw
std
::
runtime_error
(
"Could not select the gas sensor!
\n
"
);
}
int
counter
=
0
;
while
(
counter
<
40
)
{
// Do measurement
...
...
@@ -232,7 +237,6 @@ bool Controller::GasReading() {
}
printf
(
"TVOC : %dppb
\n
"
,
sgp
->
TVOC
);
printf
(
"eCO2 : %dppm
\n
"
,
sgp
->
eCO2
);
// Sleep 1 second
// TODO: embedded a delay within DoMeasurement()?
...
...
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