Skip to content

Commit ba1934f

Browse files
committed
Fix typos/formatting
1 parent cd4682d commit ba1934f

2 files changed

Lines changed: 18 additions & 13 deletions

File tree

src/components/ble/MotionService.cpp

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ int MotionService::OnStepCountRequested(uint16_t attributeHandle, ble_gatt_acces
6666

6767
int res = os_mbuf_append(context->om, &buffer, 4);
6868
return (res == 0) ? 0 : BLE_ATT_ERR_INSUFFICIENT_RES;
69-
} else if (attributeHandle == motionValuesHandle) {
69+
}
70+
if (attributeHandle == motionValuesHandle) {
7071
int16_t buffer[3] = {motionController.X(), motionController.Y(), motionController.Z()};
7172

7273
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
7677
}
7778

7879
void MotionService::OnNewStepCountValue(uint32_t stepCount) {
79-
if (!stepCountNoficationEnabled)
80+
if (!stepCountNotificationEnabled) {
8081
return;
82+
}
8183

8284
uint32_t buffer = stepCount;
8385
auto* om = ble_hs_mbuf_from_flat(&buffer, 4);
@@ -92,8 +94,9 @@ void MotionService::OnNewStepCountValue(uint32_t stepCount) {
9294
}
9395

9496
void MotionService::OnNewMotionValues(int16_t x, int16_t y, int16_t z) {
95-
if (!motionValuesNoficationEnabled)
97+
if (!motionValuesNotificationEnabled) {
9698
return;
99+
}
97100

98101
int16_t buffer[3] = {x, y, z};
99102
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) {
108111
}
109112

110113
void MotionService::SubscribeNotification(uint16_t attributeHandle) {
111-
if (attributeHandle == stepCountHandle)
112-
stepCountNoficationEnabled = true;
113-
else if (attributeHandle == motionValuesHandle)
114-
motionValuesNoficationEnabled = true;
114+
if (attributeHandle == stepCountHandle) {
115+
stepCountNotificationEnabled = true;
116+
} else if (attributeHandle == motionValuesHandle) {
117+
motionValuesNotificationEnabled = true;
118+
}
115119
}
116120

117121
void MotionService::UnsubscribeNotification(uint16_t attributeHandle) {
118-
if (attributeHandle == stepCountHandle)
119-
stepCountNoficationEnabled = false;
120-
else if (attributeHandle == motionValuesHandle)
121-
motionValuesNoficationEnabled = false;
122+
if (attributeHandle == stepCountHandle) {
123+
stepCountNotificationEnabled = false;
124+
} else if (attributeHandle == motionValuesHandle) {
125+
motionValuesNotificationEnabled = false;
126+
}
122127
}

src/components/ble/MotionService.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ namespace Pinetime {
3131

3232
uint16_t stepCountHandle;
3333
uint16_t motionValuesHandle;
34-
std::atomic_bool stepCountNoficationEnabled {false};
35-
std::atomic_bool motionValuesNoficationEnabled {false};
34+
std::atomic_bool stepCountNotificationEnabled {false};
35+
std::atomic_bool motionValuesNotificationEnabled {false};
3636
};
3737
}
3838
}

0 commit comments

Comments
 (0)