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
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
François Revol
firmware
Commits
77f1d1f6
Commit
77f1d1f6
authored
4 years ago
by
schneider
Browse files
Options
Downloads
Patches
Plain Diff
feat(bsec): Add config options
parent
8db3c3ac
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Documentation/card10-cfg.rst
+4
-0
4 additions, 0 deletions
Documentation/card10-cfg.rst
epicardium/epicardium.h
+9
-4
9 additions, 4 deletions
epicardium/epicardium.h
epicardium/modules/bsec.c
+24
-14
24 additions, 14 deletions
epicardium/modules/bsec.c
with
37 additions
and
18 deletions
Documentation/card10-cfg.rst
+
4
−
0
View file @
77f1d1f6
...
...
@@ -56,4 +56,8 @@ Option name Type Description
``long_press_ms`` Integer Defines the timespan for a long key press in milliseconds.
------------------ ---------- -----------
``retrigger_ms`` Integer Defines the timespan for repeating key presses when a key is hold in milliseconds.
------------------ ---------- -----------
``bsec_enable`` Boolean Activate the Bosch :ref:`BSEC` binary blob to compute an Indoor Air Quality indication.
------------------ ---------- -----------
``bsec_debug`` Boolean Turn on debug output of the BSEC system. Prints each meaurement on the console.
================== ========== ===========
This diff is collapsed.
Click to expand it.
epicardium/epicardium.h
+
9
−
4
View file @
77f1d1f6
...
...
@@ -920,7 +920,7 @@ API(API_BME680_GET_DATA, int epic_bme680_read_sensors(
));
/**
* B
ME680
Sensor Data
* B
SEC
Sensor Data
*/
struct
bsec_sensor_data
{
/** Compensated temperature in degree celsius */
...
...
@@ -995,17 +995,22 @@ struct bsec_sensor_data {
int32_t
static_indoor_air_quality
;
/** Estimation of equivalant CO2 content in the air in ppm. */
float
co2_equivalent
;
/** Estimation of equivalant brath VOC content in the air in ppm. */
/** Estimation of equivalant br
e
ath VOC content in the air in ppm. */
float
breath_voc_equivalent
;
};
/**
*
* .. _BSEC:
* Get the current BME680 data filtered by Bosch BSEC library
*
* The Bosch BSEC libary allows to compute an indoor air
* qualtiy (IAQ)metric as well as CO2 and VOC content
* equivalents using the gas sensor of the BME680.
*
* As it is a proprietary binary blob, it has to be enabled using
* the ``bsec_enabled`` configuration option (see <link to config>).
*
* The sample rate is currently fixed to one sample every 3 seconds.
* Querying the sensor more often will return cached data.
*
...
...
@@ -1019,10 +1024,10 @@ struct bsec_sensor_data {
* status of the sensor. Please take it into consideration when
* using / displaying the IAQ.
*
* Please refer to the description of
`
`bsec_sensor_data`
`
for more
* Please refer to the description of
:c:type:
`bsec_sensor_data` for more
* information about how to interpret its content.
*
* .. versionadded:: 1.
* .. versionadded:: 1.
x
*
* :param data: Where to store the environmental data.
* :return: 0 on success or ``-Exxx`` on error. The following
...
...
This diff is collapsed.
Click to expand it.
epicardium/modules/bsec.c
+
24
−
14
View file @
77f1d1f6
...
...
@@ -6,6 +6,7 @@
#include
"epicardium.h"
#include
"modules.h"
#include
"config.h"
#include
"modules/log.h"
#include
"FreeRTOS.h"
...
...
@@ -20,6 +21,7 @@
TaskHandle_t
bsec_task_id
;
static
int64_t
last_bme680_timestamp
;
static
bool
bsec_task_active
;
static
bool
debug
;
static
struct
bsec_sensor_data
last_bsec_data
;
#define ULP 0
...
...
@@ -116,20 +118,22 @@ void output_ready(
__sync_synchronize
();
last_bme680_timestamp
=
timestamp
;
return
;
printf
(
"bosch data time: %u, iaq: %u, iaq_a: %u, temp10: %u, hum10: %u, pres: %u, raw_temp10: %u, raw_hum10: %u, gas: %u, static_iaq: %u, co21e3: %u, breath_voc1e3: %u
\n
"
,
(
unsigned
int
)(
timestamp
/
1e6
),
(
unsigned
int
)(
iaq
),
(
unsigned
int
)(
iaq_accuracy
),
(
unsigned
int
)(
temperature
*
10
),
(
unsigned
int
)(
humidity
*
10
),
(
unsigned
int
)(
pressure
),
(
unsigned
int
)(
raw_temperature
*
10
),
(
unsigned
int
)(
raw_humidity
*
10
),
(
unsigned
int
)(
gas
),
(
unsigned
int
)(
static_iaq
),
(
unsigned
int
)(
co2_equivalent
*
1e3
),
(
unsigned
int
)(
breath_voc_equivalent
*
1e3
));
if
(
debug
)
{
printf
(
"BSEC time[ms]: %u, IAQ: %u, IAQ ACC[0-3]: %u, T[.1C]: %u, Hum[.1%%]: %u, P[Pa]: %u, Raw T[.1C]: %u, Raw Hum[.1%%]: %u, Gas[Ohm]: %u, Static IAQ: %u, CO2[ppm]: %u, Breath VOC[ppb]: %u
\n
"
,
(
unsigned
int
)(
timestamp
/
1e6
),
(
unsigned
int
)(
iaq
),
(
unsigned
int
)(
iaq_accuracy
),
(
unsigned
int
)(
temperature
*
10
),
(
unsigned
int
)(
humidity
*
10
),
(
unsigned
int
)(
pressure
),
(
unsigned
int
)(
raw_temperature
*
10
),
(
unsigned
int
)(
raw_humidity
*
10
),
(
unsigned
int
)(
gas
),
(
unsigned
int
)(
static_iaq
),
(
unsigned
int
)(
co2_equivalent
),
(
unsigned
int
)(
breath_voc_equivalent
*
1e3
));
}
}
int
epic_bsec_read_sensors
(
struct
bsec_sensor_data
*
data
)
...
...
@@ -361,6 +365,12 @@ int bsec_activate(void)
float
temperature_offset
=
0
.
0
;
bool
bsec_enabled
=
config_get_boolean_with_default
(
"bsec_enabled"
,
false
);
if
(
!
bsec_enabled
)
{
return
-
1
;
}
debug
=
config_get_boolean_with_default
(
"bsec_debug"
,
false
);
/* Puts AT LEAST 2 * #BSEC_MAX_PROPERTY_BLOB_SIZE = 2 * 454 = 908 bytes onto the stack */
ret
=
bsec_iot_init
(
sample_rate
,
...
...
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