Skip to content

Commit fab0e6d

Browse files
PR feedback
1 parent 55a5566 commit fab0e6d

File tree

6 files changed

+15
-11
lines changed

6 files changed

+15
-11
lines changed

Devices/lilygo-tdeck/Source/Init.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include "devices/TrackballDevice.h"
44

55
#include <Tactility/hal/gps/GpsConfiguration.h>
6+
#include <Tactility/kernel/Kernel.h>
67
#include <Tactility/kernel/SystemEvents.h>
78
#include <Tactility/Logger.h>
89
#include <Tactility/LogMessages.h>
@@ -31,7 +32,7 @@ static bool powerOn() {
3132
}
3233

3334
// Avoids crash when no SD card is inserted. It's unknown why, but likely is related to power draw.
34-
vTaskDelay(100);
35+
tt::kernel::delayMillis(100);
3536

3637
return true;
3738
}

TactilityKernel/Include/Tactility/concurrent/Dispatcher.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ error_t dispatcher_dispatch_timed(DispatcherHandle_t dispatcher, void* callbackC
3939
*
4040
* @param[in] callbackContext the data to pass to the function upon execution
4141
* @param[in] callback the function to execute elsewhere
42+
* @retval ERROR_RESOURCE when failing to set event
4243
* @retval ERROR_TIMEOUT unlikely to occur unless there's an issue with the internal mutex
4344
* @retval ERROR_INVALID_STATE when the dispatcher is in the process of shutting down
4445
* @retval ERROR_NONE

TactilityKernel/Include/Tactility/concurrent/Mutex.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ inline static bool mutex_try_lock_timed(struct Mutex* mutex, TickType_t timeout)
4444

4545
inline static bool mutex_is_locked(struct Mutex* mutex) {
4646
if (xPortInIsrContext() == pdTRUE) {
47-
return xSemaphoreGetMutexHolder(mutex->handle) != NULL;
48-
} else {
4947
return xSemaphoreGetMutexHolderFromISR(mutex->handle) != NULL;
48+
} else {
49+
return xSemaphoreGetMutexHolder(mutex->handle) != NULL;
5050
}
5151
}
5252

TactilityKernel/Include/Tactility/concurrent/RecursiveMutex.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ inline static void recursive_mutex_lock(struct RecursiveMutex* mutex) {
3232

3333
inline static bool recursive_mutex_is_locked(struct RecursiveMutex* mutex) {
3434
if (xPortInIsrContext() == pdTRUE) {
35-
return xSemaphoreGetMutexHolder(mutex->handle) != NULL;
36-
} else {
3735
return xSemaphoreGetMutexHolderFromISR(mutex->handle) != NULL;
36+
} else {
37+
return xSemaphoreGetMutexHolder(mutex->handle) != NULL;
3838
}
3939
}
4040

TactilityKernel/Source/Driver.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,11 @@ static DriverLedger& get_ledger() {
5757
#define driver_lock(driver) mutex_lock(&driver_internal_data(driver)->mutex);
5858
#define driver_unlock(driver) mutex_unlock(&driver_internal_data(driver)->mutex);
5959

60-
static error_t driver_add(Driver* driver) {
60+
static void driver_add(Driver* driver) {
6161
LOG_I(TAG, "add %s", driver->name);
6262
ledger.lock();
6363
ledger.drivers.push_back(driver);
6464
ledger.unlock();
65-
return ERROR_NONE;
6665
}
6766

6867
static error_t driver_remove(Driver* driver) {
@@ -98,7 +97,10 @@ error_t driver_destruct(Driver* driver) {
9897
return ERROR_INVALID_STATE;
9998
}
10099

101-
driver_remove(driver);
100+
if (driver_remove(driver) != ERROR_NONE) {
101+
LOG_W(TAG, "Failed to remove driver from ledger: %s", driver->name);
102+
}
103+
102104
delete driver_internal_data(driver);
103105
driver->internal.data = nullptr;
104106
return ERROR_NONE;

TactilityKernel/Source/concurrent/EventGroup.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@ error_t event_group_wait(
6767
: ((inFlags & result_flags) == 0U); // await any
6868

6969
if (invalid_flags) {
70-
if (timeout > 0U) { // assume time-out
70+
const uint32_t matched = inFlags & result_flags;
71+
if (matched == 0U) {
7172
return ERROR_TIMEOUT;
72-
} else {
73-
return ERROR_RESOURCE;
7473
}
74+
return ERROR_RESOURCE;
7575
}
7676

7777
if (outFlags != nullptr) {

0 commit comments

Comments
 (0)