Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Apps/Brainfuck/main/Source/Brainfuck.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "Brainfuck.h"
#include <tt_app.h>
#include <tt_lvgl_toolbar.h>
#include <lvgl/widgets/toolbar.h>
#include <dirent.h>
#include <stdio.h>
#include <stdlib.h>
Expand Down Expand Up @@ -399,11 +399,11 @@ void Brainfuck::onShow(AppHandle app, lv_obj_t* parent) {
lv_obj_remove_flag(parent, LV_OBJ_FLAG_SCROLLABLE);
lv_obj_set_flex_flow(parent, LV_FLEX_FLOW_COLUMN);

lv_obj_t* toolbar = tt_lvgl_toolbar_create_for_app(parent, app);
lv_obj_t* toolbar = lvgl_toolbar_create(parent, "Brainfuck interpreter");
lv_obj_align(toolbar, LV_ALIGN_TOP_MID, 0, 0);
clrBtn = tt_lvgl_toolbar_add_text_button_action(toolbar, LV_SYMBOL_TRASH, onClearClicked, nullptr);
clrBtn = lvgl_toolbar_add_text_button_action(toolbar, LV_SYMBOL_TRASH, onClearClicked, nullptr);
lv_obj_add_flag(clrBtn, LV_OBJ_FLAG_HIDDEN);
tt_lvgl_toolbar_add_text_button_action(toolbar, LV_SYMBOL_LIST, onExamplesClicked, nullptr);
lvgl_toolbar_add_text_button_action(toolbar, LV_SYMBOL_LIST, onExamplesClicked, nullptr);

lv_obj_t* cont = lv_obj_create(parent);
lv_obj_set_width(cont, LV_PCT(100));
Expand Down
4 changes: 2 additions & 2 deletions Apps/Brainfuck/manifest.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ manifest.version=0.2
target.sdk=0.8.0-dev
target.platforms=esp32,esp32s3,esp32c6,esp32p4
app.id=one.tactility.brainfuck
app.version.name=0.5.0
app.version.code=5
app.version.name=0.6.0
app.version.code=6
app.name=Brainfuck interpreter
app.description=Brainfuck esoteric language interpreter
11 changes: 6 additions & 5 deletions Apps/Breakout/main/Source/Breakout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@

#include <cstdio>
#include <cmath>
#include <tt_lvgl_toolbar.h>
#include <lvgl/widgets/toolbar.h>
#include <tt_preferences.h>
#include <esp_random.h>
#include <tt_lvgl_keyboard.h>
#include <tactility/device.h>
#include <tactility/drivers/keyboard.h>

#include <lvgl/lvgl.h>
#include <lvgl/lvgl_fonts.h>
#include <lvgl/fonts.h>

constexpr auto* TAG = "Breakout";

Expand Down Expand Up @@ -128,7 +129,7 @@ void Breakout::onShow(AppHandle appHandle, lv_obj_t* parent) {
}

// Toolbar
lv_obj_t* toolbar = tt_lvgl_toolbar_create_for_app(parent, appHandle);
lv_obj_t* toolbar = lvgl_toolbar_create(parent, "Breakout");

// Score wrapper in toolbar
lv_obj_t* scoreWrap = lv_obj_create(toolbar);
Expand Down Expand Up @@ -1329,7 +1330,7 @@ void Breakout::updateMessage() {
case GameState::Ready: {
char buf[64];
const char* input_hint = "Touch";
if (tt_lvgl_hardware_keyboard_is_available()) {
if (device_has_active_by_type(&KEYBOARD_TYPE)) {
input_hint = "Space";
}
if (level > 1) {
Expand Down
4 changes: 2 additions & 2 deletions Apps/Breakout/manifest.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ manifest.version=0.2
target.sdk=0.8.0-dev
target.platforms=esp32,esp32s3,esp32c6,esp32p4
app.id=one.tactility.breakout
app.version.name=0.6.0
app.version.code=6
app.version.name=0.7.0
app.version.code=7
app.name=Breakout
app.description=Classic brick-breaking arcade game
4 changes: 2 additions & 2 deletions Apps/Calculator/main/Source/Calculator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <cstdio>
#include <ctype.h>
#include <tt_lvgl_toolbar.h>
#include <lvgl/widgets/toolbar.h>
#include <stack>
#include <cstring>

Expand Down Expand Up @@ -148,7 +148,7 @@ void Calculator::onShow(AppHandle appHandle, lv_obj_t* parent) {
lv_obj_set_flex_flow(parent, LV_FLEX_FLOW_COLUMN);
lv_obj_set_style_pad_row(parent, 0, LV_STATE_DEFAULT);

lv_obj_t* toolbar = tt_lvgl_toolbar_create_for_app(parent, appHandle);
lv_obj_t* toolbar = lvgl_toolbar_create(parent, "Calculator");
lv_obj_align(toolbar, LV_ALIGN_TOP_MID, 0, 0);

lv_obj_t* wrapper = lv_obj_create(parent);
Expand Down
4 changes: 2 additions & 2 deletions Apps/Calculator/manifest.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ manifest.version=0.2
target.sdk=0.8.0-dev
target.platforms=esp32,esp32s3,esp32c6,esp32p4
app.id=one.tactility.calculator
app.version.name=0.6.0
app.version.code=6
app.version.name=0.7.0
app.version.code=7
app.name=Calculator
29 changes: 14 additions & 15 deletions Apps/Diceware/main/Source/Diceware.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#include "Diceware.h"

#include <tt_app_alertdialog.h>
#include <tt_lock.h>
#include <tactility/filesystem/file_mutex.h>
#include <lvgl/lvgl.h>
#include <tt_lvgl_toolbar.h>
#include <lvgl/widgets/toolbar.h>

#include <esp_random.h>
#include <esp_log.h>
Expand Down Expand Up @@ -39,18 +39,17 @@ static std::string readWordAtLine(const AppHandle handle, const int lineIndex) {
return "";
}

auto lock = tt_lock_alloc_for_path(path);
struct FileMutex mutex;
file_mutex_get(&mutex, path);
std::string word;
if (tt_lock_acquire(lock, tt::kernel::MAX_TICKS)) {
FILE* file = fopen(path, "r");
if (file != nullptr) {
skipNewlines(file, lineIndex);
word = readWord(file);
fclose(file);
} else { ESP_LOGE(TAG, "Failed to open %s", path); }
tt_lock_release(lock);
} else { ESP_LOGE(TAG, "Failed to acquire lock for %s", path); }
tt_lock_free(lock);
file_mutex_lock(&mutex);
FILE* file = fopen(path, "r");
if (file != nullptr) {
skipNewlines(file, lineIndex);
word = readWord(file);
fclose(file);
} else { ESP_LOGE(TAG, "Failed to open %s", path); }
file_mutex_unlock(&mutex);
return word;
}

Expand Down Expand Up @@ -123,8 +122,8 @@ void Diceware::onShow(AppHandle appHandle, lv_obj_t* parent) {
lv_obj_set_flex_flow(parent, LV_FLEX_FLOW_COLUMN);
lv_obj_set_style_pad_row(parent, 0, LV_STATE_DEFAULT);

auto* toolbar = tt_lvgl_toolbar_create_for_app(parent, appHandle);
tt_lvgl_toolbar_add_text_button_action(toolbar, "?", onHelpClicked, nullptr);
auto* toolbar = lvgl_toolbar_create(parent, "Diceware");
lvgl_toolbar_add_text_button_action(toolbar, "?", onHelpClicked, nullptr);

auto* wrapper = lv_obj_create(parent);
lv_obj_set_style_border_width(wrapper, 0, LV_STATE_DEFAULT);
Expand Down
4 changes: 2 additions & 2 deletions Apps/Diceware/manifest.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ manifest.version=0.2
target.sdk=0.8.0-dev
target.platforms=esp32,esp32s3,esp32c6,esp32p4
app.id=one.tactility.diceware
app.version.name=0.7.0
app.version.code=7
app.version.name=0.8.0
app.version.code=8
app.name=Diceware
4 changes: 2 additions & 2 deletions Apps/EpubReader/main/Source/EpubReader.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "EpubReader.h"
#include "HtmlStrip.h" // stripHtmlToText
#include <tt_bundle.h>
#include <tt_lvgl_toolbar.h>
#include <lvgl/widgets/toolbar.h>
#include <tt_app_alertdialog.h>
#include <tt_app_selectiondialog.h>
#include <tactility/log.h>
Expand Down Expand Up @@ -239,7 +239,7 @@ void EpubReader::onShow(AppHandle app, lv_obj_t* parent) {
lv_obj_set_flex_flow(parent, LV_FLEX_FLOW_COLUMN);
lv_obj_remove_flag(parent, LV_OBJ_FLAG_SCROLLABLE);

toolbar_ = tt_lvgl_toolbar_create_for_app(parent, app);
toolbar_ = lvgl_toolbar_create(parent, "Epub Reader");

wrapperWidget_ = lv_obj_create(parent);
lv_obj_set_width(wrapperWidget_, LV_PCT(100));
Expand Down
20 changes: 7 additions & 13 deletions Apps/EpubReader/main/Source/EpubReaderAsync.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "EpubReader.h"
#include <tt_lvgl_toolbar.h>
#include <tt_lock.h>
#include <lvgl/widgets/toolbar.h>
#include <tactility/filesystem/file_mutex.h>
#include <tactility/log.h>
#include <Tactility/kernel/Kernel.h>
#include <freertos/FreeRTOS.h>
Expand Down Expand Up @@ -43,7 +43,7 @@ void EpubReader::spawnOpenTask(EpubReader* self, bool restore) {

// Show a brief placeholder so old content doesn't linger during the open
lv_obj_clean(self->wrapperWidget_);
tt_lvgl_toolbar_clear_actions(self->toolbar_);
lvgl_toolbar_clear_actions(self->toolbar_);
lv_obj_t* lbl = lv_label_create(self->wrapperWidget_);
lv_obj_set_style_pad_all(lbl, 8, 0);
lv_label_set_text(lbl, restore ? "Loading..." : "Opening...");
Expand Down Expand Up @@ -115,14 +115,9 @@ void EpubReader::backgroundOpenTask(void* data) {

// Acquire the filesystem lock before any SD card I/O - prevents concurrent
// SDMMC access from the background and LVGL tasks (bus errors 0x107/0x108).
auto lock = tt_lock_alloc_for_path(a->filePath.c_str());
if (!tt_lock_acquire(lock, tt::kernel::MAX_TICKS)) {
LOG_E(TAG, "FS lock timed out, skipping open: %s", a->filePath.c_str());
tt_lock_free(lock);
lv_async_call(asyncOpenComplete, a);
vTaskDelete(nullptr);
return;
}
struct FileMutex mutex;
file_mutex_get(&mutex, a->filePath.c_str());
file_mutex_lock(&mutex);
Comment thread
KenVanHoeylandt marked this conversation as resolved.

if (isTextFile(a->filePath)) {
// Read the entire text file here (under the lock) so asyncOpenComplete
Expand All @@ -146,8 +141,7 @@ void EpubReader::backgroundOpenTask(void* data) {
a->epub = EpubService::open(a->filePath);
}

tt_lock_release(lock);
tt_lock_free(lock);
file_mutex_unlock(&mutex);

// Signal the LVGL task that the work is done
lv_async_call(asyncOpenComplete, a);
Expand Down
16 changes: 8 additions & 8 deletions Apps/EpubReader/main/Source/EpubReaderUI.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "EpubReader.h"
#include <tt_lvgl_toolbar.h>
#include <lvgl/widgets/toolbar.h>
#include <tactility/log.h>
#include <esp_heap_caps.h>
#include <dirent.h>
Expand Down Expand Up @@ -37,20 +37,20 @@ static void setListBtnLongMode(lv_obj_t* btn, lv_label_long_mode_t mode) {
// ---------------------------------------------------------------------------

void EpubReader::setReaderToolbarButtons() {
tt_lvgl_toolbar_clear_actions(toolbar_);
tt_lvgl_toolbar_add_text_button_action(toolbar_, LV_SYMBOL_PREV, onPrevPressed, this);
lvgl_toolbar_clear_actions(toolbar_);
lvgl_toolbar_add_text_button_action(toolbar_, LV_SYMBOL_PREV, onPrevPressed, this);
if (!textMode_) {
tt_lvgl_toolbar_add_text_button_action(toolbar_, LV_SYMBOL_LIST, onTocPressed, this);
lvgl_toolbar_add_text_button_action(toolbar_, LV_SYMBOL_LIST, onTocPressed, this);
}
tt_lvgl_toolbar_add_text_button_action(toolbar_, LV_SYMBOL_NEXT, onNextPressed, this);
tt_lvgl_toolbar_add_text_button_action(toolbar_, LV_SYMBOL_DIRECTORY, onBrowsePressed, this);
lvgl_toolbar_add_text_button_action(toolbar_, LV_SYMBOL_NEXT, onNextPressed, this);
lvgl_toolbar_add_text_button_action(toolbar_, LV_SYMBOL_DIRECTORY, onBrowsePressed, this);
}

void EpubReader::setBrowserToolbarButtons() {
tt_lvgl_toolbar_clear_actions(toolbar_);
lvgl_toolbar_clear_actions(toolbar_);
// Show "Use Folder" button when the current browse path isn't already the saved books folder
if (browsePath_ != booksPath_) {
tt_lvgl_toolbar_add_text_button_action(toolbar_, LV_SYMBOL_DIRECTORY, onSetBooksFolder, this);
lvgl_toolbar_add_text_button_action(toolbar_, LV_SYMBOL_DIRECTORY, onSetBooksFolder, this);
}
}

Expand Down
4 changes: 2 additions & 2 deletions Apps/EpubReader/manifest.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ manifest.version=0.2
target.sdk=0.8.0-dev
target.platforms=esp32s3,esp32p4
app.id=one.tactility.epubreader
app.version.name=0.4.0
app.version.code=4
app.version.name=0.5.0
app.version.code=5
app.name=Epub Reader
app.description=Epub and text file reader. Requires PSRAM!
5 changes: 2 additions & 3 deletions Apps/EspNowBridge/main/Source/EspNowBridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@
#include <tt_app.h>
#include <tt_app_fileselection.h>
#include <tt_bundle.h>
#include <tt_lock.h>
#include <lvgl/lvgl.h>
#include <tt_lvgl_toolbar.h>
#include <lvgl/widgets/toolbar.h>

#include <esp_app_desc.h>
#include <esp_app_format.h>
Expand Down Expand Up @@ -656,7 +655,7 @@ void EspNowBridge::onShow(AppHandle app, lv_obj_t* parent) {
lv_obj_remove_flag(parent, LV_OBJ_FLAG_SCROLLABLE);
lv_obj_set_flex_flow(parent, LV_FLEX_FLOW_COLUMN);

lv_obj_t* toolbar = tt_lvgl_toolbar_create_for_app(parent, app);
lv_obj_t* toolbar = lvgl_toolbar_create(parent, "ESP-NOW Bridge");
lv_obj_align(toolbar, LV_ALIGN_TOP_MID, 0, 0);

auto* wrapper = lv_obj_create(parent);
Expand Down
4 changes: 2 additions & 2 deletions Apps/EspNowBridge/manifest.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ manifest.version=0.2
target.sdk=0.8.0-dev
target.platforms=esp32p4
app.id=one.tactility.espnowbridge
app.version.name=0.2.0
app.version.code=2
app.version.name=0.3.0
app.version.code=3
app.name=ESP-NOW Bridge
app.description=Companion app for updating P4 device C6 co-processor firmware to enable ESP-NOW bridge support.
4 changes: 2 additions & 2 deletions Apps/GPIO/main/Source/Gpio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <Tactility/kernel/Kernel.h>

#include <tt_lvgl_toolbar.h>
#include <lvgl/widgets/toolbar.h>

#include <lvgl/lvgl.h>

Expand Down Expand Up @@ -78,7 +78,7 @@ void Gpio::onShow(AppHandle app, lv_obj_t* parent) {
lv_obj_set_flex_flow(parent, LV_FLEX_FLOW_COLUMN);
lv_obj_set_style_pad_row(parent, 0, LV_STATE_DEFAULT);

auto* toolbar = tt_lvgl_toolbar_create_for_app(parent, app);
auto* toolbar = lvgl_toolbar_create(parent, "GPIO");
lv_obj_align(toolbar, LV_ALIGN_TOP_MID, 0, 0);

// Main content wrapper, enables scrolling content without scrolling the toolbar
Expand Down
4 changes: 2 additions & 2 deletions Apps/GPIO/manifest.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ manifest.version=0.2
target.sdk=0.8.0-dev
target.platforms=esp32,esp32s3,esp32c6,esp32p4
app.id=one.tactility.gpio
app.version.name=0.8.0
app.version.code=8
app.version.name=0.9.0
app.version.code=9
app.name=GPIO
4 changes: 2 additions & 2 deletions Apps/GraphicsDemo/manifest.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ manifest.version=0.2
target.sdk=0.8.0-dev
target.platforms=esp32,esp32s3,esp32c6,esp32p4
app.id=one.tactility.graphicsdemo
app.version.name=0.6.0
app.version.code=6
app.version.name=0.7.0
app.version.code=7
app.name=Graphics Demo
4 changes: 2 additions & 2 deletions Apps/HelloWorld/main/Source/main.c
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#include <tt_app.h>
#include <tt_lvgl_toolbar.h>
#include <lvgl/widgets/toolbar.h>

/**
* Note: LVGL and Tactility methods need to be exposed manually from TactilityC/Source/tt_init.cpp
* Only C is supported for now (C++ symbols fail to link)
*/
static void onShowApp(AppHandle app, void* data, lv_obj_t* parent) {
lv_obj_t* toolbar = tt_lvgl_toolbar_create_for_app(parent, app);
lv_obj_t* toolbar = lvgl_toolbar_create(parent, "Hello World");
lv_obj_align(toolbar, LV_ALIGN_TOP_MID, 0, 0);

lv_obj_t* label = lv_label_create(parent);
Expand Down
4 changes: 2 additions & 2 deletions Apps/HelloWorld/manifest.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ manifest.version=0.2
target.sdk=0.8.0-dev
target.platforms=esp32,esp32s3,esp32c6,esp32p4
app.id=one.tactility.helloworld
app.version.name=0.6.0
app.version.code=6
app.version.name=0.7.0
app.version.code=7
app.name=Hello World
1 change: 0 additions & 1 deletion Apps/M5UnitTest/main/Source/M5UnitTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include "TestUnitLcdGfx.h"

#include <tactility/device.h>
#include <tt_lvgl_toolbar.h>
#include <esp_log.h>

constexpr auto* TAG = "M5UnitTest";
Expand Down
6 changes: 3 additions & 3 deletions Apps/M5UnitTest/main/Source/TestListView.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#include "TestListView.h"
#include "M5UnitTest.h"
#include "UiScale.h"
#include <tt_lvgl_toolbar.h>
#include <lvgl/lvgl_fonts.h>
#include <lvgl/widgets/toolbar.h>
#include <lvgl/fonts.h>

void TestListView::onStart(lv_obj_t* parent, AppHandle handle, M5UnitTest* app) {
app_ = app;

tt_lvgl_toolbar_create_for_app(parent, handle);
lvgl_toolbar_create(parent, "M5 Unit Test");

list_ = lv_list_create(parent);
lv_obj_set_width(list_, LV_PCT(100));
Expand Down
2 changes: 1 addition & 1 deletion Apps/M5UnitTest/main/Source/TestListView.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <array>
#include <lvgl.h>
#include <lvgl/lvgl_icon_shared.h>
#include <lvgl/icons/shared.h>
#include <tt_app.h>

class M5UnitTest;
Expand Down
Loading
Loading