From 2a44e2ea37ff2304be543c57aaf5b05960aea1a0 Mon Sep 17 00:00:00 2001 From: "Morgan 'ARR\\!' Allen" Date: Wed, 28 Oct 2020 17:08:55 -0700 Subject: [PATCH] make BLE name build time configurable --- main/Kconfig.projbuild | 47 ++++-------------------------------------- main/ble.c | 4 +++- sdkconfig.defaults | 1 + 3 files changed, 8 insertions(+), 44 deletions(-) diff --git a/main/Kconfig.projbuild b/main/Kconfig.projbuild index 6d54446..8790ce4 100644 --- a/main/Kconfig.projbuild +++ b/main/Kconfig.projbuild @@ -1,44 +1,5 @@ -menu "LoRComm Config" - menuconfig LORCOMM_GPS_ENABLED - bool "Enable GPS receiver" - help - Enables attached GPS receiver - - if LORCOMM_GPS_ENABLED - config LORCOMM_GPS_RX - int "GPS RX Pin" - default 13 - help - GPIO to receive data from GPS receiver - endif - - choice LORCOMM_BUTTON_ACTION - bool "User Button Action" - default LORCOMM_BUTTON_ACTION_HELO - help - Selection action to be performed when the user button - is pressed. - - config LORCOMM_BUTTON_ACTION_NONE - bool "Do nothing" - help - Do nothing - - config LORCOMM_BUTTON_ACTION_HELO - bool "Send HELO" - help - Send out a HELO packet and listen for response - - if LORCOMM_GPS_ENABLED - config LORCOMM_BUTTON_ACTION_GPS - bool "Send GPS" - help - Sends GPS coordinates and listens for ACK. - endif - endchoice - - config LORCOMM_BUTTON_ACTION_ENABLED - bool - default n if LORCOMM_BUTTON_ACTION_NONE - default y +menu "Barback" + config BARBACK_ID + string "BLE Device Name" + default "Barback" endmenu diff --git a/main/ble.c b/main/ble.c index 84099cf..3a6e8a4 100644 --- a/main/ble.c +++ b/main/ble.c @@ -426,7 +426,9 @@ void ble_init() { err = ble_gatts_add_svcs(service_defs); ESP_ERROR_CHECK(err); - err = ble_svc_gap_device_name_set(device_name); + ESP_LOGI(TAG, "Setting device name: %s", CONFIG_BARBACK_ID); + + err = ble_svc_gap_device_name_set(CONFIG_BARBACK_ID); ESP_ERROR_CHECK(err); nimble_port_freertos_init(nimble_host_task); diff --git a/sdkconfig.defaults b/sdkconfig.defaults index a22d810..deebb93 100644 --- a/sdkconfig.defaults +++ b/sdkconfig.defaults @@ -1,2 +1,3 @@ +BARBACK_ID=Barback CONFIG_BT_ENABLED=y CONFIG_BT_NIMBLE_ENABLED=y