mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-04-19 01:45:06 +00:00
More logging refactored
This commit is contained in:
parent
ec43eadb8f
commit
560ffbf4e6
@ -3,12 +3,13 @@
|
||||
#ifdef ESP_PLATFORM
|
||||
|
||||
#include <esp_http_client.h>
|
||||
#include <Tactility/Logger.h>
|
||||
|
||||
namespace tt::network {
|
||||
|
||||
class EspHttpClient {
|
||||
|
||||
static constexpr auto* TAG = "EspHttpClient";
|
||||
const Logger logger = Logger("EspHttpClient");
|
||||
|
||||
std::unique_ptr<esp_http_client_config_t> config = nullptr;
|
||||
esp_http_client_handle_t client = nullptr;
|
||||
@ -27,7 +28,7 @@ public:
|
||||
}
|
||||
|
||||
bool init(std::unique_ptr<esp_http_client_config_t> inConfig) {
|
||||
TT_LOG_I(TAG, "init(%s)", inConfig->url);
|
||||
logger.info("init(%s)", inConfig->url);
|
||||
assert(this->config == nullptr);
|
||||
config = std::move(inConfig);
|
||||
client = esp_http_client_init(config.get());
|
||||
@ -36,11 +37,11 @@ public:
|
||||
|
||||
bool open() {
|
||||
assert(client != nullptr);
|
||||
TT_LOG_I(TAG, "open()");
|
||||
logger.info("open()");
|
||||
auto result = esp_http_client_open(client, 0);
|
||||
|
||||
if (result != ESP_OK) {
|
||||
TT_LOG_E(TAG, "open() failed: %s", esp_err_to_name(result));
|
||||
logger.error("open() failed: %s", esp_err_to_name(result));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -50,7 +51,7 @@ public:
|
||||
|
||||
bool fetchHeaders() const {
|
||||
assert(client != nullptr);
|
||||
TT_LOG_I(TAG, "fetchHeaders()");
|
||||
logger.info("fetchHeaders()");
|
||||
return esp_http_client_fetch_headers(client) >= 0;
|
||||
}
|
||||
|
||||
@ -63,7 +64,7 @@ public:
|
||||
int getStatusCode() const {
|
||||
assert(client != nullptr);
|
||||
const auto status_code = esp_http_client_get_status_code(client);
|
||||
TT_LOG_I(TAG, "Status code %d", status_code);
|
||||
logger.info("Status code {}", status_code);
|
||||
return status_code;
|
||||
}
|
||||
|
||||
@ -74,19 +75,19 @@ public:
|
||||
|
||||
int read(char* bytes, int size) const {
|
||||
assert(client != nullptr);
|
||||
TT_LOG_I(TAG, "read(%d)", size);
|
||||
logger.info("read({})", size);
|
||||
return esp_http_client_read(client, bytes, size);
|
||||
}
|
||||
|
||||
int readResponse(char* bytes, int size) const {
|
||||
assert(client != nullptr);
|
||||
TT_LOG_I(TAG, "readResponse(%d)", size);
|
||||
logger.info("readResponse({})", size);
|
||||
return esp_http_client_read_response(client, bytes, size);
|
||||
}
|
||||
|
||||
bool close() {
|
||||
assert(client != nullptr);
|
||||
TT_LOG_I(TAG, "close()");
|
||||
logger.info("close()");
|
||||
if (esp_http_client_close(client) == ESP_OK) {
|
||||
isOpen = false;
|
||||
}
|
||||
@ -96,7 +97,7 @@ public:
|
||||
bool cleanup() {
|
||||
assert(client != nullptr);
|
||||
assert(!isOpen);
|
||||
TT_LOG_I(TAG, "cleanup()");
|
||||
logger.info("cleanup()");
|
||||
const auto result = esp_http_client_cleanup(client);
|
||||
client = nullptr;
|
||||
return result == ESP_OK;
|
||||
|
||||
@ -17,8 +17,8 @@ namespace tt::network::http {
|
||||
const std::string& url,
|
||||
const std::string& certFilePath,
|
||||
const std::string &downloadFilePath,
|
||||
std::function<void()> onSuccess,
|
||||
std::function<void(const char* errorMessage)> onError
|
||||
const std::function<void()>& onSuccess,
|
||||
const std::function<void(const char* errorMessage)>& onError
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
|
||||
#include <Tactility/Bundle.h>
|
||||
#include <Tactility/Check.h>
|
||||
#include <Tactility/Log.h>
|
||||
#include <Tactility/Logger.h>
|
||||
#include <Tactility/Mutex.h>
|
||||
|
||||
#include <memory>
|
||||
@ -48,7 +48,7 @@ class AppInstance : public AppContext {
|
||||
return manifest->createApp();
|
||||
} else if (manifest->appLocation.isExternal()) {
|
||||
if (manifest->createApp != nullptr) {
|
||||
TT_LOG_W("", "Manifest specifies createApp, but this is not used with external apps");
|
||||
Logger("AppInstance").warn("Manifest specifies createApp, but this is not used with external apps");
|
||||
}
|
||||
#ifdef ESP_PLATFORM
|
||||
return createElfApp(manifest);
|
||||
|
||||
@ -4,12 +4,14 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <Tactility/Logger.h>
|
||||
|
||||
namespace tt::json {
|
||||
|
||||
class Reader {
|
||||
|
||||
const cJSON* root;
|
||||
static constexpr const char* TAG = "json::Reader";
|
||||
Logger logger = Logger("json::Reader");
|
||||
|
||||
public:
|
||||
|
||||
@ -18,7 +20,7 @@ public:
|
||||
bool readString(const char* key, std::string& output) const {
|
||||
const auto* child = cJSON_GetObjectItemCaseSensitive(root, key);
|
||||
if (!cJSON_IsString(child)) {
|
||||
TT_LOG_E(TAG, "%s is not a string", key);
|
||||
logger.error("{} is not a string", key);
|
||||
return false;
|
||||
}
|
||||
output = cJSON_GetStringValue(child);
|
||||
@ -30,7 +32,7 @@ public:
|
||||
if (!readNumber(key, buffer)) {
|
||||
return false;
|
||||
}
|
||||
output = buffer;
|
||||
output = static_cast<int32_t>(buffer);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -46,7 +48,7 @@ public:
|
||||
bool readNumber(const char* key, double& output) const {
|
||||
const auto* child = cJSON_GetObjectItemCaseSensitive(root, key);
|
||||
if (!cJSON_IsNumber(child)) {
|
||||
TT_LOG_E(TAG, "%s is not a number", key);
|
||||
logger.error("{} is not a number", key);
|
||||
return false;
|
||||
}
|
||||
output = cJSON_GetNumberValue(child);
|
||||
@ -56,16 +58,16 @@ public:
|
||||
bool readStringArray(const char* key, std::vector<std::string>& output) const {
|
||||
const auto* child = cJSON_GetObjectItemCaseSensitive(root, key);
|
||||
if (!cJSON_IsArray(child)) {
|
||||
TT_LOG_E(TAG, "%s is not an array", key);
|
||||
logger.error("{} is not an array", key);
|
||||
return false;
|
||||
}
|
||||
const auto size = cJSON_GetArraySize(child);
|
||||
TT_LOG_I(TAG, "Processing %d array children", size);
|
||||
logger.info("Processing {} array children", size);
|
||||
output.resize(size);
|
||||
for (int i = 0; i < size; ++i) {
|
||||
const auto string_json = cJSON_GetArrayItem(child, i);
|
||||
if (!cJSON_IsString(string_json)) {
|
||||
TT_LOG_E(TAG, "array child of %s is not a string", key);
|
||||
logger.error("array child of %s is not a string", key);
|
||||
return false;
|
||||
}
|
||||
output[i] = cJSON_GetStringValue(string_json);
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
#ifdef ESP_PLATFORM
|
||||
|
||||
#include "Tactility/PartitionsEsp.h"
|
||||
|
||||
#include <Tactility/PartitionsEsp.h>
|
||||
#include <Tactility/Logger.h>
|
||||
|
||||
#include <esp_vfs_fat.h>
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
#ifdef ESP_PLATFORM
|
||||
|
||||
#include <Tactility/Logger.h>
|
||||
#include <Tactility/Preferences.h>
|
||||
#include <Tactility/TactilityCore.h>
|
||||
|
||||
@ -7,12 +8,12 @@
|
||||
|
||||
namespace tt {
|
||||
|
||||
constexpr auto* TAG = "Preferences";
|
||||
static const auto LOGGER = Logger("Preferences");
|
||||
|
||||
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_);
|
||||
LOGGER.error("Failed to open namespace {}", namespace_);
|
||||
return false;
|
||||
} else {
|
||||
uint8_t out_number;
|
||||
@ -28,7 +29,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_);
|
||||
LOGGER.error("Failed to open namespace {}", namespace_);
|
||||
return false;
|
||||
} else {
|
||||
bool success = nvs_get_i32(handle, key.c_str(), &out) == ESP_OK;
|
||||
@ -40,7 +41,7 @@ bool Preferences::optInt32(const std::string& key, int32_t& out) const {
|
||||
bool Preferences::optInt64(const std::string& key, int64_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_);
|
||||
LOGGER.error("Failed to open namespace {}", namespace_);
|
||||
return false;
|
||||
} else {
|
||||
bool success = nvs_get_i64(handle, key.c_str(), &out) == ESP_OK;
|
||||
@ -52,7 +53,7 @@ bool Preferences::optInt64(const std::string& key, int64_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_);
|
||||
LOGGER.error("Failed to open namespace {}", namespace_);
|
||||
return false;
|
||||
} else {
|
||||
size_t out_size = 256;
|
||||
@ -89,13 +90,13 @@ 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(), value) != ESP_OK) {
|
||||
TT_LOG_E(TAG, "Failed to set %s:%s", namespace_, key.c_str());
|
||||
LOGGER.error("Failed to set {}:{}", namespace_, key);
|
||||
} else if (nvs_commit(handle) != ESP_OK) {
|
||||
TT_LOG_E(TAG, "Failed to commit %s:%s", namespace_, key.c_str());
|
||||
LOGGER.error("Failed to commit {}:{}", namespace_, key);
|
||||
}
|
||||
nvs_close(handle);
|
||||
} else {
|
||||
TT_LOG_E(TAG, "Failed to open namespace %s", namespace_);
|
||||
LOGGER.error("Failed to open namespace {}", namespace_);
|
||||
}
|
||||
}
|
||||
|
||||
@ -103,13 +104,13 @@ 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 set %s:%s", namespace_, key.c_str());
|
||||
LOGGER.error("Failed to set {}:{}", namespace_, key);
|
||||
} else if (nvs_commit(handle) != ESP_OK) {
|
||||
TT_LOG_E(TAG, "Failed to commit %s:%s", namespace_, key.c_str());
|
||||
LOGGER.error("Failed to commit {}:{}", namespace_, key);
|
||||
}
|
||||
nvs_close(handle);
|
||||
} else {
|
||||
TT_LOG_E(TAG, "Failed to open namespace %s", namespace_);
|
||||
LOGGER.error("Failed to open namespace {}", namespace_);
|
||||
}
|
||||
}
|
||||
|
||||
@ -117,13 +118,13 @@ 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 set %s:%s", namespace_, key.c_str());
|
||||
LOGGER.error("Failed to set {}:{}", namespace_, key);
|
||||
} else if (nvs_commit(handle) != ESP_OK) {
|
||||
TT_LOG_E(TAG, "Failed to commit %s:%s", namespace_, key.c_str());
|
||||
LOGGER.error("Failed to commit {}:{}", namespace_, key);
|
||||
}
|
||||
nvs_close(handle);
|
||||
} else {
|
||||
TT_LOG_E(TAG, "Failed to open namespace %s", namespace_);
|
||||
LOGGER.error("Failed to open namespace {}", namespace_);
|
||||
}
|
||||
}
|
||||
|
||||
@ -131,13 +132,13 @@ void Preferences::putString(const std::string& key, const std::string& text) {
|
||||
nvs_handle_t handle;
|
||||
if (nvs_open(namespace_, NVS_READWRITE, &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());
|
||||
LOGGER.error("Failed to set {}:{}", namespace_, key.c_str());
|
||||
} else if (nvs_commit(handle) != ESP_OK) {
|
||||
TT_LOG_E(TAG, "Failed to commit %s:%s", namespace_, key.c_str());
|
||||
LOGGER.error("Failed to commit {}:{}", namespace_, key);
|
||||
}
|
||||
nvs_close(handle);
|
||||
} else {
|
||||
TT_LOG_E(TAG, "Failed to open namespace %s", namespace_);
|
||||
LOGGER.error("Failed to open namespace {}", namespace_);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
#ifndef ESP_PLATFOM
|
||||
|
||||
#include "Tactility/Preferences.h"
|
||||
|
||||
#include <Tactility/Preferences.h>
|
||||
#include <Tactility/Bundle.h>
|
||||
|
||||
namespace tt {
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
|
||||
namespace tt {
|
||||
|
||||
static auto logger = Logger("Tactility");
|
||||
static auto LOGGER = Logger("Tactility");
|
||||
|
||||
static const Configuration* config_instance = nullptr;
|
||||
static Dispatcher mainDispatcher;
|
||||
@ -118,7 +118,7 @@ namespace app {
|
||||
|
||||
// List of all apps excluding Boot app (as Boot app calls this function indirectly)
|
||||
static void registerInternalApps() {
|
||||
logger.info("Registering internal apps");
|
||||
LOGGER.info("Registering internal apps");
|
||||
|
||||
addAppManifest(app::alertdialog::manifest);
|
||||
addAppManifest(app::appdetails::manifest);
|
||||
@ -179,22 +179,22 @@ static void registerInternalApps() {
|
||||
}
|
||||
|
||||
static void registerInstalledApp(std::string path) {
|
||||
logger.info("Registering app at {}", path);
|
||||
LOGGER.info("Registering app at {}", path);
|
||||
std::string manifest_path = path + "/manifest.properties";
|
||||
if (!file::isFile(manifest_path)) {
|
||||
logger.error("Manifest not found at {}", manifest_path);
|
||||
LOGGER.error("Manifest not found at {}", manifest_path);
|
||||
return;
|
||||
}
|
||||
|
||||
std::map<std::string, std::string> properties;
|
||||
if (!file::loadPropertiesFile(manifest_path, properties)) {
|
||||
logger.error("Failed to load manifest at {}", manifest_path);
|
||||
LOGGER.error("Failed to load manifest at {}", manifest_path);
|
||||
return;
|
||||
}
|
||||
|
||||
app::AppManifest manifest;
|
||||
if (!app::parseManifest(properties, manifest)) {
|
||||
logger.error("Failed to parse manifest at {}", manifest_path);
|
||||
LOGGER.error("Failed to parse manifest at {}", manifest_path);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -205,7 +205,7 @@ static void registerInstalledApp(std::string path) {
|
||||
}
|
||||
|
||||
static void registerInstalledApps(const std::string& path) {
|
||||
logger.info("Registering apps from {}", path);
|
||||
LOGGER.info("Registering apps from {}", path);
|
||||
|
||||
file::listDirectory(path, [&path](const auto& entry) {
|
||||
auto absolute_path = std::format("{}/{}", path, entry.d_name);
|
||||
@ -227,14 +227,14 @@ static void registerInstalledAppsFromSdCards() {
|
||||
auto sdcard_devices = hal::findDevices<hal::sdcard::SdCardDevice>(hal::Device::Type::SdCard);
|
||||
for (const auto& sdcard : sdcard_devices) {
|
||||
if (sdcard->isMounted()) {
|
||||
logger.info("Registering apps from {}", sdcard->getMountPath());
|
||||
LOGGER.info("Registering apps from {}", sdcard->getMountPath());
|
||||
registerInstalledAppsFromSdCard(sdcard);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void registerAndStartSecondaryServices() {
|
||||
logger.info("Registering and starting system services");
|
||||
LOGGER.info("Registering and starting system services");
|
||||
addService(service::loader::manifest);
|
||||
addService(service::gui::manifest);
|
||||
addService(service::statusbar::manifest);
|
||||
@ -249,7 +249,7 @@ static void registerAndStartSecondaryServices() {
|
||||
}
|
||||
|
||||
static void registerAndStartPrimaryServices() {
|
||||
logger.info("Registering and starting system services");
|
||||
LOGGER.info("Registering and starting system services");
|
||||
addService(service::gps::manifest);
|
||||
if (hal::hasDevice(hal::Device::Type::SdCard)) {
|
||||
addService(service::sdcard::manifest);
|
||||
@ -270,15 +270,15 @@ void createTempDirectory(const std::string& rootPath) {
|
||||
auto lock = file::getLock(rootPath)->asScopedLock();
|
||||
if (lock.lock(1000 / portTICK_PERIOD_MS)) {
|
||||
if (mkdir(temp_path.c_str(), 0777) == 0) {
|
||||
logger.info("Created {}", temp_path);
|
||||
LOGGER.info("Created {}", temp_path);
|
||||
} else {
|
||||
logger.error("Failed to create {}", temp_path);
|
||||
LOGGER.error("Failed to create {}", temp_path);
|
||||
}
|
||||
} else {
|
||||
logger.error(LOG_MESSAGE_MUTEX_LOCK_FAILED_FMT_CPP, rootPath);
|
||||
LOGGER.error(LOG_MESSAGE_MUTEX_LOCK_FAILED_FMT_CPP, rootPath);
|
||||
}
|
||||
} else {
|
||||
logger.info("Found existing {}", temp_path);
|
||||
LOGGER.info("Found existing {}", temp_path);
|
||||
}
|
||||
}
|
||||
|
||||
@ -306,7 +306,7 @@ void registerApps() {
|
||||
}
|
||||
|
||||
void run(const Configuration& config) {
|
||||
logger.info("Tactility v{} on {} ({})", TT_VERSION, CONFIG_TT_DEVICE_NAME, CONFIG_TT_DEVICE_ID);
|
||||
LOGGER.info("Tactility v{} on {} ({})", TT_VERSION, CONFIG_TT_DEVICE_NAME, CONFIG_TT_DEVICE_ID);
|
||||
|
||||
assert(config.hardware);
|
||||
const hal::Configuration& hardware = *config.hardware;
|
||||
@ -326,14 +326,14 @@ void run(const Configuration& config) {
|
||||
lvgl::init(hardware);
|
||||
registerAndStartSecondaryServices();
|
||||
|
||||
logger.info("Core systems ready");
|
||||
LOGGER.info("Core systems ready");
|
||||
|
||||
logger.info("Starting boot app");
|
||||
LOGGER.info("Starting boot app");
|
||||
// The boot app takes care of registering system apps, user services and user apps
|
||||
addAppManifest(app::boot::manifest);
|
||||
app::start(app::boot::manifest.appId);
|
||||
|
||||
logger.info("Main dispatcher ready");
|
||||
LOGGER.info("Main dispatcher ready");
|
||||
while (true) {
|
||||
mainDispatcher.consume();
|
||||
}
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
#ifdef ESP_PLATFORM
|
||||
|
||||
#include "Tactility/PartitionsEsp.h"
|
||||
#include "Tactility/TactilityCore.h"
|
||||
#include <Tactility/Logger.h>
|
||||
#include <Tactility/PartitionsEsp.h>
|
||||
#include <Tactility/TactilityCore.h>
|
||||
|
||||
#include "esp_event.h"
|
||||
#include "esp_netif.h"
|
||||
@ -9,14 +10,14 @@
|
||||
|
||||
namespace tt {
|
||||
|
||||
constexpr auto* TAG = "Tactility";
|
||||
static auto LOGGER = Logger("Tactility");
|
||||
|
||||
// Initialize NVS
|
||||
static void initNvs() {
|
||||
TT_LOG_I(TAG, "Init NVS");
|
||||
LOGGER.info("Init NVS");
|
||||
esp_err_t ret = nvs_flash_init();
|
||||
if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {
|
||||
TT_LOG_I(TAG, "NVS erasing");
|
||||
LOGGER.info("NVS erasing");
|
||||
ESP_ERROR_CHECK(nvs_flash_erase());
|
||||
ret = nvs_flash_init();
|
||||
}
|
||||
@ -24,7 +25,7 @@ static void initNvs() {
|
||||
}
|
||||
|
||||
static void initNetwork() {
|
||||
TT_LOG_I(TAG, "Init network");
|
||||
LOGGER.info("Init network");
|
||||
ESP_ERROR_CHECK(esp_netif_init());
|
||||
ESP_ERROR_CHECK(esp_event_loop_create_default());
|
||||
}
|
||||
@ -6,35 +6,32 @@
|
||||
#include <Tactility/file/FileLock.h>
|
||||
#include <Tactility/file/PropertiesFile.h>
|
||||
#include <Tactility/hal/Device.h>
|
||||
#include <Tactility/hal/sdcard/SdCardDevice.h>
|
||||
#include <Tactility/Logger.h>
|
||||
#include <Tactility/Paths.h>
|
||||
|
||||
#include <cerrno>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <fcntl.h>
|
||||
#include <format>
|
||||
#include <libgen.h>
|
||||
#include <map>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <minitar.h>
|
||||
|
||||
constexpr auto* TAG = "App";
|
||||
|
||||
namespace tt::app {
|
||||
|
||||
static const auto LOGGER = Logger("App");
|
||||
|
||||
static bool untarFile(minitar* mp, const minitar_entry* entry, const std::string& destinationPath) {
|
||||
const auto absolute_path = destinationPath + "/" + entry->metadata.path;
|
||||
if (!file::findOrCreateDirectory(destinationPath, 0777)) {
|
||||
TT_LOG_E(TAG, "Can't find or create directory %s", destinationPath.c_str());
|
||||
LOGGER.error("Can't find or create directory {}", destinationPath.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
// minitar_read_contents(&mp, &entry, file_buffer, entry.metadata.size);
|
||||
if (!minitar_read_contents_to_file(mp, entry, absolute_path.c_str())) {
|
||||
TT_LOG_E(TAG, "Failed to write data to %s", absolute_path.c_str());
|
||||
LOGGER.error("Failed to write data to {}", absolute_path.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -63,32 +60,32 @@ static bool untar(const std::string& tarPath, const std::string& destinationPath
|
||||
|
||||
do {
|
||||
if (minitar_read_entry(&mp, &entry) == 0) {
|
||||
TT_LOG_I(TAG, "Extracting %s", entry.metadata.path);
|
||||
LOGGER.info("Extracting {}", entry.metadata.path);
|
||||
if (entry.metadata.type == MTAR_DIRECTORY) {
|
||||
if (!strcmp(entry.metadata.name, ".") || !strcmp(entry.metadata.name, "..") || !strcmp(entry.metadata.name, "/")) continue;
|
||||
if (!untarDirectory(&entry, destinationPath)) {
|
||||
TT_LOG_E(TAG, "Failed to create directory %s/%s: %s", destinationPath.c_str(), entry.metadata.name, strerror(errno));
|
||||
LOGGER.error("Failed to create directory {}/{}: {}", destinationPath, entry.metadata.name, strerror(errno));
|
||||
success = false;
|
||||
break;
|
||||
}
|
||||
} else if (entry.metadata.type == MTAR_REGULAR) {
|
||||
if (!untarFile(&mp, &entry, destinationPath)) {
|
||||
TT_LOG_E(TAG, "Failed to extract file %s: %s", entry.metadata.path, strerror(errno));
|
||||
LOGGER.error("Failed to extract file {}: {}", entry.metadata.path, strerror(errno));
|
||||
success = false;
|
||||
break;
|
||||
}
|
||||
} else if (entry.metadata.type == MTAR_SYMLINK) {
|
||||
TT_LOG_E(TAG, "SYMLINK not supported");
|
||||
LOGGER.error("SYMLINK not supported");
|
||||
} else if (entry.metadata.type == MTAR_HARDLINK) {
|
||||
TT_LOG_E(TAG, "HARDLINK not supported");
|
||||
LOGGER.error("HARDLINK not supported");
|
||||
} else if (entry.metadata.type == MTAR_FIFO) {
|
||||
TT_LOG_E(TAG, "FIFO not supported");
|
||||
LOGGER.error("FIFO not supported");
|
||||
} else if (entry.metadata.type == MTAR_BLKDEV) {
|
||||
TT_LOG_E(TAG, "BLKDEV not supported");
|
||||
LOGGER.error("BLKDEV not supported");
|
||||
} else if (entry.metadata.type == MTAR_CHRDEV) {
|
||||
TT_LOG_E(TAG, "CHRDEV not supported");
|
||||
LOGGER.error("CHRDEV not supported");
|
||||
} else {
|
||||
TT_LOG_E(TAG, "Unknown entry type: %d", entry.metadata.type);
|
||||
LOGGER.error("Unknown entry type: {}", static_cast<int>(entry.metadata.type));
|
||||
success = false;
|
||||
break;
|
||||
}
|
||||
@ -100,7 +97,7 @@ static bool untar(const std::string& tarPath, const std::string& destinationPath
|
||||
|
||||
void cleanupInstallDirectory(const std::string& path) {
|
||||
if (!file::deleteRecursively(path)) {
|
||||
TT_LOG_W(TAG, "Failed to delete existing installation at %s", path.c_str());
|
||||
LOGGER.warn("Failed to delete existing installation at {}", path);
|
||||
}
|
||||
}
|
||||
|
||||
@ -109,16 +106,16 @@ bool install(const std::string& path) {
|
||||
// the lock with the display. We don't want to lock the display for very long.
|
||||
|
||||
auto app_parent_path = getAppInstallPath();
|
||||
TT_LOG_I(TAG, "Installing app %s to %s", path.c_str(), app_parent_path.c_str());
|
||||
LOGGER.info("Installing app %s to {}", path, app_parent_path);
|
||||
|
||||
auto filename = file::getLastPathSegment(path);
|
||||
const std::string app_target_path = std::format("{}/{}", app_parent_path, filename);
|
||||
if (file::isDirectory(app_target_path) && !file::deleteRecursively(app_target_path)) {
|
||||
TT_LOG_W(TAG, "Failed to delete %s", app_target_path.c_str());
|
||||
LOGGER.warn("Failed to delete {}", app_target_path);
|
||||
}
|
||||
|
||||
if (!file::findOrCreateDirectory(app_target_path, 0777)) {
|
||||
TT_LOG_I(TAG, "Failed to create directory %s", app_target_path.c_str());
|
||||
LOGGER.info("Failed to create directory {}", app_target_path);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -126,9 +123,9 @@ bool install(const std::string& path) {
|
||||
auto source_path_lock = file::getLock(path)->asScopedLock();
|
||||
target_path_lock.lock();
|
||||
source_path_lock.lock();
|
||||
TT_LOG_I(TAG, "Extracting app from %s to %s", path.c_str(), app_target_path.c_str());
|
||||
LOGGER.info("Extracting app from {} to {}", path, app_target_path);
|
||||
if (!untar(path, app_target_path)) {
|
||||
TT_LOG_E(TAG, "Failed to extract");
|
||||
LOGGER.error("Failed to extract");
|
||||
return false;
|
||||
}
|
||||
source_path_lock.unlock();
|
||||
@ -136,21 +133,21 @@ bool install(const std::string& path) {
|
||||
|
||||
auto manifest_path = app_target_path + "/manifest.properties";
|
||||
if (!file::isFile(manifest_path)) {
|
||||
TT_LOG_E(TAG, "Manifest not found at %s", manifest_path.c_str());
|
||||
LOGGER.error("Manifest not found at {}", manifest_path);
|
||||
cleanupInstallDirectory(app_target_path);
|
||||
return false;
|
||||
}
|
||||
|
||||
std::map<std::string, std::string> properties;
|
||||
if (!file::loadPropertiesFile(manifest_path, properties)) {
|
||||
TT_LOG_E(TAG, "Failed to load manifest at %s", manifest_path.c_str());
|
||||
LOGGER.error("Failed to load manifest at {}", manifest_path);
|
||||
cleanupInstallDirectory(app_target_path);
|
||||
return false;
|
||||
}
|
||||
|
||||
AppManifest manifest;
|
||||
if (!parseManifest(properties, manifest)) {
|
||||
TT_LOG_W(TAG, "Invalid manifest");
|
||||
LOGGER.warn("Invalid manifest");
|
||||
cleanupInstallDirectory(app_target_path);
|
||||
return false;
|
||||
}
|
||||
@ -163,7 +160,7 @@ bool install(const std::string& path) {
|
||||
const std::string renamed_target_path = std::format("{}/{}", app_parent_path, manifest.appId);
|
||||
if (file::isDirectory(renamed_target_path)) {
|
||||
if (!file::deleteRecursively(renamed_target_path)) {
|
||||
TT_LOG_W(TAG, "Failed to delete existing installation at %s", renamed_target_path.c_str());
|
||||
LOGGER.warn("Failed to delete existing installation at {}", renamed_target_path);
|
||||
cleanupInstallDirectory(app_target_path);
|
||||
return false;
|
||||
}
|
||||
@ -174,7 +171,7 @@ bool install(const std::string& path) {
|
||||
target_path_lock.unlock();
|
||||
|
||||
if (!rename_success) {
|
||||
TT_LOG_E(TAG, "Failed to rename \"%s\" to \"%s\"", app_target_path.c_str(), manifest.appId.c_str());
|
||||
LOGGER.error(R"(Failed to rename "{}" to "{}")", app_target_path, manifest.appId);
|
||||
cleanupInstallDirectory(app_target_path);
|
||||
return false;
|
||||
}
|
||||
@ -187,7 +184,7 @@ bool install(const std::string& path) {
|
||||
}
|
||||
|
||||
bool uninstall(const std::string& appId) {
|
||||
TT_LOG_I(TAG, "Uninstalling app %s", appId.c_str());
|
||||
LOGGER.info("Uninstalling app {}", appId);
|
||||
|
||||
// If the app was running, then stop it
|
||||
if (isRunning(appId)) {
|
||||
@ -196,7 +193,7 @@ bool uninstall(const std::string& appId) {
|
||||
|
||||
auto app_path = getAppInstallPath(appId);
|
||||
if (!file::isDirectory(app_path)) {
|
||||
TT_LOG_E(TAG, "App %s not found at %s", appId.c_str(), app_path.c_str());
|
||||
LOGGER.error("App {} not found at {}", appId, app_path);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -205,7 +202,7 @@ bool uninstall(const std::string& appId) {
|
||||
}
|
||||
|
||||
if (!removeAppManifest(appId)) {
|
||||
TT_LOG_W(TAG, "Failed to remove app %s from registry", appId.c_str());
|
||||
LOGGER.warn("Failed to remove app {} from registry", appId);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@ -4,18 +4,17 @@
|
||||
#include <Tactility/app/ElfApp.h>
|
||||
#include <Tactility/file/File.h>
|
||||
#include <Tactility/file/FileLock.h>
|
||||
#include <Tactility/Log.h>
|
||||
#include <Tactility/Logger.h>
|
||||
#include <Tactility/service/loader/Loader.h>
|
||||
#include <Tactility/StringUtils.h>
|
||||
|
||||
#include <esp_elf.h>
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
namespace tt::app {
|
||||
|
||||
constexpr auto* TAG = "ElfApp";
|
||||
static auto LOGGER = Logger("ElfApp");
|
||||
|
||||
static std::string getErrorCodeString(int error_code) {
|
||||
switch (error_code) {
|
||||
@ -72,7 +71,7 @@ private:
|
||||
|
||||
bool startElf() {
|
||||
const std::string elf_path = std::format("{}/elf/{}.elf", appPath, CONFIG_IDF_TARGET);
|
||||
TT_LOG_I(TAG, "Starting ELF %s", elf_path.c_str());
|
||||
LOGGER.info("Starting ELF {}", elf_path);
|
||||
assert(elfFileData == nullptr);
|
||||
|
||||
size_t size = 0;
|
||||
@ -86,7 +85,7 @@ private:
|
||||
|
||||
if (esp_elf_init(&elf) != ESP_OK) {
|
||||
lastError = "Failed to initialize";
|
||||
TT_LOG_E(TAG, "%s", lastError.c_str());
|
||||
LOGGER.error("{}", lastError);
|
||||
elfFileData = nullptr;
|
||||
return false;
|
||||
}
|
||||
@ -95,7 +94,7 @@ private:
|
||||
if (relocate_result != 0) {
|
||||
// Note: the result code maps to values from cstdlib's errno.h
|
||||
lastError = getErrorCodeString(-relocate_result);
|
||||
TT_LOG_E(TAG, "Application failed to load: %s", lastError.c_str());
|
||||
LOGGER.error("Application failed to load: {}", lastError);
|
||||
elfFileData = nullptr;
|
||||
return false;
|
||||
}
|
||||
@ -105,7 +104,7 @@ private:
|
||||
|
||||
if (esp_elf_request(&elf, 0, argc, argv) != ESP_OK) {
|
||||
lastError = "Executable returned error code";
|
||||
TT_LOG_E(TAG, "%s", lastError.c_str());
|
||||
LOGGER.error("{}", lastError);
|
||||
esp_elf_deinit(&elf);
|
||||
elfFileData = nullptr;
|
||||
return false;
|
||||
@ -116,7 +115,7 @@ private:
|
||||
}
|
||||
|
||||
void stopElf() {
|
||||
TT_LOG_I(TAG, "Cleaning up ELF");
|
||||
LOGGER.info("Cleaning up ELF");
|
||||
|
||||
if (shouldCleanupElf) {
|
||||
esp_elf_deinit(&elf);
|
||||
@ -164,7 +163,7 @@ public:
|
||||
}
|
||||
|
||||
void onDestroy(AppContext& appContext) override {
|
||||
TT_LOG_I(TAG, "Cleaning up app");
|
||||
LOGGER.info("Cleaning up app");
|
||||
if (manifest != nullptr) {
|
||||
if (manifest->onDestroy != nullptr) {
|
||||
manifest->onDestroy(&appContext, data);
|
||||
@ -223,7 +222,7 @@ void setElfAppParameters(
|
||||
}
|
||||
|
||||
std::shared_ptr<App> createElfApp(const std::shared_ptr<AppManifest>& manifest) {
|
||||
TT_LOG_I(TAG, "createElfApp");
|
||||
LOGGER.info("createElfApp");
|
||||
assert(manifest != nullptr);
|
||||
assert(manifest->appLocation.isExternal());
|
||||
return std::make_shared<ElfApp>(manifest->appLocation.getPath());
|
||||
|
||||
@ -16,8 +16,6 @@ constexpr const char* TAG = "AddGps";
|
||||
|
||||
class AddGpsApp final : public App {
|
||||
|
||||
private:
|
||||
|
||||
lv_obj_t* uartDropdown = nullptr;
|
||||
lv_obj_t* modelDropdown = nullptr;
|
||||
lv_obj_t* baudDropdown = nullptr;
|
||||
|
||||
@ -2,32 +2,33 @@
|
||||
|
||||
#include <Tactility/Thread.h>
|
||||
#include <Tactility/CpuAffinity.h>
|
||||
#include <Tactility/Log.h>
|
||||
#include <Tactility/Logger.h>
|
||||
#include <Tactility/Mutex.h>
|
||||
#include <Tactility/lvgl/LvglSync.h>
|
||||
|
||||
#include <esp_lvgl_port.h>
|
||||
|
||||
namespace tt::lvgl {
|
||||
|
||||
// LVGL
|
||||
// The minimum task stack seems to be about 3500, but that crashes the wifi app in some scenarios
|
||||
// At 8192, it sometimes crashes when wifi-auto enables and is busy connecting and then you open WifiManage
|
||||
#define TDECK_LVGL_TASK_STACK_DEPTH 9216
|
||||
auto constexpr TAG = "lvgl";
|
||||
constexpr auto LVGL_TASK_STACK_DEPTH = 9216;
|
||||
|
||||
namespace tt::lvgl {
|
||||
static const auto LOGGER = Logger("EspLvglPort");
|
||||
|
||||
bool initEspLvglPort() {
|
||||
TT_LOG_D(TAG, "Port init");
|
||||
LOGGER.debug("Init");
|
||||
const lvgl_port_cfg_t lvgl_cfg = {
|
||||
.task_priority = static_cast<UBaseType_t>(Thread::Priority::Critical),
|
||||
.task_stack = TDECK_LVGL_TASK_STACK_DEPTH,
|
||||
.task_stack = LVGL_TASK_STACK_DEPTH,
|
||||
.task_affinity = getCpuAffinityConfiguration().graphics,
|
||||
.task_max_sleep_ms = 500,
|
||||
.timer_period_ms = 5
|
||||
};
|
||||
|
||||
if (lvgl_port_init(&lvgl_cfg) != ESP_OK) {
|
||||
TT_LOG_E(TAG, "Port init failed");
|
||||
LOGGER.error("Init failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -1,11 +1,9 @@
|
||||
#include "Tactility/lvgl/LabelUtils.h"
|
||||
#include "Tactility/file/File.h"
|
||||
#include "Tactility/file/FileLock.h"
|
||||
#include <Tactility/lvgl/LabelUtils.h>
|
||||
#include <Tactility/file/File.h>
|
||||
#include <Tactility/file/FileLock.h>
|
||||
|
||||
namespace tt::lvgl {
|
||||
|
||||
constexpr auto* TAG = "LabelUtils";
|
||||
|
||||
bool label_set_text_file(lv_obj_t* label, const char* filepath) {
|
||||
std::unique_ptr<uint8_t[]> text;
|
||||
file::getLock(filepath)->withLock([&text, filepath] {
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
#include <Tactility/Tactility.h>
|
||||
#include <Tactility/TactilityCore.h>
|
||||
|
||||
#include <Tactility/Logger.h>
|
||||
#include <Tactility/PubSub.h>
|
||||
#include <Tactility/Timer.h>
|
||||
#include <Tactility/RecursiveMutex.h>
|
||||
@ -16,7 +17,7 @@
|
||||
|
||||
namespace tt::lvgl {
|
||||
|
||||
constexpr auto TAG = "statusbar";
|
||||
static const auto LOGGER = Logger("statusbar");
|
||||
|
||||
static void onUpdateTime();
|
||||
|
||||
@ -58,7 +59,9 @@ static TickType_t getNextUpdateTime() {
|
||||
time_t now = ::time(nullptr);
|
||||
tm* tm_struct = localtime(&now);
|
||||
uint32_t seconds_to_wait = 60U - tm_struct->tm_sec;
|
||||
TT_LOG_D(TAG, "Update in %lu s", seconds_to_wait);
|
||||
if (LOGGER.isLoggingDebug()) {
|
||||
LOGGER.debug("Update in {} s", seconds_to_wait);
|
||||
}
|
||||
return pdMS_TO_TICKS(seconds_to_wait * 1000U);
|
||||
}
|
||||
|
||||
@ -101,13 +104,15 @@ static const lv_obj_class_t statusbar_class = {
|
||||
};
|
||||
|
||||
static void statusbar_pubsub_event(Statusbar* statusbar) {
|
||||
TT_LOG_D(TAG, "Update event");
|
||||
if (LOGGER.isLoggingDebug()) {
|
||||
LOGGER.debug("Update event");
|
||||
}
|
||||
if (lock(defaultLockTime)) {
|
||||
update_main(statusbar);
|
||||
lv_obj_invalidate(&statusbar->obj);
|
||||
unlock();
|
||||
} else {
|
||||
TT_LOG_W(TAG, LOG_MESSAGE_MUTEX_LOCK_FAILED_FMT, "Statusbar");
|
||||
LOGGER.warn(LOG_MESSAGE_MUTEX_LOCK_FAILED_FMT_CPP, "Statusbar");
|
||||
}
|
||||
}
|
||||
|
||||
@ -152,7 +157,6 @@ static void update_icon(lv_obj_t* image, const StatusbarIcon* icon) {
|
||||
}
|
||||
|
||||
lv_obj_t* statusbar_create(lv_obj_t* parent) {
|
||||
LV_LOG_INFO("begin");
|
||||
lv_obj_t* obj = lv_obj_class_create_obj(&statusbar_class, parent);
|
||||
lv_obj_class_init_obj(obj);
|
||||
|
||||
@ -235,7 +239,9 @@ int8_t statusbar_icon_add(const std::string& image, bool visible) {
|
||||
statusbar_data.icons[i].visible = visible;
|
||||
statusbar_data.icons[i].image = image;
|
||||
result = i;
|
||||
TT_LOG_D(TAG, "id %d: added", i);
|
||||
if (LOGGER.isLoggingDebug()) {
|
||||
LOGGER.debug("id {}: added", i);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -249,7 +255,9 @@ int8_t statusbar_icon_add() {
|
||||
}
|
||||
|
||||
void statusbar_icon_remove(int8_t id) {
|
||||
TT_LOG_D(TAG, "id %d: remove", id);
|
||||
if (LOGGER.isLoggingDebug()) {
|
||||
LOGGER.debug("id {}: remove", id);
|
||||
}
|
||||
tt_check(id >= 0 && id < STATUSBAR_ICON_LIMIT);
|
||||
statusbar_data.mutex.lock();
|
||||
StatusbarIcon* icon = &statusbar_data.icons[id];
|
||||
@ -261,7 +269,13 @@ void statusbar_icon_remove(int8_t id) {
|
||||
}
|
||||
|
||||
void statusbar_icon_set_image(int8_t id, const std::string& image) {
|
||||
TT_LOG_D(TAG, "id %d: set image %s", id, image.empty() ? "(none)" : image.c_str());
|
||||
if (LOGGER.isLoggingDebug()) {
|
||||
if (image.empty()) {
|
||||
LOGGER.debug("id {}: set image (none)", id);
|
||||
} else {
|
||||
LOGGER.debug("id {}: set image {}", id, image);
|
||||
}
|
||||
}
|
||||
tt_check(id >= 0 && id < STATUSBAR_ICON_LIMIT);
|
||||
statusbar_data.mutex.lock();
|
||||
StatusbarIcon* icon = &statusbar_data.icons[id];
|
||||
@ -272,7 +286,9 @@ void statusbar_icon_set_image(int8_t id, const std::string& image) {
|
||||
}
|
||||
|
||||
void statusbar_icon_set_visibility(int8_t id, bool visible) {
|
||||
TT_LOG_D(TAG, "id %d: set visibility %d", id, visible);
|
||||
if (LOGGER.isLoggingDebug()) {
|
||||
LOGGER.debug("id {}: set visibility {}", id, visible);
|
||||
}
|
||||
tt_check(id >= 0 && id < STATUSBAR_ICON_LIMIT);
|
||||
statusbar_data.mutex.lock();
|
||||
StatusbarIcon* icon = &statusbar_data.icons[id];
|
||||
|
||||
@ -1,11 +1,8 @@
|
||||
#define LV_USE_PRIVATE_API 1 // For actual lv_obj_t declaration
|
||||
|
||||
#include <Tactility/TactilityConfig.h>
|
||||
#include <Tactility/lvgl/Keyboard.h>
|
||||
#include <Tactility/lvgl/Toolbar.h>
|
||||
|
||||
#include <Tactility/service/loader/Loader.h>
|
||||
#include <Tactility/lvgl/Style.h>
|
||||
#include <Tactility/lvgl/Spinner.h>
|
||||
|
||||
namespace tt::lvgl {
|
||||
|
||||
@ -1,28 +1,28 @@
|
||||
#include <Tactility/Tactility.h>
|
||||
#include <Tactility/file/File.h>
|
||||
#include <Tactility/Logger.h>
|
||||
#include <Tactility/network/Http.h>
|
||||
|
||||
#ifdef ESP_PLATFORM
|
||||
#include <Tactility/network/EspHttpClient.h>
|
||||
#include <esp_sntp.h>
|
||||
#include <esp_http_client.h>
|
||||
#endif
|
||||
|
||||
namespace tt::network::http {
|
||||
|
||||
constexpr auto* TAG = "HTTP";
|
||||
static const auto LOGGER = Logger("HTTP");
|
||||
|
||||
void download(
|
||||
const std::string& url,
|
||||
const std::string& certFilePath,
|
||||
const std::string &downloadFilePath,
|
||||
std::function<void()> onSuccess,
|
||||
std::function<void(const char* errorMessage)> onError
|
||||
const std::function<void()>& onSuccess,
|
||||
const std::function<void(const char* errorMessage)>& onError
|
||||
) {
|
||||
TT_LOG_I(TAG, "Downloading %s to %s", url.c_str(), downloadFilePath.c_str());
|
||||
LOGGER.info("Downloading {} to {}", url, downloadFilePath);
|
||||
#ifdef ESP_PLATFORM
|
||||
getMainDispatcher().dispatch([url, certFilePath, downloadFilePath, onSuccess, onError] {
|
||||
TT_LOG_I(TAG, "Loading certificate");
|
||||
LOGGER.info("Loading certificate");
|
||||
auto certificate = file::readString(certFilePath);
|
||||
if (certificate == nullptr) {
|
||||
onError("Failed to read certificate");
|
||||
@ -68,14 +68,14 @@ void download(
|
||||
|
||||
auto lock = file::getLock(downloadFilePath)->asScopedLock();
|
||||
lock.lock();
|
||||
TT_LOG_I(TAG, "opening %s", downloadFilePath.c_str());
|
||||
LOGGER.info("opening {}", downloadFilePath);
|
||||
auto* file = fopen(downloadFilePath.c_str(), "wb");
|
||||
if (file == nullptr) {
|
||||
onError("Failed to open file");
|
||||
return;
|
||||
}
|
||||
|
||||
TT_LOG_I(TAG, "Writing %d bytes to %s", bytes_left, downloadFilePath.c_str());
|
||||
LOGGER.info("Writing {} bytes to {}", bytes_left, downloadFilePath);
|
||||
char buffer[512];
|
||||
while (bytes_left > 0) {
|
||||
int data_read = client->read(buffer, 512);
|
||||
@ -92,7 +92,7 @@ void download(
|
||||
}
|
||||
}
|
||||
fclose(file);
|
||||
TT_LOG_I(TAG, "Downloaded %s to %s", url.c_str(), downloadFilePath.c_str());
|
||||
LOGGER.info("Downloaded {} to {}", url, downloadFilePath);
|
||||
onSuccess();
|
||||
});
|
||||
#else
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#include <Tactility/network/HttpdReq.h>
|
||||
#include <Tactility/Log.h>
|
||||
#include <Tactility/Logger.h>
|
||||
#include <Tactility/StringUtils.h>
|
||||
#include <Tactility/file/File.h>
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
|
||||
namespace tt::network {
|
||||
|
||||
constexpr auto* TAG = "HttpdReq";
|
||||
static const auto LOGGER = Logger("HttpdReq");
|
||||
|
||||
bool getHeaderOrSendError(httpd_req_t* request, const std::string& name, std::string& value) {
|
||||
size_t header_size = httpd_req_get_hdr_value_len(request, name.c_str());
|
||||
@ -22,7 +22,7 @@ bool getHeaderOrSendError(httpd_req_t* request, const std::string& name, std::st
|
||||
|
||||
auto header_buffer = std::make_unique<char[]>(header_size + 1);
|
||||
if (header_buffer == nullptr) {
|
||||
TT_LOG_E(TAG, LOG_MESSAGE_MUTEX_LOCK_FAILED);
|
||||
LOGGER.error(LOG_MESSAGE_MUTEX_LOCK_FAILED);
|
||||
httpd_resp_send_500(request);
|
||||
return false;
|
||||
}
|
||||
@ -78,7 +78,7 @@ std::unique_ptr<char[]> receiveByteArray(httpd_req_t* request, size_t length, si
|
||||
// and we don't have exceptions enabled in the compiler settings
|
||||
auto* buffer = static_cast<char*>(malloc(length));
|
||||
if (buffer == nullptr) {
|
||||
TT_LOG_E(TAG, LOG_MESSAGE_ALLOC_FAILED_FMT, length);
|
||||
LOGGER.error(LOG_MESSAGE_ALLOC_FAILED_FMT, length);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -86,7 +86,7 @@ std::unique_ptr<char[]> receiveByteArray(httpd_req_t* request, size_t length, si
|
||||
size_t read_size = length - bytesRead;
|
||||
size_t bytes_received = httpd_req_recv(request, buffer + bytesRead, read_size);
|
||||
if (bytes_received <= 0) {
|
||||
TT_LOG_W(TAG, "Received %zu / %zu", bytesRead + bytes_received, length);
|
||||
LOGGER.warn("Received {} / {}", bytesRead + bytes_received, length);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -172,7 +172,7 @@ size_t receiveFile(httpd_req_t* request, size_t length, const std::string& fileP
|
||||
|
||||
auto* file = fopen(filePath.c_str(), "wb");
|
||||
if (file == nullptr) {
|
||||
TT_LOG_E(TAG, "Failed to open file for writing: %s", filePath.c_str());
|
||||
LOGGER.error("Failed to open file for writing: {}", filePath);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -180,11 +180,11 @@ size_t receiveFile(httpd_req_t* request, size_t length, const std::string& fileP
|
||||
auto expected_chunk_size = std::min<size_t>(BUFFER_SIZE, length - bytes_received);
|
||||
size_t receive_chunk_size = httpd_req_recv(request, buffer, expected_chunk_size);
|
||||
if (receive_chunk_size <= 0) {
|
||||
TT_LOG_E(TAG, "Receive failed");
|
||||
LOGGER.error("Receive failed");
|
||||
break;
|
||||
}
|
||||
if (fwrite(buffer, 1, receive_chunk_size, file) != receive_chunk_size) {
|
||||
TT_LOG_E(TAG, "Failed to write all bytes");
|
||||
LOGGER.error("Failed to write all bytes");
|
||||
break;
|
||||
}
|
||||
bytes_received += receive_chunk_size;
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
#include <Tactility/network/NtpPrivate.h>
|
||||
#include <Tactility/Logger.h>
|
||||
#include <Tactility/Preferences.h>
|
||||
|
||||
#ifdef ESP_PLATFORM
|
||||
@ -10,7 +11,8 @@
|
||||
|
||||
namespace tt::network::ntp {
|
||||
|
||||
constexpr auto* TAG = "NTP";
|
||||
static const auto LOGGER = Logger("NTP");
|
||||
|
||||
static bool processedSyncEvent = false;
|
||||
|
||||
#ifdef ESP_PLATFORM
|
||||
@ -21,14 +23,14 @@ void storeTimeInNvs() {
|
||||
|
||||
auto preferences = std::make_unique<Preferences>("time");
|
||||
preferences->putInt64("syncTime", now);
|
||||
TT_LOG_I(TAG, "Stored time %llu", now);
|
||||
LOGGER.info("Stored time {}", now);
|
||||
}
|
||||
|
||||
void setTimeFromNvs() {
|
||||
auto preferences = std::make_unique<Preferences>("time");
|
||||
time_t synced_time;
|
||||
if (preferences->optInt64("syncTime", synced_time)) {
|
||||
TT_LOG_I(TAG, "Restoring last known time to %llu", synced_time);
|
||||
LOGGER.info("Restoring last known time to {}", synced_time);
|
||||
timeval get_nvs_time;
|
||||
get_nvs_time.tv_sec = synced_time;
|
||||
settimeofday(&get_nvs_time, nullptr);
|
||||
@ -36,7 +38,7 @@ void setTimeFromNvs() {
|
||||
}
|
||||
|
||||
static void onTimeSynced(timeval* tv) {
|
||||
TT_LOG_I(TAG, "Time synced (%llu)", tv->tv_sec);
|
||||
LOGGER.info("Time synced ({})", tv->tv_sec);
|
||||
processedSyncEvent = true;
|
||||
esp_netif_sntp_deinit();
|
||||
storeTimeInNvs();
|
||||
|
||||
@ -1,13 +1,14 @@
|
||||
#ifdef ESP_PLATFORM
|
||||
#include <Tactility/file/PropertiesFile.h>
|
||||
#include <Tactility/Log.h>
|
||||
#include <Tactility/Logger.h>
|
||||
#include <Tactility/service/development/DevelopmentSettings.h>
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
namespace tt::service::development {
|
||||
|
||||
constexpr auto* TAG = "DevSettings";
|
||||
static const auto LOGGER = Logger("DevSettings");
|
||||
|
||||
constexpr auto* SETTINGS_FILE = "/data/settings/development.properties";
|
||||
constexpr auto* SETTINGS_KEY_ENABLE_ON_BOOT = "enableOnBoot";
|
||||
|
||||
@ -39,7 +40,7 @@ static bool save(const DevelopmentSettings& settings) {
|
||||
void setEnableOnBoot(bool enable) {
|
||||
DevelopmentSettings properties { .enableOnBoot = enable };
|
||||
if (!save(properties)) {
|
||||
TT_LOG_E(TAG, "Failed to save %s", SETTINGS_FILE);
|
||||
LOGGER.error("Failed to save {}", SETTINGS_FILE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,14 +1,14 @@
|
||||
#include <Tactility/hal/sdcard/SdCardDevice.h>
|
||||
#include <Tactility/Logger.h>
|
||||
#include <Tactility/Mutex.h>
|
||||
#include <Tactility/service/ServiceContext.h>
|
||||
#include <Tactility/service/ServiceRegistration.h>
|
||||
|
||||
#include <Tactility/Timer.h>
|
||||
#include <Tactility/Mutex.h>
|
||||
#include <Tactility/Tactility.h>
|
||||
#include <Tactility/hal/sdcard/SdCardDevice.h>
|
||||
#include <Tactility/Timer.h>
|
||||
|
||||
namespace tt::service::sdcard {
|
||||
|
||||
constexpr auto* TAG = "SdcardService";
|
||||
static const auto LOGGER = Logger("SdcardService");
|
||||
|
||||
extern const ServiceManifest manifest;
|
||||
|
||||
@ -37,7 +37,7 @@ class SdCardService final : public Service {
|
||||
auto new_state = sdcard->getState();
|
||||
|
||||
if (new_state == hal::sdcard::SdCardDevice::State::Error) {
|
||||
TT_LOG_E(TAG, "Sdcard error - unmounting. Did you eject the card in an unsafe manner?");
|
||||
LOGGER.error("Sdcard error - unmounting. Did you eject the card in an unsafe manner?");
|
||||
sdcard->unmount();
|
||||
}
|
||||
|
||||
@ -47,7 +47,7 @@ class SdCardService final : public Service {
|
||||
|
||||
unlock();
|
||||
} else {
|
||||
TT_LOG_W(TAG, LOG_MESSAGE_MUTEX_LOCK_FAILED);
|
||||
LOGGER.warn(LOG_MESSAGE_MUTEX_LOCK_FAILED);
|
||||
}
|
||||
}
|
||||
|
||||
@ -55,7 +55,7 @@ public:
|
||||
|
||||
bool onStart(ServiceContext& serviceContext) override {
|
||||
if (hal::findFirstDevice<hal::sdcard::SdCardDevice>(hal::Device::Type::SdCard) == nullptr) {
|
||||
TT_LOG_W(TAG, "No SD card device found - not starting Service");
|
||||
LOGGER.warn("No SD card device found - not starting Service");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -1,20 +1,21 @@
|
||||
#include <Tactility/lvgl/Statusbar.h>
|
||||
|
||||
#include <Tactility/Timer.h>
|
||||
#include <Tactility/Mutex.h>
|
||||
#include <Tactility/hal/power/PowerDevice.h>
|
||||
#include <Tactility/hal/sdcard/SdCardDevice.h>
|
||||
#include <Tactility/Logger.h>
|
||||
#include <Tactility/lvgl/Lvgl.h>
|
||||
#include <Tactility/lvgl/LvglSync.h>
|
||||
#include <Tactility/Mutex.h>
|
||||
#include <Tactility/service/ServiceContext.h>
|
||||
#include <Tactility/service/ServicePaths.h>
|
||||
#include <Tactility/service/ServiceRegistration.h>
|
||||
#include <Tactility/service/gps/GpsService.h>
|
||||
#include <Tactility/service/wifi/Wifi.h>
|
||||
#include <Tactility/Timer.h>
|
||||
|
||||
namespace tt::service::statusbar {
|
||||
|
||||
constexpr auto* TAG = "StatusbarService";
|
||||
static const auto LOGGER = Logger("StatusbarService");
|
||||
|
||||
// SD card status
|
||||
constexpr auto* STATUSBAR_ICON_SDCARD = "sdcard.png";
|
||||
@ -252,7 +253,7 @@ public:
|
||||
|
||||
bool onStart(ServiceContext& serviceContext) override {
|
||||
if (lv_screen_active() == nullptr) {
|
||||
TT_LOG_E(TAG, "No display found");
|
||||
LOGGER.error("No display found");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
|
||||
#include <Tactility/crypt/Crypt.h>
|
||||
#include <Tactility/file/File.h>
|
||||
#include <Tactility/Logger.h>
|
||||
|
||||
#include <Tactility/service/ServicePaths.h>
|
||||
#include <format>
|
||||
@ -14,7 +15,7 @@
|
||||
|
||||
namespace tt::service::wifi::settings {
|
||||
|
||||
constexpr auto* TAG = "WifiApSettings";
|
||||
static const auto LOGGER = Logger("WifiApSettings");
|
||||
|
||||
constexpr auto* AP_SETTINGS_FORMAT = "{}/{}.ap.properties";
|
||||
|
||||
@ -33,7 +34,7 @@ std::string toHexString(const uint8_t *data, int length) {
|
||||
|
||||
bool readHex(const std::string& input, uint8_t* buffer, int length) {
|
||||
if (input.size() / 2 != length) {
|
||||
TT_LOG_E(TAG, "readHex() length mismatch");
|
||||
LOGGER.error("readHex() length mismatch");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -63,7 +64,7 @@ static bool encrypt(const std::string& ssidInput, std::string& ssidOutput) {
|
||||
|
||||
crypt::getIv(ssidInput.c_str(), ssidInput.size(), iv);
|
||||
if (crypt::encrypt(iv, reinterpret_cast<const uint8_t*>(ssidInput.c_str()), buffer, encrypted_length) != 0) {
|
||||
TT_LOG_E(TAG, "Failed to encrypt");
|
||||
LOGGER.error("Failed to encrypt");
|
||||
free(buffer);
|
||||
return false;
|
||||
}
|
||||
@ -79,7 +80,7 @@ static bool decrypt(const std::string& ssidInput, std::string& ssidOutput) {
|
||||
assert(ssidInput.size() % 2 == 0);
|
||||
auto* data = static_cast<uint8_t*>(malloc(ssidInput.size() / 2));
|
||||
if (!readHex(ssidInput, data, ssidInput.size() / 2)) {
|
||||
TT_LOG_E(TAG, "Failed to read hex");
|
||||
LOGGER.error("Failed to read hex");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -101,7 +102,7 @@ static bool decrypt(const std::string& ssidInput, std::string& ssidOutput) {
|
||||
free(data);
|
||||
|
||||
if (decrypt_result != 0) {
|
||||
TT_LOG_E(TAG, "Failed to decrypt credentials for \"%s\": %d", ssidInput.c_str(), decrypt_result);
|
||||
LOGGER.error("Failed to decrypt credentials for \"{}s\": {}", ssidInput, decrypt_result);
|
||||
free(result);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -409,7 +409,7 @@ static bool copy_scan_list(std::shared_ptr<Wifi> wifi) {
|
||||
if (scan_result == ESP_OK) {
|
||||
uint16_t safe_record_count = std::min(wifi->scan_list_limit, record_count);
|
||||
wifi->scan_list_count = safe_record_count;
|
||||
LOGGER.info("Scanned %u APs. Showing %u:", record_count, safe_record_count);
|
||||
LOGGER.info("Scanned {} APs. Showing {}:", record_count, safe_record_count);
|
||||
for (uint16_t i = 0; i < safe_record_count; i++) {
|
||||
wifi_ap_record_t* record = &wifi->scan_list[i];
|
||||
LOGGER.info(" - SSID {}, RSSI {}, channel {}, BSSID {:02x}:{:02x}:{:02x}:{:02x}:{:02x}:{:02x}",
|
||||
@ -505,7 +505,7 @@ static void eventHandler(TT_UNUSED void* arg, esp_event_base_t event_base, int32
|
||||
} else if (event_base == IP_EVENT && event_id == IP_EVENT_STA_GOT_IP) {
|
||||
auto* event = static_cast<ip_event_got_ip_t*>(event_data);
|
||||
memcpy(&wifi->ip_info, &event->ip_info, sizeof(esp_netif_ip_info_t));
|
||||
LOGGER.info("eventHandler: got ip: {} {}", IPSTR, IP2STR(&event->ip_info.ip));
|
||||
LOGGER.info("eventHandler: got ip: {}.{}.{}.{}", IP2STR(&event->ip_info.ip));
|
||||
if (wifi->getRadioState() == RadioState::ConnectionPending) {
|
||||
wifi->connection_wait_flags.set(WIFI_CONNECTED_BIT);
|
||||
// We resume auto-connecting only when there was an explicit request by the user for the connection
|
||||
@ -802,7 +802,7 @@ static void dispatchConnect(std::shared_ptr<Wifi> wifi) {
|
||||
wifi->setSecureConnection(config.sta.password[0] != 0x00U);
|
||||
wifi->setRadioState(RadioState::ConnectionActive);
|
||||
publish_event(wifi, WifiEvent::ConnectionSuccess);
|
||||
LOGGER.info("Connected to %s", wifi->connection_target.ssid.c_str());
|
||||
LOGGER.info("Connected to {}", wifi->connection_target.ssid.c_str());
|
||||
if (wifi->connection_target_remember) {
|
||||
if (!settings::save(wifi->connection_target)) {
|
||||
LOGGER.error("Failed to store credentials");
|
||||
|
||||
@ -8,15 +8,12 @@
|
||||
|
||||
#include <Tactility/PubSub.h>
|
||||
#include <Tactility/Check.h>
|
||||
#include <Tactility/Log.h>
|
||||
#include <Tactility/RecursiveMutex.h>
|
||||
#include <Tactility/service/Service.h>
|
||||
#include <Tactility/service/ServiceManifest.h>
|
||||
|
||||
namespace tt::service::wifi {
|
||||
|
||||
constexpr auto* TAG = "Wifi";
|
||||
|
||||
struct Wifi {
|
||||
/** @brief Locking mechanism for modifying the Wifi instance */
|
||||
RecursiveMutex mutex;
|
||||
|
||||
@ -1,14 +1,14 @@
|
||||
#include <Tactility/service/wifi/WifiSettings.h>
|
||||
|
||||
#include <Tactility/Log.h>
|
||||
#include <Tactility/file/File.h>
|
||||
#include <Tactility/file/PropertiesFile.h>
|
||||
#include <Tactility/Logger.h>
|
||||
#include <Tactility/service/ServicePaths.h>
|
||||
#include <Tactility/service/wifi/WifiPrivate.h>
|
||||
|
||||
namespace tt::service::wifi::settings {
|
||||
|
||||
constexpr auto* TAG = "WifiSettings";
|
||||
static const auto LOGGER = Logger("WifiSettings");
|
||||
constexpr auto* SETTINGS_KEY_ENABLE_ON_BOOT = "enableOnBoot";
|
||||
|
||||
struct WifiSettings {
|
||||
@ -56,7 +56,7 @@ static bool save(const WifiSettings& settings) {
|
||||
WifiSettings getCachedOrLoad() {
|
||||
if (!cached) {
|
||||
if (!load(cachedSettings)) {
|
||||
TT_LOG_E(TAG, "Failed to load");
|
||||
LOGGER.error("Failed to load");
|
||||
} else {
|
||||
cached = true;
|
||||
}
|
||||
@ -68,7 +68,7 @@ WifiSettings getCachedOrLoad() {
|
||||
void setEnableOnBoot(bool enable) {
|
||||
cachedSettings.enableOnBoot = enable;
|
||||
if (!save(cachedSettings)) {
|
||||
TT_LOG_E(TAG, "Failed to save");
|
||||
LOGGER.error("Failed to save");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
#include <Tactility/file/File.h>
|
||||
#include <Tactility/file/PropertiesFile.h>
|
||||
#include <Tactility/hal/sdcard/SdCardDevice.h>
|
||||
#include <Tactility/Log.h>
|
||||
#include <Tactility/Logger.h>
|
||||
#include <Tactility/settings/BootSettings.h>
|
||||
|
||||
#include <format>
|
||||
@ -11,7 +11,8 @@
|
||||
|
||||
namespace tt::settings {
|
||||
|
||||
constexpr auto* TAG = "BootSettings";
|
||||
static const auto LOGGER = Logger("BootSettings");
|
||||
|
||||
constexpr auto* PROPERTIES_FILE_FORMAT = "{}/settings/boot.properties";
|
||||
constexpr auto* PROPERTIES_KEY_LAUNCHER_APP_ID = "launcherAppId";
|
||||
constexpr auto* PROPERTIES_KEY_AUTO_START_APP_ID = "autoStartAppId";
|
||||
@ -36,7 +37,7 @@ bool loadBootSettings(BootSettings& properties) {
|
||||
properties.launcherAppId = value;
|
||||
}
|
||||
})) {
|
||||
TT_LOG_E(TAG, "Failed to load %s", path.c_str());
|
||||
LOGGER.error("Failed to load {}", path);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -10,7 +10,6 @@
|
||||
|
||||
namespace tt::settings::display {
|
||||
|
||||
constexpr auto* TAG = "DisplaySettings";
|
||||
constexpr auto* SETTINGS_FILE = "/data/settings/display.properties";
|
||||
constexpr auto* SETTINGS_KEY_ORIENTATION = "orientation";
|
||||
constexpr auto* SETTINGS_KEY_GAMMA_CURVE = "gammaCurve";
|
||||
|
||||
@ -1,11 +1,12 @@
|
||||
#include <Tactility/Log.h>
|
||||
#include <Tactility/Logger.h>
|
||||
#include <Tactility/settings/Language.h>
|
||||
#include <utility>
|
||||
#include <Tactility/settings/SystemSettings.h>
|
||||
|
||||
#include <utility>
|
||||
|
||||
namespace tt::settings {
|
||||
|
||||
constexpr auto* TAG = "Language";
|
||||
static const auto LOGGER = Logger("Language");
|
||||
|
||||
void setLanguage(Language newLanguage) {
|
||||
SystemSettings properties;
|
||||
@ -39,7 +40,7 @@ std::string toString(Language language) {
|
||||
case Language::nl_NL:
|
||||
return "nl-NL";
|
||||
default:
|
||||
TT_LOG_E(TAG, "Missing serialization for language %d", static_cast<int>(language));
|
||||
LOGGER.error("Missing serialization for language {}", static_cast<int>(language));
|
||||
std::unreachable();
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,6 +5,6 @@
|
||||
|
||||
namespace tt {
|
||||
|
||||
typedef std::function<void(LogLevel, const char* tag, const char*)> LoggerAdapter;
|
||||
typedef std::function<void(LogLevel level, const char* tag, const char* message)> LoggerAdapter;
|
||||
|
||||
}
|
||||
|
||||
@ -1,28 +1,28 @@
|
||||
#include <Tactility/Check.h>
|
||||
|
||||
#include <Tactility/Log.h>
|
||||
#include <Tactility/Logger.h>
|
||||
#include <Tactility/freertoscompat/Task.h>
|
||||
|
||||
constexpr auto TAG = "kernel";
|
||||
static const auto LOGGER = tt::Logger("kernel");
|
||||
|
||||
static void logMemoryInfo() {
|
||||
#ifdef ESP_PLATFORM
|
||||
TT_LOG_E(TAG, "default caps:");
|
||||
TT_LOG_E(TAG, " total: %u", heap_caps_get_total_size(MALLOC_CAP_DEFAULT));
|
||||
TT_LOG_E(TAG, " free: %u", heap_caps_get_free_size(MALLOC_CAP_DEFAULT));
|
||||
TT_LOG_E(TAG, " min free: %u", heap_caps_get_minimum_free_size(MALLOC_CAP_DEFAULT));
|
||||
TT_LOG_E(TAG, "internal caps:");
|
||||
TT_LOG_E(TAG, " total: %u", heap_caps_get_total_size(MALLOC_CAP_INTERNAL));
|
||||
TT_LOG_E(TAG, " free: %u", heap_caps_get_free_size(MALLOC_CAP_INTERNAL));
|
||||
TT_LOG_E(TAG, " min free: %u", heap_caps_get_minimum_free_size(MALLOC_CAP_INTERNAL));
|
||||
LOGGER.error("default caps:");
|
||||
LOGGER.error(" total: {}", heap_caps_get_total_size(MALLOC_CAP_DEFAULT));
|
||||
LOGGER.error(" free: {}", heap_caps_get_free_size(MALLOC_CAP_DEFAULT));
|
||||
LOGGER.error(" min free: {}", heap_caps_get_minimum_free_size(MALLOC_CAP_DEFAULT));
|
||||
LOGGER.error("internal caps:");
|
||||
LOGGER.error(" total: {}", heap_caps_get_total_size(MALLOC_CAP_INTERNAL));
|
||||
LOGGER.error(" free: {}", heap_caps_get_free_size(MALLOC_CAP_INTERNAL));
|
||||
LOGGER.error(" min free: {}", heap_caps_get_minimum_free_size(MALLOC_CAP_INTERNAL));
|
||||
#endif
|
||||
}
|
||||
|
||||
static void logTaskInfo() {
|
||||
const char* name = pcTaskGetName(nullptr);
|
||||
const char* safe_name = name ? name : "main";
|
||||
TT_LOG_E(TAG, "Task: %s", safe_name);
|
||||
TT_LOG_E(TAG, "Stack watermark: %u", uxTaskGetStackHighWaterMark(NULL) * 4);
|
||||
LOGGER.error("Task: %s", safe_name);
|
||||
LOGGER.error("Stack watermark: %u", uxTaskGetStackHighWaterMark(NULL) * 4);
|
||||
}
|
||||
|
||||
namespace tt {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user