diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt index 0427b1b..9ec7c35 100644 --- a/main/CMakeLists.txt +++ b/main/CMakeLists.txt @@ -1,3 +1,3 @@ idf_component_register(SRCS main.c lcd/lcd.c sd/sd.c lcd/ui.c lcd/ui_log.c lcd/ui_image_browser.c - PRIV_REQUIRES spi_flash esp_psram esp_lcd esp_driver_gpio esp_driver_i2c esp_driver_ledc esp_driver_sdspi esp_driver_spi esp_lvgl_port esp_lcd_touch_gt911 fatfs sdmmc + PRIV_REQUIRES spi_flash esp_psram esp_lcd esp_driver_gpio esp_driver_i2c esp_driver_ledc esp_driver_sdspi esp_driver_spi esp_lvgl_port esp_lcd_touch_gt911 fatfs sdmmc mbedtls INCLUDE_DIRS "." "include") diff --git a/main/lcd/ui.c b/main/lcd/ui.c index 42f2738..640c291 100644 --- a/main/lcd/ui.c +++ b/main/lcd/ui.c @@ -7,6 +7,8 @@ #include "lcd/ui_log.h" #include "lcd/ui_image_browser.h" +#include "mbedtls/base64.h" + static const char *TAG = "ui"; static ui_view_t current_view = UI_VIEW_LOG; @@ -52,7 +54,28 @@ static void ui_build_image_browser_view_locked(void){ } void create_log_ui(void){ - ui_log_append("Created by Timo Niemann"); + const char *encode = "Q3JlYXRlZCBieSBUaW1vIE5pZW1hbm4="; + unsigned char output[strlen(encode) * 3 / 4 + 1]; + size_t output_len = 0; + + int ret = mbedtls_base64_decode( + output, + sizeof(output) - 1, + &output_len, + (const unsigned char *)encode, + strlen(encode) + ); + + if(ret != 0){ + ESP_LOGW(TAG, "Base64 decode failed: %d", ret); + ui_log_appendf("Base64 decode failed: %d", ret); + } + else{ + output[output_len] = '\0'; + ESP_LOGI(TAG, "Base64 decoded"); + ui_log_append((const char*)output); + } + ESP_LOGI(TAG, "Creating log UI"); ui_log_append("Creating log UI");