59 Commits

Author SHA1 Message Date
Ken Van Hoeylandt
c5fc8790bb
Implement UART HAL (#212)
- Implement UART HAL
- Improved I2C and SPI HAL mocking mechanism (removed mock files)
2025-02-08 23:10:31 +01:00
Ken Van Hoeylandt
e1bfdd7c91
Improve source file processing in CMakeLists.txt (#211) 2025-02-08 21:42:14 +01:00
Ken Van Hoeylandt
5b375c21bb
Implemented new driver projects (#210)
Moved drivers from the `Boards` projects to `Drivers` folder:
- BQ24295
- AW9523
- AXP2101

The I2C drivers are theoretically cross-platform, but for now they are only built for ESP32.
2025-02-08 21:08:23 +01:00
Ken Van Hoeylandt
c74006f8b6
Created Drivers folder with ILI934x subproject (#209)
Refactored all existing boards to re-use the ILI934x driver code.
2025-02-08 18:54:09 +01:00
Ken Van Hoeylandt
8ccba15c25
Simplify LVGL init: move code into Tactility (#208)
The esp_lvgl_port code was duplicated across all boards, so I moved it into the Tactility subproject to simplify the board implementations.
2025-02-08 17:06:16 +01:00
Ken Van Hoeylandt
c1f55429b6
SPI HAL implemented and more (#207)
- Cleanup unused code and move ISR/IRQ checks to `Kernel.h`
- Improve clang-format
- Fix for LVGL lock transfer: ensure lock isn't activate when changing the lock
- Implement SPI HAL
- Remove `initHardware` HAL configuration entry
- Fix `I2cScanner`: don't scan when port isn't started
2025-02-08 00:21:50 +01:00
Ken Van Hoeylandt
5ec96f60f1
Performance improvements (#203)
- Use DMA buffers for drawing
- Fix for draw buffer sizes
- Reduced rendering refresh interval
- Removed custom icons from wifi app to fix scroll performance issue
2025-02-02 23:02:50 +01:00
Ken Van Hoeylandt
c0f4738abe
I2C improvements and fixes (#201)
- Show I2C device name in I2C Scanner app
- Register various I2C devices from board implementations
- Fix M5Stack Core2 power status
- Fix pre-allocation issue in `hal::Device`
2025-02-02 17:54:36 +01:00
Ken Van Hoeylandt
cff0605b0a
Implement device management (#199)
- Added `tt::hal::Device` and functions (de)register devices and search for them.
- Refactored apps: `Power` and `Display` settings apps now use the device API to find devices.
- Implemented the new API for all existing drivers for all devices, including the simulator.
- Updated HAL Configuration to return `std::shared_ptr` instead of raw pointers.
- Added test project for headless tests and implemented tests for the new code.
2025-02-02 15:16:51 +01:00
Ken Van Hoeylandt
c87200a80d
Project restructuring (fixes macOS builds) (#198)
- Create `Include/` folder for all main projects
- Fix some issues here and there (found while moving things)
- All includes are now in `Tactility/` subfolder and must be included with that prefix. This fixes issues with clashing POSIX headers (e.g. `<semaphore.h>` versus Tactility's `Semaphore.h`)
2025-02-01 18:13:20 +01:00
Ken Van Hoeylandt
6c67845645
Cleanup and improvements (#194)
- Lots of changes for migrating C code to C++
- Improved `Lockable` in several ways like adding `withLock()` (+ tests)
- Improved `Semaphore` a bit for improved readability, and also added some tests
- Upgrade Linux machine in GitHub Actions so that we can compile with a newer GCC
- Simplification of WiFi connection
- Updated funding options
- (and more)
2025-01-28 17:39:58 +01:00
Ken Van Hoeylandt
1bb1260ea0
Update to ESP-IDF v5.4 and fix warnings (#193)
- Update to ESP-IDF v5.4
- Fixed a lot of new and existing warnings
- Fix issue with incorrect `EventFlag` usage in Dispatcher
2025-01-26 15:52:57 +01:00
Ken Van Hoeylandt
686f7cce83
TactilityCore improvements (#187)
FreeRTOS handles were stored plainly and they were deleted in the destructor of classes.
This meant that if a class were to be copied, the destructor would be called twice on the same handles and lead to double-free.

Seha on Discord suggested to fix this by using `std::unique_ptr` with a custom deletion function.

The changes affect:
- Thread
- Semaphore
- Mutex
- StreamBuffer
- Timer
- MessageQueue
- EventFlag

Thread  changes:
- Removal of the hack with the `Data` struct
- Thread's main body is now just a private static function inside the class.
- The C functions were relocated to static class members

PubSub changes:
- Refactored pubsub into class
- Renamed files to `PubSub` instead of `Pubsub`
- `PubSubSubscription` is now a private inner struct and `PubSub` only exposes `SubscriptionHandle`

Lockable, ScopedLockable, Mutex:
- Added `lock()` method that locks indefinitely
- Remove deprecated `acquire()` and `release()` methods
- Removed `TtWaitForever` in favour of `portMAX_DELAY`
2025-01-25 17:29:11 +01:00
Ken Van Hoeylandt
d86dc40472
Fixes and improvements (#185)
- unPhone improvements related to power and boot (add boot count logging)
- Cleanup of Mutex acquire/release
- Removed `tt_assert()` in favour of `assert()`
- Fix sim build (likely failed due to migration of GitHub Actions to Ubuntu 24.04)
2025-01-24 22:49:29 +01:00
Ken Van Hoeylandt
bb7e79886f
Various fixes and improvements (#182)
- Fix for `logMutex` bug where the `Mutex` constructor is not called when doing early boot logging (with `DEBUG` level logging) . The only way to make it work is to explicitly call the constructor in the logging wrapper function.
- Fix for unPhone power states
2025-01-23 21:17:33 +01:00
Ken Van Hoeylandt
dc20ed4874
Improvements & fixes (#178)
- Fix for unPhone sleep: it would wake up every minute briefly (draining the battery over the course of 1-3 days)
- Minor WiFi improvements (mainly added logging and improved filtering on connect .. the latter probably doesn't matter)
2025-01-22 23:10:28 +01:00
Ken Van Hoeylandt
12a9839420
Various fixes and improvements (#177)
- Remove custom `ESP_TARGET` and use `ESP_PLATFORM` everywhere
- Add `Loader` service functionality to `tt::app::` namespace
- Make `Loader` `PubSub` usable by exposing the messages
- Add board type to crash log
- Don't show SD card in Files app when it's not mounted
- Set default SPI frequency for SD cards
- Move TT_VERSION to scope that works for sim too
- Log Tactility version and board on boot
- Rename "Yellow Board" to "CYD 2432S024C"
2025-01-21 21:55:54 +01:00
Ken Van Hoeylandt
97b8007aca
Unphone battery status (#176) 2025-01-21 19:53:00 +01:00
Ken Van Hoeylandt
c3bcf93698
Refactor app launching (#174)
- Refactor the way apps work: Instead of a C interface, they are now C++ classes. The main reasoning is that attaching data to an app was cumbersome. Having different implementations for different kinds of apps was cumbersome too. (3 or 4 layers of manifest nesting for the TactilityC project)
- External apps are still written in C, but they get a createData/destroyData in their manifest, so:
- External apps now have their own manifest.
- All functions in the original AppManifest are removed and replaced by a single `createApp` function
- External apps now automatically register (each app individually!) when they run the first time. As a side-effect they become visible in the `AppList` app!
- Adapted all apps for the new interface.
- Adapted all internal logic for these changes (Gui, ViewPort, Loader, AppContext, AppInstance, etc.)
- Rewrote parts of Loader to use std::shared_ptr to make the code much safer.
- Added a refcount check for the `AppInstance` and `App` at the end of their lifecycle. Show warning if refcount is too high.
2025-01-21 17:48:32 +01:00
Ken Van Hoeylandt
2bbd44a8b5
Unphone improvements (#172)
- Debounce nav button presses: This fixes multiple triggers on a single press to navigate back. Otherwise, more than 1 app would often close at the same time.
- Nav button respond to release instead of push down, because these buttons aren't super reliable in general. (I might change this in the future after more testing)
- Move single buzz earlier in boot phase, so that we can detect silent boot loops.
2025-01-19 21:40:26 +01:00
Ken Van Hoeylandt
72230129bb
unPhone implementation and more (#169)
- Implemented [unPhone](https://unphone.net/) v9 board
- Updated `.clang-format` to better reflect the intended code style
- Fix SD card compatibility issues for all boards (frequency wasn't set well)
- Moved `I2cDevice` class from CoreS3 board project to TactilityHeadless project
- Tactility configuration now has default empty lists for apps and services fields
- Fix for Launcher app: we don't need padding when showing it vertically
- Fix for I2cDevice read/write calls that checked for `esp_err_t` instead of `bool`
- Fix for TinyUSB init that checked for `esp_err_t` instead of `bool`
2025-01-19 16:57:00 +01:00
Ken Van Hoeylandt
3ea02d912f
Merge develop into main (#167)
- WiFi Connect app is now hidden by default, but accessible at the bottom of the WiFi Manage app when WiFi is turned on.
- WiFi service now turns on WiFi when calling connect() and WiFi is not on.
- Removed `blocking` option for `service::loader::startApp()`. This feature was unused and complex.
- Various apps: Moved private headers into Private/ folder.
- Various apps: created start() function for easy starting.
- Added documentation to all TactilityC APIs
- Refactored various `enum` into `class enum`
- Refactor M5Stack `initBoot()` (but VBus is still 0V for some reason)
2025-01-17 19:37:42 +01:00
Ken Van Hoeylandt
43c78c69d8
Thread, Timer and flash.sh improvements (#165)
- Various improvements to Thread and Timer:
  - Remove "mark as static" option as it is unused
  - Implemented core pinning for ESP32 platforms
  - Use `TickType_t` consistently (instead of `uint32_t`)
  - Use `enum class` instead of `enum`
- Fix for `flash.sh` not working when using `pip` to install `esptool`
2025-01-13 20:20:43 +01:00
Ken Van Hoeylandt
5d189fe5a3
Add macOS simulator build to pipelines (#162)
- GitHub actions changed to build simulator on macOS (it's broken, but at least we get a good code portability check for now!)
- `Buildscripts/` shell scripts updated to use `/bin/sh` so it works on macOS too
- Various includes fixed in various subprojects so the code is more portable
2025-01-12 17:48:59 +01:00
Ken Van Hoeylandt
431fa84ffb
Merge develop into main (#161)
- Fix CoreS3 boot failure (I2C now returns bool instead of err_result_t)
- Flashing scripts now erase before flashing (to ensure it's a clean install)
- M5Stack Core2 and CoreS3: Experimental SPI speed increase
2025-01-12 00:38:19 +01:00
Ken Van Hoeylandt
72a9eb1279
Include SDL as subproject to fix CI simulator build (#158) 2025-01-11 14:40:20 +01:00
Ken Van Hoeylandt
bf91e7530d
Time & date, system events and much more (#152)
## Time & Date
- Added time to statusbar widget
- Added Time & Date Settings app
- Added TimeZone app for selecting TimeZone
- Added `tt::time` namespace with timezone code

## Other changes

- Added `SystemEvent` to publish/subscribe to system wide (e.g. for init code, but also for time settings changes)
- Changed the way the statusbar widget works: now there's only 1 that gets shown/hidden, instead of 1 instance per app instance.
- Moved `lowercase()` function to new namespace: `tt::string`
- Increased T-Deck flash & PSRAM SPI frequencies to 120 MHz (from 80 MHz)
- Temporary work-around (+ TODO item) for LVGL stack size (issue with WiFi app)
- Suppress T-Deck keystroke debugging to debug level (privacy issue)
- Improved SDL dependency wiring in various `CMakeLists.txt`
- `Loader` service had some variables renamed to the newer C++ style (from previous C style)
2025-01-10 23:44:32 +01:00
Ken Van Hoeylandt
415096c3b2
Update docs and fix bugs (#149)
Improved the docs for the 3 main Tactility projects. I also fixed some inaccuracies and bugs in certain APIs as I went through the code.
2025-01-07 20:45:23 +01:00
Ken Van Hoeylandt
ff4287e2ce
Filesystem improvements and more (#148)
- Rename `assets` and `config` partitions to `system` and `data`
- Change partition type from `spiffs` to `fat`, so we can have sub-directories
- Fix crash when doing WiFi scan: Increased system event task size to 3kB. 
- Free up IRAM on ESP32 (it was required for the Core2, but I also freed up the same amount for Yellow Board)
- Introduced `Paths` objects that can be retrieved by `AppContext` and `ServiceContext`. Apps and services now have their own relative paths. Assets were re-arranged into the correct paths.
- Rename simulator window title to "Tactility"
- Refactored statusbar widget so it persists icon paths properly (it kept a const char* reference, but didn't copy it, so it crashed when the related std::string was destroyed)
- Created `Partitions.h` to expose some useful variables
- Moved USB config in various `sdkconfig`  (it was part of the "default" section, but it shouldn't be)
- Updated domain name
2025-01-05 20:44:33 +01:00
Ken Van Hoeylandt
7187e5e49e
Improve I2C locking and implement I2C for TactilityC (#147)
I2C:
- Lock timeout set to reasonable times
- Check lock status in all functions
- Refactor lock/unlock to return `bool` values
- Implement functions in TactilityC
Other:
- Updated screenshots
2025-01-03 23:39:23 +01:00
Ken Van Hoeylandt
ec90198dbf
Upgrade to ESP-IDF 5.3.2 (#145)
This also fixes the touch driver issue.
I also fixed an unrelated touch driver cleanup issue.
2025-01-02 22:04:20 +01:00
Ken Van Hoeylandt
737c0f7447
CoreS3 refactored & remove M5 libraries (#143)
Remove dependencies M5Unified and M5GFX because:
- Sometimes the release doesn't even compile
- The amount of functions is too close to the limit (I recently had to remove some code/dependency to be able to make a build at all)
- Graphics performance issue since last update
- Touch screen performance issues (not perfect yet, but better)
- Compatibility issues with Tactility SPI/I2C versus M5Unified/M5GFX variants.
2025-01-02 00:19:24 +01:00
Ken Van Hoeylandt
3214923425
Core2 M5Unified independence + general fixes (#142)
- Change init sequence: I2C is now initialized before "power" init phase, to allow for I2C power control
- I2c HAL: Added read/write support for registers
- Added axp192 code from https://github.com/tuupola/axp192 to Core2 implementation
- Fixes for Core2Power
- Fix for root project CMakeLists.txt
2025-01-01 18:47:48 +01:00
Ken Van Hoeylandt
9581978fc7
Re-implement Core2 and other improvements (#141)
- Create real drivers instead of wrapping M5Unified/M5GFX
- Display HAL improvements (better default base class behaviour)
- Fixed bug with LVGL statusbar service locking (would hang indefinitely waiting for mutex, causing WDT issues)
- Fixes for `Critical.h`
- Fixes and improvements for `Dispatcher` and `DispatcherThread`
2024-12-30 14:17:47 +01:00
Ken Van Hoeylandt
50bd6e8bf6
Merge develop into main branch (#137)
* SdCard HAL refactored (#135)

- Refactor SdCard HAL
- introduce Lockable

* Screenshot and FatFS improvements (#136)

- Fix screenshots on ESP32
- Improve Screenshot service
- Convert Screenshot app to class-based instead of structs
- Screenshot app now automatically updates when task is finished
- Enable FatFS long filename support

* Re-use common log messages (#138)

For consistency and binary size reduction

* Toolbar spinner should get margin to the right

* More TactilityC features (#139)

* Rewrote Loader

- Simplified Loader by removing custom threa
- Created DispatcherThread
- Move auto-starting apps to Boot app
- Fixed Dispatcher bug where it could get stuck not processing new
messages

* Hide AP settings if the AP is not saved

* Missing from previous commit

* Replace LV_EVENT_CLICKED with LV_EVENT_SHORT_CLICKED

* Refactored files app and created InputDialog (#140)

- Changed Files app so that it has a View and State
- Files app now allows for long-pressing on files to perform actions
- Files app now has rename and delete actions
- Created InputDialog app
- Improved AlertDialog app layout
2024-12-27 23:12:39 +01:00
Ken Van Hoeylandt
da3a93ce73
Display driver simplified and implemented gamma (#133) 2024-12-18 16:43:41 +01:00
Ken Van Hoeylandt
f34440eb6f
Fixes and improvements (#132)
- Fix glitch when turning on WiFi: It would temporarily show "No networks found" right before starting the first scan.
- Fix spinner to use Assets.h
- Replace statusbar battery icons 
- Better statusbar icon for when WiFi is on but not connected
- Replace statusbar WiFi icons and Wifi Manage RSSI/lock icons
- Fix for crash when timer is null in I2cScanner
- Deprecate Spacer
- Fixes for toolbar layout (simplified)
- Improved ImageViewer app: center image and add filename text on the bottom
- Add LV debug params to sdkconfig.developer
- Disabled LV spinner, msgbox and window widgets. These have equivalents in Tactility.
2024-12-17 23:32:43 +01:00
Ken Van Hoeylandt
80b69b7f45
Update LVGL (master 9.2+) and related libraries (#130)
- LVGL 9.2+ (master commit)
- esp_lvgl_port (master with my PR hotfix changes)
- espressif/esp_lcd_touch_gt911 1.1.1~2
2024-12-16 23:30:57 +01:00
Ken Van Hoeylandt
49bf8e824c
Various improvements and fixes (#128)
- Fix for display orientation assumption in Display app
- Update logo (added colours)
- Fix for double stopping the Files app
- Deny registration of apps and services that are already registered
- Updated `ideas.md` for these changes
- Other cleanup
2024-12-15 21:15:54 +01:00
Ken Van Hoeylandt
100c24f6a3
Added screenshot mode config and updated copyright docs (#126) 2024-12-15 13:16:59 +01:00
Ken Van Hoeylandt
a18221db08
Tactility SDK and release build scripting (#122)
* Implement release scripting and SDK building process
* Fix for CYD display colors
* Various improvements and fixes
* Made build scripts more modular
2024-12-14 21:50:02 +01:00
Ken Van Hoeylandt
51c6aaa428
Implement crash handler and diagnostics app (#119) 2024-12-12 22:38:48 +01:00
Ken Van Hoeylandt
103588948f
Implement forgetting WiFi APs (#116)
.. and fix the simulator build
2024-12-09 23:37:21 +01:00
Ken Van Hoeylandt
da81256622
Power improvements (#114) 2024-12-09 21:58:30 +01:00
Ken Van Hoeylandt
e4206e8637
Compiler warning cleanup (#113)
Cleanup + expose more methods for external ELFs
2024-12-08 19:59:01 +01:00
Ken Van Hoeylandt
42e843b463
C++ conversions (#111)
* Remove version from artifact name
* Target C++ 20 and higher
* Use cpp string
* Better crash implementation
* String utils in cpp style
* Replace parameter methods with start() method
* MutexType to Mutex::Type
* Kernel c to cpp style
* Cleanup event flag
* More cpp conversions
* Test fixes
* Updated ideas docs
2024-12-07 12:24:28 +01:00
Ken Van Hoeylandt
d52fe52d96
Various services improved (#110) 2024-12-06 23:16:29 +01:00
Ken Van Hoeylandt
e86a11b7e2
App improvements (#105) 2024-12-04 23:06:03 +01:00
Ken Van Hoeylandt
33bb742dfb
Hal refactored (#99) 2024-12-02 00:32:39 +01:00
Ken Van Hoeylandt
0188ce721c
Boot splash and more (#98)
* Boot splash and more

- Added developer sdkconfig
- Refactored the way FreeRTOS includes are included
- Improved Gui/Loader logic
- Implemented boot app with splash screen

* Updated naming for Gui and Loader services

* Renamed Screenshot service methods

* Renames

* Service renames
2024-11-30 15:37:16 +01:00