mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-02-19 03:13:14 +00:00
Fixes
This commit is contained in:
parent
560ffbf4e6
commit
f6dfc04cb8
@ -65,7 +65,7 @@ bool setBrightness(uint8_t brightness) {
|
||||
LOGGER.info("Successfully set brightness to {}", brightness);
|
||||
return true;
|
||||
} else {
|
||||
LOGGER.error("Failed to set brightness: {} (0x%x)", esp_err_to_name(ret), ret);
|
||||
LOGGER.error("Failed to set brightness: {} (0x{:02X})", esp_err_to_name(ret), ret);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -28,7 +28,7 @@ public:
|
||||
}
|
||||
|
||||
bool init(std::unique_ptr<esp_http_client_config_t> inConfig) {
|
||||
logger.info("init(%s)", inConfig->url);
|
||||
logger.info("init({})", inConfig->url);
|
||||
assert(this->config == nullptr);
|
||||
config = std::move(inConfig);
|
||||
client = esp_http_client_init(config.get());
|
||||
@ -41,7 +41,7 @@ public:
|
||||
auto result = esp_http_client_open(client, 0);
|
||||
|
||||
if (result != ESP_OK) {
|
||||
logger.error("open() failed: %s", esp_err_to_name(result));
|
||||
logger.error("open() failed: {}", esp_err_to_name(result));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -67,7 +67,7 @@ public:
|
||||
for (int i = 0; i < size; ++i) {
|
||||
const auto string_json = cJSON_GetArrayItem(child, i);
|
||||
if (!cJSON_IsString(string_json)) {
|
||||
logger.error("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);
|
||||
|
||||
@ -53,14 +53,14 @@ esp_err_t initPartitionsEsp() {
|
||||
|
||||
auto system_result = esp_vfs_fat_spiflash_mount_ro("/system", "system", &mount_config);
|
||||
if (system_result != ESP_OK) {
|
||||
LOGGER.error("Failed to mount /system (%s)", esp_err_to_name(system_result));
|
||||
LOGGER.error("Failed to mount /system ({})", esp_err_to_name(system_result));
|
||||
} else {
|
||||
LOGGER.info("Mounted /system");
|
||||
}
|
||||
|
||||
auto data_result = esp_vfs_fat_spiflash_mount_rw_wl("/data", "data", &mount_config, &data_wl_handle);
|
||||
if (data_result != ESP_OK) {
|
||||
LOGGER.error("Failed to mount /data (%s)", esp_err_to_name(data_result));
|
||||
LOGGER.error("Failed to mount /data ({})", esp_err_to_name(data_result));
|
||||
} else {
|
||||
LOGGER.info("Mounted /data");
|
||||
}
|
||||
|
||||
@ -106,7 +106,7 @@ 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();
|
||||
LOGGER.info("Installing app %s to {}", path, app_parent_path);
|
||||
LOGGER.info("Installing app {} to {}", path, app_parent_path);
|
||||
|
||||
auto filename = file::getLastPathSegment(path);
|
||||
const std::string app_target_path = std::format("{}/{}", app_parent_path, filename);
|
||||
|
||||
@ -39,7 +39,7 @@ bool ObjectFileWriter::open() {
|
||||
}
|
||||
|
||||
if (file_header.version != OBJECT_FILE_VERSION) {
|
||||
LOGGER.error("Unknown version for {}: {}", filePath, file_header.identifier);
|
||||
LOGGER.error("Unknown version for {}: {}", filePath, file_header.version);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
|
||||
namespace tt::hal::sdcard {
|
||||
|
||||
static const auto LOGGER = Logger("EspLcdDisplay");
|
||||
static const auto LOGGER = Logger("SdCardMounting");
|
||||
constexpr auto* TT_SDCARD_MOUNT_POINT = "/sdcard";
|
||||
|
||||
static void mount(const std::shared_ptr<SdCardDevice>& sdcard, const std::string& path) {
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
|
||||
namespace tt::hal::uart {
|
||||
|
||||
static const auto LOGGER = Logger("SPI");
|
||||
static const auto LOGGER = Logger("UART");
|
||||
|
||||
constexpr uint32_t uartIdNotInUse = 0;
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@ bool UartEsp::start() {
|
||||
|
||||
esp_err_t result = uart_param_config(configuration.port, &configuration.config);
|
||||
if (result != ESP_OK) {
|
||||
LOGGER.error("[{}] Starting: Failed to configure: %s", configuration.name, esp_err_to_name(result));
|
||||
LOGGER.error("[{}] Starting: Failed to configure: {}", configuration.name, esp_err_to_name(result));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -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) {
|
||||
LOGGER.error(LOG_MESSAGE_MUTEX_LOCK_FAILED);
|
||||
LOGGER.error( LOG_MESSAGE_ALLOC_FAILED);
|
||||
httpd_resp_send_500(request);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -39,7 +39,7 @@ bool GpsService::getGpsConfigurations(std::vector<hal::gps::GpsConfiguration>& c
|
||||
return true;
|
||||
}
|
||||
|
||||
LOGGER.info("Reading configuration file %s", path.c_str());
|
||||
LOGGER.info("Reading configuration file {}", path);
|
||||
auto reader = file::ObjectFileReader(path, sizeof(hal::gps::GpsConfiguration));
|
||||
if (!reader.open()) {
|
||||
LOGGER.error("Failed to open configuration file");
|
||||
|
||||
@ -195,7 +195,7 @@ void GpsService::onGgaSentence(hal::Device::Id deviceId, const minmea_sentence_g
|
||||
}
|
||||
|
||||
void GpsService::onRmcSentence(hal::Device::Id deviceId, const minmea_sentence_rmc& rmc) {
|
||||
LOGGER.debug("[device {}] LAT {} LON %f, speed: {}", deviceId, minmea_tocoord(&rmc.latitude), minmea_tocoord(&rmc.longitude), minmea_tofloat(&rmc.speed));
|
||||
LOGGER.debug("[device {}] LAT {} LON {}, speed: {}", deviceId, minmea_tocoord(&rmc.latitude), minmea_tocoord(&rmc.longitude), minmea_tofloat(&rmc.speed));
|
||||
}
|
||||
|
||||
State GpsService::getState() const {
|
||||
|
||||
@ -459,7 +459,7 @@ static void dispatchAutoConnect(std::shared_ptr<Wifi> wifi) {
|
||||
|
||||
settings::WifiApSettings settings;
|
||||
if (find_auto_connect_ap(wifi, settings)) {
|
||||
LOGGER.info("Auto-connecting to %s", settings.ssid.c_str());
|
||||
LOGGER.info("Auto-connecting to {}", settings.ssid);
|
||||
connect(settings, false);
|
||||
// TODO: We currently have to manually reset it because connect() sets it.
|
||||
// connect() assumes it's only being called by the user and not internally, so it disables auto-connect
|
||||
@ -475,18 +475,18 @@ static void eventHandler(TT_UNUSED void* arg, esp_event_base_t event_base, int32
|
||||
}
|
||||
|
||||
if (event_base == WIFI_EVENT) {
|
||||
LOGGER.info("eventHandler: WIFI_EVENT ({})", event_id);
|
||||
LOGGER.info("eventHandler: WIFI_EVENT {}", event_id);
|
||||
} else if (event_base == IP_EVENT) {
|
||||
LOGGER.info("eventHandler: IP_EVENT ({})", event_id);
|
||||
LOGGER.info("eventHandler: IP_EVENT {}", event_id);
|
||||
}
|
||||
|
||||
if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_START) {
|
||||
LOGGER.info("eventHandler: sta start");
|
||||
LOGGER.info("eventHandler: STA_START");
|
||||
if (wifi->getRadioState() == RadioState::ConnectionPending) {
|
||||
esp_wifi_connect();
|
||||
}
|
||||
} else if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_DISCONNECTED) {
|
||||
LOGGER.info("eventHandler: disconnected");
|
||||
LOGGER.info("eventHandler: STA_DISCONNECTED");
|
||||
clearIp();
|
||||
switch (wifi->getRadioState()) {
|
||||
case RadioState::ConnectionPending:
|
||||
|
||||
@ -3,6 +3,8 @@
|
||||
#include "LoggerAdapter.h"
|
||||
#include "LoggerAdapterShared.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <mutex>
|
||||
#include <sstream>
|
||||
#include <sys/time.h>
|
||||
|
||||
@ -10,12 +12,13 @@ namespace tt {
|
||||
|
||||
static uint64_t getLogTimestamp() {
|
||||
static uint64_t base = 0U;
|
||||
static std::once_flag init_flag;
|
||||
timeval time {};
|
||||
gettimeofday(&time, nullptr);
|
||||
uint64_t now = ((uint64_t)time.tv_sec * 1000U) + (time.tv_usec / 1000U);
|
||||
if (base == 0U) {
|
||||
std::call_once(init_flag, [now]() {
|
||||
base = now;
|
||||
}
|
||||
});
|
||||
return now - base;
|
||||
}
|
||||
|
||||
|
||||
@ -21,8 +21,8 @@ static void logMemoryInfo() {
|
||||
static void logTaskInfo() {
|
||||
const char* name = pcTaskGetName(nullptr);
|
||||
const char* safe_name = name ? name : "main";
|
||||
LOGGER.error("Task: %s", safe_name);
|
||||
LOGGER.error("Stack watermark: %u", uxTaskGetStackHighWaterMark(NULL) * 4);
|
||||
LOGGER.error("Task: {}", safe_name);
|
||||
LOGGER.error("Stack watermark: {}", uxTaskGetStackHighWaterMark(NULL) * 4);
|
||||
}
|
||||
|
||||
namespace tt {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user