fix build warnings in HR implementation

This commit is contained in:
petter 2021-01-25 14:18:57 +01:00
parent 80838d1e42
commit 169b861af1
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) {