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
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions code/nrf-connect/samples/ble/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,20 @@ static int prst_init() {
return 0;
}

static void dump_config() {
#if IS_ENABLED(CONFIG_PRST_BLE_ENCODING_BTHOME_V2)
LOG_INF("Payload encoding: BTHOME_V2");
#elif IS_ENABLED(CONFIG_PRST_BLE_ENCODING_BTHOME_V1)
LOG_INF("Payload encoding: BTHOME_V1");
#elif IS_ENABLED(CONFIG_PRST_BLE_ENCODING_BPARASITE_V2)
LOG_INF("Payload encoding: BPARASITE_V2");
#else
#error "Unhandled CONFIG_PRST_BLE_ENCODING_ choice in dump_config()"
#endif

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

static int prst_loop(prst_sensors_t *sensors) {
RET_IF_ERR(prst_sensors_read_all(sensors));
RET_IF_ERR(prst_ble_adv_set_data(sensors));
Expand All @@ -34,6 +48,9 @@ static int prst_loop(prst_sensors_t *sensors) {
int main(void) {
__ASSERT(!prst_init(), "Error in prst_init()");
prst_led_flash(2);

dump_config();

prst_sensors_t sensors;
while (true) {
__ASSERT(!prst_loop(&sensors), "Error in prst_loop()");
Expand Down
Loading