Coder Social home page Coder Social logo

shelladdicted / bno055esp32 Goto Github PK

View Code? Open in Web Editor NEW
23.0 3.0 9.0 113 KB

C++ Interface for the Bosch-Sensortec's BNO055 compatible with Espressif's ESP32 SoC running esp-idf.

License: MIT License

C++ 99.85% CMake 0.15%
esp32 esp-idf bno055 imu uart-interface embedded-systems iot i2c i2c-sensors

bno055esp32's Introduction

BNO055ESP32

C++ Interface for the Bosch-Sensortec's BNO055 compatible with Espressif's ESP32 SoC running esp-idf.

Compatibility

Tested on ESP32D0WDQ6 (DevKitC) with Adafruit's BNO055 Breakout Board

Supported Interfaces

Interface Notes
UART Fully Supported
I²C Partially Supported*

*unstable (due to clock stretching)

Getting Started

NOTE: this code is not (yet) Production Ready.

You can use this as a managed-component for your project by adding the following to your idf_component.yml:

BNO055ESP32:
  path: .
  git: https://github.com/ShellAddicted/BNO055ESP32.git

Alternatively, you can use this as a component for your project:

mkdir components/
cd components/
git clone https://github.com/ShellAddicted/BNO055ESP32.git

Remember to enable Compiler Options -> Enable C++ Exceptions using idf.py menuconfig.

For more details see examples/

Wiring

IMU Pin UART I²C
PS1 3.3v GND
SCL UART RX (Default: GPIO_NUM_17) SCL (Default: GPIO_NUM_22)
SDA UART TX (Default: GPIO_NUM_16) SDA (Default: GPIO_NUM_21)

bno055esp32's People

Contributors

shelladdicted avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

bno055esp32's Issues

Unknown CMake command "register_component".

Hello,

I can't compile this example.
When running idf.py menuconfig, I end up with the following errors:

`
idf.py menuconfig
Checking Python dependencies...
Python requirements from /Users/marcel/esp/esp-idf/requirements.txt are satisfied.
Executing action: menuconfig
Running cmake in directory /Users/marcel/esp/components/BNO055ESP32/build
Executing "cmake -G Ninja -DPYTHON_DEPS_CHECKED=1 -DESP_PLATFORM=1 --warn-uninitialized -DCCACHE_ENABLE=0 /Users/marcel/esp/components/BNO055ESP32"...
Warn about uninitialized values.
-- The C compiler identification is AppleClang 11.0.3.11030032
-- The CXX compiler identification is AppleClang 11.0.3.11030032
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:4 (register_component):
Unknown CMake command "register_component".

-- Configuring incomplete, errors occurred!
See also "/Users/marcel/esp/components/BNO055ESP32/build/CMakeFiles/CMakeOutput.log".
cmake failed with exit code 1
`

abandoned?

sorry to be so direct: is this production ready or abandoned? As far as I can see there is no alternative to this

enableInterrupt() multiple interrupts routed to INT pin?

Hi,

i want to configure the BNO055 for using its interrupts signals. My setup consists of one ESP32 connected to a BNO055 Shuttle board from Bosch.

On page 40 inside the datasheet of the BNO055 sensor, it is described how to enable specific interrupts by setting the corresponding bits inside the INT_EN (address: 0x10) register. In order to route an interrupt to the INT pin, it is neccessary to set the corresponding bit inside the INT_MSK register (address: 0xF0).

Those two register in your case are named (see BNO055ESP32.h):

typedef enum {
    ...
    BNO055_REG_INT_MSK = 0x0F,
    BNO055_REG_INT_EN = 0x10,
    ...
} bno055_reg_t;

What i understood from your implementation so far is that you set the corresponding bits inside the register BNO055_REG_INT_MSK with the content of tmp[0] and BNO055_REG_INT_EN with the content of tmp[1] right?

