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
@@ -7,16 +7,17 @@
|
||||
|
||||
#if CONFIG_TINYUSB_MSC_ENABLED == 1
|
||||
|
||||
#include <Tactility/Log.h>
|
||||
#include <Tactility/Logger.h>
|
||||
#include <tinyusb.h>
|
||||
#include <tusb_msc_storage.h>
|
||||
#include <wear_levelling.h>
|
||||
|
||||
#define TAG "usb"
|
||||
#define EPNUM_MSC 1
|
||||
#define TUSB_DESC_TOTAL_LEN (TUD_CONFIG_DESC_LEN + TUD_MSC_DESC_LEN)
|
||||
#define SECTOR_SIZE 512
|
||||
|
||||
static const auto LOGGER = tt::Logger("USB");
|
||||
|
||||
namespace tt::hal::usb {
|
||||
extern sdmmc_card_t* _Nullable getCard();
|
||||
}
|
||||
@@ -93,9 +94,9 @@ static uint8_t const msc_hs_configuration_desc[] = {
|
||||
|
||||
static void storage_mount_changed_cb(tinyusb_msc_event_t* event) {
|
||||
if (event->mount_changed_data.is_mounted) {
|
||||
TT_LOG_I(TAG, "MSC Mounted");
|
||||
LOGGER.info("MSC Mounted");
|
||||
} else {
|
||||
TT_LOG_I(TAG, "MSC Unmounted");
|
||||
LOGGER.info("MSC Unmounted");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,7 +122,7 @@ static bool ensureDriverInstalled() {
|
||||
};
|
||||
|
||||
if (tinyusb_driver_install(&tusb_cfg) != ESP_OK) {
|
||||
TT_LOG_E(TAG, "Failed to install TinyUSB driver");
|
||||
LOGGER.error("Failed to install TinyUSB driver");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -136,7 +137,7 @@ bool tusbStartMassStorageWithSdmmc() {
|
||||
|
||||
auto* card = tt::hal::usb::getCard();
|
||||
if (card == nullptr) {
|
||||
TT_LOG_E(TAG, "SD card not mounted");
|
||||
LOGGER.error("SD card not mounted");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -155,21 +156,21 @@ bool tusbStartMassStorageWithSdmmc() {
|
||||
|
||||
auto result = tinyusb_msc_storage_init_sdmmc(&config_sdmmc);
|
||||
if (result != ESP_OK) {
|
||||
TT_LOG_E(TAG, "TinyUSB SDMMC init failed: %s", esp_err_to_name(result));
|
||||
LOGGER.error("TinyUSB SDMMC init failed: {}", esp_err_to_name(result));
|
||||
} else {
|
||||
TT_LOG_I(TAG, "TinyUSB SDMMC init success");
|
||||
LOGGER.info("TinyUSB SDMMC init success");
|
||||
}
|
||||
|
||||
return result == ESP_OK;
|
||||
}
|
||||
|
||||
bool tusbStartMassStorageWithFlash() {
|
||||
TT_LOG_I(TAG, "Starting flash MSC");
|
||||
LOGGER.info("Starting flash MSC");
|
||||
ensureDriverInstalled();
|
||||
|
||||
wl_handle_t handle = tt::getDataPartitionWlHandle();
|
||||
if (handle == WL_INVALID_HANDLE) {
|
||||
TT_LOG_E(TAG, "WL not mounted for /data");
|
||||
LOGGER.error("WL not mounted for /data");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -188,9 +189,9 @@ bool tusbStartMassStorageWithFlash() {
|
||||
|
||||
esp_err_t result = tinyusb_msc_storage_init_spiflash(&config_flash);
|
||||
if (result != ESP_OK) {
|
||||
TT_LOG_E(TAG, "TinyUSB flash init failed: %s", esp_err_to_name(result));
|
||||
LOGGER.error("TinyUSB flash init failed: {}", esp_err_to_name(result));
|
||||
} else {
|
||||
TT_LOG_I(TAG, "TinyUSB flash init success");
|
||||
LOGGER.info("TinyUSB flash init success");
|
||||
}
|
||||
return result == ESP_OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user