New logging and more (#446)
- `TT_LOG_*` macros are replaced by `Logger` via `#include<Tactility/Logger.h>` - Changed default timezone to Europe/Amsterdam - Fix for logic bug in unPhone hardware - Fix for init/deinit in DRV2605 driver - Other fixes - Removed optimization that broke unPhone (disabled the moving of heap-related functions to flash)
This commit is contained in:
committed by
GitHub
parent
719f7bcece
commit
f620255c41
@@ -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 {} is not a string", key);
|
||||
return false;
|
||||
}
|
||||
output[i] = cJSON_GetStringValue(string_json);
|
||||
|
||||
Reference in New Issue
Block a user