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
487ac25e
Commit
487ac25e
authored
4 years ago
by
schneider
Browse files
Options
Downloads
Patches
Plain Diff
feat(bsec): Apply default configuration if there is no config file
parent
27332428
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
epicardium/modules/bsec.c
+20
-5
20 additions, 5 deletions
epicardium/modules/bsec.c
with
20 additions
and
5 deletions
epicardium/modules/bsec.c
+
20
−
5
View file @
487ac25e
...
...
@@ -12,8 +12,13 @@
#include
"max32665.h"
#include
"gcr_regs.h"
#include
<string.h>
#include
<stdio.h>
// From generic_18v_3s_4d/bsec_serialized_configurations_iaq.c
static
const
uint8_t
bsec_config_generic_18v_3s_4d
[
454
]
=
{
4
,
7
,
4
,
1
,
61
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
174
,
1
,
0
,
0
,
48
,
0
,
1
,
0
,
0
,
192
,
168
,
71
,
64
,
49
,
119
,
76
,
0
,
0
,
225
,
68
,
137
,
65
,
0
,
63
,
205
,
204
,
204
,
62
,
0
,
0
,
64
,
63
,
205
,
204
,
204
,
62
,
0
,
0
,
0
,
0
,
216
,
85
,
0
,
100
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
28
,
0
,
2
,
0
,
0
,
244
,
1
,
225
,
0
,
25
,
0
,
0
,
128
,
64
,
0
,
0
,
32
,
65
,
144
,
1
,
0
,
0
,
112
,
65
,
0
,
0
,
0
,
63
,
16
,
0
,
3
,
0
,
10
,
215
,
163
,
60
,
10
,
215
,
35
,
59
,
10
,
215
,
35
,
59
,
9
,
0
,
5
,
0
,
0
,
0
,
0
,
0
,
1
,
88
,
0
,
9
,
0
,
7
,
240
,
150
,
61
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
28
,
124
,
225
,
61
,
52
,
128
,
215
,
63
,
0
,
0
,
160
,
64
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
205
,
204
,
12
,
62
,
103
,
213
,
39
,
62
,
230
,
63
,
76
,
192
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
145
,
237
,
60
,
191
,
251
,
58
,
64
,
63
,
177
,
80
,
131
,
64
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
93
,
254
,
227
,
62
,
54
,
60
,
133
,
191
,
0
,
0
,
64
,
64
,
12
,
0
,
10
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
229
,
0
,
254
,
0
,
2
,
1
,
5
,
48
,
117
,
100
,
0
,
44
,
1
,
112
,
23
,
151
,
7
,
132
,
3
,
197
,
0
,
92
,
4
,
144
,
1
,
64
,
1
,
64
,
1
,
144
,
1
,
48
,
117
,
48
,
117
,
48
,
117
,
48
,
117
,
100
,
0
,
100
,
0
,
100
,
0
,
48
,
117
,
48
,
117
,
48
,
117
,
100
,
0
,
100
,
0
,
48
,
117
,
48
,
117
,
100
,
0
,
100
,
0
,
100
,
0
,
100
,
0
,
48
,
117
,
48
,
117
,
48
,
117
,
100
,
0
,
100
,
0
,
100
,
0
,
48
,
117
,
48
,
117
,
100
,
0
,
100
,
0
,
44
,
1
,
44
,
1
,
44
,
1
,
44
,
1
,
44
,
1
,
44
,
1
,
44
,
1
,
44
,
1
,
44
,
1
,
44
,
1
,
44
,
1
,
44
,
1
,
44
,
1
,
44
,
1
,
8
,
7
,
8
,
7
,
8
,
7
,
8
,
7
,
8
,
7
,
8
,
7
,
8
,
7
,
8
,
7
,
8
,
7
,
8
,
7
,
8
,
7
,
8
,
7
,
8
,
7
,
8
,
7
,
112
,
23
,
112
,
23
,
112
,
23
,
112
,
23
,
112
,
23
,
112
,
23
,
112
,
23
,
112
,
23
,
112
,
23
,
112
,
23
,
112
,
23
,
112
,
23
,
112
,
23
,
112
,
23
,
255
,
255
,
255
,
255
,
255
,
255
,
255
,
255
,
220
,
5
,
220
,
5
,
220
,
5
,
255
,
255
,
255
,
255
,
255
,
255
,
220
,
5
,
220
,
5
,
255
,
255
,
255
,
255
,
255
,
255
,
255
,
255
,
255
,
255
,
255
,
255
,
255
,
255
,
255
,
255
,
255
,
255
,
255
,
255
,
255
,
255
,
255
,
255
,
255
,
255
,
255
,
255
,
255
,
255
,
255
,
255
,
44
,
1
,
0
,
0
,
0
,
0
,
52
,
233
,
0
,
0
};
/**********************************************************************************************************************/
/* header files */
/**********************************************************************************************************************/
...
...
@@ -83,12 +88,12 @@ void output_ready(
(
unsigned
int
)(
breath_voc_equivalent
*
1e6
));
}
static
int
bsec_load
(
char
*
path
,
uint8_t
*
buffer
,
uint32_t
n_buffer
)
static
u
int
32_t
bsec_load
(
char
*
path
,
uint8_t
*
buffer
,
uint32_t
n_buffer
)
{
uint32_t
len
=
0
;
int
fd
,
res
;
printf
(
"BSEC load %s %
d
\n
"
,
path
,
(
int
)
n_buffer
);
printf
(
"BSEC load %s %
lu
\n
"
,
path
,
n_buffer
);
if
((
fd
=
epic_file_open
(
path
,
"r"
))
<
0
)
{
printf
(
"Open failed
\n
"
);
...
...
@@ -107,7 +112,7 @@ static int bsec_load(char *path, uint8_t *buffer, uint32_t n_buffer)
goto
done
;
}
if
(
epic_file_read
(
fd
,
buffer
,
header
)
!=
header
)
{
if
(
epic_file_read
(
fd
,
buffer
,
header
)
!=
(
int
)
header
)
{
printf
(
"Read failed
\n
"
);
goto
done
;
}
...
...
@@ -158,7 +163,7 @@ void state_save(const uint8_t *state_buffer, uint32_t length)
goto
done
;
}
if
(
epic_file_write
(
fd
,
state_buffer
,
header
)
!=
header
)
{
if
(
epic_file_write
(
fd
,
state_buffer
,
header
)
!=
(
int
)
header
)
{
printf
(
"Write failed
\n
"
);
goto
done
;
}
...
...
@@ -198,7 +203,15 @@ i2c_read(uint8_t addr, uint8_t reg, uint8_t *p_buf, uint16_t size)
*/
uint32_t
config_load
(
uint8_t
*
config_buffer
,
uint32_t
n_buffer
)
{
return
bsec_load
(
"bsec_iaq.config"
,
config_buffer
,
n_buffer
);
uint32_t
len
=
bsec_load
(
"bsec_iaq.config"
,
config_buffer
,
n_buffer
);
if
(
len
==
0
)
{
printf
(
"Using default bsec_config_generic_18v_3s_4d
\n
"
);
len
=
sizeof
(
bsec_config_generic_18v_3s_4d
);
memcpy
(
config_buffer
,
bsec_config_generic_18v_3s_4d
,
len
);
}
return
len
;
}
#if 0
...
...
@@ -266,10 +279,12 @@ void vBSECTask(void *pvParameters)
);
#endif
if
(
ret
.
bme680_status
)
{
printf
(
"bme680 init failed
\n
"
);
/* Could not intialize BME680 or BSEC library */
while
(
1
)
;
}
else
if
(
ret
.
bsec_status
)
{
printf
(
"bsec init failed
\n
"
);
/* Could not intialize BSEC library */
while
(
1
)
;
...
...
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