Switching sleep to to msec. Will aid FCC 15b testing
This commit is contained in:
parent
5f671b0170
commit
2dc7144de1
3 changed files with 7 additions and 7 deletions
|
|
@ -2,12 +2,12 @@
|
||||||
source "Kconfig.zephyr"
|
source "Kconfig.zephyr"
|
||||||
rsource "../../prstlib/Kconfig"
|
rsource "../../prstlib/Kconfig"
|
||||||
|
|
||||||
config PRST_SLEEP_DURATION_SEC
|
config PRST_SLEEP_DURATION_MSEC
|
||||||
int "Sleep duration in seconds"
|
int "Sleep duration in milliseconds"
|
||||||
default 600
|
default 600
|
||||||
|
|
||||||
config PRST_BLE_ADV_DURATION_SEC
|
config PRST_BLE_ADV_DURATION_MSEC
|
||||||
int "Advertising duration in seconds"
|
int "Advertising duration in milliseconds"
|
||||||
default 1
|
default 1
|
||||||
|
|
||||||
config PRST_BLE_MIN_ADV_INTERVAL
|
config PRST_BLE_MIN_ADV_INTERVAL
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ Available configurations and their default values are in [`Kconfig`](./Kconfig).
|
||||||
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.
|
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.
|
||||||
|
|
||||||
### Advertising Duration
|
### Advertising Duration
|
||||||
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.
|
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.
|
||||||
|
|
||||||
### Advertising Packet Encoding
|
### Advertising Packet Encoding
|
||||||
There are different ways to encode the sensor data in a BLE advertising packet.
|
There are different ways to encode the sensor data in a BLE advertising packet.
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ static int prst_loop(prst_sensors_t *sensors) {
|
||||||
RET_IF_ERR(prst_sensors_read_all(sensors));
|
RET_IF_ERR(prst_sensors_read_all(sensors));
|
||||||
RET_IF_ERR(prst_ble_adv_set_data(sensors));
|
RET_IF_ERR(prst_ble_adv_set_data(sensors));
|
||||||
RET_IF_ERR(prst_ble_adv_start());
|
RET_IF_ERR(prst_ble_adv_start());
|
||||||
k_sleep(K_SECONDS(CONFIG_PRST_BLE_ADV_DURATION_SEC));
|
k_msleep(CONFIG_PRST_BLE_ADV_DURATION_MSEC);
|
||||||
RET_IF_ERR(prst_ble_adv_stop());
|
RET_IF_ERR(prst_ble_adv_stop());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -37,6 +37,6 @@ int main(void) {
|
||||||
prst_sensors_t sensors;
|
prst_sensors_t sensors;
|
||||||
while (true) {
|
while (true) {
|
||||||
__ASSERT(!prst_loop(&sensors), "Error in prst_loop()");
|
__ASSERT(!prst_loop(&sensors), "Error in prst_loop()");
|
||||||
k_sleep(K_SECONDS(CONFIG_PRST_SLEEP_DURATION_SEC));
|
k_msleep(CONFIG_PRST_SLEEP_DURATION_MSEC);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue