Various improvements (#461)

* **New Features**
  * Time and delay utilities added (ticks, ms, µs); SD card now uses an expansion-header CS pin; HTTP downloads warn when run on the GUI task and yield to avoid blocking.

* **Bug Fixes / Reliability**
  * Many hard-crash paths converted to guarded checks to reduce abrupt termination and improve stability.

* **Tests**
  * Unit tests added to validate time and delay accuracy.

* **Chores**
  * License header and build/macro updates.
This commit is contained in:
Ken Van Hoeylandt
2026-01-27 08:04:21 +01:00
committed by GitHub
parent 619b5aa53b
commit e6abd496f9
95 changed files with 433 additions and 284 deletions
@@ -53,10 +53,10 @@ class AppInstance : public AppContext {
#ifdef ESP_PLATFORM
return createElfApp(manifest);
#else
tt_crash("not supported");
check(false, "not supported");
#endif
} else {
tt_crash("not implemented");
check(false, "not implemented");
}
}
@@ -17,6 +17,13 @@ constexpr auto GUI_THREAD_FLAG_INPUT = (1 << 1);
constexpr auto GUI_THREAD_FLAG_EXIT = (1 << 2);
constexpr auto GUI_THREAD_FLAG_ALL = (GUI_THREAD_FLAG_DRAW | GUI_THREAD_FLAG_INPUT | GUI_THREAD_FLAG_EXIT);
/**
* Output a log warning if the current task is the GUI task.
* This is meant for code that should either create their own task or use a different task to execute on.
* @param[in] context a descriptive name or label that refers to the caller of this function
*/
void warnIfRunningOnGuiTask(const char* context);
class GuiService final : public Service {
// Thread and lock
@@ -46,7 +53,7 @@ class GuiService final : public Service {
void redraw();
void lock() const {
tt_check(mutex.lock(pdMS_TO_TICKS(1000)));
check(mutex.lock(pdMS_TO_TICKS(1000)));
}
void unlock() const {
@@ -59,9 +66,9 @@ class GuiService final : public Service {
public:
bool onStart(TT_UNUSED ServiceContext& service) override;
bool onStart(ServiceContext& service) override;
void onStop(TT_UNUSED ServiceContext& service) override;
void onStop(ServiceContext& service) override;
void requestDraw();