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"
This commit is contained in:
Ken Van Hoeylandt 2025-01-21 21:55:54 +01:00 committed by GitHub
parent 97b8007aca
commit 12a9839420
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
58 changed files with 147 additions and 101 deletions

View File

@ -4,14 +4,14 @@ on: [push]
permissions: read-all permissions: read-all
jobs: jobs:
yellow-board: cyd-2432S024c:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: "Build" - name: "Build"
uses: ./.github/actions/build-firmware uses: ./.github/actions/build-firmware
with: with:
board_id: yellow-board board_id: cyd-2432S024c
arch: esp32 arch: esp32
lilygo-tdeck: lilygo-tdeck:
runs-on: ubuntu-latest runs-on: ubuntu-latest

View File

@ -11,7 +11,7 @@ jobs:
- name: "Build" - name: "Build"
uses: ./.github/actions/build-sdk uses: ./.github/actions/build-sdk
with: with:
board_id: yellow-board board_id: cyd-2432S024c
arch: esp32 arch: esp32
esp32s3: esp32s3:
runs-on: ubuntu-latest runs-on: ubuntu-latest

View File

@ -5,7 +5,7 @@ if (DEFINED ENV{ESP_IDF_VERSION})
if("${IDF_TARGET}" STREQUAL "esp32") if("${IDF_TARGET}" STREQUAL "esp32")
list(APPEND BOARD_COMPONENTS list(APPEND BOARD_COMPONENTS
YellowBoard CYD-2432S024C
M5stackCore2 M5stackCore2
) )
endif() endif()

View File

@ -1,13 +1,18 @@
# Kconfig file for Tactility example app # Kconfig file for Tactility example app
menu "Tactility App" menu "Tactility App"
config TT_BOARD_NAME
string "Board Name"
default ""
config TT_BOARD_ID
string "Board ID"
default ""
choice choice
prompt "Board" prompt "Board"
default TT_BOARD_CUSTOM default TT_BOARD_CUSTOM
config TT_BOARD_CUSTOM config TT_BOARD_CUSTOM
bool "Custom" bool "Custom"
config TT_BOARD_YELLOW_BOARD_24_CAP config TT_BOARD_CYD_2432S024C
bool "Yellow Board (2.4\" capacitive)" bool "CYD 2432S024C"
config TT_BOARD_LILYGO_TDECK config TT_BOARD_LILYGO_TDECK
bool "LilyGo T-Deck" bool "LilyGo T-Deck"
config TT_BOARD_M5STACK_CORE2 config TT_BOARD_M5STACK_CORE2

View File

@ -7,9 +7,9 @@
#if defined(CONFIG_TT_BOARD_LILYGO_TDECK) #if defined(CONFIG_TT_BOARD_LILYGO_TDECK)
#include "LilygoTdeck.h" #include "LilygoTdeck.h"
#define TT_BOARD_HARDWARE &lilygo_tdeck #define TT_BOARD_HARDWARE &lilygo_tdeck
#elif defined(CONFIG_TT_BOARD_YELLOW_BOARD_24_CAP) #elif defined(CONFIG_TT_BOARD_CYD_2432S024C)
#include "YellowBoard.h" #include "CYD2432S024C.h"
#define TT_BOARD_HARDWARE &yellow_board_24inch_cap #define TT_BOARD_HARDWARE &cyd_2432S024c_config
#elif defined(CONFIG_TT_BOARD_M5STACK_CORE2) #elif defined(CONFIG_TT_BOARD_M5STACK_CORE2)
#include "M5stackCore2.h" #include "M5stackCore2.h"
#define TT_BOARD_HARDWARE &m5stack_core2 #define TT_BOARD_HARDWARE &m5stack_core2

View File

