Skip to content

Allow CONFIG_BT_NIMBLE_MAX_CONNECTIONS to be defined by project #156

@fvanroie

Description

@fvanroie

CONFIG_BT_NIMBLE_MAX_CONNECTIONS is defined solely in the nimconfig.h header of the library. This requires a change to the library file to increase the number of connections. To make it more portable, I would like to define this macro in the bluild_flags of my PlatformIO project, like so:

build_flags =
    -D CONFIG_NIMBLE_CPP_ENABLE_RETURN_CODE_TEXT
    -D CONFIG_BT_NIMBLE_MAX_CONNECTIONS=9

This currently generates a compiler warning, because it's already defined:

.pio/libdeps/lolind32pro-lolintft24/NimBLE-Arduino/src/nimconfig.h:105:0: warning: "CONFIG_BT_NIMBLE_MAX_CONNECTIONS" 
redefined #define CONFIG_BT_NIMBLE_MAX_CONNECTIONS 3

It would be nice if the #define in the nimconfig.h header would be enclosed by #ifndef checks:

#ifndef CONFIG_BT_NIMBLE_MAX_CONNECTIONS
#define CONFIG_BT_NIMBLE_MAX_CONNECTIONS 3
#endif

This way, the macro can be set in the project without the need to touch any of the library files. This is especially handy when using the platformio library version of NimBLE-Arduino. The change will be transparent for users that don't use build flags.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions