From ba1934f85af2a4863c458f25334d723c0291fc06 Mon Sep 17 00:00:00 2001 From: mark9064 <30447455+mark9064@users.noreply.github.com> Date: Thu, 16 Oct 2025 00:08:38 +0100 Subject: Fix typos/formatting --- src/components/ble/MotionService.cpp | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'src/components/ble/MotionService.cpp') 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; + } } -- cgit v1.2.3-70-g09d2