Skip to content
Snippets Groups Projects
Commit f9f6dbaf authored by Caroline Axelsen's avatar Caroline Axelsen
Browse files

answered last question of the analysis

parent 3173fd9f
Branches main
No related tags found
No related merge requests found
Pipeline #459890 passed
Source diff could not be displayed: it is too large. Options to address this: view the blob.
{
"files.associations": {
"bluetooth.h": "c"
}
}
\ No newline at end of file
......@@ -62,7 +62,8 @@ int i = 0;
int j = 0;
int err;
int error_type; //if error_type is 1 its a VBUS error if its 2 is a pressure sensor error
int battery_level;
float battery_percent;
float battery_level;
int normalized_battery_level;
float raw_data_array1[DATA_ARRAY]={};
float max_data_array1[PERIOD_ARRAY]={};
......@@ -312,9 +313,7 @@ int bluetooth_init(struct bt_conn_cb *bt_cb, struct bt_remote_srv_cb *remote_cb)
LOG_ERR("Could not start advertising (ret = %d)", ret);
return ret;
}
return ret;
}
/* Setup Callbacks */
......@@ -504,6 +503,14 @@ void button2_callback(const struct device *dev, struct gpio_callback*cb, uint32_
k_work_submit(&button2_callback_work);
}
void button2_callback_work_handler(struct k_work*button2_callback_work){
battery_percent = ((100*val_mv)/3600);
LOG_INF("Battery_percent: %f", battery_percent);
int battery_err = bt_bas_set_battery_level((int)battery_level);
if (battery_err) {
LOG_ERR("BAS set error (err = %d)", battery_err);
}
battery_level = bt_bas_get_battery_level();
err = send_data_notification(current_conn, bluetooth_outputs, 3);
if (err) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment