mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-08-22 01:45:06 +00:00
Compare commits
12 Commits
a96fd77986
...
c5a8c99597
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c5a8c99597 | ||
|
|
884a008333 | ||
|
|
e618086590 | ||
|
|
24860be671 | ||
|
|
9c54ac4944 | ||
|
|
6b68e9f194 | ||
|
|
52f90ae6a6 | ||
|
|
e02766c1a4 | ||
|
|
3c783c1fb4 | ||
|
|
22192dd1e4 | ||
|
|
68aae6520d | ||
|
|
26a8aa26c2 |
@ -7,7 +7,6 @@ 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,7 +20,6 @@ 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
|
||||||
@ -31,7 +30,6 @@ 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,43 +111,13 @@ 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 discover_all_drivers():
|
def generate_tactility_sdk_cmake(target_path):
|
||||||
"""
|
|
||||||
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_cmake(target_path, available_drivers):
|
|
||||||
src = os.path.join('Buildscripts', 'TactilitySDK', 'TactilitySDK.cmake')
|
src = os.path.join('Buildscripts', 'TactilitySDK', 'TactilitySDK.cmake')
|
||||||
with open(src) as f:
|
shutil.copy2(src, os.path.join(target_path, 'TactilitySDK.cmake'))
|
||||||
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):
|
def generate_tactility_sdk_top_cmakelists(target_path):
|
||||||
src = os.path.join('Buildscripts', 'TactilitySDK', 'CMakeLists.txt')
|
src = os.path.join('Buildscripts', 'TactilitySDK', 'CMakeLists.txt')
|
||||||
with open(src) as f:
|
shutil.copy2(src, os.path.join(target_path, 'CMakeLists.txt'))
|
||||||
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:
|
||||||
@ -208,16 +178,9 @@ 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")
|
||||||
|
|
||||||
# Drivers - only ones actually built for this target (chip-restricted drivers like
|
# Final scripts - copied verbatim
|
||||||
# sc2356-module won't have a .a outside ESP32-P4)
|
generate_tactility_sdk_cmake(target_path)
|
||||||
available_drivers = [d for d in discover_all_drivers() if driver_is_available(d)]
|
generate_tactility_sdk_top_cmakelists(target_path)
|
||||||
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,6 +12,8 @@
|
|||||||
|
|
||||||
## 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.
|
||||||
@ -52,6 +54,7 @@
|
|||||||
|
|
||||||
## 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,11 +50,10 @@ 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 Wires a textarea up to the on-screen keyboard: shows it on focus, hides it on
|
* @brief Adds the textarea to the shared keyboard navigation group (so any keypad indev -
|
||||||
* defocus/ready, and adds the textarea to the keyboard's navigation group.
|
* hardware or on-screen - can type into it once it's focused), and, only when
|
||||||
*
|
* lvgl_software_keyboard_is_enabled() is true (i.e. no hardware keyboard is present), wires it
|
||||||
* No-op if lvgl_software_keyboard_is_enabled() is false (i.e. a hardware keyboard is present).
|
* up to show/hide the on-screen keyboard on focus/defocus/ready.
|
||||||
*
|
|
||||||
* @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,16 +177,22 @@ 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,14 +1,12 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../../../app-module/include/app/instance.h"
|
#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,10 +1,12 @@
|
|||||||
|
/**
|
||||||
|
* 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/Paths.h>
|
#include <Tactility/DeprecatedPaths.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/Paths.h>
|
#include <Tactility/DeprecatedPaths.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,8 +68,15 @@ 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)) {
|
||||||
@ -92,10 +99,8 @@ 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() {
|
||||||
@ -253,7 +258,6 @@ 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/Paths.h>
|
#include <Tactility/DeprecatedPaths.h>
|
||||||
#include <Tactility/Timer.h>
|
#include <Tactility/Timer.h>
|
||||||
|
|
||||||
#include <app/event.h>
|
#include <app/event.h>
|
||||||
|
|||||||
@ -1,7 +1,9 @@
|
|||||||
#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>
|
||||||
@ -10,8 +12,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>
|
||||||
@ -32,17 +34,16 @@ namespace tt::app::setup {
|
|||||||
|
|
||||||
extern const ::AppManifest manifest;
|
extern const ::AppManifest manifest;
|
||||||
|
|
||||||
constexpr auto* PREFERENCES_NAMESPACE = "setup";
|
constexpr auto* TAG = "setup";
|
||||||
constexpr auto* PREFERENCES_KEY_COMPLETED = "completed";
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
bool getPreferencesPath(std::string& outPath) {
|
bool getCompletedMarkerPath(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) + "/" + PREFERENCES_NAMESPACE + ".properties";
|
outPath = std::string(root) + "/.setup_complete";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,32 +51,23 @@ bool getPreferencesPath(std::string& outPath) {
|
|||||||
|
|
||||||
bool isCompleted() {
|
bool isCompleted() {
|
||||||
std::string path;
|
std::string path;
|
||||||
if (!getPreferencesPath(path)) {
|
if (!getCompletedMarkerPath(path)) {
|
||||||
|
LOG_E(TAG, "Setup path not found");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Preferences* preferences = preferences_open(path.c_str());
|
file::FileMutexGuard guard(path);
|
||||||
if (preferences == nullptr) {
|
return file::isFile(path);
|
||||||
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 (!getPreferencesPath(path)) {
|
if (!getCompletedMarkerPath(path)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Preferences* preferences = preferences_open(path.c_str());
|
file::FileMutexGuard guard(path);
|
||||||
if (preferences == nullptr) {
|
file::writeString(path, "");
|
||||||
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/Paths.h>
|
#include <Tactility/DeprecatedPaths.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/Paths.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>
|
||||||
|
|||||||
@ -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/Paths.h>
|
#include <Tactility/DeprecatedPaths.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/DevelopmentSettings.h>
|
|
||||||
#include <Tactility/service/development/DevelopmentService.h>
|
#include <Tactility/service/development/DevelopmentService.h>
|
||||||
|
#include <Tactility/service/development/DevelopmentSettings.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/service/wifi/Wifi.h>
|
#include <Tactility/lvgl/Lvgl.h>
|
||||||
#include <Tactility/network/HttpdReq.h>
|
#include <Tactility/network/HttpdReq.h>
|
||||||
#include <Tactility/network/Url.h>
|
#include <Tactility/network/Url.h>
|
||||||
#include <Tactility/Paths.h>
|
#include <Tactility/service/wifi/Wifi.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/Paths.h>
|
#include <Tactility/DeprecatedPaths.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/Paths.h>
|
#include <Tactility/DeprecatedPaths.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/Paths.h>
|
#include <Tactility/DeprecatedPaths.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/Paths.h>
|
#include <Tactility/DeprecatedPaths.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/Paths.h"
|
#include "Tactility/DeprecatedPaths.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/Paths.h>
|
#include <Tactility/DeprecatedPaths.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/Paths.h>
|
#include <Tactility/DeprecatedPaths.h>
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
#include <Tactility/settings/WebServerSettings.h>
|
#include <Tactility/DeprecatedPaths.h>
|
||||||
#include <Tactility/file/PropertiesFile.h>
|
|
||||||
#include <Tactility/file/File.h>
|
#include <Tactility/file/File.h>
|
||||||
#include <Tactility/Paths.h>
|
#include <Tactility/file/PropertiesFile.h>
|
||||||
|
#include <Tactility/settings/WebServerSettings.h>
|
||||||
|
|
||||||
#include <tactility/log.h>
|
#include <tactility/log.h>
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,9 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
#include <tactility/preferences.h>
|
#include <tactility/preferences.h>
|
||||||
#include <tactility/properties_file.h>
|
|
||||||
|
#include <tactility/log.h>
|
||||||
#include <tactility/paths.h>
|
#include <tactility/paths.h>
|
||||||
|
#include <tactility/properties_file.h>
|
||||||
|
|
||||||
#include <cerrno>
|
#include <cerrno>
|
||||||
#include <cinttypes>
|
#include <cinttypes>
|
||||||
@ -15,6 +17,8 @@
|
|||||||
|
|
||||||
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) {
|
||||||
@ -176,16 +180,19 @@ 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,6 +150,10 @@ 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 ${TACTILITY_SDK_PATH}/Drivers)
|
set(EXTRA_COMPONENT_DIRS ${TACTILITY_SDK_PATH} ${TACTILITY_SDK_PATH}/Modules)
|
||||||
|
|
||||||
project(SdkTest)
|
project(SdkTest)
|
||||||
tactility_project(SdkTest)
|
tactility_project(SdkTest)
|
||||||
|
|||||||
@ -3,11 +3,5 @@ file(GLOB_RECURSE SOURCE_FILES Source/*.c)
|
|||||||
idf_component_register(
|
idf_component_register(
|
||||||
SRCS ${SOURCE_FILES}
|
SRCS ${SOURCE_FILES}
|
||||||
REQUIRES TactilitySDK
|
REQUIRES TactilitySDK
|
||||||
lvgl-module
|
app-module crypt-module gps-module lvgl-module lvgl-window-manager-module service-module
|
||||||
bm8563-module
|
|
||||||
bmi270-module
|
|
||||||
mpu6886-module
|
|
||||||
pi4ioe5v6408-module
|
|
||||||
qmi8658-module
|
|
||||||
rx8130ce-module
|
|
||||||
)
|
)
|
||||||
|
|||||||
@ -1,37 +1,15 @@
|
|||||||
#include <tt_app.h>
|
#include <app/event.h>
|
||||||
|
#include <app/manager.h>
|
||||||
|
#include <app/scheduler.h>
|
||||||
|
|
||||||
#include <lvgl/lvgl.h>
|
#include <lvgl_window_manager/window_manager.h>
|
||||||
|
|
||||||
|
#include <lvgl.h>
|
||||||
#include <lvgl/widgets/toolbar.h>
|
#include <lvgl/widgets/toolbar.h>
|
||||||
|
|
||||||
#include <tactility/concurrent/dispatcher.h>
|
#include <stdbool.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>
|
|
||||||
|
|
||||||
#include <drivers/bm8563.h>
|
static void create_widgets(lv_obj_t* parent, void* userData) {
|
||||||
#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);
|
||||||
|
|
||||||
@ -41,8 +19,27 @@ static void onShowApp(AppHandle app, void* data, lv_obj_t* parent) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
tt_app_register((AppRegistration) {
|
AppInstanceId app_instance_id = app_scheduler_current_app_id();
|
||||||
.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