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
+4 -3
View File
@@ -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";
+5 -4
View File
@@ -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();
}
}
+11 -10
View File
@@ -1,3 +1,4 @@
#include <Tactility/Logger.h>
#include <Tactility/MountPoints.h>
#include <Tactility/Mutex.h>
#include <Tactility/file/FileLock.h>
@@ -6,11 +7,11 @@
#include <Tactility/settings/SystemSettings.h>
#include <format>
#include <Tactility/file/File.h>
namespace tt::settings {
constexpr auto* TAG = "SystemSettings";
static const auto LOGGER = Logger("SystemSettings");
constexpr auto* FILE_PATH_FORMAT = "{}/settings/system.properties";
static Mutex mutex;
@@ -19,17 +20,17 @@ static SystemSettings cachedSettings;
static bool loadSystemSettingsFromFile(SystemSettings& properties) {
auto file_path = std::format(FILE_PATH_FORMAT, file::MOUNT_POINT_DATA);
TT_LOG_I(TAG, "System settings loading from %s", file_path.c_str());
LOGGER.info("System settings loading from {}", file_path);
std::map<std::string, std::string> map;
if (!file::loadPropertiesFile(file_path, map)) {
TT_LOG_E(TAG, "Failed to load %s", file_path.c_str());
LOGGER.error("Failed to load {}", file_path);
return false;
}
auto language_entry = map.find("language");
if (language_entry != map.end()) {
if (!fromString(language_entry->second, properties.language)) {
TT_LOG_W(TAG, "Unknown language \"%s\" in %s", language_entry->second.c_str(), file_path.c_str());
LOGGER.warn("Unknown language \"{}\" in {}", language_entry->second, file_path);
properties.language = Language::en_US;
}
} else {
@@ -46,7 +47,7 @@ static bool loadSystemSettingsFromFile(SystemSettings& properties) {
if (date_format_entry != map.end() && !date_format_entry->second.empty()) {
properties.dateFormat = date_format_entry->second;
} else {
TT_LOG_I(TAG, "dateFormat missing or empty, using default MM/DD/YYYY (likely from older system.properties)");
LOGGER.info("dateFormat missing or empty, using default MM/DD/YYYY (likely from older system.properties)");
properties.dateFormat = "MM/DD/YYYY";
}
@@ -55,11 +56,11 @@ static bool loadSystemSettingsFromFile(SystemSettings& properties) {
if (region_entry != map.end() && !region_entry->second.empty()) {
properties.region = region_entry->second;
} else {
TT_LOG_I(TAG, "region missing or empty, using default US");
properties.region = "US";
LOGGER.info("Region missing or empty, using default EU");
properties.region = "EU";
}
TT_LOG_I(TAG, "System settings loaded");
LOGGER.info("System settings loaded");
return true;
}
@@ -84,7 +85,7 @@ bool saveSystemSettings(const SystemSettings& properties) {
map["region"] = properties.region;
if (!file::savePropertiesFile(file_path, map)) {
TT_LOG_E(TAG, "Failed to save %s", file_path.c_str());
LOGGER.error("Failed to save {}", file_path);
return false;
}
+2 -2
View File
@@ -45,7 +45,7 @@ std::string getTimeZoneName() {
if (preferences.optString(TIMEZONE_PREFERENCES_KEY_NAME, result)) {
return result;
} else {
return "America/Los_Angeles"; // Default: Pacific Time (PST/PDT)
return "Europe/Amsterdam";
}
}
@@ -55,7 +55,7 @@ std::string getTimeZoneCode() {
if (preferences.optString(TIMEZONE_PREFERENCES_KEY_CODE, result)) {
return result;
} else {
return "PST8PDT,M3.2.0,M11.1.0"; // Default: Pacific Time POSIX string
return "CET-1CEST,M3.5.0,M10.5.0/3"; // Default: Europe/Amsterdam
}
}