h2zero / NimBLE-Arduino

A fork of the NimBLE library structured for compilation with Arduino, for use with ESP32, nRF5x.
https://h2zero.github.io/NimBLE-Arduino/
Apache License 2.0
672 stars 138 forks source link

Value of CONFIG_BT_NIMBLE_NVS_PERSIST is ignored by compiler #518

Closed Staars closed 1 year ago

Staars commented 1 year ago

In esp_nimble_cfg.h the existence of a #define for CONFIG_BT_NIMBLE_NVS_PERSIST is checked, but the value is ignored, so (at least for my compiler) this always sets MYNEWT_VAL_BLE_STORE_CONFIG_PERSIST to 1. I am not totally sure, if this is undefined behavior and may work for some compilers or if it is completely wrong.

For me this change works:

#ifndef MYNEWT_VAL_BLE_STORE_CONFIG_PERSIST
#if     CONFIG_BT_NIMBLE_NVS_PERSIST==1
#define MYNEWT_VAL_BLE_STORE_CONFIG_PERSIST (1)
#else
#define MYNEWT_VAL_BLE_STORE_CONFIG_PERSIST (0)
#endif
#endif
h2zero commented 1 year ago

Thanks, I'll have a look into this.

h2zero commented 1 year ago

You're correct, I will update this shortly.