Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BLE sample] Log sleep interval and encoding on boot #223

Merged
merged 7 commits into from
Feb 3, 2025

Conversation

ryanrolds
Copy link
Contributor

  • Adding configuration logging to start-up
  • Added more detail to the BLE project configuration

Copy link
Owner

@rbaron rbaron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use a more descriptive commit message title. Something like "[BLE sample] Log sleep interval and encoding on boot".

# The amount of time it sleeps between sending data.
CONFIG_PRST_SLEEP_DURATION_MSEC=600000

# Choose one of the following encoding options:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would refrain from exhaustively listing options in the prj.conf file. Reasoning:

  • Why list some configs and not others?
  • Why only in prj.conf and not prj_debug.conf?
  • More importantly, this list will go stale once we add or remove some of these options.

A quick example and pointing to Kconfig for details is enough, as before.

LOG_INF("Payload Encoding: BPARASITE_V2");
}

LOG_INF("Sleep duration: %d", CONFIG_PRST_SLEEP_DURATION_MSEC);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add unit " ms"

@@ -34,6 +34,17 @@ static int prst_loop(prst_sensors_t *sensors) {
int main(void) {
__ASSERT(!prst_init(), "Error in prst_init()");
prst_led_flash(2);

if (IS_ENABLED(CONFIG_PRST_BLE_ENCODING_BTHOME_V2)) {
Copy link
Owner

@rbaron rbaron Dec 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will silently output nothing when new encoding schemes are introduced. We have this information at compile time, we can also avoid paying the binary size cost for all these strings.

static void dump_config() {

#if IS_ENABLED(CONFIG_PRST_BLE_ENCODING_BTHOME_V2)
// Only capitalize first letter.
  LOG_INFO("Payload encoding: BTHOME_V2");
#else if ...
...
#else
#error "Unhandled CONFIG_PRST_BLE_ENCODING_ choice in dump_config()"
#endif

  LOG_INF("Sleep duration: %d ms", CONFIG_PRST_SLEEP_DURATION_MSEC);
}

int main(void) {
  ...

  dump_config();

  ...
}

@ryanrolds ryanrolds changed the title Production ergonomics improvements [BLE sample] Log sleep interval and encoding on boot Dec 2, 2024
@ryanrolds
Copy link
Contributor Author

Thank you for the feedback. I will correct my PR in the next few days.

@ryanrolds
Copy link
Contributor Author

This hasn't fallen off my rader. I've had a lot going on.

@ryanrolds
Copy link
Contributor Author

Confirming I haven't forgotten about this. It's approaching the top of my todos.

@ryanrolds
Copy link
Contributor Author

Adjustments made here is the output from trying the options:

*** Booting nRF Connect SDK v2.7.0-f783fe7fd18a ***
*** Using Zephyr OS v3.6.99-100befc70c74 ***
[00:00:00.000,549] <inf> bt_sdc_hci_driver: SoftDevice Controller build revision:
                                            d6 da c7 ae 08 db 72 6f  2a a3 26 49 2a 4d a8 b3 |......ro *.&I*M..
                                            98 0e 07 7f                                      |....
[00:00:00.003,814] <inf> bt_hci_core: HW Platform: Nordic Semiconductor (0x0002)
[00:00:00.003,845] <inf> bt_hci_core: HW Variant: nRF52x (0x0002)
[00:00:00.003,875] <inf> bt_hci_core: Firmware: Standard Bluetooth controller (0x00) Version 214.51162 Build 1926957230
[00:00:00.005,126] <inf> bt_hci_core: Identity: FB:BF:D1:84:C6:B2 (random)
[00:00:00.005,157] <inf> bt_hci_core: HCI: version 5.4 (0x0d) revision 0x11fb, manufacturer 0x0059
[00:00:00.005,187] <inf> bt_hci_core: LMP: version 5.4 (0x0d) subver 0x11fb
[00:00:00.005,218] <inf> ble[00:00:00.805,511] <inf> main: Payload encoding: BTHOME_V2
[00:00:00.805,541] <inf> main: Sleep duration: 600000 ms
*** Booting nRF Connect SDK v2.7.0-f783fe7fd18a ***
*** Using Zephyr OS v3.6.99-100befc70c74 ***
[00:00:00.000,549] <inf> bt_sdc_hci_driver: SoftDevice Controller build revision:
                                            d6 da c7 ae 08 db 72 6f  2a a3 26 49 2a 4d a8 b3 |......ro *.&I*M..
                                            98 0e 07 7f                                      |....
[00:00:00.003,784] <inf> bt_hci_core: HW Platform: Nordic Semiconductor (0x0002)
[00:00:00.003,814] <inf> bt_hci_core: HW Variant: nRF52x (0x0002)
[00:00:00.003,845] <inf> bt_hci_core: Firmware: Standard Bluetooth controller (0x00) Version 214.51162 Build 1926957230
[00:00:00.005,096] <inf> bt_hci_core: Identity: FB:BF:D1:84:C6:B2 (random)
[00:00:00.005,126] <inf> bt_hci_core: HCI: version 5.4 (0x0d) revision 0x11fb, manufacturer 0x0059
[00:00:00.005,187] <inf> bt_hci_core: LMP: version 5.4 (0x0d) subver 0x11fb
[00:00:00.005,187] <inf> ble[00:00:00.805,511] <inf> main: Payload encoding: BTHOME_V1
[00:00:00.805,541] <inf> main: Sleep duration: 600000 ms
*** Booting nRF Connect SDK v2.7.0-f783fe7fd18a ***
*** Using Zephyr OS v3.6.99-100befc70c74 ***
[00:00:00.000,549] <inf> bt_sdc_hci_driver: SoftDevice Controller build revision:
                                            d6 da c7 ae 08 db 72 6f  2a a3 26 49 2a 4d a8 b3 |......ro *.&I*M..
                                            98 0e 07 7f                                      |....
[00:00:00.003,814] <inf> bt_hci_core: HW Platform: Nordic Semiconductor (0x0002)
[00:00:00.003,845] <inf> bt_hci_core: HW Variant: nRF52x (0x0002)
[00:00:00.003,875] <inf> bt_hci_core: Firmware: Standard Bluetooth controller (0x00) Version 214.51162 Build 1926957230
[00:00:00.005,096] <inf> bt_hci_core: Identity: FB:BF:D1:84:C6:B2 (random)
[00:00:00.005,126] <inf> bt_hci_core: HCI: version 5.4 (0x0d) revision 0x11fb, manufacturer 0x0059
[00:00:00.005,187] <inf> bt_hci_core: LMP: version 5.4 (0x0d) subver 0x11fb
[00:00:00.005,187] <inf> ble[00:00:00.805,511] <inf> main: Payload encoding: BPARASITE_V2
[00:00:00.805,541] <inf> main: Sleep duration: 600000 ms

@ryanrolds ryanrolds requested a review from rbaron February 3, 2025 02:06
@rbaron rbaron merged commit dbde189 into rbaron:main Feb 3, 2025
14 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.

2 participants