@ -1,11 +1,11 @@
#include "YellowBoard.h" #include "CYD2432S024C.h"
#include "hal/YellowDisplay.h" #include "hal/YellowDisplay.h"
#include "hal/YellowSdCard.h" #include "hal/YellowSdCard.h"
bool twodotfour_lvgl_init(); bool twodotfour_lvgl_init();
bool twodotfour_boot(); bool twodotfour_boot();
const tt::hal::Configuration yellow_board_24inch_cap = { const tt::hal::Configuration cyd_2432S024c_config = {
.initBoot = &twodotfour_boot, .initBoot = &twodotfour_boot,
.initLvgl = &twodotfour_lvgl_init, .initLvgl = &twodotfour_lvgl_init,
.createDisplay = createDisplay, .createDisplay = createDisplay,

View File

@ -3,4 +3,4 @@
#include "hal/Configuration.h" #include "hal/Configuration.h"
// Capacitive touch version of the 2.4" yellow board // Capacitive touch version of the 2.4" yellow board
extern const tt::hal::Configuration yellow_board_24inch_cap; extern const tt::hal::Configuration cyd_2432S024c_config;

View File

@ -7,11 +7,9 @@
#define SDCARD_SPI_HOST SPI3_HOST #define SDCARD_SPI_HOST SPI3_HOST
#define SDCARD_PIN_CS GPIO_NUM_5 #define SDCARD_PIN_CS GPIO_NUM_5
#define SDCARD_SPI_FREQUENCY 20000000U
std::shared_ptr<SdCard> createYellowSdCard() { std::shared_ptr<SdCard> createYellowSdCard() {
auto* configuration = new tt::hal::SpiSdCard::Config( auto* configuration = new tt::hal::SpiSdCard::Config(
SDCARD_SPI_FREQUENCY,
SDCARD_PIN_CS, SDCARD_PIN_CS,
GPIO_NUM_NC, GPIO_NUM_NC,
GPIO_NUM_NC, GPIO_NUM_NC,

View File

@ -6,14 +6,12 @@
#include <esp_vfs_fat.h> #include <esp_vfs_fat.h>
#include <sdmmc_cmd.h> #include <sdmmc_cmd.h>
#define TDECK_SDCARD_SPI_FREQUENCY 20000000U
#define TDECK_SDCARD_PIN_CS GPIO_NUM_39 #define TDECK_SDCARD_PIN_CS GPIO_NUM_39
#define TDECK_LCD_PIN_CS GPIO_NUM_12 #define TDECK_LCD_PIN_CS GPIO_NUM_12
#define TDECK_RADIO_PIN_CS GPIO_NUM_9 #define TDECK_RADIO_PIN_CS GPIO_NUM_9
std::shared_ptr<SdCard> createTdeckSdCard() { std::shared_ptr<SdCard> createTdeckSdCard() {
auto* configuration = new tt::hal::SpiSdCard::Config( auto* configuration = new tt::hal::SpiSdCard::Config(
TDECK_SDCARD_SPI_FREQUENCY,
TDECK_SDCARD_PIN_CS, TDECK_SDCARD_PIN_CS,
GPIO_NUM_NC, GPIO_NUM_NC,
GPIO_NUM_NC, GPIO_NUM_NC,

View File

@ -5,13 +5,11 @@
#include <esp_vfs_fat.h> #include <esp_vfs_fat.h>
#define CORE2_SDCARD_SPI_FREQUENCY 20000000U
#define CORE2_SDCARD_PIN_CS GPIO_NUM_4 #define CORE2_SDCARD_PIN_CS GPIO_NUM_4
#define CORE2_LCD_PIN_CS GPIO_NUM_5 #define CORE2_LCD_PIN_CS GPIO_NUM_5
std::shared_ptr<SdCard> createSdCard() { std::shared_ptr<SdCard> createSdCard() {
auto* configuration = new tt::hal::SpiSdCard::Config( auto* configuration = new tt::hal::SpiSdCard::Config(
CORE2_SDCARD_SPI_FREQUENCY,
CORE2_SDCARD_PIN_CS, CORE2_SDCARD_PIN_CS,
GPIO_NUM_NC, GPIO_NUM_NC,
GPIO_NUM_NC, GPIO_NUM_NC,

View File

@ -5,13 +5,11 @@
#include <esp_vfs_fat.h> #include <esp_vfs_fat.h>
#define CORES3_SDCARD_SPI_FREQUENCY 20000000U
#define CORES3_SDCARD_PIN_CS GPIO_NUM_4 #define CORES3_SDCARD_PIN_CS GPIO_NUM_4
#define CORES3_LCD_PIN_CS GPIO_NUM_3 #define CORES3_LCD_PIN_CS GPIO_NUM_3
std::shared_ptr<SdCard> createSdCard() { std::shared_ptr<SdCard> createSdCard() {
auto* configuration = new tt::hal::SpiSdCard::Config( auto* configuration = new tt::hal::SpiSdCard::Config(
CORES3_SDCARD_SPI_FREQUENCY,
CORES3_SDCARD_PIN_CS, CORES3_SDCARD_PIN_CS,
GPIO_NUM_NC, GPIO_NUM_NC,
GPIO_NUM_NC, GPIO_NUM_NC,

View File

@ -5,7 +5,6 @@
#include <esp_vfs_fat.h> #include <esp_vfs_fat.h>
#define UNPHONE_SDCARD_SPI_FREQUENCY 20000000U
#define UNPHONE_SDCARD_PIN_CS GPIO_NUM_43 #define UNPHONE_SDCARD_PIN_CS GPIO_NUM_43
#define UNPHONE_LCD_PIN_CS GPIO_NUM_48 #define UNPHONE_LCD_PIN_CS GPIO_NUM_48
#define UNPHONE_LORA_PIN_CS GPIO_NUM_44 #define UNPHONE_LORA_PIN_CS GPIO_NUM_44
@ -13,7 +12,6 @@
std::shared_ptr<SdCard> createUnPhoneSdCard() { std::shared_ptr<SdCard> createUnPhoneSdCard() {
auto* configuration = new tt::hal::SpiSdCard::Config( auto* configuration = new tt::hal::SpiSdCard::Config(
UNPHONE_SDCARD_SPI_FREQUENCY,
UNPHONE_SDCARD_PIN_CS, UNPHONE_SDCARD_PIN_CS,
GPIO_NUM_NC, GPIO_NUM_NC,
GPIO_NUM_NC, GPIO_NUM_NC,

View File

@ -6,8 +6,6 @@ endfunction()
macro(tactility_project project_name) macro(tactility_project project_name)
set(TACTILITY_SKIP_SPIFFS 1) set(TACTILITY_SKIP_SPIFFS 1)
add_definitions(-DESP_TARGET)
add_compile_definitions(ESP_TARGET)
include("${TACTILITY_SDK_PATH}/Libraries/elf_loader/elf_loader.cmake") include("${TACTILITY_SDK_PATH}/Libraries/elf_loader/elf_loader.cmake")
project_elf($project_name) project_elf($project_name)

View File

@ -8,13 +8,13 @@ set(CMAKE_ASM_COMPILE_OBJECT "${CMAKE_CXX_COMPILER_TARGET}")
include("Buildscripts/logo.cmake") include("Buildscripts/logo.cmake")
file(READ version.txt TACTILITY_VERSION)
add_compile_definitions(TT_VERSION="${TACTILITY_VERSION}")
if (DEFINED ENV{ESP_IDF_VERSION}) if (DEFINED ENV{ESP_IDF_VERSION})
message("Building with ESP-IDF v$ENV{ESP_IDF_VERSION}") message("Building with ESP-IDF v$ENV{ESP_IDF_VERSION}")
include($ENV{IDF_PATH}/tools/cmake/project.cmake) include($ENV{IDF_PATH}/tools/cmake/project.cmake)
add_definitions(-DESP_TARGET)
add_compile_definitions(ESP_TARGET)
set(COMPONENTS App) set(COMPONENTS App)
set(EXTRA_COMPONENT_DIRS set(EXTRA_COMPONENT_DIRS
"Boards" "Boards"
@ -34,7 +34,7 @@ if (DEFINED ENV{ESP_IDF_VERSION})
# Non-ESP32 boards # Non-ESP32 boards
if(NOT "${IDF_TARGET}" STREQUAL "esp32") if(NOT "${IDF_TARGET}" STREQUAL "esp32")
set(EXCLUDE_COMPONENTS "YellowBoard") set(EXCLUDE_COMPONENTS "CYD-2432S024C")
set(EXCLUDE_COMPONENTS "M5stackCore2") set(EXCLUDE_COMPONENTS "M5stackCore2")
endif() endif()
@ -53,11 +53,10 @@ if (DEFINED ENV{ESP_IDF_VERSION})
add_compile_definitions(LV_CONF_PATH="${LVGL_CONFIG_FULL_PATH}/lv_conf_kconfig.h") add_compile_definitions(LV_CONF_PATH="${LVGL_CONFIG_FULL_PATH}/lv_conf_kconfig.h")
idf_build_set_property(LINK_OPTIONS "-Wl,--wrap=esp_panic_handler" APPEND) idf_build_set_property(LINK_OPTIONS "-Wl,--wrap=esp_panic_handler" APPEND)
idf_build_set_property(LINK_OPTIONS "-Wl,--wrap=esp_log_write" APPEND) idf_build_set_property(LINK_OPTIONS "-Wl,--wrap=esp_log_write" APPEND)
file(READ version.txt TACTILITY_VERSION)
add_compile_definitions(TT_VERSION="${TACTILITY_VERSION}")
else() else()
message("Building for sim target") message("Building for sim target")
add_compile_definitions(CONFIG_TT_BOARD_ID="simulator")
add_compile_definitions(CONFIG_TT_BOARD_NAME="Simulator")
endif() endif()
project(Tactility) project(Tactility)

View File

@ -10,18 +10,12 @@
- Show error in WiFi screen (e.g. AlertDialog when SPI is not enabled and available memory is below a certain amount) - Show error in WiFi screen (e.g. AlertDialog when SPI is not enabled and available memory is below a certain amount)
- Clean up static_cast when casting to base class. - Clean up static_cast when casting to base class.
- EventFlag: Fix return value of set/get/wait (the errors are weirdly mixed in) - EventFlag: Fix return value of set/get/wait (the errors are weirdly mixed in)
- tt_check() failure during app argument bundle nullptr check seems to trigger SIGSEGV
- Fix bug in T-Deck/etc: esp_lvgl_port settings has a large stack size (~9kB) to fix an issue where the T-Deck would get a stackoverflow. This sometimes happens when WiFi is auto-enabled and you open the app while it is still connecting. - Fix bug in T-Deck/etc: esp_lvgl_port settings has a large stack size (~9kB) to fix an issue where the T-Deck would get a stackoverflow. This sometimes happens when WiFi is auto-enabled and you open the app while it is still connecting.
- M5Stack Core only shows 4MB of SPIRAM in use - M5Stack Core only shows 4MB of SPIRAM in use
- Try to improve Core2 and CoreS3 performance by setting swap_bytes of display driver to false (this is a software operation on the display buffer!) and use 24 bit colour mode if needed
- Files app: When SD card is not mounted, don't show it
- Crash log must mention board type
- Oops crashlog site: Add copy-pasteable addr2line command (e.g. xtensa-esp32s3-elf-addr2line -pfiaC -e Tactility.elf 00000000) - Oops crashlog site: Add copy-pasteable addr2line command (e.g. xtensa-esp32s3-elf-addr2line -pfiaC -e Tactility.elf 00000000)
# TODOs # TODOs
- Experiment with what happens when using C++ code in an external app (without using standard library!) - Experiment with what happens when using C++ code in an external app (without using standard library!)
- Get rid of "ESP_TARGET" and use official "ESP_PLATFORM"
- SpiSdCard should use SDMMC_FREQ_DEFAULT by default
- Boards' CMakeLists.txt manually declare each source folder. Update them all to do a recursive search of all folders. - Boards' CMakeLists.txt manually declare each source folder. Update them all to do a recursive search of all folders.
- We currently build all boards for a given platform (e.g. ESP32S3), but it's better to filter all irrelevant ones based on the Kconfig board settings: - We currently build all boards for a given platform (e.g. ESP32S3), but it's better to filter all irrelevant ones based on the Kconfig board settings:
Projects will load and compile faster as it won't compile all the dependencies of all these other boards Projects will load and compile faster as it won't compile all the dependencies of all these other boards
@ -43,7 +37,6 @@
- Explore LVGL9's FreeRTOS functionality - Explore LVGL9's FreeRTOS functionality
- External app loading: Check version of Tactility and check ESP target hardware, to check for compatibility. - External app loading: Check version of Tactility and check ESP target hardware, to check for compatibility.
- Scanning SD card for external apps and auto-register them (in a temporary register?) - Scanning SD card for external apps and auto-register them (in a temporary register?)
- tt::app::start() and similar functions as proxies for Loader app start/stop/etc.
- Support hot-plugging SD card - Support hot-plugging SD card
# Nice-to-haves # Nice-to-haves

View File

@ -14,22 +14,6 @@
namespace tt::service::loader { namespace tt::service::loader {
// region LoaderEvent
typedef enum {
LoaderEventTypeApplicationStarted,
LoaderEventTypeApplicationShowing,
LoaderEventTypeApplicationHiding,
LoaderEventTypeApplicationStopped
} LoaderEventType;
struct LoaderEvent {
LoaderEventType type;
};
// endregion LoaderEvent
// region LoaderMessage // region LoaderMessage
class LoaderMessageAppStart { class LoaderMessageAppStart {

View File

@ -141,7 +141,7 @@ static void register_and_start_user_services(const std::vector<const service::Se
} }
void run(const Configuration& config) { void run(const Configuration& config) {
TT_LOG_I(TAG, "init started"); TT_LOG_D(TAG, "run");
tt_assert(config.hardware); tt_assert(config.hardware);
const hal::Configuration& hardware = *config.hardware; const hal::Configuration& hardware = *config.hardware;

View File

@ -0,0 +1,22 @@
#include "App.h"
#include "service/loader/Loader.h"
namespace tt::app {
void start(const std::string& id, std::shared_ptr<const Bundle> _Nullable parameters) {
service::loader::startApp(id, std::move(parameters));
}
void stop() {
service::loader::stopApp();
}
std::shared_ptr<app::AppContext> _Nullable getCurrentAppContext() {
return service::loader::getCurrentAppContext();
}
std::shared_ptr<app::App> _Nullable getCurrentApp() {
return service::loader::getCurrentApp();
}
}

View File

@ -3,6 +3,7 @@
#include "AppContext.h" #include "AppContext.h"
#include "Bundle.h" #include "Bundle.h"
#include <Mutex.h> #include <Mutex.h>
#include <string>
// Forward declarations // Forward declarations
typedef struct _lv_obj_t lv_obj_t; typedef struct _lv_obj_t lv_obj_t;
@ -75,4 +76,20 @@ public:
template<typename T> template<typename T>
std::shared_ptr<App> create() { return std::shared_ptr<T>(new T); } std::shared_ptr<App> create() { return std::shared_ptr<T>(new T); }
/**
* @brief Start an app
* @param[in] id application name or id
* @param[in] parameters optional parameters to pass onto the application
*/
void start(const std::string& id, std::shared_ptr<const Bundle> _Nullable parameters = nullptr);
/** @brief Stop the currently showing app. Show the previous app if any app was still running. */
void stop();
/** @return the currently running app context (it is only ever null before the splash screen is shown) */
std::shared_ptr<app::AppContext> _Nullable getCurrentAppContext();
/** @return the currently running app (it is only ever null before the splash screen is shown) */
std::shared_ptr<app::App> _Nullable getCurrentApp();
} }

View File

@ -1,4 +1,4 @@
#ifdef ESP_TARGET #ifdef ESP_PLATFORM
#include "app/crashdiagnostics/QrHelpers.h" #include "app/crashdiagnostics/QrHelpers.h"
#include "app/crashdiagnostics/QrUrl.h" #include "app/crashdiagnostics/QrUrl.h"

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
#ifdef ESP_TARGET #ifdef ESP_PLATFORM
namespace tt::app::crashdiagnostics { namespace tt::app::crashdiagnostics {

View File

@ -1,4 +1,4 @@
#ifdef ESP_TARGET #ifdef ESP_PLATFORM
#include "app/crashdiagnostics/QrUrl.h" #include "app/crashdiagnostics/QrUrl.h"
@ -8,6 +8,8 @@
#include <sstream> #include <sstream>
#include <esp_cpu_utils.h> #include <esp_cpu_utils.h>
#include <sdkconfig.h>
std::string getUrlFromCrashData() { std::string getUrlFromCrashData() {
auto crash_data = getRtcCrashData(); auto crash_data = getRtcCrashData();
auto* stack_buffer = (uint32_t*) malloc(crash_data.callstackLength * 2 * sizeof(uint32_t)); auto* stack_buffer = (uint32_t*) malloc(crash_data.callstackLength * 2 * sizeof(uint32_t));
@ -28,6 +30,7 @@ std::string getUrlFromCrashData() {
stream << "https://oops.tactility.one"; stream << "https://oops.tactility.one";
stream << "?v=" << TT_VERSION; // Version stream << "?v=" << TT_VERSION; // Version
stream << "&a=" << CONFIG_IDF_TARGET; // Architecture stream << "&a=" << CONFIG_IDF_TARGET; // Architecture
stream << "&b=" << CONFIG_TT_BOARD_ID; // Board identifier
stream << "&s="; // Stacktrace stream << "&s="; // Stacktrace
for (int i = crash_data.callstackLength - 1; i >= 0; --i) { for (int i = crash_data.callstackLength - 1; i >= 0; --i) {

View File

@ -1,10 +1,11 @@
#include "app/files/State.h" #include "app/files/State.h"
#include "app/files/FileUtils.h" #include "app/files/FileUtils.h"
#include "kernel/Kernel.h"
#include "Log.h" #include "Log.h"
#include "Partitions.h" #include "Partitions.h"
#include "TactilityHeadless.h"
#include "hal/SdCard.h" #include "hal/SdCard.h"
#include "kernel/Kernel.h"
#include <unistd.h> #include <unistd.h>
@ -61,11 +62,22 @@ bool State::setEntriesForPath(const std::string& path) {
.d_type = TT_DT_DIR, .d_type = TT_DT_DIR,
.d_name = DATA_PARTITION_NAME .d_name = DATA_PARTITION_NAME
}); });
dir_entries.push_back({
.d_ino = 2, #ifndef TT_SCREENSHOT_MODE
.d_type = TT_DT_DIR, auto sdcard = tt::hal::getConfiguration()->sdcard;
.d_name = TT_SDCARD_MOUNT_NAME if (sdcard != nullptr) {
}); auto state = sdcard->getState();
if (state == hal::SdCard::State::Mounted) {
#endif
dir_entries.push_back({
.d_ino = 2,
.d_type = TT_DT_DIR,
.d_name = TT_SDCARD_MOUNT_NAME
});
#ifndef TT_SCREENSHOT_MODE
}
}
#endif
current_path = path; current_path = path;
selected_child_entry = ""; selected_child_entry = "";

View File

@ -49,10 +49,10 @@ static void loader_free() {
loader_singleton = nullptr; loader_singleton = nullptr;
} }
void startApp(const std::string& id, const std::shared_ptr<const Bundle>& parameters) { void startApp(const std::string& id, std::shared_ptr<const Bundle> parameters) {
TT_LOG_I(TAG, "Start app %s", id.c_str()); TT_LOG_I(TAG, "Start app %s", id.c_str());
tt_assert(loader_singleton); tt_assert(loader_singleton);
auto message = std::make_shared<LoaderMessageAppStart>(id, parameters); auto message = std::make_shared<LoaderMessageAppStart>(id, std::move(parameters));
loader_singleton->dispatcherThread->dispatch(onStartAppMessage, message); loader_singleton->dispatcherThread->dispatch(onStartAppMessage, message);
} }

View File

@ -8,15 +8,27 @@
namespace tt::service::loader { namespace tt::service::loader {
typedef struct Loader Loader; // region LoaderEvent for PubSub
typedef enum {
LoaderEventTypeApplicationStarted,
LoaderEventTypeApplicationShowing,
LoaderEventTypeApplicationHiding,
LoaderEventTypeApplicationStopped
} LoaderEventType;
struct LoaderEvent {
LoaderEventType type;
};
// endregion LoaderEvent for PubSub
/** /**
* @brief Start an app * @brief Start an app
* @param[in] id application name or id * @param[in] id application name or id
* @param[in] parameters optional parameters to pass onto the application * @param[in] parameters optional parameters to pass onto the application
*/ */
void startApp(const std::string& id, const std::shared_ptr<const Bundle>& _Nullable parameters = nullptr); void startApp(const std::string& id, std::shared_ptr<const Bundle> _Nullable parameters = nullptr);
/** @brief Stop the currently showing app. Show the previous app if any app was still running. */ /** @brief Stop the currently showing app. Show the previous app if any app was still running. */
void stopApp(); void stopApp();

View File

@ -31,7 +31,7 @@ TT_NORETURN void _crash() {
logTaskInfo(); logTaskInfo();
logMemoryInfo(); logMemoryInfo();
// TODO: Add breakpoint when debugger is attached. // TODO: Add breakpoint when debugger is attached.
#ifdef ESP_TARGET #ifdef ESP_PLATFORM
esp_system_abort("System halted. Connect debugger for more info."); esp_system_abort("System halted. Connect debugger for more info.");
#endif #endif
__builtin_unreachable(); __builtin_unreachable();

View File

@ -22,7 +22,7 @@
#define TT_ALIGN(n) __attribute__((aligned(n))) #define TT_ALIGN(n) __attribute__((aligned(n)))
// Used by portENABLE_INTERRUPTS and portDISABLE_INTERRUPTS? // Used by portENABLE_INTERRUPTS and portDISABLE_INTERRUPTS?
#ifdef ESP_TARGET #ifdef ESP_PLATFORM
#define TT_IS_IRQ_MODE() (xPortInIsrContext() == pdTRUE) #define TT_IS_IRQ_MODE() (xPortInIsrContext() == pdTRUE)
#else #else
#define TT_IS_IRQ_MODE() false #define TT_IS_IRQ_MODE() false

View File

@ -2,7 +2,7 @@
#include "LogMessages.h" #include "LogMessages.h"
#ifdef ESP_TARGET #ifdef ESP_PLATFORM
#include <esp_log.h> #include <esp_log.h>
#else #else
#include <cstdarg> #include <cstdarg>
@ -43,7 +43,7 @@ LogEntry* copyLogEntries(unsigned int& outIndex);
} // namespace tt } // namespace tt
#ifdef ESP_TARGET #ifdef ESP_PLATFORM
#define TT_LOG_E(tag, format, ...) \ #define TT_LOG_E(tag, format, ...) \
ESP_LOGE(tag, format, ##__VA_ARGS__) ESP_LOGE(tag, format, ##__VA_ARGS__)
@ -75,4 +75,4 @@ void log(LogLevel level, const char* tag, const char* format, ...);
#define TT_LOG_V(tag, format, ...) \ #define TT_LOG_V(tag, format, ...) \
tt::log(tt::LogLevel::Trace, tag, format, ##__VA_ARGS__) tt::log(tt::LogLevel::Trace, tag, format, ##__VA_ARGS__)
#endif // ESP_TARGET #endif // ESP_PLATFORM

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
#ifdef ESP_TARGET #ifdef ESP_PLATFORM
namespace tt { namespace tt {
@ -8,4 +8,4 @@ void initEsp();
} // namespace } // namespace
#endif // ESP_TARGET #endif // ESP_PLATFORM

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
#ifdef ESP_TARGET #ifdef ESP_PLATFORM
#include "esp_err.h" #include "esp_err.h"
@ -10,4 +10,4 @@ esp_err_t initPartitionsEsp();
} // namespace } // namespace
#endif // ESP_TARGET #endif // ESP_PLATFORM

View File

@ -1,4 +1,4 @@
#ifdef ESP_TARGET #ifdef ESP_PLATFORM
#include "EspPartitions_i.h" #include "EspPartitions_i.h"
#include "Log.h" #include "Log.h"
@ -51,4 +51,4 @@ esp_err_t initPartitionsEsp() {
} // namespace } // namespace
#endif // ESP_TARGET #endif // ESP_PLATFORM

View File

@ -38,6 +38,7 @@ static void register_and_start_system_services() {
} }
void initHeadless(const hal::Configuration& config) { void initHeadless(const hal::Configuration& config) {
TT_LOG_I(TAG, "Tactility v%s on %s (%s)", TT_VERSION, CONFIG_TT_BOARD_NAME, CONFIG_TT_BOARD_ID);
#ifdef ESP_PLATFORM #ifdef ESP_PLATFORM
initEsp(); initEsp();
#endif #endif

View File

@ -1,4 +1,4 @@
#ifdef ESP_TARGET #ifdef ESP_PLATFORM
#include "TactilityCore.h" #include "TactilityCore.h"
#include "EspPartitions_i.h" #include "EspPartitions_i.h"

View File

@ -74,7 +74,7 @@ bool SpiSdCard::mountInternal(const char* mountPoint) {
// The following value is from T-Deck repo's UnitTest.ino project: // The following value is from T-Deck repo's UnitTest.ino project:
// https://github.com/Xinyuan-LilyGO/T-Deck/blob/master/examples/UnitTest/UnitTest.ino // https://github.com/Xinyuan-LilyGO/T-Deck/blob/master/examples/UnitTest/UnitTest.ino
// Observation: Using this automatically sets the bus to 20MHz // Observation: Using this automatically sets the bus to 20MHz
host.max_freq_khz = config->spiFrequency / 1000U; host.max_freq_khz = config->spiFrequencyKhz;
host.slot = config->spiHost; host.slot = config->spiHost;
esp_err_t result = esp_vfs_fat_sdspi_mount(mountPoint, &host, &slot_config, &mount_config, &card); esp_err_t result = esp_vfs_fat_sdspi_mount(mountPoint, &host, &slot_config, &mount_config, &card);

View File

@ -19,7 +19,6 @@ class SpiSdCard : public tt::hal::SdCard {
public: public:
struct Config { struct Config {
Config( Config(
int spiFrequency,
gpio_num_t spiPinCs, gpio_num_t spiPinCs,
gpio_num_t spiPinCd, gpio_num_t spiPinCd,
gpio_num_t spiPinWp, gpio_num_t spiPinWp,
@ -27,8 +26,9 @@ public:
MountBehaviour mountBehaviourAtBoot, MountBehaviour mountBehaviourAtBoot,
std::shared_ptr<Lockable> lockable = nullptr, std::shared_ptr<Lockable> lockable = nullptr,
std::vector<gpio_num_t> csPinWorkAround = std::vector<gpio_num_t>(), std::vector<gpio_num_t> csPinWorkAround = std::vector<gpio_num_t>(),
spi_host_device_t spiHost = SPI2_HOST spi_host_device_t spiHost = SPI2_HOST,
) : spiFrequency(spiFrequency), int spiFrequencyKhz = SDMMC_FREQ_DEFAULT
) : spiFrequencyKhz(spiFrequencyKhz),
spiPinCs(spiPinCs), spiPinCs(spiPinCs),
spiPinCd(spiPinCd), spiPinCd(spiPinCd),
spiPinWp(spiPinWp), spiPinWp(spiPinWp),
@ -39,7 +39,7 @@ public:
spiHost(spiHost) spiHost(spiHost)
{} {}
int spiFrequency; int spiFrequencyKhz;
gpio_num_t spiPinCs; // Clock gpio_num_t spiPinCs; // Clock
gpio_num_t spiPinCd; // Card detect gpio_num_t spiPinCd; // Card detect
gpio_num_t spiPinWp; // Write-protect gpio_num_t spiPinWp; // Write-protect

View File

@ -1,4 +1,4 @@
#ifdef ESP_TARGET #ifdef ESP_PLATFORM
#include "I2c.h" #include "I2c.h"
#include "Log.h" #include "Log.h"

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
#ifdef ESP_TARGET #ifdef ESP_PLATFORM
#include <hal/i2c_types.h> #include <hal/i2c_types.h>
#include <driver/i2c.h> #include <driver/i2c.h>
#else #else

View File

@ -1,4 +1,4 @@
#ifndef ESP_TARGET #ifndef ESP_PLATFORM
/** /**
* This code is based on i2c_manager from https://github.com/ropg/i2c_manager/blob/master/i2c_manager/i2c_manager.c (original has MIT license) * This code is based on i2c_manager from https://github.com/ropg/i2c_manager/blob/master/i2c_manager/i2c_manager.c (original has MIT license)

View File

@ -1,4 +1,4 @@
#ifdef ESP_TARGET #ifdef ESP_PLATFORM
#include "Wifi.h" #include "Wifi.h"
@ -970,4 +970,4 @@ extern const ServiceManifest manifest = {
} // namespace } // namespace
#endif // ESP_TARGET #endif // ESP_PLATFORM

View File

@ -1,6 +1,6 @@
#include "Wifi.h" #include "Wifi.h"
#ifndef ESP_TARGET #ifndef ESP_PLATFORM
#include "Check.h" #include "Check.h"
#include "Log.h" #include "Log.h"
@ -160,4 +160,4 @@ extern const ServiceManifest manifest = {
} // namespace } // namespace
#endif // ESP_TARGET #endif // ESP_PLATFORM

View File

@ -1,4 +1,4 @@
#ifdef ESP_TARGET #ifdef ESP_PLATFORM
#include "WifiGlobals.h" #include "WifiGlobals.h"
#include "WifiSettings.h" #include "WifiSettings.h"
@ -144,4 +144,4 @@ bool remove(const char* ssid) {
} // nemespace } // nemespace
#endif // ESP_TARGET #endif // ESP_PLATFORM

View File

@ -1,4 +1,4 @@
#ifndef ESP_TARGET #ifndef ESP_PLATFORM
#include "WifiSettings.h" #include "WifiSettings.h"
#include "Log.h" #include "Log.h"
@ -25,4 +25,4 @@ bool remove(const char* ssid) {
} // namespace } // namespace
#endif // ESP_TARGET #endif // ESP_PLATFORM

View File

@ -29,7 +29,9 @@ CONFIG_FATFS_LFN_HEAP=y
CONFIG_FATFS_VOLUME_COUNT=3 CONFIG_FATFS_VOLUME_COUNT=3
# Hardware: Main # Hardware: Main
CONFIG_TT_BOARD_YELLOW_BOARD_24_CAP=y CONFIG_TT_BOARD_CYD_2432S024C=y
CONFIG_TT_BOARD_NAME="CYD 2432S024C"
CONFIG_TT_BOARD_ID="cyd-2432S024c"
CONFIG_IDF_TARGET="esp32" CONFIG_IDF_TARGET="esp32"
CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y
CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y

View File

@ -29,8 +29,10 @@ CONFIG_FATFS_LFN_HEAP=y
CONFIG_FATFS_VOLUME_COUNT=3 CONFIG_FATFS_VOLUME_COUNT=3
# Hardware: Main # Hardware: Main
CONFIG_IDF_EXPERIMENTAL_FEATURES=y
CONFIG_TT_BOARD_LILYGO_TDECK=y CONFIG_TT_BOARD_LILYGO_TDECK=y
CONFIG_TT_BOARD_NAME="LilyGo T-Deck"
CONFIG_TT_BOARD_ID="lilygo-tdeck"
CONFIG_IDF_EXPERIMENTAL_FEATURES=y
CONFIG_IDF_TARGET="esp32s3" CONFIG_IDF_TARGET="esp32s3"
CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y
CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y

View File

@ -29,8 +29,10 @@ CONFIG_FATFS_LFN_HEAP=y
CONFIG_FATFS_VOLUME_COUNT=3 CONFIG_FATFS_VOLUME_COUNT=3
# Hardware: Main # Hardware: Main
CONFIG_IDF_EXPERIMENTAL_FEATURES=y
CONFIG_TT_BOARD_M5STACK_CORE2=y CONFIG_TT_BOARD_M5STACK_CORE2=y
CONFIG_TT_BOARD_NAME="M5Stack Core2"
CONFIG_TT_BOARD_ID="m5stack-core2"
CONFIG_IDF_EXPERIMENTAL_FEATURES=y
CONFIG_IDF_TARGET="esp32" CONFIG_IDF_TARGET="esp32"
CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y
CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y

View File

@ -29,8 +29,10 @@ CONFIG_FATFS_LFN_HEAP=y
CONFIG_FATFS_VOLUME_COUNT=3 CONFIG_FATFS_VOLUME_COUNT=3
# Hardware: Main # Hardware: Main
CONFIG_IDF_EXPERIMENTAL_FEATURES=y
CONFIG_TT_BOARD_M5STACK_CORES3=y CONFIG_TT_BOARD_M5STACK_CORES3=y
CONFIG_TT_BOARD_NAME="M5Stack CoreS3"
CONFIG_TT_BOARD_ID="m5stack-cores3"
CONFIG_IDF_EXPERIMENTAL_FEATURES=y
CONFIG_IDF_TARGET="esp32s3" CONFIG_IDF_TARGET="esp32s3"
CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y
CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y

View File

@ -30,6 +30,8 @@ CONFIG_FATFS_VOLUME_COUNT=3
# Hardware: Main # Hardware: Main
CONFIG_TT_BOARD_UNPHONE=y CONFIG_TT_BOARD_UNPHONE=y
CONFIG_TT_BOARD_NAME="unPhone"
CONFIG_TT_BOARD_ID="unphone"
CONFIG_IDF_TARGET="esp32s3" CONFIG_IDF_TARGET="esp32s3"
CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y
CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y