But if useInterruptPin is true, tmp[1] | flag will only add the corresponding bit inside the BNO055_REG_INT_EN register while tmp[0] |= flag will do the same for the BNO055_REG_INT_MSK, so in this case we would have multiple interrupts enabled and masked for being routed to the INT pin or did i missed something?

void BNO055::enableInterrupt(uint8_t flag, bool useInterruptPin) {
    uint8_t tmp[2];
    setPage(1);

    readLen(BNO055_REG_INT_MSK, tmp, 2); 
    tmp[0] |= flag;                                                   
    tmp[1] = (useInterruptPin == true) ?  (tmp[1] | flag) : (tmp[1] & ~flag);   <--  tmp[0] & flag ? 
    writeLen(BNO055_REG_INT_MSK, tmp, 2);
}

So in order to route only the last "activated" interrupt to the INT pin, tmp[1] | flag has to be changed to tmp[0] & flag?

Reuse / License?

Thanks for your great work. I've been looking at different BNO055 libs and yours seems to work really well and the code is well structured. It would be great if I could use it in my robot vehicle project (https://bitbucket.org/ospringauf/mecanumrover). Unfortunately, I cannot do that, because my project uses the Eclipse Public License (EPL) which is incompatible with your license (GPL). Is there a specific reason why you chose the GPL?

Connection unstable

Hello,

@ShellAddicted: the examples work sometimes, most of the time I receive the following error:

uart: ALREADY NULL
E (1088) BNO055ESP32Example: Setup Failed, Error: timeout expired, if you see this often, try to increase timeoutMS.

The wiring should be ok, I increased the timeout MS from 30 to 50, 100 and even 1000 with the same result.
It seems, that only once the esp and bno055 had been disconnected from USB for several minutes, there is a chance that everything works as it should.
I experience the same behaviour with various BNO055s.
Is there a way to get this more stable by tweaking the config here and there, or is it known there is a degree of uncertainty whether the sensor will deliver values after booting the Esp-chip?

Is this working with ESP-IDF v5.1

Hello, first of all thanks for this repo, i want to ask you if you tried to build an example with the latest version of ESP-IDF (v5.1) because i have some weird errors:

  1. First of all i needed to add REQUIRES driver to CMakeLists.txt of the library, because ESP-IDF doesn't include driver by default anymore
  2. This is the error log during build:
