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
@@ -1,20 +1,20 @@
|
||||
#ifdef ESP_PLATFORM
|
||||
|
||||
#include "Tactility/hal/Device.h"
|
||||
|
||||
#include <Tactility/app/crashdiagnostics/QrHelpers.h>
|
||||
#include <Tactility/app/crashdiagnostics/QrUrl.h>
|
||||
#include <Tactility/app/launcher/Launcher.h>
|
||||
#include <Tactility/hal/Device.h>
|
||||
#include <Tactility/Logger.h>
|
||||
#include <Tactility/lvgl/Statusbar.h>
|
||||
#include <Tactility/service/loader/Loader.h>
|
||||
|
||||
#include <lvgl.h>
|
||||
#include <qrcode.h>
|
||||
|
||||
#define TAG "CrashDiagnostics"
|
||||
|
||||
namespace tt::app::crashdiagnostics {
|
||||
|
||||
static const auto LOGGER = Logger("CrashDiagnostics");
|
||||
|
||||
extern const AppManifest manifest;
|
||||
|
||||
void onContinuePressed(TT_UNUSED lv_event_t* event) {
|
||||
@@ -44,38 +44,38 @@ public:
|
||||
lv_obj_align(bottom_label, LV_ALIGN_BOTTOM_MID, 0, -2);
|
||||
|
||||
std::string url = getUrlFromCrashData();
|
||||
TT_LOG_I(TAG, "%s", url.c_str());
|
||||
LOGGER.info("{}", url);
|
||||
size_t url_length = url.length();
|
||||
|
||||
int qr_version;
|
||||
if (!getQrVersionForBinaryDataLength(url_length, qr_version)) {
|
||||
TT_LOG_E(TAG, "QR is too large");
|
||||
LOGGER.error("QR is too large");
|
||||
stop(manifest.appId);
|
||||
return;
|
||||
}
|
||||
|
||||
TT_LOG_I(TAG, "QR version %d (length: %d)", qr_version, url_length);
|
||||
LOGGER.info("QR version {} (length: {})", qr_version, url_length);
|
||||
auto qrcodeData = std::make_shared<uint8_t[]>(qrcode_getBufferSize(qr_version));
|
||||
if (qrcodeData == nullptr) {
|
||||
TT_LOG_E(TAG, "Failed to allocate QR buffer");
|
||||
stop();
|
||||
LOGGER.error("Failed to allocate QR buffer");
|
||||
stop(manifest.appId);
|
||||
return;
|
||||
}
|
||||
|
||||
QRCode qrcode;
|
||||
TT_LOG_I(TAG, "QR init text");
|
||||
LOGGER.info("QR init text");
|
||||
if (qrcode_initText(&qrcode, qrcodeData.get(), qr_version, ECC_LOW, url.c_str()) != 0) {
|
||||
TT_LOG_E(TAG, "QR init text failed");
|
||||
LOGGER.error("QR init text failed");
|
||||
stop(manifest.appId);
|
||||
return;
|
||||
}
|
||||
|
||||
TT_LOG_I(TAG, "QR size: %d", qrcode.size);
|
||||
LOGGER.info("QR size: {}", qrcode.size);
|
||||
|
||||
// Calculate QR dot size
|
||||
int32_t top_label_height = lv_obj_get_height(top_label) + 2;
|
||||
int32_t bottom_label_height = lv_obj_get_height(bottom_label) + 2;
|
||||
TT_LOG_I(TAG, "Create canvas");
|
||||
LOGGER.info("Create canvas");
|
||||
int32_t available_height = parent_height - top_label_height - bottom_label_height;
|
||||
int32_t available_width = lv_display_get_horizontal_resolution(display);
|
||||
int32_t smallest_size = std::min(available_height, available_width);
|
||||
@@ -85,7 +85,7 @@ public:
|
||||
} else if (qrcode.size <= smallest_size) {
|
||||
pixel_size = 1;
|
||||
} else {
|
||||
TT_LOG_E(TAG, "QR code won't fit screen");
|
||||
LOGGER.error("QR code won't fit screen");
|
||||
stop(manifest.appId);
|
||||
return;
|
||||
}
|
||||
@@ -97,10 +97,10 @@ public:
|
||||
lv_obj_set_content_height(canvas, qrcode.size * pixel_size);
|
||||
lv_obj_set_content_width(canvas, qrcode.size * pixel_size);
|
||||
|
||||
TT_LOG_I(TAG, "Create draw buffer");
|
||||
LOGGER.info("Create draw buffer");
|
||||
auto* draw_buf = lv_draw_buf_create(pixel_size * qrcode.size, pixel_size * qrcode.size, LV_COLOR_FORMAT_RGB565, LV_STRIDE_AUTO);
|
||||
if (draw_buf == nullptr) {
|
||||
TT_LOG_E(TAG, "Draw buffer alloc");
|
||||
LOGGER.error("Failed to allocate draw buffer");
|
||||
stop(manifest.appId);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user