Sensirion / arduino-ble-gadget

Create your own Do-It-Yourself BLE enabled sensor gadget on the ESP32 platform.
BSD 3-Clause "New" or "Revised" License
62 stars 20 forks source link

no member named 'converterFunction' - Complilation fails #33

Closed sighmon closed 5 months ago

sighmon commented 6 months ago

Hi there,

I've just bought a Sparkfun ESP32-C6 to use with an Adafruit SCD30.

In the past I've had success building for an Adafruit ESP32-C3, but am running into these errors:

In file included from /Users/simos/Library/Arduino15/packages/esp32/tools/esp32-arduino-libs/idf-release_v5.1-3662303f31/esp32c6/include/bt/include/esp32c6/include/esp_bt.h:17,
                 from /Users/simos/Documents/Arduino/libraries/NimBLE-Arduino/src/NimBLEDevice.h:46,
                 from /Users/simos/Documents/Arduino/libraries/Sensirion_Gadget_BLE_Arduino_Lib/src/NimBLELibraryWrapper.cpp:2:
/Users/simos/Library/Arduino15/packages/esp32/tools/esp32-arduino-libs/idf-release_v5.1-3662303f31/esp32c6/include/bt/common/api/include/api/../../../../controller/esp32c6/esp_bt_cfg.h:19:10: fatal error: syscfg/syscfg.h: No such file or directory
   19 | #include "syscfg/syscfg.h"
      |          ^~~~~~~~~~~~~~~~~
compilation terminated.
exit status 1

Compilation error: exit status 1

Guessing it was related to: https://github.com/h2zero/NimBLE-Arduino/issues/642

I tried using this branch: https://github.com/h2zero/NimBLE-Arduino/tree/esp32-c6-test

In file included from /Users/simos/Documents/Arduino/libraries/Sensirion_Gadget_BLE_Arduino_Lib/src/AdvertisementHeader.h:34,
                 from /Users/simos/Documents/Arduino/libraries/Sensirion_Gadget_BLE_Arduino_Lib/src/DataProvider.h:34,
                 from /Users/simos/Documents/Arduino/libraries/Sensirion_Gadget_BLE_Arduino_Lib/src/Sensirion_Gadget_BLE.h:35,
                 from /Users/simos/Documents/Arduino/Sensirion_Example2_SCD30_BLE_Gadget/Sensirion_Example2_SCD30_BLE_Gadget.ino:1:
/Users/simos/Documents/Arduino/libraries/Sensirion_Gadget_BLE_Arduino_Lib/src/ByteArray.h:40:10: error: 'string' in namespace 'std' does not name a type
   40 |     std::string getDataString() {
      |          ^~~~~~
/Users/simos/Documents/Arduino/libraries/Sensirion_Gadget_BLE_Arduino_Lib/src/ByteArray.h:1:1: note: 'std::string' is defined in header '<string>'; did you forget to '#include <string>'?
  +++ |+#include <string>
    1 | /*

exit status 1

Compilation error: exit status 1

So then I added #include <string> to Arduino/libraries/Sensirion_Gadget_BLE_Arduino_Lib/src/ByteArray.h

/Users/simos/Documents/Arduino/libraries/Sensirion_Gadget_BLE_Arduino_Lib/src/DataProvider.cpp: In member function 'void DataProvider::writeValueToCurrentSample(float, SignalType)':
/Users/simos/Documents/Arduino/libraries/Sensirion_Gadget_BLE_Arduino_Lib/src/DataProvider.cpp:42:50: error: 'std::map<SignalType, SampleSlot>::mapped_type' {aka 'struct SampleSlot'} has no member named 'converterFunction'
   42 |         _sampleConfig.sampleSlots.at(signalType).converterFunction;
      |                                                  ^~~~~~~~~~~~~~~~~

exit status 1

Compilation error: exit status 1
qfisch commented 5 months ago

Hello @sighmon ,

What version of Sensirion_UPT_Core do you have installed ? In 0.3.0 some changes have been made and BLE gadget is not compatible yet.

Q.

sighmon commented 5 months ago

@qfisch Thanks for the update. I've got:

Is there a combination that I should be able to build with now? Or wait until BLE gadget is updated?

qfisch commented 5 months ago

@sighmon : You can get UPT Core 0.2.0 from the repository as a zip and load it into the Arduino IDE using "Load .Zip library" That should allow you to continue with your project until we update this library

Q.

qfisch commented 5 months ago

Hej @sighmon

in the end the changes were already done in code but were never released. I created the version 1.3.0 which include the necessary changes to be compatible with the latest "UPT Core"

Q.

sighmon commented 5 months ago

@qfisch I'm still seeing this error when trying to compile with:

/Users/simos/Documents/Arduino/libraries/arduino-ble-gadget/src/ByteArray.h:40:10: error: 'string' in namespace 'std' does not name a type
   40 |     std::string getDataString() {
      |          ^~~~~~
qfisch commented 5 months ago

@qfisch I'm still seeing this error when trying to compile with:

* Sensirion Core `0.6.0`

* Sensirion UPT Core `0.3.0`

* Sensirion Gadget BLE Arduino Lib `v1.3.0`:
/Users/simos/Documents/Arduino/libraries/arduino-ble-gadget/src/ByteArray.h:40:10: error: 'string' in namespace 'std' does not name a type
   40 |     std::string getDataString() {
      |          ^~~~~~

Hej @sighmon

Yes this release only solved the dependency issue with UPT Core. We would need to look further at the usage of string within the lib... For now adding #include <string> seems to be a reasonable workaround