[862/879] Building C object esp-idf/model/CMakeFiles/__idf_model.dir/BNO055.c.objFAILED: esp-idf/model/CMakeFiles/__idf_model.dir/BNO055.c.obj
ccache C:\Users\carme\.espressif\tools\xtensa-esp32-elf\esp-2022r1-11.2.0\xtensa-esp32-elf\bin\xtensa-esp32-elf-gcc.exe -DESP_PLATFORM -DIDF_VER=\"v5.1-dev-3196-g732df630cd\" -D_GNU_SOURCE -D_POSIX_READER_WRITER_LOCKS -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/examples/opcua-esp32-bno/build/config -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/examples/opcua-esp32-bno/components/model/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/examples/opcua-esp32-bno/components/open62541lib/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/examples/opcua-esp32-bno/components/BNO055ESP32/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/newlib/platform_include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/freertos/FreeRTOS-Kernel/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/freertos/esp_additions/include/freertos -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/freertos/esp_additions/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/esp_hw_support/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/esp_hw_support/include/soc -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/esp_hw_support/include/soc/esp32 -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/esp_hw_support/port/esp32/. -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/esp_hw_support/port/esp32/private_include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/heap/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/log/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/soc/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/soc/esp32 -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/soc/esp32/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/hal/esp32/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/hal/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/hal/platform_port/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/esp_rom/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/esp_rom/include/esp32 -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/esp_rom/esp32 -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/esp_common/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/esp_system/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/esp_system/port/soc -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/esp_system/port/include/private -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/xtensa/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/xtensa/esp32/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/lwip/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/lwip/include/apps -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/lwip/include/apps/sntp -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/lwip/lwip/src/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/lwip/port/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/lwip/port/freertos/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/lwip/port/esp32xx/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/lwip/port/esp32xx/include/arch -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/driver/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/driver/deprecated -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/driver/esp32/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/esp_pm/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/esp_ringbuf/include -mlongcalls -Wno-frame-address  -fdiagnostics-color=always -ffunction-sections -fdata-sections -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=unused-but-set-variable -Wno-error=deprecated-declarations -Wextra -Wno-unused-parameter -Wno-sign-compare -Wno-enum-conversion -gdwarf-4 -ggdb -Og -fmacro-prefix-map=C:/Users/carme/Documents/Haptica/IMU/esp-idf/examples/opcua-esp32-bno=. -fmacro-prefix-map=C:/Users/carme/Documents/Haptica/IMU/esp-idf=/IDF -fstrict-volatile-bitfields -fno-jump-tables -fno-tree-switch-conversion -DconfigENABLE_FREERTOS_DEBUG_OCDAWARE=1 -std=gnu17 -Wno-old-style-declaration -Wno-error=format= -Wno-format -MD -MT esp-idf/model/CMakeFiles/__idf_model.dir/BNO055.c.obj -MF esp-idf\model\CMakeFiles\__idf_model.dir\BNO055.c.obj.d -o esp-idf/model/CMakeFiles/__idf_model.dir/BNO055.c.obj -c C:/Users/carme/Documents/Haptica/IMU/esp-idf/examples/opcua-esp32-bno/components/model/BNO055.c
In file included from C:/Users/carme/Documents/Haptica/IMU/esp-idf/examples/opcua-esp32-bno/components/model/BNO055.c:2
:
C:/Users/carme/Documents/Haptica/IMU/esp-idf/examples/opcua-esp32-bno/components/BNO055ESP32/include/BNO055ESP32.h:33:10: fatal error: cstring: No such file or directory
   33 | #include <cstring>  //memset, memcpy
      |          ^~~~~~~~~
compilation terminated.
[865/879] Building CXX object esp-idf/BNO055ESP32/CMakeFiles/__idf_BNO055ESP32.dir/BNO055ESP32.cpp.objFAILED: esp-idf/BNO055ESP32/CMakeFiles/__idf_BNO055ESP32.dir/BNO055ESP32.cpp.obj
ccache C:\Users\carme\.espressif\tools\xtensa-esp32-elf\esp-2022r1-11.2.0\xtensa-esp32-elf\bin\xtensa-esp32-elf-g++.exe -DESP_PLATFORM -DIDF_VER=\"v5.1-dev-3196-g732df630cd\" -D_GNU_SOURCE -D_POSIX_READER_WRITER_LOCKS -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/examples/opcua-esp32-bno/build/config -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/examples/opcua-esp32-bno/components/BNO055ESP32/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/newlib/platform_include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/freertos/FreeRTOS-Kernel/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/freertos/esp_additions/include/freertos -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/freertos/esp_additions/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/esp_hw_support/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/esp_hw_support/include/soc -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/esp_hw_support/include/soc/esp32 -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/esp_hw_support/port/esp32/. -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/esp_hw_support/port/esp32/private_include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/heap/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/log/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/soc/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/soc/esp32 -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/soc/esp32/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/hal/esp32/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/hal/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/hal/platform_port/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/esp_rom/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/esp_rom/include/esp32 -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/esp_rom/esp32 -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/esp_common/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/esp_system/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/esp_system/port/soc -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/esp_system/port/include/private -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/xtensa/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/xtensa/esp32/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/lwip/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/lwip/include/apps -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/lwip/include/apps/sntp -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/lwip/lwip/src/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/lwip/port/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/lwip/port/freertos/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/lwip/port/esp32xx/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/lwip/port/esp32xx/include/arch -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/driver/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/driver/deprecated -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/driver/esp32/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/esp_pm/include -IC:/Users/carme/Documents/Haptica/IMU/esp-idf/components/esp_ringbuf/include -mlongcalls -Wno-frame-address  -fdiagnostics-color=always -ffunction-sections -fdata-sections -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=unused-but-set-variable -Wno-error=deprecated-declarations -Wextra -Wno-unused-parameter -Wno-sign-compare -Wno-enum-conversion -gdwarf-4 -ggdb -Og -fmacro-prefix-map=C:/Users/carme/Documents/Haptica/IMU/esp-idf/examples/opcua-esp32-bno=. -fmacro-prefix-map=C:/Users/carme/Documents/Haptica/IMU/esp-idf=/IDF -fstrict-volatile-bitfields -fno-jump-tables -fno-tree-switch-conversion -DconfigENABLE_FREERTOS_DEBUG_OCDAWARE=1 -std=gnu++20 -fno-exceptions -fno-rtti -MD -MT esp-idf/BNO055ESP32/CMakeFiles/__idf_BNO055ESP32.dir/BNO055ESP32.cpp.obj -MF esp-idf\BNO055ESP32\CMakeFiles\__idf_BNO055ESP32.dir\BNO055ESP32.cpp.obj.d -o esp-idf/BNO055ESP32/CMakeFiles/__idf_BNO055ESP32.dir/BNO055ESP32.cpp.obj -c C:/Users/carme/Documents/Haptica/IMU/esp-idf/examples/opcua-esp32-bno/components/BNO055ESP32/BNO055ESP32.cpp
In file included from C:/Users/carme/Documents/Haptica/IMU/esp-idf/examples/opcua-esp32-bno/components/BNO055ESP32/BNO055ESP32.cpp:29:
C:/Users/carme/Documents/Haptica/IMU/esp-idf/examples/opcua-esp32-bno/components/BNO055ESP32/include/BNO055ESP32.h:666:61: error: 'const uart_config_t' has no non-static data member named 'use_ref_tick'
  666 |                                        .use_ref_tick = false};
      |                                                             ^
