compiling bme280 from yanbe

vibnwis
Posts: 89
Joined: Thu Aug 24, 2017 1:13 am

compiling bme280 from yanbe

Postby vibnwis » Thu Aug 24, 2017 11:06 am

Hi there,
I am wanting to try the source from repo, https://github.com/yanbe/bme280-esp-idf-i2c.git. However, when I built it, it could not find bme280.h as stated as #include "bme280.h" in the main.c. Out of no choice, I found a copy of bme280.h from https://github.com/whitecatboard/Lua-RTOS-ESP32.git. It is becoming very complicated beyond my capability. Can someone help please? I gave it a go, by copying bme280.h, bme280.c and sensor.c, sensor.h to esp_idf/driver/ and its include folders. However, I experienced the following errors. Any comments are welcome.

/home/esp32/esp/esp-idf/components/driver/include/driver/bme280.h:1473:1: error: unknown type name 'driver_error_t'
driver_error_t *bme280_presetup(sensor_instance_t *unit);
^
/home/esp32/esp/esp-idf/components/driver/include/driver/bme280.h:1473:33: error: unknown type name 'sensor_instance_t'
driver_error_t *bme280_presetup(sensor_instance_t *unit);
^
/home/esp32/esp/esp-idf/components/driver/include/driver/bme280.h:1474:1: error: unknown type name 'driver_error_t'
driver_error_t *bme280_setup(sensor_instance_t *unit);
^
/home/esp32/esp/esp-idf/components/driver/include/driver/bme280.h:1474:30: error: unknown type name 'sensor_instance_t'
driver_error_t *bme280_setup(sensor_instance_t *unit);
^
/home/esp32/esp/esp-idf/components/driver/include/driver/bme280.h:1475:1: error: unknown type name 'driver_error_t'
/home/esp32/esp/esp-idf/make/component_wrapper.mk:228: recipe for target 'main.o' failed
driver_error_t *bme280_acquire(sensor_instance_t *unit, sensor_value_t *values);
/home/esp32/esp/esp-idf/make/project.mk:391: recipe for target 'component-main-build' failed
^
/home/esp32/esp/esp-idf/components/driver/include/driver/bme280.h:1475:32: error: unknown type name 'sensor_instance_t'
driver_error_t *bme280_acquire(sensor_instance_t *unit, sensor_value_t *values);
^
/home/esp32/esp/esp-idf/components/driver/include/driver/bme280.h:1475:57: error: unknown type name 'sensor_value_t'
driver_error_t *bme280_acquire(sensor_instance_t *unit, sensor_value_t *values);
^
/home/esp32/esp/esp-idf/components/driver/include/driver/bme280.h:1476:1: error: unknown type name 'driver_error_t'
driver_error_t *bme280_set(sensor_instance_t *unit, const char *id, sensor_value_t *property);
^
/home/esp32/esp/esp-idf/components/driver/include/driver/bme280.h:1476:28: error: unknown type name 'sensor_instance_t'
driver_error_t *bme280_set(sensor_instance_t *unit, const char *id, sensor_value_t *property);
^
/home/esp32/esp/esp-idf/components/driver/include/driver/bme280.h:1476:69: error: unknown type name 'sensor_value_t'
driver_error_t *bme280_set(sensor_instance_t *unit, const char *id, sensor_value_t *property);
^
/home/esp32/esp/esp-idf/components/driver/include/driver/bme280.h:1477:1: error: unknown type name 'driver_error_t'
driver_error_t *bme280_get(sensor_instance_t *unit, const char *id, sensor_value_t *property);
^
/home/esp32/esp/esp-idf/components/driver/include/driver/bme280.h:1477:28: error: unknown type name 'sensor_instance_t'
driver_error_t *bme280_get(sensor_instance_t *unit, const char *id, sensor_value_t *property);
^
/home/esp32/esp/esp-idf/components/driver/include/driver/bme280.h:1477:69: error: unknown type name 'sensor_value_t'
driver_error_t *bme280_get(sensor_instance_t *unit, const char *id, sensor_value_t *property);
^
/home/esp32/esp/esp-idf/components/driver/include/driver/bme280.h:1479:20: error: unknown type name 'sensor_instance_t'
int bm280_get_mode(sensor_instance_t *unit, char *buf);
^
/home/esp32/esp/bme280-esp-idf-i2c/main/./main.c: In function 'task_bme280_normal_mode':
/home/esp32/esp/bme280-esp-idf-i2c/main/./main.c:97:9: error: variable 'bme280' has initializer but incomplete type
struct bme280_t bme280 = {
^
/home/esp32/esp/bme280-esp-idf-i2c/main/./main.c:98:3: error: unknown field 'bus_write' specified in initializer
.bus_write = BME280_I2C_bus_write,
^
/home/esp32/esp/bme280-esp-idf-i2c/main/./main.c:98:16: warning: excess elements in struct initializer
.bus_write = BME280_I2C_bus_write,
^
/home/esp32/esp/bme280-esp-idf-i2c/main/./main.c:98:16: note: (near initialization for 'bme280')
/home/esp32/esp/bme280-esp-idf-i2c/main/./main.c:99:3: error: unknown field 'bus_read' specified in initializer
.bus_read = BME280_I2C_bus_read,
^
/home/esp32/esp/bme280-esp-idf-i2c/main/./main.c:99:15: warning: excess elements in struct initializer
.bus_read = BME280_I2C_bus_read,
^
/home/esp32/esp/bme280-esp-idf-i2c/main/./main.c:99:15: note: (near initialization for 'bme280')
/home/esp32/esp/bme280-esp-idf-i2c/main/./main.c:100:3: error: unknown field 'dev_addr' specified in initializer
.dev_addr = BME280_I2C_ADDRESS2,
^
In file included from /home/esp32/esp/bme280-esp-idf-i2c/main/./main.c:9:0:
/home/esp32/esp/esp-idf/components/driver/include/driver/bme280.h:254:46: warning: excess elements in struct initializer
#define BME280_I2C_ADDRESS2 (0x77)
^
/home/esp32/esp/bme280-esp-idf-i2c/main/./main.c:100:15: note: in expansion of macro 'BME280_I2C_ADDRESS2'
.dev_addr = BME280_I2C_ADDRESS2,
^
/home/esp32/esp/esp-idf/components/driver/include/driver/bme280.h:254:46: note: (near initialization for 'bme280')
#define BME280_I2C_ADDRESS2 (0x77)
^
/home/esp32/esp/bme280-esp-idf-i2c/main/./main.c:100:15: note: in expansion of macro 'BME280_I2C_ADDRESS2'
.dev_addr = BME280_I2C_ADDRESS2,
^
/home/esp32/esp/bme280-esp-idf-i2c/main/./main.c:101:3: error: unknown field 'delay_msec' specified in initializer
.delay_msec = BME280_delay_msek
^
/home/esp32/esp/bme280-esp-idf-i2c/main/./main.c:101:17: warning: excess elements in struct initializer
.delay_msec = BME280_delay_msek
^
/home/esp32/esp/bme280-esp-idf-i2c/main/./main.c:101:17: note: (near initialization for 'bme280')
/home/esp32/esp/bme280-esp-idf-i2c/main/./main.c:97:18: error: storage size of 'bme280' isn't known
struct bme280_t bme280 = {
^
/home/esp32/esp/bme280-esp-idf-i2c/main/./main.c:97:18: warning: unused variable 'bme280' [-Wunused-variable]
/home/esp32/esp/bme280-esp-idf-i2c/main/./main.c: In function 'task_bme280_forced_mode':
/home/esp32/esp/bme280-esp-idf-i2c/main/./main.c:143:9: error: variable 'bme280' has initializer but incomplete type
struct bme280_t bme280 = {
^
/home/esp32/esp/bme280-esp-idf-i2c/main/./main.c:144:3: error: unknown field 'bus_write' specified in initializer
.bus_write = BME280_I2C_bus_write,
^
/home/esp32/esp/bme280-esp-idf-i2c/main/./main.c:144:16: warning: excess elements in struct initializer
.bus_write = BME280_I2C_bus_write,
^
/home/esp32/esp/bme280-esp-idf-i2c/main/./main.c:144:16: note: (near initialization for 'bme280')
/home/esp32/esp/bme280-esp-idf-i2c/main/./main.c:145:3: error: unknown field 'bus_read' specified in initializer
.bus_read = BME280_I2C_bus_read,
^
/home/esp32/esp/bme280-esp-idf-i2c/main/./main.c:145:15: warning: excess elements in struct initializer
.bus_read = BME280_I2C_bus_read,
^
/home/esp32/esp/bme280-esp-idf-i2c/main/./main.c:145:15: note: (near initialization for 'bme280')
/home/esp32/esp/bme280-esp-idf-i2c/main/./main.c:146:3: error: unknown field 'dev_addr' specified in initializer
.dev_addr = BME280_I2C_ADDRESS2,
^
In file included from /home/esp32/esp/bme280-esp-idf-i2c/main/./main.c:9:0:
/home/esp32/esp/esp-idf/components/driver/include/driver/bme280.h:254:46: warning: excess elements in struct initializer
#define BME280_I2C_ADDRESS2 (0x77)
^
/home/esp32/esp/bme280-esp-idf-i2c/main/./main.c:146:15: note: in expansion of macro 'BME280_I2C_ADDRESS2'
.dev_addr = BME280_I2C_ADDRESS2,
^
/home/esp32/esp/esp-idf/components/driver/include/driver/bme280.h:254:46: note: (near initialization for 'bme280')
#define BME280_I2C_ADDRESS2 (0x77)
^
/home/esp32/esp/bme280-esp-idf-i2c/main/./main.c:146:15: note: in expansion of macro 'BME280_I2C_ADDRESS2'
.dev_addr = BME280_I2C_ADDRESS2,
^
/home/esp32/esp/bme280-esp-idf-i2c/main/./main.c:147:3: error: unknown field 'delay_msec' specified in initializer
.delay_msec = BME280_delay_msek
^
/home/esp32/esp/bme280-esp-idf-i2c/main/./main.c:147:17: warning: excess elements in struct initializer
.delay_msec = BME280_delay_msek
^
/home/esp32/esp/bme280-esp-idf-i2c/main/./main.c:147:17: note: (near initialization for 'bme280')
/home/esp32/esp/bme280-esp-idf-i2c/main/./main.c:143:18: error: storage size of 'bme280' isn't known
struct bme280_t bme280 = {
^
/home/esp32/esp/bme280-esp-idf-i2c/main/./main.c:143:18: warning: unused variable 'bme280' [-Wunused-variable]
make[1]: *** [main.o] Error 1
make: *** [component-main-build] Error 2

vibnwis
Posts: 89
Joined: Thu Aug 24, 2017 1:13 am

Re: compiling bme280 from yanbe

Postby vibnwis » Thu Aug 24, 2017 12:24 pm

After revisiting the yanbe repo, I found out the bme280.h and bme280.c have rerouted to Bocsh repo. Having clone from the site, I managed to remove all bme280 related errors. However, I faced the following errors.

CC /home/esp32/esp/bme280-esp-idf-i2c/build/nghttp/nghttp2/lib/nghttp2_session.o
/home/esp32/esp/esp-idf/components/nghttp/nghttp2/lib/nghttp2_session.c: In function 'nghttp2_session_get_remote_settings':
/home/esp32/esp/esp-idf/components/nghttp/nghttp2/lib/nghttp2_session.c:7132:1: error: control reaches end of non-void function [-Werror=return-type]
}
^
/home/esp32/esp/esp-idf/components/nghttp/nghttp2/lib/nghttp2_session.c: In function 'nghttp2_session_get_local_settings':
/home/esp32/esp/esp-idf/components/nghttp/nghttp2/lib/nghttp2_session.c:7152:1: error: control reaches end of non-void function [-Werror=return-type]
}
^
cc1: some warnings being treated as errors
make[1]: *** [nghttp2/lib/nghttp2_session.o] Error 1
make: *** [component-nghttp-build] Error 2
/home/esp32/esp/esp-idf/make/component_wrapper.mk:228: recipe for target 'nghttp2/lib/nghttp2_session.o' failed
/home/esp32/esp/esp-idf/make/project.mk:391: recipe for target 'component-nghttp-build' failed

Appreciate any comments ?

vibnwis
Posts: 89
Joined: Thu Aug 24, 2017 1:13 am

Re: compiling bme280 from yanbe

Postby vibnwis » Fri Aug 25, 2017 1:10 am

Further investigation I could resolve the error messages by adding

return 0;

at the end of the related functions.

However, if someone have better solution, I would like to hear it.

Thanks

tele_player
Posts: 90
Joined: Sun Jul 02, 2017 3:38 am

Re: compiling bme280 from yanbe

Postby tele_player » Fri Aug 25, 2017 4:20 am

That's a fine solution. Or, you could experiment with with changes to the compiler command, probably in a makefile or config file, to ignore this error.

onehorse
Posts: 70
Joined: Mon Feb 15, 2016 1:35 am

Re: compiling bme280 from yanbe

Postby onehorse » Sat Aug 26, 2017 4:16 am


Who is online

Users browsing this forum: Baidu [Spider] and 154 guests