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
+1 -1
View File
@@ -21,7 +21,7 @@ add_test(NAME TactilityTests
target_link_libraries(TactilityTests PRIVATE
Tactility
TactilityCore
Tactility
TactilityKernel
Simulator
SDL2::SDL2-static SDL2-static
)
+1
View File
@@ -20,6 +20,7 @@ add_test(NAME TactilityCoreTests
target_link_libraries(TactilityCoreTests PUBLIC
TactilityCore
TactilityKernel
TactilityFreeRtos
freertos_kernel
)
+30
View File
@@ -0,0 +1,30 @@
#include "doctest.h"
#include <Tactility/Time.h>
#include <Tactility/Delay.h>
TEST_CASE("delay ticks should be accurate within 1 tick") {
auto start_time = get_ticks();
delay_ticks(100);
auto end_time = get_ticks();
auto difference = end_time - start_time;
CHECK_EQ(difference >= 100, true);
CHECK_EQ(difference <= 101, true);
}
TEST_CASE("delay millis should be accurate within 1 tick") {
auto start_time = get_millis();
delay_millis(100);
auto end_time = get_millis();
auto difference = end_time - start_time;
CHECK_EQ(difference >= 100, true);
CHECK_EQ(difference <= 101, true);
}
TEST_CASE("microsecond time should be accurate within 1 tick") {
auto start_time = get_micros_since_boot();
delay_millis(100);
auto end_time = get_micros_since_boot();
auto difference = (end_time - start_time) / 1000;
CHECK_EQ(difference >= 99, true);
CHECK_EQ(difference <= 101, true);
}