diff options
| author | mark9064 <30447455+mark9064@users.noreply.github.com> | 2025-10-16 00:08:38 +0100 |
|---|---|---|
| committer | mark9064 <30447455+mark9064@users.noreply.github.com> | 2025-10-16 09:34:55 +0100 |
| commit | ba1934f85af2a4863c458f25334d723c0291fc06 (patch) | |
| tree | 757ace371213f0989a33f90f0f8a12693ccb3af9 | |
| parent | cd4682d1ef087494ea53dc5c5c2303fdaf5fe2a8 (diff) | |
Fix typos/formatting
| -rw-r--r-- | src/components/ble/MotionService.cpp | 27 | ||||
| -rw-r--r-- | src/components/ble/MotionService.h | 4 |
2 files changed, 18 insertions, 13 deletions
diff --git a/src/components/ble/MotionService.cpp b/src/components/ble/MotionService.cpp index 029be894..4b223c1e 100644 --- a/src/components/ble/MotionService.cpp +++ b/src/components/ble/MotionService.cpp @@ -66,7 +66,8 @@ int MotionService::OnStepCountRequested(uint16_t attributeHandle, ble_gatt_acces int res = os_mbuf_append(context->om, &buffer, 4); return (res == 0) ? 0 : BLE_ATT_ERR_INSUFFICIENT_RES; - } else if (attributeHandle == motionValuesHandle) { + } + if (attributeHandle == motionValuesHandle) { int16_t buffer[3] = {motionController.X(), motionController.Y(), motionController.Z()}; int res = os_mbuf_append(context->om, buffer, 3 * sizeof(int16_t)); @@ -76,8 +77,9 @@ int MotionService::OnStepCountRequested(uint16_t attributeHandle, ble_gatt_acces } void MotionService::OnNewStepCountValue(uint32_t stepCount) { - if (!stepCountNoficationEnabled) + if (!stepCountNotificationEnabled) { return; + } uint32_t buffer = stepCount; auto* om = ble_hs_mbuf_from_flat(&buffer, 4); @@ -92,8 +94,9 @@ void MotionService::OnNewStepCountValue(uint32_t stepCount) { } void MotionService::OnNewMotionValues(int16_t x, int16_t y, int16_t z) { - if (!motionValuesNoficationEnabled) + if (!motionValuesNotificationEnabled) { return; + } int16_t buffer[3] = {x, y, z}; auto* om = ble_hs_mbuf_from_flat(buffer, 3 * sizeof(int16_t)); @@ -108,15 +111,17 @@ void MotionService::OnNewMotionValues(int16_t x, int16_t y, int16_t z) { } void MotionService::SubscribeNotification(uint16_t attributeHandle) { - if (attributeHandle == stepCountHandle) - stepCountNoficationEnabled = true; - else if (attributeHandle == motionValuesHandle) - motionValuesNoficationEnabled = true; + if (attributeHandle == stepCountHandle) { + stepCountNotificationEnabled = true; + } else if (attributeHandle == motionValuesHandle) { + motionValuesNotificationEnabled = true; + } } void MotionService::UnsubscribeNotification(uint16_t attributeHandle) { - if (attributeHandle == stepCountHandle) - stepCountNoficationEnabled = false; - else if (attributeHandle == motionValuesHandle) - motionValuesNoficationEnabled = false; + if (attributeHandle == stepCountHandle) { + stepCountNotificationEnabled = false; + } else if (attributeHandle == motionValuesHandle) { + motionValuesNotificationEnabled = false; + } } diff --git a/src/components/ble/MotionService.h b/src/components/ble/MotionService.h index e15cffe3..f311b6bc 100644 --- a/src/components/ble/MotionService.h +++ b/src/components/ble/MotionService.h @@ -31,8 +31,8 @@ namespace Pinetime { uint16_t stepCountHandle; uint16_t motionValuesHandle; - std::atomic_bool stepCountNoficationEnabled {false}; - std::atomic_bool motionValuesNoficationEnabled {false}; + std::atomic_bool stepCountNotificationEnabled {false}; + std::atomic_bool motionValuesNotificationEnabled {false}; }; } } |
