Replaced Logger usage with LOG_x (#548)

This commit is contained in:
Ken Van Hoeylandt
2026-07-04 23:49:19 +02:00
committed by GitHub
parent ecad2248d9
commit 9d5993930d
162 changed files with 1776 additions and 1842 deletions
+8 -17
View File
@@ -1,10 +1,11 @@
#include <Tactility/hal/gps/Satellites.h>
#include <Tactility/kernel/Kernel.h>
#include <Tactility/Logger.h>
#include <tactility/log.h>
namespace tt::hal::gps {
static const auto LOGGER = Logger("Satellites");
constexpr auto* TAG = "Satellites";
constexpr bool hasTimeElapsed(TickType_t now, TickType_t timeInThePast, TickType_t expireTimeInTicks) {
return (TickType_t)(now - timeInThePast) >= expireTimeInTicks;
@@ -33,9 +34,7 @@ SatelliteStorage::SatelliteRecord* SatelliteStorage::findUnusedRecord() {
if (!result.empty()) {
auto* record = &result.front();
record->inUse = true;
if (LOGGER.isLoggingDebug()) {
LOGGER.debug("Found unused record");
}
LOG_D(TAG, "Found unused record");
return record;
} else {
return nullptr;
@@ -53,9 +52,7 @@ SatelliteStorage::SatelliteRecord* SatelliteStorage::findRecordToRecycle() {
for (int i = 0; i < records.size(); ++i) {
// First try to find a record that is "old enough"
if (hasTimeElapsed(now, records[i].lastUpdated, expire_duration)) {
if (LOGGER.isLoggingDebug()) {
LOGGER.debug("! [{}] {} < {}", i, records[i].lastUpdated, expire_duration);
}
LOG_D(TAG, "! [%d] %u < %u", i, records[i].lastUpdated, expire_duration);
candidate_index = i;
break;
}
@@ -64,17 +61,13 @@ SatelliteStorage::SatelliteRecord* SatelliteStorage::findRecordToRecycle() {
if (records[i].inUse && records[i].lastUpdated < candidate_age) {
candidate_index = i;
candidate_age = records[i].lastUpdated;
if (LOGGER.isLoggingDebug()) {
LOGGER.debug("? [{}] {} < {}", i, records[i].lastUpdated, candidate_age);
}
LOG_D(TAG, "? [%d] %u < %u", i, records[i].lastUpdated, candidate_age);
}
}
assert(candidate_index != -1);
if (LOGGER.isLoggingDebug()) {
LOGGER.debug("Recycled record {}", candidate_index);
}
LOG_D(TAG, "Recycled record %d", candidate_index);
return &records[candidate_index];
}
@@ -101,9 +94,7 @@ void SatelliteStorage::notify(const minmea_sat_info& data) {
record->inUse = true;
record->lastUpdated = kernel::getTicks();
record->data = data;
if (LOGGER.isLoggingDebug()) {
LOGGER.debug("Updated satellite {}: elevation {}, azimuth {}, snr {}", record->data.nr, record->data.elevation, record->data.elevation, record->data.snr);
}
LOG_D(TAG, "Updated satellite %d: elevation %d, azimuth %d, snr %d", record->data.nr, record->data.elevation, record->data.elevation, record->data.snr);
}
}