Skip to content

Commit 5214f90

Browse files
authored
Merge pull request #214 from ryanrolds/rolds/msec_sleep
Adjusting sleep durations to be milliseconds. Needed for FCC 15b testing.
2 parents 5f671b0 + 2069314 commit 5214f90

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

.github/workflows/b-parasite.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ jobs:
8686
sample-dir: code/nrf-connect/samples/ble
8787
board: bparasite_${{ matrix.soc }}
8888
revision: ${{ matrix.revision }}
89-
cmake-extra: -DCONFIG_PRST_BLE_ENCODING_BTHOME_V2=y -DCONFIG_PRST_SLEEP_DURATION_SEC=1 -DCONFIG_PRSTLIB_LOG_LEVEL_DBG=y
89+
cmake-extra: -DCONFIG_PRST_BLE_ENCODING_BTHOME_V2=y -DCONFIG_PRST_SLEEP_DURATION_MSEC=1000 -DCONFIG_PRSTLIB_LOG_LEVEL_DBG=y
9090
output-bin: ble_${{ matrix.soc }}_${{ matrix.revision }}_debug.hex
9191

9292
build-zigbee:

code/nrf-connect/samples/ble/Kconfig

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
source "Kconfig.zephyr"
33
rsource "../../prstlib/Kconfig"
44

5-
config PRST_SLEEP_DURATION_SEC
6-
int "Sleep duration in seconds"
7-
default 600
5+
config PRST_SLEEP_DURATION_MSEC
6+
int "Sleep duration in milliseconds"
7+
default 600000
88

9-
config PRST_BLE_ADV_DURATION_SEC
10-
int "Advertising duration in seconds"
11-
default 1
9+
config PRST_BLE_ADV_DURATION_MSEC
10+
int "Advertising duration in milliseconds"
11+
default 1000
1212

1313
config PRST_BLE_MIN_ADV_INTERVAL
1414
int "Minimum advertising interval in milliseconds"

code/nrf-connect/samples/ble/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Available configurations and their default values are in [`Kconfig`](./Kconfig).
88
To save energy, the board spends most of the time in a "deep sleep" state, in which most peripherals and radio are completely turned off. The period of sleep is controlled by the `PRST_SLEEP_DURATION_SEC` config.
99

1010
### Advertising Duration
11-
When it wakes up, the sample reads all sensors and keep broadcasting advertising packets for `PRST_BLE_ADV_DURATION_SEC` before going back to sleep.
11+
When it wakes up, the sample reads all sensors and keep broadcasting advertising packets for `PRST_BLE_ADV_DURATION_MSEC` before going back to sleep.
1212

1313
### Advertising Packet Encoding
1414
There are different ways to encode the sensor data in a BLE advertising packet.

code/nrf-connect/samples/ble/prj.conf

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ CONFIG_ASSERT=y
2121

2222
# Application config - see all options in Kconfig.
2323
# CONFIG_PRST_BLE_ENCODING_BTHOME_V2=y
24-
# CONFIG_PRST_SLEEP_DURATION_SEC=1
24+
# CONFIG_PRST_SLEEP_DURATION_MSEC=1000
2525

2626
# prstlib config - ser all options in prstlib/Kconfig.
2727
# CONFIG_PRSTLIB_LOG_LEVEL_DBG=y

code/nrf-connect/samples/ble/src/main.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ static int prst_loop(prst_sensors_t *sensors) {
2626
RET_IF_ERR(prst_sensors_read_all(sensors));
2727
RET_IF_ERR(prst_ble_adv_set_data(sensors));
2828
RET_IF_ERR(prst_ble_adv_start());
29-
k_sleep(K_SECONDS(CONFIG_PRST_BLE_ADV_DURATION_SEC));
29+
k_msleep(CONFIG_PRST_BLE_ADV_DURATION_MSEC);
3030
RET_IF_ERR(prst_ble_adv_stop());
3131
return 0;
3232
}
@@ -37,6 +37,6 @@ int main(void) {
3737
prst_sensors_t sensors;
3838
while (true) {
3939
__ASSERT(!prst_loop(&sensors), "Error in prst_loop()");
40-
k_sleep(K_SECONDS(CONFIG_PRST_SLEEP_DURATION_SEC));
40+
k_msleep(CONFIG_PRST_SLEEP_DURATION_MSEC);
4141
}
4242
}

0 commit comments

Comments
 (0)