Improvements and fixes (#595)

- Fix BluetoothSettings app not updating when toggling on Bluetooth on
- Fix BluetoothSettings app crash when closing while scanning
- Fix BluetoothSettings app crash when turning BT off while scanning
- WebServer doesn't save config anymore as a side-effect of reading the config
- Add missing license headers
- Use TactilityKernel's time and delay functions instead of TactilityFreeRtos ones
This commit is contained in:
Ken Van Hoeylandt
2026-07-28 18:38:23 +02:00
committed by GitHub
parent e6e1dcd0ca
commit bd108cc3c4
33 changed files with 215 additions and 112 deletions
@@ -57,7 +57,7 @@ public:
* @param[in] timeout lock acquisition timeout
* @return true if dispatching was successful (timeout not reached)
*/
bool dispatch(Function function, TickType_t timeout = kernel::MAX_TICKS) {
bool dispatch(Function function, TickType_t timeout = kernel::FREERTOS_MAX_TICKS) {
// Mutate
if (!mutex.lock(timeout)) {
#ifdef ESP_PLATFORM
@@ -92,7 +92,7 @@ public:
* @param[in] timeout the ticks to wait for a message
* @return the amount of messages that were consumed
*/
uint32_t consume(TickType_t timeout = kernel::MAX_TICKS) {
uint32_t consume(TickType_t timeout = kernel::FREERTOS_MAX_TICKS) {
// Wait for signal
if (!eventFlag.wait(WAIT_FLAG, false, true, nullptr, timeout)) {
return 0;
@@ -46,7 +46,7 @@ public:
/**
* Dispatch a message.
*/
bool dispatch(const Dispatcher::Function& function, TickType_t timeout = kernel::MAX_TICKS) {
bool dispatch(const Dispatcher::Function& function, TickType_t timeout = kernel::FREERTOS_MAX_TICKS) {
return dispatcher.dispatch(function, timeout);
}
@@ -100,7 +100,7 @@ public:
bool awaitAll = false,
bool clearOnExit = true,
uint32_t* outFlags = nullptr,
TickType_t timeout = kernel::MAX_TICKS
TickType_t timeout = kernel::FREERTOS_MAX_TICKS
) const {
assert(xPortInIsrContext() == pdFALSE);
+3 -3
View File
@@ -20,7 +20,7 @@ public:
virtual bool lock(TickType_t timeout) const = 0;
bool lock() const { return lock(kernel::MAX_TICKS); }
bool lock() const { return lock(kernel::FREERTOS_MAX_TICKS); }
virtual void unlock() const = 0;
@@ -40,9 +40,9 @@ public:
}
}
void withLock(const std::function<void()>& onLockAcquired) const { withLock(kernel::MAX_TICKS, onLockAcquired); }
void withLock(const std::function<void()>& onLockAcquired) const { withLock(kernel::FREERTOS_MAX_TICKS, onLockAcquired); }
void withLock(const std::function<void()>& onLockAcquired, const std::function<void()>& onLockFailed) const { withLock(kernel::MAX_TICKS, onLockAcquired, onLockFailed); }
void withLock(const std::function<void()>& onLockAcquired, const std::function<void()>& onLockFailed) const { withLock(kernel::FREERTOS_MAX_TICKS, onLockAcquired, onLockFailed); }
ScopedLock asScopedLock() const;
};
+1 -1
View File
@@ -43,7 +43,7 @@ public:
}
// Wait for Mutex usage
if (mutex.lock(kernel::MAX_TICKS)) {
if (mutex.lock(kernel::FREERTOS_MAX_TICKS)) {
// TODO: Fix the case where the mutex might be immediately locked after this point and then crashes when deleted
mutex.unlock();
}
+1 -1
View File
@@ -224,7 +224,7 @@ public:
/**
* @warning If this blocks forever, it might be because of the Thread, but it could also be because another task is blocking the CPU.
*/
bool join(TickType_t timeout = kernel::MAX_TICKS, TickType_t pollInterval = 10) {
bool join(TickType_t timeout = kernel::FREERTOS_MAX_TICKS, TickType_t pollInterval = 10) {
assert(getCurrent() != this);
TickType_t start_ticks = kernel::getTicks();
+6 -6
View File
@@ -29,7 +29,7 @@ private:
struct TimerHandleDeleter {
void operator()(TimerHandle_t handleToDelete) const {
xTimerDelete(handleToDelete, kernel::MAX_TICKS);
xTimerDelete(handleToDelete, kernel::FREERTOS_MAX_TICKS);
}
};
@@ -75,7 +75,7 @@ public:
*/
bool start() const {
assert(xPortInIsrContext() == pdFALSE);
return xTimerStart(handle.get(), kernel::MAX_TICKS) == pdPASS;
return xTimerStart(handle.get(), kernel::FREERTOS_MAX_TICKS) == pdPASS;
}
/** Stop the timer
@@ -84,7 +84,7 @@ public:
*/
bool stop() const {
assert(xPortInIsrContext() == pdFALSE);
return xTimerStop(handle.get(), kernel::MAX_TICKS) == pdPASS;
return xTimerStop(handle.get(), kernel::FREERTOS_MAX_TICKS) == pdPASS;
}
/**
@@ -94,8 +94,8 @@ public:
*/
bool reset(TickType_t interval) const {
assert(xPortInIsrContext() == pdFALSE);
return xTimerChangePeriod(handle.get(), interval, kernel::MAX_TICKS) == pdPASS &&
xTimerReset(handle.get(), kernel::MAX_TICKS) == pdPASS;
return xTimerChangePeriod(handle.get(), interval, kernel::FREERTOS_MAX_TICKS) == pdPASS &&
xTimerReset(handle.get(), kernel::FREERTOS_MAX_TICKS) == pdPASS;
}
/**
@@ -104,7 +104,7 @@ public:
*/
bool reset() const {
assert(xPortInIsrContext() == pdFALSE);
return xTimerReset(handle.get(), kernel::MAX_TICKS) == pdPASS;
return xTimerReset(handle.get(), kernel::FREERTOS_MAX_TICKS) == pdPASS;
}
/** @return true when the timer is running */
@@ -17,7 +17,7 @@
namespace tt::kernel {
constexpr TickType_t MAX_TICKS = ~static_cast<TickType_t>(0);
constexpr TickType_t FREERTOS_MAX_TICKS = ~static_cast<TickType_t>(0);
/** @return the frequency at which the kernel task schedulers operate */
constexpr uint32_t getTickFrequency() {