Merge pull request #182 from petterhs/warnings

Fix build warnings coming from HR implementation
This commit is contained in:
JF002 2021-02-14 14:25:38 +01:00 committed by GitHub
commit 97a1c4b3d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 8 deletions

View File

@ -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);

View File

@ -38,8 +38,8 @@ NimbleController::NimbleController(Pinetime::System::SystemTask& systemTask,
navService{systemTask},
batteryInformationService{batteryController},
immediateAlertService{systemTask, notificationManager},
serviceDiscovery({&currentTimeClient, &alertNotificationClient}),
heartRateService{systemTask, heartRateController} {
heartRateService{systemTask, heartRateController},
serviceDiscovery({&currentTimeClient, &alertNotificationClient}) {
}
int GAPEventCallback(struct ble_gap_event *event, void *arg) {

View File

@ -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;
}

View File

@ -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<uint8_t>(Registers::Hgain), hgain << 2);
}
}
void Hrs3300::SetDrive(uint8_t drive) {