Implement Serial Console app & more (#239)
- Implemented new app: Serial Console - `Uart::writeString()`: fixed 2 mutex bugs - `AlertDialog::start()` with default "OK" button added - Created `tt::lvgl::defaultLockTime` for re-use - Removed various usages of deprecated `lvgl::obj_set_style_no_padding()` - Implemented `hal::uart::getNames()` to list all interface names
This commit is contained in:
committed by
GitHub
parent
83a82be901
commit
13d7e84ef3
@@ -12,6 +12,7 @@ namespace tt {
|
||||
bool Preferences::optBool(const std::string& key, bool& out) const {
|
||||
nvs_handle_t handle;
|
||||
if (nvs_open(namespace_, NVS_READWRITE, &handle) != ESP_OK) {
|
||||
TT_LOG_E(TAG, "Failed to open namespace %s", namespace_);
|
||||
return false;
|
||||
} else {
|
||||
uint8_t out_number;
|
||||
@@ -27,6 +28,7 @@ bool Preferences::optBool(const std::string& key, bool& out) const {
|
||||
bool Preferences::optInt32(const std::string& key, int32_t& out) const {
|
||||
nvs_handle_t handle;
|
||||
if (nvs_open(namespace_, NVS_READWRITE, &handle) != ESP_OK) {
|
||||
TT_LOG_E(TAG, "Failed to open namespace %s", namespace_);
|
||||
return false;
|
||||
} else {
|
||||
bool success = nvs_get_i32(handle, key.c_str(), &out) == ESP_OK;
|
||||
@@ -38,6 +40,7 @@ bool Preferences::optInt32(const std::string& key, int32_t& out) const {
|
||||
bool Preferences::optString(const std::string& key, std::string& out) const {
|
||||
nvs_handle_t handle;
|
||||
if (nvs_open(namespace_, NVS_READWRITE, &handle) != ESP_OK) {
|
||||
TT_LOG_E(TAG, "Failed to open namespace %s", namespace_);
|
||||
return false;
|
||||
} else {
|
||||
size_t out_size = 256;
|
||||
@@ -69,11 +72,11 @@ 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());
|
||||
TT_LOG_E(TAG, "Failed to write %s:%s", namespace_, key.c_str());
|
||||
}
|
||||
nvs_close(handle);
|
||||
} else {
|
||||
TT_LOG_E(TAG, "failed to open namespace %s for writing", namespace_);
|
||||
TT_LOG_E(TAG, "Failed to open namespace %s", namespace_);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,11 +84,11 @@ 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 write %s:%s", namespace_, key.c_str());
|
||||
}
|
||||
nvs_close(handle);
|
||||
} else {
|
||||
TT_LOG_E(TAG, "failed to open namespace %s for writing", namespace_);
|
||||
TT_LOG_E(TAG, "Failed to open namespace %s", namespace_);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,7 +98,7 @@ void Preferences::putString(const std::string& key, const std::string& text) {
|
||||
nvs_set_str(handle, key.c_str(), text.c_str());
|
||||
nvs_close(handle);
|
||||
} else {
|
||||
TT_LOG_E(TAG, "failed to open namespace %s for writing", namespace_);
|
||||
TT_LOG_E(TAG, "Failed to open namespace %s", namespace_);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user