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:
Ken Van Hoeylandt
2026-01-06 22:35:39 +01:00
committed by GitHub
parent 719f7bcece
commit f620255c41
188 changed files with 1973 additions and 1755 deletions
+13 -13
View File
@@ -1,44 +1,44 @@
#include "Tactility/file/ObjectFile.h"
#include "Tactility/file/ObjectFilePrivate.h"
#include <Tactility/file/ObjectFile.h>
#include <Tactility/file/ObjectFilePrivate.h>
#include <cstring>
#include <Tactility/Log.h>
#include <Tactility/Logger.h>
namespace tt::file {
constexpr auto* TAG = "ObjectFileReader";
static const auto LOGGER = Logger("ObjectFileReader");
bool ObjectFileReader::open() {
auto opening_file = std::unique_ptr<FILE, FileCloser>(fopen(filePath.c_str(), "r"));
if (opening_file == nullptr) {
TT_LOG_E(TAG, "Failed to open file %s", filePath.c_str());
LOGGER.error("Failed to open file {}", filePath.c_str());
return false;
}
FileHeader file_header;
if (fread(&file_header, sizeof(FileHeader), 1, opening_file.get()) != 1) {
TT_LOG_E(TAG, "Failed to read file header from %s", filePath.c_str());
LOGGER.error("Failed to read file header from {}", filePath);
return false;
}
if (file_header.identifier != OBJECT_FILE_IDENTIFIER) {
TT_LOG_E(TAG, "Invalid file type for %s", filePath.c_str());
LOGGER.error("Invalid file type for {}", filePath);
return false;
}
if (file_header.version != OBJECT_FILE_VERSION) {
TT_LOG_E(TAG, "Unknown version for %s: %lu", filePath.c_str(), file_header.identifier);
LOGGER.error("Unknown version for {}: {}", filePath, file_header.identifier);
return false;
}
ContentHeader content_header;
if (fread(&content_header, sizeof(ContentHeader), 1, opening_file.get()) != 1) {
TT_LOG_E(TAG, "Failed to read content header from %s", filePath.c_str());
LOGGER.error("Failed to read content header from {}", filePath);
return false;
}
if (recordSize != content_header.recordSize) {
TT_LOG_E(TAG, "Record size mismatch for %s: expected %lu, got %lu", filePath.c_str(), recordSize, content_header.recordSize);
LOGGER.error("Record size mismatch for {}: expected {}, got {}", filePath, recordSize, content_header.recordSize);
return false;
}
@@ -47,8 +47,8 @@ bool ObjectFileReader::open() {
file = std::move(opening_file);
TT_LOG_D(TAG, "File version: %lu", file_header.version);
TT_LOG_D(TAG, "Content: version = %lu, size = %lu bytes, count = %lu", content_header.recordVersion, content_header.recordSize, content_header.recordCount);
LOGGER.debug("File version: {}", file_header.version);
LOGGER.debug("Content: version = {}, size = {} bytes, count = {}", content_header.recordVersion, content_header.recordSize, content_header.recordCount);
return true;
}
@@ -63,7 +63,7 @@ void ObjectFileReader::close() {
bool ObjectFileReader::readNext(void* output) {
if (file == nullptr) {
TT_LOG_E(TAG, "File not open");
LOGGER.error("File not open");
return false;
}