1
0
Fork 0

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, int HeartRateService::OnHeartRateRequested(uint16_t connectionHandle, uint16_t attributeHandle,
ble_gatt_access_ctxt *context) { ble_gatt_access_ctxt *context) {
if(attributeHandle == heartRateMeasurementHandle) { if(attributeHandle == heartRateMeasurementHandle) {
NRF_LOG_INFO("BATTERY : handle = %d", heartRateMeasurementHandle); NRF_LOG_INFO("HEARTRATE : handle = %d", heartRateMeasurementHandle);
static uint8_t batteryValue = heartRateController.HeartRate();
uint8_t buffer[2] = {0, heartRateController.HeartRate()}; // [0] = flags, [1] = hr value uint8_t buffer[2] = {0, heartRateController.HeartRate()}; // [0] = flags, [1] = hr value
int res = os_mbuf_append(context->om, buffer, 2); int res = os_mbuf_append(context->om, buffer, 2);

View file

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

View file

@ -13,7 +13,7 @@ using namespace Pinetime::Controllers;
namespace { namespace {
int Compare(int* d1, int* d2, size_t count) { int Compare(int* d1, int* d2, size_t count) {
int e = 0; int e = 0;
for(int i = 0; i < count; i++) { for(size_t i = 0; i < count; i++) {
auto d = d1[i] - d2[i]; auto d = d1[i] - d2[i];
e += d * d; e += d * d;
} }

View file

@ -73,10 +73,10 @@ void Hrs3300::SetGain(uint8_t gain) {
static constexpr uint8_t maxGain = 64; static constexpr uint8_t maxGain = 64;
gain = std::min(gain, maxGain); gain = std::min(gain, maxGain);
uint8_t hgain = 0; uint8_t hgain = 0;
while((1 << hgain) < gain) while((1 << hgain) < gain) {
hgain++; hgain++;
WriteRegister(static_cast<uint8_t>(Registers::Hgain), hgain << 2); WriteRegister(static_cast<uint8_t>(Registers::Hgain), hgain << 2);
}
} }
void Hrs3300::SetDrive(uint8_t drive) { void Hrs3300::SetDrive(uint8_t drive) {