From 169b861af1fd8b1f7834ad78a8880882b236dc96 Mon Sep 17 00:00:00 2001 From: petter <39340152+petterhs@users.noreply.github.com> Date: Mon, 25 Jan 2021 14:18:57 +0100 Subject: [PATCH] fix build warnings in HR implementation --- src/components/ble/HeartRateService.cpp | 4 +--- src/components/ble/NimbleController.cpp | 4 ++-- src/components/heartrate/Ppg.cpp | 2 +- src/drivers/Hrs3300.cpp | 4 ++-- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/components/ble/HeartRateService.cpp b/src/components/ble/HeartRateService.cpp index ecd6235d..ee115ed0 100644 --- a/src/components/ble/HeartRateService.cpp +++ b/src/components/ble/HeartRateService.cpp @@ -57,9 +57,7 @@ void HeartRateService::Init() { int HeartRateService::OnHeartRateRequested(uint16_t connectionHandle, uint16_t attributeHandle, ble_gatt_access_ctxt *context) { if(attributeHandle == heartRateMeasurementHandle) { - NRF_LOG_INFO("BATTERY : handle = %d", heartRateMeasurementHandle); - static uint8_t batteryValue = heartRateController.HeartRate(); - + NRF_LOG_INFO("HEARTRATE : handle = %d", heartRateMeasurementHandle); uint8_t buffer[2] = {0, heartRateController.HeartRate()}; // [0] = flags, [1] = hr value int res = os_mbuf_append(context->om, buffer, 2); diff --git a/src/components/ble/NimbleController.cpp b/src/components/ble/NimbleController.cpp index f2786ea1..eb83c709 100644 --- a/src/components/ble/NimbleController.cpp +++ b/src/components/ble/NimbleController.cpp @@ -38,8 +38,8 @@ NimbleController::NimbleController(Pinetime::System::SystemTask& systemTask, navService{systemTask}, batteryInformationService{batteryController}, immediateAlertService{systemTask, notificationManager}, - serviceDiscovery({¤tTimeClient, &alertNotificationClient}), - heartRateService{systemTask, heartRateController} { + heartRateService{systemTask, heartRateController}, + serviceDiscovery({¤tTimeClient, &alertNotificationClient}) { } int GAPEventCallback(struct ble_gap_event *event, void *arg) { diff --git a/src/components/heartrate/Ppg.cpp b/src/components/heartrate/Ppg.cpp index 233c3003..e84cbdf3 100644 --- a/src/components/heartrate/Ppg.cpp +++ b/src/components/heartrate/Ppg.cpp @@ -13,7 +13,7 @@ using namespace Pinetime::Controllers; namespace { int Compare(int* d1, int* d2, size_t count) { int e = 0; - for(int i = 0; i < count; i++) { + for(size_t i = 0; i < count; i++) { auto d = d1[i] - d2[i]; e += d * d; } diff --git a/src/drivers/Hrs3300.cpp b/src/drivers/Hrs3300.cpp index 2aded7d3..a16c8e4e 100644 --- a/src/drivers/Hrs3300.cpp +++ b/src/drivers/Hrs3300.cpp @@ -73,10 +73,10 @@ void Hrs3300::SetGain(uint8_t gain) { static constexpr uint8_t maxGain = 64; gain = std::min(gain, maxGain); uint8_t hgain = 0; - while((1 << hgain) < gain) + while((1 << hgain) < gain) { hgain++; - WriteRegister(static_cast(Registers::Hgain), hgain << 2); + } } void Hrs3300::SetDrive(uint8_t drive) {