C:/Users/carme/Documents/Haptica/IMU/esp-idf/examples/opcua-esp32-bno/components/BNO055ESP32/BNO055ESP32.cpp: In member function 'void BNO055::i2c_readLen(uint8_t, uint8_t*, uint8_t, uint32_t)':
C:/Users/carme/Documents/Haptica/IMU/esp-idf/examples/opcua-esp32-bno/components/BNO055ESP32/BNO055ESP32.cpp:101:45: error: exception handling disabled, use '-fexceptions' to enable
  101 |     if (err != ESP_OK) throw BNO055I2CError();
      |                                             ^
C:/Users/carme/Documents/Haptica/IMU/esp-idf/examples/opcua-esp32-bno/components/BNO055ESP32/BNO055ESP32.cpp: In member function 'void BNO055::uart_readLen(bno055_reg_t, uint8_t*, uint8_t, uint32_t)':
C:/Users/carme/Documents/Haptica/IMU/esp-idf/examples/opcua-esp32-bno/components/BNO055ESP32/BNO055ESP32.cpp:173:79: error: 'portTICK_RATE_MS' was not declared in this scope; did you mean 'portTICK_PERIOD_MS'?
  173 |             rxBytes = uart_read_bytes(_uartPort, data, (len + 2), timeoutMS / portTICK_RATE_MS);
      |                                                                               ^~~~~~~~~~~~~~~~
      |                                                                               portTICK_PERIOD_MS
C:/Users/carme/Documents/Haptica/IMU/esp-idf/examples/opcua-esp32-bno/components/BNO055ESP32/BNO055ESP32.cpp: In member function 'void BNO055::uart_writeLen(bno055_reg_t, uint8_t*, uint8_t, uint32_t)':
C:/Users/carme/Documents/Haptica/IMU/esp-idf/examples/opcua-esp32-bno/components/BNO055ESP32/BNO055ESP32.cpp:234:71: error: 'portTICK_RATE_MS' was not declared in this scope; did you mean 'portTICK_PERIOD_MS'?
  234 |             rxBytes = uart_read_bytes(_uartPort, data, 2, timeoutMS / portTICK_RATE_MS);
      |                                                                       ^~~~~~~~~~~~~~~~
      |                                                                       portTICK_PERIOD_MS
