mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-08-22 01:45:06 +00:00
Compare commits
No commits in common. "c5a8c99597410945f2360cb59983e943168a0029" and "a96fd77986505517d70dcb6e566097be91051dbb" have entirely different histories.
c5a8c99597
...
a96fd77986
@ -7,6 +7,7 @@ idf_component_register(
|
|||||||
"Libraries/minmea/include"
|
"Libraries/minmea/include"
|
||||||
"Libraries/minitar/include"
|
"Libraries/minitar/include"
|
||||||
"Modules/lvgl-module/include"
|
"Modules/lvgl-module/include"
|
||||||
|
# DRIVER_INCLUDE_DIRS_PLACEHOLDER
|
||||||
REQUIRES esp_timer app-module crypt-module gps-module lvgl-module lvgl-window-manager-module service-module
|
REQUIRES esp_timer app-module crypt-module gps-module lvgl-module lvgl-window-manager-module service-module
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -20,6 +20,7 @@ macro(tactility_project project_name)
|
|||||||
set(EXTRA_COMPONENT_DIRS
|
set(EXTRA_COMPONENT_DIRS
|
||||||
"${TACTILITY_SDK_PATH}/Libraries/TactilityFreeRtos"
|
"${TACTILITY_SDK_PATH}/Libraries/TactilityFreeRtos"
|
||||||
"${TACTILITY_SDK_PATH}/Modules"
|
"${TACTILITY_SDK_PATH}/Modules"
|
||||||
|
"${TACTILITY_SDK_PATH}/Drivers"
|
||||||
)
|
)
|
||||||
|
|
||||||
set(COMPONENTS
|
set(COMPONENTS
|
||||||
@ -30,6 +31,7 @@ macro(tactility_project project_name)
|
|||||||
lvgl-module
|
lvgl-module
|
||||||
lvgl-window-manager-module
|
lvgl-window-manager-module
|
||||||
service-module
|
service-module
|
||||||
|
# DRIVER_COMPONENTS_PLACEHOLDER
|
||||||
)
|
)
|
||||||
|
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|||||||
@ -111,13 +111,43 @@ def add_module(target_path, module_name):
|
|||||||
cmakelists_content = create_module_cmakelists(module_name)
|
cmakelists_content = create_module_cmakelists(module_name)
|
||||||
write_module_cmakelists(os.path.join(target_path, f"Modules/{module_name}/CMakeLists.txt"), cmakelists_content)
|
write_module_cmakelists(os.path.join(target_path, f"Modules/{module_name}/CMakeLists.txt"), cmakelists_content)
|
||||||
|
|
||||||
def generate_tactility_sdk_cmake(target_path):
|
def discover_all_drivers():
|
||||||
src = os.path.join('Buildscripts', 'TactilitySDK', 'TactilitySDK.cmake')
|
"""
|
||||||
shutil.copy2(src, os.path.join(target_path, 'TactilitySDK.cmake'))
|
Discover all *-module directories under Drivers/ (not Modules/ - those are handled
|
||||||
|
separately via add_module). Sorted for deterministic output across OS/filesystem order.
|
||||||
|
"""
|
||||||
|
pattern = os.path.join('Drivers', '*-module')
|
||||||
|
return sorted(
|
||||||
|
os.path.basename(p) for p in glob.glob(pattern) if os.path.isdir(p)
|
||||||
|
)
|
||||||
|
|
||||||
def generate_tactility_sdk_top_cmakelists(target_path):
|
def generate_tactility_sdk_cmake(target_path, available_drivers):
|
||||||
|
src = os.path.join('Buildscripts', 'TactilitySDK', 'TactilitySDK.cmake')
|
||||||
|
with open(src) as f:
|
||||||
|
content = f.read()
|
||||||
|
placeholder = " # DRIVER_COMPONENTS_PLACEHOLDER"
|
||||||
|
assert placeholder in content, \
|
||||||
|
f"Placeholder '{placeholder.strip()}' not found in {src} - template drifted, generator needs updating"
|
||||||
|
components = "\n".join(f" {d}" for d in available_drivers)
|
||||||
|
new_content = content.replace(placeholder, components)
|
||||||
|
assert placeholder not in new_content, \
|
||||||
|
f"Placeholder '{placeholder.strip()}' still present after replacement in {src}"
|
||||||
|
with open(os.path.join(target_path, 'TactilitySDK.cmake'), 'w') as f:
|
||||||
|
f.write(new_content)
|
||||||
|
|
||||||
|
def generate_tactility_sdk_top_cmakelists(target_path, available_drivers):
|
||||||
src = os.path.join('Buildscripts', 'TactilitySDK', 'CMakeLists.txt')
|
src = os.path.join('Buildscripts', 'TactilitySDK', 'CMakeLists.txt')
|
||||||
shutil.copy2(src, os.path.join(target_path, 'CMakeLists.txt'))
|
with open(src) as f:
|
||||||
|
content = f.read()
|
||||||
|
placeholder = " # DRIVER_INCLUDE_DIRS_PLACEHOLDER"
|
||||||
|
assert placeholder in content, \
|
||||||
|
f"Placeholder '{placeholder.strip()}' not found in {src} - template drifted, generator needs updating"
|
||||||
|
include_dirs = "\n".join(f' "Drivers/{d}/include"' for d in available_drivers)
|
||||||
|
new_content = content.replace(placeholder, include_dirs)
|
||||||
|
assert placeholder not in new_content, \
|
||||||
|
f"Placeholder '{placeholder.strip()}' still present after replacement in {src}"
|
||||||
|
with open(os.path.join(target_path, 'CMakeLists.txt'), 'w') as f:
|
||||||
|
f.write(new_content)
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
if len(sys.argv) < 2:
|
if len(sys.argv) < 2:
|
||||||
@ -178,9 +208,16 @@ def main():
|
|||||||
add_module(target_path, "lvgl-window-manager-module")
|
add_module(target_path, "lvgl-window-manager-module")
|
||||||
add_module(target_path, "service-module")
|
add_module(target_path, "service-module")
|
||||||
|
|
||||||
# Final scripts - copied verbatim
|
# Drivers - only ones actually built for this target (chip-restricted drivers like
|
||||||
generate_tactility_sdk_cmake(target_path)
|
# sc2356-module won't have a .a outside ESP32-P4)
|
||||||
generate_tactility_sdk_top_cmakelists(target_path)
|
available_drivers = [d for d in discover_all_drivers() if driver_is_available(d)]
|
||||||
|
for driver_name in available_drivers:
|
||||||
|
add_driver(target_path, driver_name)
|
||||||
|
|
||||||
|
# Final scripts - generated (not copied verbatim) so COMPONENTS/INCLUDE_DIRS only list
|
||||||
|
# drivers actually available for this target
|
||||||
|
generate_tactility_sdk_cmake(target_path, available_drivers)
|
||||||
|
generate_tactility_sdk_top_cmakelists(target_path, available_drivers)
|
||||||
|
|
||||||
# Output ESP-IDF SDK version to file
|
# Output ESP-IDF SDK version to file
|
||||||
esp_idf_version = os.environ.get("ESP_IDF_VERSION", "")
|
esp_idf_version = os.environ.get("ESP_IDF_VERSION", "")
|
||||||
|
|||||||
@ -12,8 +12,6 @@
|
|||||||
|
|
||||||
## Higher Priority
|
## Higher Priority
|
||||||
|
|
||||||
- Devices with a keyboard attached should always highlight the first widget (~Cardputer navigation issue), same for LV_INDEV_TYPE_ENCODER being present
|
|
||||||
- Make it more clear to end-users that an SD card is required to run Tactility
|
|
||||||
- Move "# Fix error "PSRAM space not enough for the Flash instructions" on boot:" fix from T-Deck and others to device.py
|
- Move "# Fix error "PSRAM space not enough for the Flash instructions" on boot:" fix from T-Deck and others to device.py
|
||||||
- Make it possible to override stack size for an app via config file (loaded at boot), and make it possible to set preferred memory location (e.g. internal/external)
|
- Make it possible to override stack size for an app via config file (loaded at boot), and make it possible to set preferred memory location (e.g. internal/external)
|
||||||
- Put task stacks in PSRAM when possible.
|
- Put task stacks in PSRAM when possible.
|
||||||
@ -54,7 +52,6 @@
|
|||||||
|
|
||||||
## Medium Priority
|
## Medium Priority
|
||||||
|
|
||||||
- Consider moving certain drivers into separate modules: audio, bt, wifi, etc
|
|
||||||
- Consider using https://github.com/Graphify-Labs/graphify
|
- Consider using https://github.com/Graphify-Labs/graphify
|
||||||
- Consider implementing LVGL gridnav in apps https://lvgl.io/docs/open/9.3/details/auxiliary-modules/gridnav.html
|
- Consider implementing LVGL gridnav in apps https://lvgl.io/docs/open/9.3/details/auxiliary-modules/gridnav.html
|
||||||
- Implement a LED kernel driver (single colour and RGB, plain GPIO and PWM)
|
- Implement a LED kernel driver (single colour and RGB, plain GPIO and PWM)
|
||||||
|
|||||||
@ -50,10 +50,11 @@ void lvgl_keyboard_enable(lv_indev_t* indev);
|
|||||||
void lvgl_keyboard_disable(lv_indev_t* indev);
|
void lvgl_keyboard_disable(lv_indev_t* indev);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Adds the textarea to the shared keyboard navigation group (so any keypad indev -
|
* @brief Wires a textarea up to the on-screen keyboard: shows it on focus, hides it on
|
||||||
* hardware or on-screen - can type into it once it's focused), and, only when
|
* defocus/ready, and adds the textarea to the keyboard's navigation group.
|
||||||
* lvgl_software_keyboard_is_enabled() is true (i.e. no hardware keyboard is present), wires it
|
*
|
||||||
* up to show/hide the on-screen keyboard on focus/defocus/ready.
|
* No-op if lvgl_software_keyboard_is_enabled() is false (i.e. a hardware keyboard is present).
|
||||||
|
*
|
||||||
* @warning Caller must hold the LVGL lock.
|
* @warning Caller must hold the LVGL lock.
|
||||||
* @param[in] keyboard the on-screen keyboard to associate with the textarea
|
* @param[in] keyboard the on-screen keyboard to associate with the textarea
|
||||||
* @param[in] textarea the lv_textarea_t object to wire up
|
* @param[in] textarea the lv_textarea_t object to wire up
|
||||||
|
|||||||
@ -177,22 +177,16 @@ LvglSoftwareKeyboard* lvgl_software_keyboard_get_last() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void lvgl_keyboard_add_textarea(LvglSoftwareKeyboard* keyboard, lv_obj_t* textarea) {
|
void lvgl_keyboard_add_textarea(LvglSoftwareKeyboard* keyboard, lv_obj_t* textarea) {
|
||||||
// Only the on-screen keyboard's show/hide wiring is specific to "no hardware keyboard"
|
|
||||||
// mode. Group membership must NOT be gated on it: a hardware keypad indev (see
|
|
||||||
// lvgl_keyboard_enable()/lvgl_software_keyboard_activate()) is bound to keyboard_group
|
|
||||||
// regardless of whether a software keyboard is in use, so skipping lv_group_add_obj()
|
|
||||||
// here left every textarea unreachable from a hardware keyboard - it was never a member
|
|
||||||
// of the group its indev delivers key events through.
|
|
||||||
if (lvgl_software_keyboard_is_enabled()) {
|
if (lvgl_software_keyboard_is_enabled()) {
|
||||||
lv_obj_add_event_cb(textarea, textarea_show_keyboard, LV_EVENT_FOCUSED, nullptr);
|
lv_obj_add_event_cb(textarea, textarea_show_keyboard, LV_EVENT_FOCUSED, nullptr);
|
||||||
lv_obj_add_event_cb(textarea, textarea_hide_keyboard, LV_EVENT_DEFOCUSED, nullptr);
|
lv_obj_add_event_cb(textarea, textarea_hide_keyboard, LV_EVENT_DEFOCUSED, nullptr);
|
||||||
lv_obj_add_event_cb(textarea, textarea_hide_keyboard, LV_EVENT_READY, nullptr);
|
lv_obj_add_event_cb(textarea, textarea_hide_keyboard, LV_EVENT_READY, nullptr);
|
||||||
}
|
|
||||||
|
|
||||||
// lv_obj_t auto-remove themselves from the group when they are destroyed (last checked in LVGL 8.3)
|
// lv_obj_t auto-remove themselves from the group when they are destroyed (last checked in LVGL 8.3)
|
||||||
lv_group_add_obj(keyboard_group, textarea);
|
lv_group_add_obj(keyboard_group, textarea);
|
||||||
|
|
||||||
lvgl_software_keyboard_activate(keyboard);
|
lvgl_software_keyboard_activate(keyboard);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void lvgl_software_keyboard_activate(LvglSoftwareKeyboard* keyboard) {
|
void lvgl_software_keyboard_activate(LvglSoftwareKeyboard* keyboard) {
|
||||||
|
|||||||
@ -1,12 +1,14 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <app/instance.h>
|
#include "../../../app-module/include/app/instance.h"
|
||||||
|
|
||||||
|
|
||||||
#include <lvgl.h>
|
#include <lvgl.h>
|
||||||
|
|
||||||
#include <tactility/error.h>
|
#include <tactility/error.h>
|
||||||
#include <tactility/freertos/freertos.h>
|
#include <tactility/freertos/freertos.h>
|
||||||
|
#include <tactility/freertos/task.h>
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
|||||||
@ -1,12 +1,10 @@
|
|||||||
/**
|
|
||||||
* DEPRECATED: Use TactilityKernels' tactility/paths.h
|
|
||||||
*/
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <tactility/filesystem/file_system.h>
|
#include <tactility/filesystem/file_system.h>
|
||||||
|
|
||||||
|
|
||||||
namespace tt {
|
namespace tt {
|
||||||
|
|
||||||
bool findFirstMountedSdCardPath(std::string& path);
|
bool findFirstMountedSdCardPath(std::string& path);
|
||||||
@ -1,4 +1,4 @@
|
|||||||
#include <Tactility/DeprecatedPaths.h>
|
#include <Tactility/Paths.h>
|
||||||
|
|
||||||
#include "../../Modules/app-module/private/app/private/app_metadata_parsing_internal.h"
|
#include "../../Modules/app-module/private/app/private/app_metadata_parsing_internal.h"
|
||||||
|
|
||||||
@ -18,9 +18,9 @@
|
|||||||
#include <Tactility/Tactility.h>
|
#include <Tactility/Tactility.h>
|
||||||
|
|
||||||
#include <Tactility/CpuAffinity.h>
|
#include <Tactility/CpuAffinity.h>
|
||||||
#include <Tactility/DeprecatedPaths.h>
|
|
||||||
#include <Tactility/LogMessages.h>
|
#include <Tactility/LogMessages.h>
|
||||||
#include <Tactility/MountPoints.h>
|
#include <Tactility/MountPoints.h>
|
||||||
|
#include <Tactility/Paths.h>
|
||||||
#include <Tactility/TactilityConfig.h>
|
#include <Tactility/TactilityConfig.h>
|
||||||
#include <Tactility/bluetooth/Bluetooth.h>
|
#include <Tactility/bluetooth/Bluetooth.h>
|
||||||
#include <Tactility/file/File.h>
|
#include <Tactility/file/File.h>
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#include <Tactility/DeprecatedPaths.h>
|
|
||||||
#include <Tactility/Mutex.h>
|
#include <Tactility/Mutex.h>
|
||||||
|
#include <Tactility/Paths.h>
|
||||||
#include <Tactility/app/apphub/AppHub.h>
|
#include <Tactility/app/apphub/AppHub.h>
|
||||||
#include <Tactility/app/apphub/AppHubEntry.h>
|
#include <Tactility/app/apphub/AppHubEntry.h>
|
||||||
#include <Tactility/app/apphubdetails/AppHubDetailsApp.h>
|
#include <Tactility/app/apphubdetails/AppHubDetailsApp.h>
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
#include "app/metadata.h"
|
#include "app/metadata.h"
|
||||||
|
|
||||||
|
|
||||||
#include <Tactility/DeprecatedPaths.h>
|
#include <Tactility/Paths.h>
|
||||||
#include <Tactility/StringUtils.h>
|
#include <Tactility/StringUtils.h>
|
||||||
#include <Tactility/app/alertdialog/AlertDialog.h>
|
#include <Tactility/app/alertdialog/AlertDialog.h>
|
||||||
#include <Tactility/app/apphub/AppHub.h>
|
#include <Tactility/app/apphub/AppHub.h>
|
||||||
|
|||||||
@ -12,8 +12,8 @@
|
|||||||
|
|
||||||
#include <lvgl_window_manager/window_manager.h>
|
#include <lvgl_window_manager/window_manager.h>
|
||||||
|
|
||||||
#include <Tactility/DeprecatedPaths.h>
|
|
||||||
#include <Tactility/MountPoints.h>
|
#include <Tactility/MountPoints.h>
|
||||||
|
#include <Tactility/Paths.h>
|
||||||
#include <Tactility/TactilityPrivate.h>
|
#include <Tactility/TactilityPrivate.h>
|
||||||
#include <Tactility/hal/usb/Usb.h>
|
#include <Tactility/hal/usb/Usb.h>
|
||||||
#include <Tactility/lvgl/Lvgl.h>
|
#include <Tactility/lvgl/Lvgl.h>
|
||||||
@ -68,15 +68,8 @@ std::string getBootAssetsPath(const std::string& childPath) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setupDisplay() {
|
void setupDisplay() {
|
||||||
// TODO: Support for multiple displays
|
|
||||||
|
|
||||||
Device* display = nullptr;
|
Device* display = nullptr;
|
||||||
if (device_get_first_by_type(&DISPLAY_TYPE, &display) != ERROR_NONE) {
|
if (device_get_first_by_type(&DISPLAY_TYPE, &display) == ERROR_NONE) {
|
||||||
LOG_I(TAG, "No kernel display");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set backlight brightness
|
|
||||||
Device* backlight;
|
Device* backlight;
|
||||||
if (display_get_backlight(display, &backlight) == ERROR_NONE) {
|
if (display_get_backlight(display, &backlight) == ERROR_NONE) {
|
||||||
if (!device_is_ready(backlight)) {
|
if (!device_is_ready(backlight)) {
|
||||||
@ -99,8 +92,10 @@ void setupDisplay() {
|
|||||||
} else {
|
} else {
|
||||||
LOG_I(TAG, "No backlight for %s", display->name);
|
LOG_I(TAG, "No backlight for %s", display->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
device_put(display);
|
device_put(display);
|
||||||
|
} else {
|
||||||
|
LOG_I(TAG, "No kernel display");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool setupUsbBootMode() {
|
bool setupUsbBootMode() {
|
||||||
@ -258,6 +253,7 @@ void runBootSequence(TickType_t startTime) {
|
|||||||
// This works with 5 ms on a T-Lora Pager, so we give it 10 ms to be safe
|
// This works with 5 ms on a T-Lora Pager, so we give it 10 ms to be safe
|
||||||
delay_millis(10);
|
delay_millis(10);
|
||||||
|
|
||||||
|
// TODO: Support for multiple displays
|
||||||
LOG_I(TAG, "Setup display");
|
LOG_I(TAG, "Setup display");
|
||||||
setupDisplay();
|
setupDisplay();
|
||||||
LOG_I(TAG, "Prepare file systems");
|
LOG_I(TAG, "Prepare file systems");
|
||||||
|
|||||||
@ -7,9 +7,9 @@
|
|||||||
#include <Tactility/app/chat/ChatSettings.h>
|
#include <Tactility/app/chat/ChatSettings.h>
|
||||||
#include <Tactility/app/chat/ChatProtocol.h>
|
#include <Tactility/app/chat/ChatProtocol.h>
|
||||||
|
|
||||||
#include <Tactility/DeprecatedPaths.h>
|
|
||||||
#include <Tactility/file/File.h>
|
#include <Tactility/file/File.h>
|
||||||
#include <Tactility/file/PropertiesFile.h>
|
#include <Tactility/file/PropertiesFile.h>
|
||||||
|
#include <Tactility/Paths.h>
|
||||||
|
|
||||||
#include <crypt/crypt.h>
|
#include <crypt/crypt.h>
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
#include <Tactility/Platform.h>
|
#include <Tactility/Platform.h>
|
||||||
#include <Tactility/lvgl/Lvgl.h>
|
#include <Tactility/lvgl/Lvgl.h>
|
||||||
#include <Tactility/service/screenshot/Screenshot.h>
|
#include <Tactility/service/screenshot/Screenshot.h>
|
||||||
#include <Tactility/DeprecatedPaths.h>
|
#include <Tactility/Paths.h>
|
||||||
#include <Tactility/Timer.h>
|
#include <Tactility/Timer.h>
|
||||||
|
|
||||||
#include <app/event.h>
|
#include <app/event.h>
|
||||||
|
|||||||
@ -1,9 +1,7 @@
|
|||||||
#include <Tactility/app/setup/Setup.h>
|
#include <Tactility/app/setup/Setup.h>
|
||||||
|
|
||||||
#include <Tactility/StringUtils.h>
|
#include <Tactility/StringUtils.h>
|
||||||
#include <Tactility/app/timezone/TimeZone.h>
|
#include <Tactility/app/timezone/TimeZone.h>
|
||||||
#include <Tactility/app/wifimanage/WifiManage.h>
|
#include <Tactility/app/wifimanage/WifiManage.h>
|
||||||
#include <Tactility/file/File.h>
|
|
||||||
#include <Tactility/service/wifi/Wifi.h>
|
#include <Tactility/service/wifi/Wifi.h>
|
||||||
|
|
||||||
#include <app/event.h>
|
#include <app/event.h>
|
||||||
@ -12,8 +10,8 @@
|
|||||||
|
|
||||||
#include <lvgl_window_manager/window_manager.h>
|
#include <lvgl_window_manager/window_manager.h>
|
||||||
|
|
||||||
#include <tactility/log.h>
|
|
||||||
#include <tactility/paths.h>
|
#include <tactility/paths.h>
|
||||||
|
#include <tactility/preferences.h>
|
||||||
|
|
||||||
#include <lvgl/fonts.h>
|
#include <lvgl/fonts.h>
|
||||||
#include <lvgl/lvgl.h>
|
#include <lvgl/lvgl.h>
|
||||||
@ -34,16 +32,17 @@ namespace tt::app::setup {
|
|||||||
|
|
||||||
extern const ::AppManifest manifest;
|
extern const ::AppManifest manifest;
|
||||||
|
|
||||||
constexpr auto* TAG = "setup";
|
constexpr auto* PREFERENCES_NAMESPACE = "setup";
|
||||||
|
constexpr auto* PREFERENCES_KEY_COMPLETED = "completed";
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
bool getCompletedMarkerPath(std::string& outPath) {
|
bool getPreferencesPath(std::string& outPath) {
|
||||||
char root[128];
|
char root[128];
|
||||||
if (paths_get_user_data_path(root, sizeof(root)) != ERROR_NONE) {
|
if (paths_get_user_data_path(root, sizeof(root)) != ERROR_NONE) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
outPath = std::string(root) + "/.setup_complete";
|
outPath = std::string(root) + "/" + PREFERENCES_NAMESPACE + ".properties";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,23 +50,32 @@ bool getCompletedMarkerPath(std::string& outPath) {
|
|||||||
|
|
||||||
bool isCompleted() {
|
bool isCompleted() {
|
||||||
std::string path;
|
std::string path;
|
||||||
if (!getCompletedMarkerPath(path)) {
|
if (!getPreferencesPath(path)) {
|
||||||
LOG_E(TAG, "Setup path not found");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
file::FileMutexGuard guard(path);
|
Preferences* preferences = preferences_open(path.c_str());
|
||||||
return file::isFile(path);
|
if (preferences == nullptr) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
bool completed = false;
|
||||||
|
preferences_opt_bool(preferences, PREFERENCES_KEY_COMPLETED, &completed);
|
||||||
|
preferences_close(preferences);
|
||||||
|
return completed;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
void markCompleted() {
|
void markCompleted() {
|
||||||
std::string path;
|
std::string path;
|
||||||
if (!getCompletedMarkerPath(path)) {
|
if (!getPreferencesPath(path)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
file::FileMutexGuard guard(path);
|
Preferences* preferences = preferences_open(path.c_str());
|
||||||
file::writeString(path, "");
|
if (preferences == nullptr) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
preferences_put_bool(preferences, PREFERENCES_KEY_COMPLETED, true);
|
||||||
|
preferences_close(preferences);
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class Phase {
|
enum class Phase {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
#include "tactility/time.h"
|
#include "tactility/time.h"
|
||||||
|
|
||||||
#include <Tactility/DeprecatedPaths.h>
|
#include <Tactility/Paths.h>
|
||||||
#include <Tactility/Tactility.h>
|
#include <Tactility/Tactility.h>
|
||||||
#include <Tactility/TactilityConfig.h>
|
#include <Tactility/TactilityConfig.h>
|
||||||
#include <Tactility/Timer.h>
|
#include <Tactility/Timer.h>
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
#include <Tactility/bluetooth/BluetoothPairedDevice.h>
|
#include <Tactility/bluetooth/BluetoothPairedDevice.h>
|
||||||
|
|
||||||
#include "Tactility/DeprecatedPaths.h"
|
#include "Tactility/Paths.h"
|
||||||
|
|
||||||
#include <Tactility/file/File.h>
|
#include <Tactility/file/File.h>
|
||||||
#include <Tactility/file/PropertiesFile.h>
|
#include <Tactility/file/PropertiesFile.h>
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
#include <Tactility/bluetooth/BluetoothSettings.h>
|
#include <Tactility/bluetooth/BluetoothSettings.h>
|
||||||
|
|
||||||
#include <Tactility/DeprecatedPaths.h>
|
|
||||||
#include <Tactility/Mutex.h>
|
|
||||||
#include <Tactility/file/File.h>
|
#include <Tactility/file/File.h>
|
||||||
#include <Tactility/file/PropertiesFile.h>
|
#include <Tactility/file/PropertiesFile.h>
|
||||||
|
#include <Tactility/Mutex.h>
|
||||||
|
#include <Tactility/Paths.h>
|
||||||
#include <tactility/log.h>
|
#include <tactility/log.h>
|
||||||
|
|
||||||
namespace tt::bluetooth::settings {
|
namespace tt::bluetooth::settings {
|
||||||
|
|||||||
@ -5,14 +5,14 @@
|
|||||||
|
|
||||||
#include <tactility/log.h>
|
#include <tactility/log.h>
|
||||||
|
|
||||||
#include <Tactility/DeprecatedPaths.h>
|
#include <Tactility/Paths.h>
|
||||||
#include <Tactility/StringUtils.h>
|
#include <Tactility/StringUtils.h>
|
||||||
#include <Tactility/file/File.h>
|
#include <Tactility/file/File.h>
|
||||||
#include <Tactility/network/HttpdReq.h>
|
#include <Tactility/network/HttpdReq.h>
|
||||||
#include <Tactility/network/Url.h>
|
#include <Tactility/network/Url.h>
|
||||||
#include <Tactility/service/ServiceRegistration.h>
|
#include <Tactility/service/ServiceRegistration.h>
|
||||||
#include <Tactility/service/development/DevelopmentService.h>
|
|
||||||
#include <Tactility/service/development/DevelopmentSettings.h>
|
#include <Tactility/service/development/DevelopmentSettings.h>
|
||||||
|
#include <Tactility/service/development/DevelopmentService.h>
|
||||||
|
|
||||||
#include <ranges>
|
#include <ranges>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
#ifdef ESP_PLATFORM
|
#ifdef ESP_PLATFORM
|
||||||
#include <Tactility/DeprecatedPaths.h>
|
|
||||||
#include <Tactility/file/File.h>
|
#include <Tactility/file/File.h>
|
||||||
#include <Tactility/file/PropertiesFile.h>
|
#include <Tactility/file/PropertiesFile.h>
|
||||||
|
#include <Tactility/Paths.h>
|
||||||
#include <Tactility/service/development/DevelopmentSettings.h>
|
#include <Tactility/service/development/DevelopmentSettings.h>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|||||||
@ -8,13 +8,13 @@
|
|||||||
#include <Tactility/lvgl/Statusbar.h>
|
#include <Tactility/lvgl/Statusbar.h>
|
||||||
#include <Tactility/Mutex.h>
|
#include <Tactility/Mutex.h>
|
||||||
|
|
||||||
#include <Tactility/DeprecatedPaths.h>
|
|
||||||
#include <Tactility/StringUtils.h>
|
|
||||||
#include <Tactility/TactilityConfig.h>
|
#include <Tactility/TactilityConfig.h>
|
||||||
#include <Tactility/lvgl/Lvgl.h>
|
#include <Tactility/service/wifi/Wifi.h>
|
||||||
#include <Tactility/network/HttpdReq.h>
|
#include <Tactility/network/HttpdReq.h>
|
||||||
#include <Tactility/network/Url.h>
|
#include <Tactility/network/Url.h>
|
||||||
#include <Tactility/service/wifi/Wifi.h>
|
#include <Tactility/Paths.h>
|
||||||
|
#include <Tactility/lvgl/Lvgl.h>
|
||||||
|
#include <Tactility/StringUtils.h>
|
||||||
|
|
||||||
#include <tactility/check.h>
|
#include <tactility/check.h>
|
||||||
#include <tactility/filesystem/file_system.h>
|
#include <tactility/filesystem/file_system.h>
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
#include <Tactility/file/File.h>
|
#include <Tactility/file/File.h>
|
||||||
#include <Tactility/service/wifi/WifiApSettings.h>
|
#include <Tactility/service/wifi/WifiApSettings.h>
|
||||||
|
|
||||||
#include <Tactility/DeprecatedPaths.h>
|
#include <Tactility/Paths.h>
|
||||||
#include <Tactility/Tactility.h>
|
#include <Tactility/Tactility.h>
|
||||||
|
|
||||||
#include <tactility/log.h>
|
#include <tactility/log.h>
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
#include <Tactility/settings/AudioSettings.h>
|
#include <Tactility/settings/AudioSettings.h>
|
||||||
|
|
||||||
#include <Tactility/DeprecatedPaths.h>
|
|
||||||
#include <Tactility/file/File.h>
|
#include <Tactility/file/File.h>
|
||||||
#include <Tactility/file/PropertiesFile.h>
|
#include <Tactility/file/PropertiesFile.h>
|
||||||
|
#include <Tactility/Paths.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
#include <Tactility/file/PropertiesFile.h>
|
#include <Tactility/file/PropertiesFile.h>
|
||||||
#include <Tactility/settings/BootSettings.h>
|
#include <Tactility/settings/BootSettings.h>
|
||||||
|
|
||||||
#include <Tactility/DeprecatedPaths.h>
|
#include <Tactility/Paths.h>
|
||||||
#include <format>
|
#include <format>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include <Tactility/file/File.h>
|
#include <Tactility/file/File.h>
|
||||||
#include <Tactility/file/PropertiesFile.h>
|
#include <Tactility/file/PropertiesFile.h>
|
||||||
#include <Tactility/DeprecatedPaths.h>
|
#include <Tactility/Paths.h>
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
#include <Tactility/settings/KeyboardSettings.h>
|
#include <Tactility/settings/KeyboardSettings.h>
|
||||||
#include <Tactility/file/File.h>
|
#include <Tactility/file/File.h>
|
||||||
#include <Tactility/file/PropertiesFile.h>
|
#include <Tactility/file/PropertiesFile.h>
|
||||||
#include <Tactility/DeprecatedPaths.h>
|
#include <Tactility/Paths.h>
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
#include <Tactility/settings/Language.h>
|
#include <Tactility/settings/Language.h>
|
||||||
#include <Tactility/settings/SystemSettings.h>
|
#include <Tactility/settings/SystemSettings.h>
|
||||||
|
|
||||||
#include "Tactility/DeprecatedPaths.h"
|
#include "Tactility/Paths.h"
|
||||||
|
|
||||||
#include <tactility/log.h>
|
#include <tactility/log.h>
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include <Tactility/file/File.h>
|
#include <Tactility/file/File.h>
|
||||||
#include <Tactility/file/PropertiesFile.h>
|
#include <Tactility/file/PropertiesFile.h>
|
||||||
#include <Tactility/DeprecatedPaths.h>
|
#include <Tactility/Paths.h>
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cerrno>
|
#include <cerrno>
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
#include <Tactility/settings/TrackballSettings.h>
|
#include <Tactility/settings/TrackballSettings.h>
|
||||||
#include <Tactility/file/File.h>
|
#include <Tactility/file/File.h>
|
||||||
#include <Tactility/file/PropertiesFile.h>
|
#include <Tactility/file/PropertiesFile.h>
|
||||||
#include <Tactility/DeprecatedPaths.h>
|
#include <Tactility/Paths.h>
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
#include <Tactility/DeprecatedPaths.h>
|
|
||||||
#include <Tactility/file/File.h>
|
|
||||||
#include <Tactility/file/PropertiesFile.h>
|
|
||||||
#include <Tactility/settings/WebServerSettings.h>
|
#include <Tactility/settings/WebServerSettings.h>
|
||||||
|
#include <Tactility/file/PropertiesFile.h>
|
||||||
|
#include <Tactility/file/File.h>
|
||||||
|
#include <Tactility/Paths.h>
|
||||||
|
|
||||||
#include <tactility/log.h>
|
#include <tactility/log.h>
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,7 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
#include <tactility/preferences.h>
|
#include <tactility/preferences.h>
|
||||||
|
|
||||||
#include <tactility/log.h>
|
|
||||||
#include <tactility/paths.h>
|
|
||||||
#include <tactility/properties_file.h>
|
#include <tactility/properties_file.h>
|
||||||
|
#include <tactility/paths.h>
|
||||||
|
|
||||||
#include <cerrno>
|
#include <cerrno>
|
||||||
#include <cinttypes>
|
#include <cinttypes>
|
||||||
@ -17,8 +15,6 @@
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
constexpr auto* TAG = "preferences";
|
|
||||||
|
|
||||||
// Escapes '\\' and '\n' so a string value can never break properties_file's one-entry-per-line
|
// Escapes '\\' and '\n' so a string value can never break properties_file's one-entry-per-line
|
||||||
// on-disk format, regardless of its content.
|
// on-disk format, regardless of its content.
|
||||||
std::string escape(const std::string& value) {
|
std::string escape(const std::string& value) {
|
||||||
@ -180,19 +176,16 @@ extern "C" {
|
|||||||
Preferences* preferences_open(const char* path) {
|
Preferences* preferences_open(const char* path) {
|
||||||
std::string directory = parent_directory(path);
|
std::string directory = parent_directory(path);
|
||||||
if (!directory.empty() && !ensure_directory_recursive(directory)) {
|
if (!directory.empty() && !ensure_directory_recursive(directory)) {
|
||||||
LOG_E(TAG, "Directory not found: %s", directory.c_str());
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
PropertiesFile* file = properties_file_open(path);
|
PropertiesFile* file = properties_file_open(path);
|
||||||
if (file == nullptr) {
|
if (file == nullptr) {
|
||||||
LOG_E(TAG, "Failed to open %s", path);
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto* preferences = new (std::nothrow) Preferences { file };
|
auto* preferences = new (std::nothrow) Preferences { file };
|
||||||
if (preferences == nullptr) {
|
if (preferences == nullptr) {
|
||||||
LOG_E(TAG, "Out of memory");
|
|
||||||
properties_file_close(file);
|
properties_file_close(file);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -150,10 +150,6 @@ bool save_to_file(const PropertiesFile* file) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// rename() may not overwrite an existing destination on some filesystems (e.g. FAT on
|
|
||||||
// ESP32), so remove it first; this is best-effort and ignored if the path doesn't exist yet.
|
|
||||||
std::remove(file->path.c_str());
|
|
||||||
|
|
||||||
if (std::rename(temp_path.c_str(), file->path.c_str()) != 0) {
|
if (std::rename(temp_path.c_str(), file->path.c_str()) != 0) {
|
||||||
LOG_E(TAG, "Failed to replace %s", file->path.c_str());
|
LOG_E(TAG, "Failed to replace %s", file->path.c_str());
|
||||||
std::remove(temp_path.c_str());
|
std::remove(temp_path.c_str());
|
||||||
|
|||||||
@ -10,7 +10,7 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
include("${TACTILITY_SDK_PATH}/TactilitySDK.cmake")
|
include("${TACTILITY_SDK_PATH}/TactilitySDK.cmake")
|
||||||
set(EXTRA_COMPONENT_DIRS ${TACTILITY_SDK_PATH} ${TACTILITY_SDK_PATH}/Modules)
|
set(EXTRA_COMPONENT_DIRS ${TACTILITY_SDK_PATH} ${TACTILITY_SDK_PATH}/Modules ${TACTILITY_SDK_PATH}/Drivers)
|
||||||
|
|
||||||
project(SdkTest)
|
project(SdkTest)
|
||||||
tactility_project(SdkTest)
|
tactility_project(SdkTest)
|
||||||
|
|||||||
@ -3,5 +3,11 @@ file(GLOB_RECURSE SOURCE_FILES Source/*.c)
|
|||||||
idf_component_register(
|
idf_component_register(
|
||||||
SRCS ${SOURCE_FILES}
|
SRCS ${SOURCE_FILES}
|
||||||
REQUIRES TactilitySDK
|
REQUIRES TactilitySDK
|
||||||
app-module crypt-module gps-module lvgl-module lvgl-window-manager-module service-module
|
lvgl-module
|
||||||
|
bm8563-module
|
||||||
|
bmi270-module
|
||||||
|
mpu6886-module
|
||||||
|
pi4ioe5v6408-module
|
||||||
|
qmi8658-module
|
||||||
|
rx8130ce-module
|
||||||
)
|
)
|
||||||
|
|||||||
@ -1,15 +1,37 @@
|
|||||||
#include <app/event.h>
|
#include <tt_app.h>
|
||||||
#include <app/manager.h>
|
|
||||||
#include <app/scheduler.h>
|
|
||||||
|
|
||||||
#include <lvgl_window_manager/window_manager.h>
|
#include <lvgl/lvgl.h>
|
||||||
|
|
||||||
#include <lvgl.h>
|
|
||||||
#include <lvgl/widgets/toolbar.h>
|
#include <lvgl/widgets/toolbar.h>
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <tactility/concurrent/dispatcher.h>
|
||||||
|
#include <tactility/concurrent/event_group.h>
|
||||||
|
#include <tactility/concurrent/mutex.h>
|
||||||
|
#include <tactility/concurrent/recursive_mutex.h>
|
||||||
|
#include <tactility/concurrent/thread.h>
|
||||||
|
#include <tactility/concurrent/timer.h>
|
||||||
|
#include <tactility/drivers/gpio.h>
|
||||||
|
#include <tactility/drivers/gpio_controller.h>
|
||||||
|
#include <tactility/drivers/i2c_controller.h>
|
||||||
|
#include <tactility/drivers/i2s_controller.h>
|
||||||
|
#include <tactility/drivers/root.h>
|
||||||
|
#include <tactility/check.h>
|
||||||
|
#include <tactility/defines.h>
|
||||||
|
#include <tactility/delay.h>
|
||||||
|
#include <tactility/device.h>
|
||||||
|
#include <tactility/driver.h>
|
||||||
|
#include <tactility/error.h>
|
||||||
|
#include <tactility/log.h>
|
||||||
|
#include <tactility/module.h>
|
||||||
|
#include <tactility/time.h>
|
||||||
|
|
||||||
static void create_widgets(lv_obj_t* parent, void* userData) {
|
#include <drivers/bm8563.h>
|
||||||
|
#include <drivers/bmi270.h>
|
||||||
|
#include <drivers/mpu6886.h>
|
||||||
|
#include <drivers/pi4ioe5v6408.h>
|
||||||
|
#include <drivers/qmi8658.h>
|
||||||
|
#include <drivers/rx8130ce.h>
|
||||||
|
|
||||||
|
static void onShowApp(AppHandle app, void* data, lv_obj_t* parent) {
|
||||||
lv_obj_t* toolbar = lvgl_toolbar_create(parent, "Title");
|
lv_obj_t* toolbar = lvgl_toolbar_create(parent, "Title");
|
||||||
lv_obj_align(toolbar, LV_ALIGN_TOP_MID, 0, 0);
|
lv_obj_align(toolbar, LV_ALIGN_TOP_MID, 0, 0);
|
||||||
|
|
||||||
@ -19,27 +41,8 @@ static void create_widgets(lv_obj_t* parent, void* userData) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
AppInstanceId app_instance_id = app_scheduler_current_app_id();
|
tt_app_register((AppRegistration) {
|
||||||
|
.onShow = onShowApp
|
||||||
struct AppEventSubscription sub = { .app_instance_id = app_instance_id };
|
});
|
||||||
app_event_subscribe(&sub);
|
|
||||||
|
|
||||||
WindowId window = window_manager_create(app_instance_id, create_widgets, NULL);
|
|
||||||
|
|
||||||
bool should_close = false;
|
|
||||||
while (!should_close) {
|
|
||||||
struct AppEvent event;
|
|
||||||
if (app_event_await(&sub, &event, portMAX_DELAY) != ERROR_NONE) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (event.type == APP_EVENT_CLOSE) {
|
|
||||||
app_manager_finish(app_instance_id);
|
|
||||||
should_close = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
window_manager_remove(window);
|
|
||||||
app_event_unsubscribe(&sub);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user