From de9db29af72f8927e792fd34f88c4fd60641f560 Mon Sep 17 00:00:00 2001 From: Hector Bujanda Date: Thu, 15 Jul 2021 12:30:07 +0200 Subject: [PATCH 1/3] adc: detect error when sampling Avoid sample conversion after sampling error. https://onedigi.atlassian.net/browse/DEL-7623 Signed-off-by: Hector Bujanda (cherry picked from commit 6e7e975754f00873df69fe71ed46a228720c1cbc) --- apix-adc-example/main.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apix-adc-example/main.c b/apix-adc-example/main.c index 811f1c9..ef7617c 100644 --- a/apix-adc-example/main.c +++ b/apix-adc-example/main.c @@ -157,6 +157,12 @@ static int adc_sampling_cb(int sample, void *arg) struct adc_sampling_cb_data *data = arg; float sample_mv = 0; + if (sample < 0) { + /* An error happened */ + printf("Error %d reading ADC sample\n", sample); + return EXIT_FAILURE; + } + data->number_of_samples--; sample_mv = ldx_adc_convert_sample_to_mv(data->adc, sample); From b67f0eaba1b59a41e0f8eeddcf8462afaa60a628 Mon Sep 17 00:00:00 2001 From: Tatiana Leon Date: Tue, 20 Jul 2021 16:18:30 +0200 Subject: [PATCH 2/3] ble-gatt-server-example: add support for notify multiple See bluez commit b8b59af4e88069cb2f67b0168113aa489f6e1fe9. Signed-off-by: Tatiana Leon (cherry picked from commit f0d0e84ef4fdb6457b4a0444dce7303fc0500a9e) --- ble-gatt-server-example/ble-gatt-server-app.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ble-gatt-server-example/ble-gatt-server-app.c b/ble-gatt-server-example/ble-gatt-server-app.c index d13b257..797dc3c 100644 --- a/ble-gatt-server-example/ble-gatt-server-app.c +++ b/ble-gatt-server-example/ble-gatt-server-app.c @@ -351,7 +351,7 @@ static bool temperature_notify_cb(void *user_data) bt_gatt_server_send_notification(server->gatt, notify_data->handle, ¬ify_value, - sizeof(notify_value)); + sizeof(notify_value), false); } return true; From 644023bc6640fe5e5f3180ac9354874a58818ba7 Mon Sep 17 00:00:00 2001 From: Tatiana Leon Date: Tue, 20 Jul 2021 16:21:39 +0200 Subject: [PATCH 3/3] ble-gatt-server-example: remove mainloop_set_signal and use mainloop_run_with_signal See bluez commits: * 5202ea57a8fda7b298bb920a05c349897377abc1 * b597afa45a40ed2720659649e77dd25b45383fc0 * 5bdc09bb3a9e1e15aaff10ada0eddad21a2915fa * 0aa6516a154b1ce02bd99c2dda6a4f305e3854c0 Signed-off-by: Tatiana Leon (cherry picked from commit 7fd22392de163d43ac8deaf8b387ab5034aed404) --- ble-gatt-server-example/ble-gatt-server-app.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/ble-gatt-server-example/ble-gatt-server-app.c b/ble-gatt-server-example/ble-gatt-server-app.c index 797dc3c..130c68c 100644 --- a/ble-gatt-server-example/ble-gatt-server-app.c +++ b/ble-gatt-server-example/ble-gatt-server-app.c @@ -764,7 +764,6 @@ int main(int argc, char *argv[]) bdaddr_t src_addr; int dev_id = -1; uint16_t mtu = 0; - sigset_t mask; setlogmask (LOG_UPTO (LOG_NOTICE)); @@ -864,17 +863,7 @@ int main(int argc, char *argv[]) return EXIT_FAILURE; } - sigemptyset(&mask); - sigaddset(&mask, SIGINT); - sigaddset(&mask, SIGTERM); - - mainloop_set_signal(&mask, signal_cb, NULL, NULL); - mainloop_run(); - - /* remove the application signals */ - sigdelset(&mask, SIGTERM); - sigdelset(&mask, SIGINT); - sigemptyset(&mask); + mainloop_run_with_signal(signal_cb, NULL); server_destroy(server);