C:/Users/carme/Documents/Haptica/IMU/esp-idf/examples/opcua-esp32-bno/components/BNO055ESP32/BNO055ESP32.cpp: In member function 'void BNO055::reset()':
C:/Users/carme/Documents/Haptica/IMU/esp-idf/examples/opcua-esp32-bno/components/BNO055ESP32/BNO055ESP32.cpp:409:9: error: 'gpio_pad_select_gpio' was not declared in this scope; did you mean 'esp_rom_gpio_pad_select_gpio'?
  409 |         gpio_pad_select_gpio(_rstPin);
      |         ^~~~~~~~~~~~~~~~~~~~
      |         esp_rom_gpio_pad_select_gpio
C:/Users/carme/Documents/Haptica/IMU/esp-idf/examples/opcua-esp32-bno/components/BNO055ESP32/BNO055ESP32.cpp: In member function 'void BNO055::begin()':
C:/Users/carme/Documents/Haptica/IMU/esp-idf/examples/opcua-esp32-bno/components/BNO055ESP32/BNO055ESP32.cpp:793:9: error: 'gpio_pad_select_gpio' was not declared in this scope; did you mean 'esp_rom_gpio_pad_select_gpio'?
  793 |         gpio_pad_select_gpio(_intPin);
      |         ^~~~~~~~~~~~~~~~~~~~
      |         esp_rom_gpio_pad_select_gpio
C:/Users/carme/Documents/Haptica/IMU/esp-idf/examples/opcua-esp32-bno/components/BNO055ESP32/BNO055ESP32.cpp: In member function 'void BNO055::stop()':
C:/Users/carme/Documents/Haptica/IMU/esp-idf/examples/opcua-esp32-bno/components/BNO055ESP32/BNO055ESP32.cpp:814:7: error: '...' handler must be the last handler for its try block [-fpermissive]
  814 |     } catch (BNO055BaseException &exc) {
      |       ^~~~~

Did you have some ideas?
Thanks a lot!

enum BNO055_CONF_ACCEL_BANDWIDTH_500HZ wrong

It looks like this type definition is wrong (BNO055ESP32.h, line 304):

typedef enum {
    BNO055_CONF_ACCEL_BANDWIDTH_7_81HZ = 0x00,
    BNO055_CONF_ACCEL_BANDWIDTH_15_63HZ = 0x04,
    BNO055_CONF_ACCEL_BANDWIDTH_31_25HZ = 0x08,
    BNO055_CONF_ACCEL_BANDWIDTH_62_5HZ = 0x0C,
    BNO055_CONF_ACCEL_BANDWIDTH_125HZ = 0x10,
    BNO055_CONF_ACCEL_BANDWIDTH_250HZ = 0x14,
    BNO055_CONF_ACCEL_BANDWIDTH_500HZ = 0x08,    <---
    BNO055_CONF_ACCEL_BANDWIDTH_1000HZ = 0x1C
} bno055_accel_bandwidth_t;

It has to be 0x18 in order to configure the sensor for 500Hz bandwidth.

Greetings,
Joe

Original firmware of the yeelight lamp

I apologize for writing the wrong repository.
I want to recreate the yeelight LXV1.7 board from the xiaomi desk lamp for use as a ceiling light control board.
I have esp8266, but I do not have such a lamp, if you have a copy of the firmware or you are interested in the idea, I would be very happy if you post the original yeelight firmware image.

Compilation error with latest esp-idf: string not found.

Hi! Thanks for the great work. I am trying to use this driver in my project, but have compilation error.
As soon as I include #include "BNO055ESP32.h" in my source, I get string related error

make
Toolchain path: ~/esp/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc
Toolchain version: crosstool-ng-1.22.0-80-g6c4433a
Compiler version: 5.2.0
Python requirements from ~/esp/esp-idf/requirements.txt are satisfied.
fatal: bad revision 'HEAD'
Project do not have git repo, it needs to get PROJECT_VER from `git describe` command.
App "awifi" version: ""
CC build/app_update/esp_app_desc.o
AR build/app_update/libapp_update.a
CC build/main/main.o
In file included from ~/esp/awifi/main/main.c:2:0:
~/esp/awifi/components/BNO055ESP32/src/BNO055ESP32.h:33:18: fatal error: string: No such file or directory
compilation terminated.
make[1]: *** [~esp/esp-idf/make/component_wrapper.mk:292: main.o] Ошибка 1
make: *** [~esp/esp-idf/make/project.mk:527: component-main-build] Ошибка 2

Error string is #include <string>. If I change it to #include "string.h" I got screen full of errors like:

In file included from ~/esp/awifi/components/BNO055ESP32/src/BNO055ESP32.cpp:28:0:
~/esp/awifi/components/BNO055ESP32/src/BNO055ESP32.h:462:7: error: 'string' in namespace 'std' does not name a type
  std::string _msg;

Without including bno055 header everything works fine. I am new to esp-idf, so maybe its stupid question.
What I doing wrong?

interrupt example not working

Hi,

currently I try to get your example of enabling interrupts working. I am wondering about to correct wiring. To which pin of the ESP32 do i have to route the INT pin of the BNO055, because if i define e.g. GPIO_NUM_16, your example seems not working.

	/* setup I²C */
	i2c_config_t conf;
	conf.mode = I2C_MODE_MASTER;
	conf.sda_io_num = GPIO_NUM_21;
	conf.scl_io_num = GPIO_NUM_22;
	conf.sda_pullup_en = GPIO_PULLUP_DISABLE;
	conf.scl_pullup_en = GPIO_PULLUP_DISABLE;
	conf.master.clk_speed = 1000000;
	i2c_param_config(I2C_NUM_0, &conf);
	i2c_driver_install(I2C_NUM_0, I2C_MODE_MASTER, 0, 0, 0);
	i2c_set_timeout(I2C_NUM_0, 56000);

	/* BNO055 I2C Addr can be 0x28 or 0x29 (depends on your hardware) */
	ESP_LOGD(TAG, "start BNO055 I2C init");  // DEBUG
	bno = new BNO055((i2c_port_t) I2C_NUM_0, 0x29, GPIO_NUM_MAX, GPIO_NUM_16);

        ....

	/* setup sensor */
	try {
		/* BNO055 is in CONFIG_MODE until it is changed */
		bno->begin();
		bno->enableExternalCrystal();

		bno->setPwrModeNormal();
		bno->setAccelAnyMotionInterrupt(2, 2, true, true, true);  // configure the interrupt, see datasheet for more details.
		bno->setAccelNoMotionInterrupt(0, 0, true, true, true);
		bno->enableAccelAnyMotionInterrupt(true);  // you can disable it with disableAccelAnyMotionInterrupt();
		bno->enableAccelNoMotionInterrupt(true);
		bno->setOprModeNdof();

		ESP_LOGI(TAG, "Setup Done.");
	} catch (BNO055BaseException &ex) {
		ESP_LOGE(TAG, "Setup Failed, Error: %s", ex.what());
		return;
	} catch (std::exception &ex) {
		ESP_LOGE(TAG, "Setup Failed, Error: %s", ex.what());
		return;
	}

	int16_t sw = bno->getSWRevision();
	uint8_t bl_rev = bno->getBootloaderRevision();
	ESP_LOGI(TAG, "SW rev: %d, bootloader rev: %u", sw, bl_rev);

        ....

I am using the BNO055 Shuttle Board and my connection is the following:

/*
 * PS1 -> GND (LOW) -> Enables I²C protocol
 * SCL -> SCL (Default: GPIO_NUM_22)
 * SDA -> SDA (Default: GPIO_NUM_21)
 * INT  -> GPIO_NUM_16
*/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.