02-08-2020 01:53 AM
Hello community,
I am trying to compile and run the bsec_iot_example BME680 on an ESP32 chip using Arduino IDE. However, I'm getting this compilation error:
sketch\bsec_integration.c: In function 'bme680_bsec_update_subscription':
bsec_integration.c:122:46: error: 'BSEC_OUTPUT_IAQ_ESTIMATE' undeclared (first use in this function)
requested_virtual_sensors[0].sensor_id = BSEC_OUTPUT_IAQ_ESTIMATE;
^
sketch\bsec_integration.c:122:46: note: each undeclared identifier is reported only once for each function it appears in
sketch\bsec_integration.c: In function 'bme680_bsec_process_data':
bsec_integration.c:404:22: error: 'BSEC_OUTPUT_IAQ_ESTIMATE' undeclared (first use in this function)
case BSEC_OUTPUT_IAQ_ESTIMATE:
^
exit status 1
'BSEC_OUTPUT_IAQ_ESTIMATE' undeclared (first use in this function)
Initially, I was able to run the same project on an ESP8266 chip successfully by following the manual BST-BME680-Integration guide. To compile it for esp32 I simply replaced libalgobsec.a, bsec_datatypes.h and bsec_interface.h files with their equivalents for esp32 chip which I found them in BSEC zip file in the directory "bsec_1-4-7-4_generic_release\BSEC_1.4.7.4_Generic_Release\algo\normal_version\bin\esp32"
Attached is the list of files in the project directory.
any idea what could be wrong?
Regards,
Sina
Solved! Go to Solution.
02-10-2020 10:17 AM
It seems like your project includes a mix of old and new code. 'BSEC_OUTPUT_IAQ_ESTIMATE' is an old name, which became 'BSEC_OUTPUT_IAQ' in the meantime (at least it is the case now in BSEC v1.4.7.4). It is likely that you have to update a bit more code in your project, maybe also bsec_integration.c/.h?
02-11-2020 01:44 AM
Hi
Thank you for the comment. As you said I updated the library and it solved the "BSEC_OUTPUT_IAQ_ESTIMATE" issue. However, now I'm getting a different error. It seems the compiler cannot find the declaration of the functions in bsec_integration.h, despite the fact that it is included in the main project file. should I set something in the Arduino IDE?
Here is the list of errors:
Arduino: 1.8.11 (Windows 10), Board: "ESP32 Dev Module, Disabled, Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS), 240MHz (WiFi/BT), QIO, 80MHz, 4MB (32Mb), 921600, None"
bsec_iot_example:145:25: error: ambiguating new declaration of 'void sleep(uint32_t)'
void sleep(uint32_t t_ms)
^
In file included from C:\Users\User\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4/tools/sdk/include/newlib/stdio.h:29:0,
from C:\Users\User\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\cores\esp32/Arduino.h:27,
from sketch\bsec_iot_example.ino.cpp:1:
C:\Users\User\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4/tools/sdk/include/newlib/sys/unistd.h:185:10: note: old declaration 'unsigned int sleep(unsigned int)'
unsigned _EXFUN(sleep, (unsigned int __seconds ));
^
E:\Sketchbook\libraries\bsec_iot_example\bsec_iot_example.ino: In function 'void sleep(uint32_t)':
bsec_iot_example:145:25: error: ambiguating new declaration of 'void sleep(uint32_t)'
void sleep(uint32_t t_ms)
^
In file included from C:\Users\User\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4/tools/sdk/include/newlib/stdio.h:29:0,
from C:\Users\User\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\cores\esp32/Arduino.h:27,
from sketch\bsec_iot_example.ino.cpp:1:
C:\Users\User\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4/tools/sdk/include/newlib/sys/unistd.h:185:10: note: old declaration 'unsigned int sleep(unsigned int)'
unsigned _EXFUN(sleep, (unsigned int __seconds ));
^
E:\Sketchbook\libraries\bsec_iot_example\bsec_iot_example.ino: In function 'void setup()':
bsec_iot_example:261:103: error: invalid conversion from 'unsigned int (*)(unsigned int)' to 'sleep_fct {aka void (*)(unsigned int)}' [-fpermissive]
ret = bsec_iot_init(BSEC_SAMPLE_RATE_LP, 0.0f, bus_write, bus_read, sleep, state_load, config_load);
^
In file included from E:\Sketchbook\libraries\bsec_iot_example\bsec_iot_example.ino:78:0:
sketch\bsec_integration.h:141:20: note: initializing argument 5 of 'return_values_init bsec_iot_init(float, float, bme680_com_fptr_t, bme680_com_fptr_t, sleep_fct, state_load_fct, config_load_fct)'
return_values_init bsec_iot_init(float sample_rate, float temperature_offset, bme680_com_fptr_t bus_write, bme680_com_fptr_t bus_read,
^
bsec_iot_example:277:75: error: invalid conversion from 'unsigned int (*)(unsigned int)' to 'sleep_fct {aka void (*)(unsigned int)}' [-fpermissive]
bsec_iot_loop(sleep, get_timestamp_us, output_ready, state_save, 10000);
^
In file included from E:\Sketchbook\libraries\bsec_iot_example\bsec_iot_example.ino:78:0:
sketch\bsec_integration.h:155:6: note: initializing argument 1 of 'void bsec_iot_loop(sleep_fct, get_timestamp_us_fct, output_ready_fct, state_save_fct, uint32_t)'
void bsec_iot_loop(sleep_fct sleep, get_timestamp_us_fct get_timestamp_us, output_ready_fct output_ready,
^
bsec_iot_example:277:75: error: invalid conversion from 'void (*)(int64_t, float, uint8_t, float, float, float, float, float, float, bsec_library_return_t) {aka void (*)(long long int, float, unsigned char, float, float, float, float, float, float, bsec_library_return_t)}' to 'output_ready_fct {aka void (*)(long long int, float, unsigned char, float, float, float, float, float, float, bsec_library_return_t, float, float, float)}' [-fpermissive]
bsec_iot_loop(sleep, get_timestamp_us, output_ready, state_save, 10000);
^
In file included from E:\Sketchbook\libraries\bsec_iot_example\bsec_iot_example.ino:78:0:
sketch\bsec_integration.h:155:6: note: initializing argument 3 of 'void bsec_iot_loop(sleep_fct, get_timestamp_us_fct, output_ready_fct, state_save_fct, uint32_t)'
void bsec_iot_loop(sleep_fct sleep, get_timestamp_us_fct get_timestamp_us, output_ready_fct output_ready,
^
exit status 1
ambiguating new declaration of 'void sleep(uint32_t)'
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
02-13-2020 04:09 PM
There error indicated is error: ambiguating new declaration of 'void sleep(uint32_t)'. This means the sleep() function in bsec_iot_example has the same name as a function in the ESP32 toolchain, which is not permitted. This could be solvable by renaming the sleep function in bsec_iot_example, for example into "delay_ms" or similar. Note that if you are using the Arduino IDE, we also have an Arduino library available for the BME680+BSEC.