Skip to content

Use designated initializer for NimBLEScan parameters and conditionally set disable_observer_mode#400

Merged
h2zero merged 3 commits intoh2zero:masterfrom
stdstijn:master
Mar 14, 2026
Merged

Use designated initializer for NimBLEScan parameters and conditionally set disable_observer_mode#400
h2zero merged 3 commits intoh2zero:masterfrom
stdstijn:master

Conversation

@stdstijn
Copy link
Contributor

Use designated initializer for NimBLEScan::m_scanParams and guard disable_observer_mode field for ESP-IDF >= 5.4.2

The NimBLEScan constructor previously used positional struct initialization, which no longer matches the ble_gap_disc_params layout in newer ESP-IDF versions (>= 5.4.2) where the field disable_observer_mode was added.

This is caused by -Wmissing-field-initializers.

Switch to designated initializers to make the field assignments explicit and more robust across ESP-IDF/NimBLE revisions. The new field is only initialized when building against ESP-IDF 5.4.2 or later to maintain backwards compatibility.

…able_observer_mode field for ESP-IDF >= 5.4.2

The NimBLEScan constructor previously used positional struct initialization,
which no longer matches the ble_gap_disc_params layout in newer ESP-IDF
versions (>= 5.4.2) where the field `disable_observer_mode` was added.

This is caused by -Wmissing-field-initializers.

Switch to designated initializers to make the field assignments explicit
and more robust across ESP-IDF/NimBLE revisions. The new field is only
initialized when building against ESP-IDF 5.4.2 or later to maintain
backwards compatibility.
@stdstijn
Copy link
Contributor Author

stdstijn commented Mar 12, 2026

Proposed fix for issue #374

@h2zero
Copy link
Owner

h2zero commented Mar 13, 2026

Thanks!

Can you please add additional conditional of #if defined(ESP_PLATFORM) && #if !defined(CONFIG_USING_NIMBLE_COMPONENT) above this one?

@stdstijn
Copy link
Contributor Author

Done, if I understand your suggestion correctly.

@h2zero
Copy link
Owner

h2zero commented Mar 13, 2026

Perfect, thanks!

@h2zero h2zero merged commit a0a8db9 into h2zero:master Mar 14, 2026
75 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

missing initialize for member 'ble_gap_desc_params::disable_observer_mode' in NimBLEScan.cpp:37:7

2 participants