1
0
mirror of https://github.com/CovidBraceletPrj/CovidBracelet.git synced 2024-10-15 02:19:20 +02:00

Wip current measurement

This commit is contained in:
Patrick Rathje 2022-05-31 00:54:02 +02:00
parent b1173bfaff
commit f88a878dca
3 changed files with 23 additions and 17 deletions

View File

@ -94,7 +94,7 @@ def calculate_consumption_per_day(labels, normalize_with_idle=True):
# THE TOTAL EXPECTED AMOUNT PER DAY in milli ampere
expected_consumption_per_day = 0.0
idle_consumption = 0.500
idle_consumption = 0.00256
add_consumption(IDLE_LABEL, idle_consumption, 1.0, 1.0)
# ADVERTISING

View File

@ -27,6 +27,7 @@ typedef ENIntervalIdentifier ENIntervalIdentifier;
#define RPI_ROTATION_MS_MIN (500*1000)
#define RPI_ROTATION_MS_MAX (1250*1000)
#define RPI_ROTATION_MS (600*1000)
#define SCAN_INTERVAL_MS (5*60*1000)
#define SCAN_DURATION_MS 2000
#define ADV_INTERVAL_MS 250
@ -137,8 +138,6 @@ int tracing_init()
k_timer_start(&scan_timer, K_MSEC(SCAN_INTERVAL_MS), K_MSEC(SCAN_INTERVAL_MS));
set_tx_power(txp[cur_tx_pwr]);
int err = 0;
err = adv_start();
if (err)
@ -154,10 +153,21 @@ int tracing_init()
uint32_t tracing_run()
{
if (k_timer_status_get(&rpi_timer) > 0) {
on_rpi();
}
int err = adv_stop();
// TODO: Randomize the adv power!
if (err)
{
printk("Advertising failed to stop (err %d)\n", err);
}
on_rpi();
// TODO: Enable power randomization!
//cur_tx_pwr = (cur_tx_pwr +1) % DEVICE_BEACON_TXPOWER_NUM;
//set_tx_power(txp[cur_tx_pwr]);
adv_start();
}
if (k_timer_status_get(&scan_timer) > 0) {
int err = adv_stop();
@ -169,10 +179,6 @@ uint32_t tracing_run()
on_scan();
cur_tx_pwr = (cur_tx_pwr +1) % DEVICE_BEACON_TXPOWER_NUM;
set_tx_power(txp[cur_tx_pwr]);
adv_start();
}

View File

@ -3,7 +3,7 @@
CONFIG_BT=y
CONFIG_BT_BROADCASTER=y
CONFIG_BT_OBSERVER=y
CONFIG_BT_DEBUG_LOG=n
#CONFIG_BT_DEBUG_LOG=n
CONFIG_BT_SMP=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DEVICE_NAME="CWB"
@ -24,15 +24,13 @@ CONFIG_FLASH_MAP=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_NVS=y
CONFIG_NVS_LOG_LEVEL_DBG=y
#CONFIG_NVS_LOG_LEVEL_DBG=y
CONFIG_MPU_ALLOW_FLASH_WRITE=y
# CONFIG_DISK_ACCESS=y
CONFIG_MAIN_STACK_SIZE=2048
CONFIG_NEWLIB_LIBC=y
CONFIG_HEAP_MEM_POOL_SIZE=131072
CONFIG_NORDIC_QSPI_NOR=y # configuration options for MX25R64 flash device
@ -42,15 +40,17 @@ CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096
CONFIG_ENS_MAX_CONTACTS=65536
#CONFIG_TIMING_FUNCTIONS=y
CONFIG_BT_CTLR_TX_PWR_DYNAMIC_CONTROL=y
#CONFIG_BT_CTLR_TX_PWR_DYNAMIC_CONTROL=y
CONFIG_PM=y
CONFIG_SERIAL=n
CONFIG_UART_CONSOLE=n
# DEBUG!
# Let __ASSERT do its job
CONFIG_DEBUG=y
CONFIG_LOG=y
#CONFIG_DEBUG=y
#CONFIG_LOG=y
# # Run protobuf unpack tests at startup
# CONFIG_TEST_UNPACK_KEYS_N=12