Merge develop into main (#391)
## Improvements - Created new base driver classes: `EspLcdDisplayV2' and `EspLcdSpiDisplay` - Updated `St7789Display` to implement `EspLcdSpiDisplay` - Updated all boards with ST7789 display ## Fixes - Ensure that `tmp/` is created on startup (for all writeable filesystems) - Fix for `lv_list` padding on small screen devices - Fix for `PreferencesEsp` not processing result when writing string to NVS ## Other - Remove unused build scripts
This commit is contained in:
committed by
GitHub
parent
37420db000
commit
db6d3b4acb
@@ -88,8 +88,8 @@ bool Preferences::hasString(const std::string& key) const {
|
||||
void Preferences::putBool(const std::string& key, bool value) {
|
||||
nvs_handle_t handle;
|
||||
if (nvs_open(namespace_, NVS_READWRITE, &handle) == ESP_OK) {
|
||||
if (nvs_set_u8(handle, key.c_str(), (uint8_t)value) != ESP_OK) {
|
||||
TT_LOG_E(TAG, "Failed to write %s:%s", namespace_, key.c_str());
|
||||
if (nvs_set_u8(handle, key.c_str(), value) != ESP_OK) {
|
||||
TT_LOG_E(TAG, "Failed to set %s:%s", namespace_, key.c_str());
|
||||
} else if (nvs_commit(handle) != ESP_OK) {
|
||||
TT_LOG_E(TAG, "Failed to commit %s:%s", namespace_, key.c_str());
|
||||
}
|
||||
@@ -103,7 +103,7 @@ void Preferences::putInt32(const std::string& key, int32_t value) {
|
||||
nvs_handle_t handle;
|
||||
if (nvs_open(namespace_, NVS_READWRITE, &handle) == ESP_OK) {
|
||||
if (nvs_set_i32(handle, key.c_str(), value) != ESP_OK) {
|
||||
TT_LOG_E(TAG, "Failed to write %s:%s", namespace_, key.c_str());
|
||||
TT_LOG_E(TAG, "Failed to set %s:%s", namespace_, key.c_str());
|
||||
} else if (nvs_commit(handle) != ESP_OK) {
|
||||
TT_LOG_E(TAG, "Failed to commit %s:%s", namespace_, key.c_str());
|
||||
}
|
||||
@@ -117,7 +117,7 @@ void Preferences::putInt64(const std::string& key, int64_t value) {
|
||||
nvs_handle_t handle;
|
||||
if (nvs_open(namespace_, NVS_READWRITE, &handle) == ESP_OK) {
|
||||
if (nvs_set_i64(handle, key.c_str(), value) != ESP_OK) {
|
||||
TT_LOG_E(TAG, "Failed to write %s:%s", namespace_, key.c_str());
|
||||
TT_LOG_E(TAG, "Failed to set %s:%s", namespace_, key.c_str());
|
||||
} else if (nvs_commit(handle) != ESP_OK) {
|
||||
TT_LOG_E(TAG, "Failed to commit %s:%s", namespace_, key.c_str());
|
||||
}
|
||||
@@ -130,8 +130,9 @@ void Preferences::putInt64(const std::string& key, int64_t value) {
|
||||
void Preferences::putString(const std::string& key, const std::string& text) {
|
||||
nvs_handle_t handle;
|
||||
if (nvs_open(namespace_, NVS_READWRITE, &handle) == ESP_OK) {
|
||||
nvs_set_str(handle, key.c_str(), text.c_str());
|
||||
if (nvs_commit(handle) != ESP_OK) {
|
||||
if (nvs_set_str(handle, key.c_str(), text.c_str()) != ESP_OK) {
|
||||
TT_LOG_E(TAG, "Failed to set %s:%s", namespace_, key.c_str());
|
||||
} else if (nvs_commit(handle) != ESP_OK) {
|
||||
TT_LOG_E(TAG, "Failed to commit %s:%s", namespace_, key.c_str());
|
||||
}
|
||||
nvs_close(handle);
|
||||
|
||||
@@ -233,6 +233,38 @@ static void registerAndStartPrimaryServices() {
|
||||
#endif
|
||||
}
|
||||
|
||||
void createTempDirectory(const std::string& rootPath) {
|
||||
auto temp_path = std::format("{}/tmp", rootPath);
|
||||
if (!file::isDirectory(temp_path)) {
|
||||
auto lock = file::getLock(rootPath)->asScopedLock();
|
||||
if (lock.lock(1000 / portTICK_PERIOD_MS)) {
|
||||
if (mkdir(temp_path.c_str(), 0777) == 0) {
|
||||
TT_LOG_I(TAG, "Created %s", temp_path.c_str());
|
||||
} else {
|
||||
TT_LOG_E(TAG, "Failed to create %s", temp_path.c_str());
|
||||
}
|
||||
} else {
|
||||
TT_LOG_E(TAG, LOG_MESSAGE_MUTEX_LOCK_FAILED_FMT, rootPath.c_str());
|
||||
}
|
||||
} else {
|
||||
TT_LOG_I(TAG, "Found existing %s", temp_path.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void prepareFileSystems() {
|
||||
// Temporary directories for SD cards
|
||||
auto sdcard_devices = hal::findDevices<hal::sdcard::SdCardDevice>(hal::Device::Type::SdCard);
|
||||
for (const auto& sdcard : sdcard_devices) {
|
||||
if (sdcard->isMounted()) {
|
||||
createTempDirectory(sdcard->getMountPath());
|
||||
}
|
||||
}
|
||||
// Temporary directory for /data
|
||||
if (file::isDirectory(file::MOUNT_POINT_DATA)) {
|
||||
createTempDirectory(file::MOUNT_POINT_DATA);
|
||||
}
|
||||
}
|
||||
|
||||
void registerApps() {
|
||||
registerInternalApps();
|
||||
auto data_apps_path = std::format("{}/apps", file::MOUNT_POINT_DATA);
|
||||
|
||||
@@ -100,11 +100,7 @@ class BootApp : public App {
|
||||
// TODO: Support for multiple displays
|
||||
TT_LOG_I(TAG, "Setup display");
|
||||
setupDisplay(); // Set backlight
|
||||
|
||||
// This event will likely block as other systems are initialized
|
||||
// e.g. Wi-Fi reads AP configs from SD card
|
||||
TT_LOG_I(TAG, "Publish event");
|
||||
kernel::publishSystemEvent(kernel::SystemEvent::BootSplash);
|
||||
prepareFileSystems();
|
||||
|
||||
if (!setupUsbBootMode()) {
|
||||
TT_LOG_I(TAG, "initFromBootApp");
|
||||
@@ -114,6 +110,11 @@ class BootApp : public App {
|
||||
startNextApp();
|
||||
}
|
||||
|
||||
// This event will likely block as other systems are initialized
|
||||
// e.g. Wi-Fi reads AP configs from SD card
|
||||
TT_LOG_I(TAG, "Publish event");
|
||||
kernel::publishSystemEvent(kernel::SystemEvent::BootSplash);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,18 +10,19 @@ extern lv_obj_t* __real_lv_list_create(lv_obj_t* parent);
|
||||
extern lv_obj_t* __real_lv_list_add_button(lv_obj_t* list, const void* icon, const char* txt);
|
||||
|
||||
lv_obj_t* __wrap_lv_list_create(lv_obj_t* parent) {
|
||||
auto list = __real_lv_list_create(parent);
|
||||
auto* list = __real_lv_list_create(parent);
|
||||
|
||||
if (tt::hal::getConfiguration()->uiScale == tt::hal::UiScale::Smallest) {
|
||||
lv_obj_set_style_pad_row(list, 2, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_pad_column(list, 2, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_pad_all(list, 2, LV_STATE_DEFAULT);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
lv_obj_t* __wrap_lv_list_add_button(lv_obj_t* list, const void* icon, const char* txt) {
|
||||
auto button = __real_lv_list_add_button(list, icon, txt);
|
||||
auto* button = __real_lv_list_add_button(list, icon, txt);
|
||||
|
||||
if (tt::hal::getConfiguration()->uiScale == tt::hal::UiScale::Smallest) {
|
||||
lv_obj_set_style_pad_ver(button, 2, LV_STATE_DEFAULT);
|
||||
|
||||
Reference in New Issue
Block a user