Various fixes and improvements (#424)

- Read WiFi provisioning from /data
- Fix for finding apps at /data
- Expose more LVGL functions with TactilityC
This commit is contained in:
NellowTCS 2025-12-05 05:18:23 -07:00 committed by GitHub
parent 62124541e9
commit 65d3d55cc4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 44 additions and 5 deletions

View File

@ -283,7 +283,7 @@ void prepareFileSystems() {
void registerApps() { void registerApps() {
registerInternalApps(); registerInternalApps();
auto data_apps_path = std::format("{}/apps", file::MOUNT_POINT_DATA); auto data_apps_path = std::format("{}/app", file::MOUNT_POINT_DATA);
if (file::isDirectory(data_apps_path)) { if (file::isDirectory(data_apps_path)) {
registerInstalledApps(data_apps_path); registerInstalledApps(data_apps_path);
} }

View File

@ -1,6 +1,7 @@
#include "Tactility/service/wifi/WifiBootSplashInit.h" #include "Tactility/service/wifi/WifiBootSplashInit.h"
#include "Tactility/file/PropertiesFile.h" #include "Tactility/file/PropertiesFile.h"
#include <Tactility/MountPoints.h>
#include <Tactility/file/File.h> #include <Tactility/file/File.h>
#include <Tactility/Log.h> #include <Tactility/Log.h>
#include <Tactility/service/wifi/WifiApSettings.h> #include <Tactility/service/wifi/WifiApSettings.h>
@ -80,9 +81,7 @@ static void importWifiAp(const std::string& filePath) {
} }
} }
static void importWifiApSettings(std::shared_ptr<hal::sdcard::SdCardDevice> sdcard) { static void importWifiApSettingsFromDir(const std::string& path) {
auto path = file::getChildPath(sdcard->getMountPath(), "settings");
std::vector<dirent> dirent_list; std::vector<dirent> dirent_list;
if (file::scandir(path, dirent_list, [](const dirent* entry) { if (file::scandir(path, dirent_list, [](const dirent* entry) {
switch (entry->d_type) { switch (entry->d_type) {
@ -101,11 +100,12 @@ static void importWifiApSettings(std::shared_ptr<hal::sdcard::SdCardDevice> sdca
} }
} }
}, nullptr) == 0) { }, nullptr) == 0) {
// keep original behavior: if scandir returns 0, give up silently
return; return;
} }
if (dirent_list.empty()) { if (dirent_list.empty()) {
TT_LOG_W(TAG, "No AP files found at %s", sdcard->getMountPath().c_str()); TT_LOG_W(TAG, "No AP files found at %s", path.c_str());
return; return;
} }
@ -115,8 +115,21 @@ static void importWifiApSettings(std::shared_ptr<hal::sdcard::SdCardDevice> sdca
} }
} }
static void importWifiApSettings(std::shared_ptr<hal::sdcard::SdCardDevice> sdcard) {
const std::string settings_path = file::getChildPath(sdcard->getMountPath(), "settings");
importWifiApSettingsFromDir(settings_path);
}
static void importWifiApSettingsFromData() {
importWifiApSettingsFromDir(tt::file::MOUNT_POINT_DATA);
}
void bootSplashInit() { void bootSplashInit() {
getMainDispatcher().dispatch([] { getMainDispatcher().dispatch([] {
// First import any provisioning files placed on the system data partition.
importWifiApSettingsFromData();
// Then scan attached SD cards as before.
const auto sdcards = hal::findDevices<hal::sdcard::SdCardDevice>(hal::Device::Type::SdCard); const auto sdcards = hal::findDevices<hal::sdcard::SdCardDevice>(hal::Device::Type::SdCard);
for (auto& sdcard : sdcards) { for (auto& sdcard : sdcards) {
if (sdcard->isMounted()) { if (sdcard->isMounted()) {

View File

@ -138,6 +138,7 @@ const esp_elfsym main_symbols[] {
// cstring // cstring
ESP_ELFSYM_EXPORT(strlen), ESP_ELFSYM_EXPORT(strlen),
ESP_ELFSYM_EXPORT(strcmp), ESP_ELFSYM_EXPORT(strcmp),
ESP_ELFSYM_EXPORT(strncmp),
ESP_ELFSYM_EXPORT(strncpy), ESP_ELFSYM_EXPORT(strncpy),
ESP_ELFSYM_EXPORT(strcpy), ESP_ELFSYM_EXPORT(strcpy),
ESP_ELFSYM_EXPORT(strcat), ESP_ELFSYM_EXPORT(strcat),
@ -388,6 +389,7 @@ const esp_elfsym main_symbols[] {
ESP_ELFSYM_EXPORT(lv_obj_get_style_layout), ESP_ELFSYM_EXPORT(lv_obj_get_style_layout),
ESP_ELFSYM_EXPORT(lv_obj_update_layout), ESP_ELFSYM_EXPORT(lv_obj_update_layout),
ESP_ELFSYM_EXPORT(lv_obj_set_scroll_dir), ESP_ELFSYM_EXPORT(lv_obj_set_scroll_dir),
ESP_ELFSYM_EXPORT(lv_obj_scroll_to_view),
ESP_ELFSYM_EXPORT(lv_obj_set_style_radius), ESP_ELFSYM_EXPORT(lv_obj_set_style_radius),
ESP_ELFSYM_EXPORT(lv_obj_set_style_border_width), ESP_ELFSYM_EXPORT(lv_obj_set_style_border_width),
ESP_ELFSYM_EXPORT(lv_obj_set_style_border_color), ESP_ELFSYM_EXPORT(lv_obj_set_style_border_color),
@ -540,6 +542,7 @@ const esp_elfsym main_symbols[] {
ESP_ELFSYM_EXPORT(lv_palette_darken), ESP_ELFSYM_EXPORT(lv_palette_darken),
ESP_ELFSYM_EXPORT(lv_palette_lighten), ESP_ELFSYM_EXPORT(lv_palette_lighten),
// lv_display // lv_display
ESP_ELFSYM_EXPORT(lv_display_get_default),
ESP_ELFSYM_EXPORT(lv_display_get_horizontal_resolution), ESP_ELFSYM_EXPORT(lv_display_get_horizontal_resolution),
ESP_ELFSYM_EXPORT(lv_display_get_vertical_resolution), ESP_ELFSYM_EXPORT(lv_display_get_vertical_resolution),
ESP_ELFSYM_EXPORT(lv_display_get_physical_horizontal_resolution), ESP_ELFSYM_EXPORT(lv_display_get_physical_horizontal_resolution),
@ -570,6 +573,29 @@ const esp_elfsym main_symbols[] {
ESP_ELFSYM_EXPORT(lv_indev_get_key), ESP_ELFSYM_EXPORT(lv_indev_get_key),
ESP_ELFSYM_EXPORT(lv_indev_get_gesture_dir), ESP_ELFSYM_EXPORT(lv_indev_get_gesture_dir),
ESP_ELFSYM_EXPORT(lv_indev_get_state), ESP_ELFSYM_EXPORT(lv_indev_get_state),
// lv_timer
ESP_ELFSYM_EXPORT(lv_timer_handler),
ESP_ELFSYM_EXPORT(lv_timer_handler_run_in_period),
ESP_ELFSYM_EXPORT(lv_timer_periodic_handler),
ESP_ELFSYM_EXPORT(lv_timer_handler_set_resume_cb),
ESP_ELFSYM_EXPORT(lv_timer_create_basic),
ESP_ELFSYM_EXPORT(lv_timer_create),
ESP_ELFSYM_EXPORT(lv_timer_delete),
ESP_ELFSYM_EXPORT(lv_timer_pause),
ESP_ELFSYM_EXPORT(lv_timer_resume),
ESP_ELFSYM_EXPORT(lv_timer_set_cb),
ESP_ELFSYM_EXPORT(lv_timer_set_period),
ESP_ELFSYM_EXPORT(lv_timer_ready),
ESP_ELFSYM_EXPORT(lv_timer_set_repeat_count),
ESP_ELFSYM_EXPORT(lv_timer_set_auto_delete),
ESP_ELFSYM_EXPORT(lv_timer_set_user_data),
ESP_ELFSYM_EXPORT(lv_timer_reset),
ESP_ELFSYM_EXPORT(lv_timer_enable),
ESP_ELFSYM_EXPORT(lv_timer_get_idle),
ESP_ELFSYM_EXPORT(lv_timer_get_time_until_next),
ESP_ELFSYM_EXPORT(lv_timer_get_next),
ESP_ELFSYM_EXPORT(lv_timer_get_user_data),
ESP_ELFSYM_EXPORT(lv_timer_get_paused),
// lvgl other // lvgl other
ESP_ELFSYM_EXPORT(lv_refr_now), ESP_ELFSYM_EXPORT(lv_refr_now),
ESP_ELFSYM_EXPORT(lv_line_create), ESP_ELFSYM_EXPORT(lv_line_create),