Skip to content

Commit

Permalink
app: allow DFU and Sidewalk to run in parallel
Browse files Browse the repository at this point in the history
remove disabling of Sidewalk when entering to DFU mode

Signed-off-by: Robert Gałat <robert.galat@nordicsemi.no>
  • Loading branch information
RobertGalatNordic committed Nov 13, 2024
1 parent 871ea7b commit 1b9529d
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 10 deletions.
4 changes: 0 additions & 4 deletions samples/sid_end_device/src/hello/app.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,13 +269,9 @@ static void app_btn_dfu_state(uint32_t unused)
ARG_UNUSED(unused);
static bool go_to_dfu_state = true;
if (go_to_dfu_state) {
sidewalk_event_send(sidewalk_event_exit, NULL, NULL);
sidewalk_event_send(app_event_enter_dfu_mode, NULL, NULL);
application_state_working(&global_state_notifier, false);
} else {
sidewalk_event_send(app_event_exit_dfu_mode, NULL, NULL);
sidewalk_event_send(sidewalk_event_autostart, NULL, NULL);
application_state_working(&global_state_notifier, true);
}

go_to_dfu_state = !go_to_dfu_state;
Expand Down
2 changes: 0 additions & 2 deletions samples/sid_end_device/src/sensor_monitoring/app.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,9 @@ static void app_btn_dfu_state(uint32_t unused)
ARG_UNUSED(unused);
static bool go_to_dfu_state = true;
if (go_to_dfu_state) {
sidewalk_event_send(sidewalk_event_exit, NULL, NULL);
sidewalk_event_send(app_event_enter_dfu_mode, NULL, NULL);
} else {
sidewalk_event_send(app_event_exit_dfu_mode, NULL, NULL);
sidewalk_event_send(sidewalk_event_autostart, NULL, NULL);
}

go_to_dfu_state = !go_to_dfu_state;
Expand Down
2 changes: 2 additions & 0 deletions subsys/sal/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ zephyr_include_directories(sid_pal_ifc)
zephyr_include_directories(sid_time_ops)

add_subdirectory_ifdef(CONFIG_SIDEWALK_ON_DEV_CERT sid_on_dev_cert)

zephyr_library_sources(sid_ifc/bt_app_callbacks.c)
4 changes: 2 additions & 2 deletions subsys/sal/common/sid_ifc/bt_app_callbacks.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ enum BT_id_values{
#if defined (CONFIG_SIDEWALK_DFU)
BT_ID_SMP_DFU,
#endif
_BT_ID_MAX = CONFIG_BT_ID_MAX
_BT_ID_MAX
};

BUILD_ASSERT(_BT_ID_MAX <= CONFIG_BT_ID_MAX, "Too many BT Ids! Configured limit is %d, but used %d", CONFIG_BT_ID_MAX, _BT_ID_MAX);
BUILD_ASSERT(_BT_ID_MAX <= CONFIG_BT_ID_MAX, "Too many BT Ids! increase CONFIG_BT_ID_MAX, to match _BT_ID_MAX");

#endif
5 changes: 3 additions & 2 deletions subsys/sal/sid_pal/src/sid_ble_advert.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <sid_ble_uuid.h>

#include <sid_ble_uuid.h>
#include <bt_app_callbacks.h>

#include <zephyr/bluetooth/bluetooth.h>
#include <zephyr/bluetooth/uuid.h>
Expand Down Expand Up @@ -37,15 +38,15 @@ LOG_MODULE_REGISTER(sid_ble_advert, CONFIG_SIDEWALK_BLE_ADAPTER_LOG_LEVEL);

/* Advertising parameters. */
static struct bt_le_adv_param adv_param_fast = {
.id = CONFIG_SIDEWALK_BLE_ID,
.id = BT_ID_SIDEWALK,
.options = (AMA_ADV_OPTIONS),
.interval_min = MS_TO_INTERVAL_VAL(CONFIG_SIDEWALK_BLE_ADV_INT_FAST),
.interval_max = MS_TO_INTERVAL_VAL(CONFIG_SIDEWALK_BLE_ADV_INT_FAST +
CONFIG_SIDEWALK_BLE_ADV_INT_PRECISION),
};

static struct bt_le_adv_param adv_param_slow = {
.id = CONFIG_SIDEWALK_BLE_ID,
.id = BT_ID_SIDEWALK,
.options = (AMA_ADV_OPTIONS),
.interval_min = MS_TO_INTERVAL_VAL(CONFIG_SIDEWALK_BLE_ADV_INT_SLOW),
.interval_max = MS_TO_INTERVAL_VAL(CONFIG_SIDEWALK_BLE_ADV_INT_SLOW +
Expand Down

0 comments on commit 1b9529d

Please sign in to comment.