From f4110bb854ddd3f41b83cb11fc964d74edabf40f Mon Sep 17 00:00:00 2001 From: CommanderRedYT Date: Fri, 21 Oct 2022 15:42:26 +0200 Subject: [PATCH] Minor modifications --- configs/config_comred_new.cmake | 28 ++++++++++++++-------------- configs/sdkconfig_comred_new | 4 ++-- main/displays/setup/information.cpp | 9 +++++++-- main/displays/setup/information.h | 1 + main/main.cpp | 16 +++++++++++++--- 5 files changed, 37 insertions(+), 21 deletions(-) diff --git a/configs/config_comred_new.cmake b/configs/config_comred_new.cmake index fe9ea98..331f554 100644 --- a/configs/config_comred_new.cmake +++ b/configs/config_comred_new.cmake @@ -1,20 +1,20 @@ set(BOBBY_APP_NAME bobbyquad_comred_new) set(BOBBY_DEFAULT_USERNAME comred_new) -add_definitions( - -DUSER_SETUP_LOADED=1 - -DLOAD_GLCD=1 - -DLOAD_FONT2=1 - -DLOAD_FONT4=1 - -DLOAD_FONT7=1 - -DILI9341_DRIVER=1 - -DTFT_MOSI=13 - -DTFT_SCLK=15 - -DTFT_CS=14 - -DTFT_DC=12 - -DTFT_RST=2 - -DSPI_FREQUENCY=40000000 -) +# add_definitions( +# -DUSER_SETUP_LOADED=1 +# -DLOAD_GLCD=1 +# -DLOAD_FONT2=1 +# -DLOAD_FONT4=1 +# -DLOAD_FONT7=1 +# -DILI9341_DRIVER=1 +# -DTFT_MOSI=13 +# -DTFT_SCLK=15 +# -DTFT_CS=14 +# -DTFT_DC=12 +# -DTFT_RST=2 +# -DSPI_FREQUENCY=40000000 +# ) set(BOBBYCAR_BUILDFLAGS # Pins diff --git a/configs/sdkconfig_comred_new b/configs/sdkconfig_comred_new index bbb6272..ae1fa1e 100644 --- a/configs/sdkconfig_comred_new +++ b/configs/sdkconfig_comred_new @@ -1733,8 +1733,8 @@ CONFIG_TFT_ILI9341_DRIVER=y # CONFIG_TFT_SSD1963_800ALT_DRIVER is not set # CONFIG_TFT_ILI9225_DRIVER is not set # CONFIG_TFT_GC9A01_DRIVER is not set -CONFIG_TFT_RGB_ORDER=y -# CONFIG_TFT_BGR_ORDER is not set +# CONFIG_TFT_RGB_ORDER is not set +CONFIG_TFT_BGR_ORDER=y # CONFIG_TFT_M5STACK is not set CONFIG_TFT_INVERSION_DISABLE=y # CONFIG_TFT_INVERSION_ON is not set diff --git a/main/displays/setup/information.cpp b/main/displays/setup/information.cpp index a8add3e..53fec57 100644 --- a/main/displays/setup/information.cpp +++ b/main/displays/setup/information.cpp @@ -39,11 +39,16 @@ void SetupInformationDisplay::update() espgui::switchScreen(); } - m_init_text_progressbar.redraw(espchrono::ago(m_menu_opened_timestamp) / 50ms ); - Base::update(); } +void SetupInformationDisplay::redraw() +{ + m_init_text_progressbar.redraw(espchrono::ago(m_menu_opened_timestamp) / 50ms); + + Base::redraw(); +} + void SetupInformationDisplay::buttonPressed(espgui::Button button) { if (espchrono::ago(m_menu_opened_timestamp) > 500ms) diff --git a/main/displays/setup/information.h b/main/displays/setup/information.h index 84454c3..fe7e09f 100644 --- a/main/displays/setup/information.h +++ b/main/displays/setup/information.h @@ -15,6 +15,7 @@ public: void initScreen() override; void start() override; void update() override; + void redraw() override; void buttonPressed(espgui::Button button) override; diff --git a/main/main.cpp b/main/main.cpp index cbc307f..75b5a19 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -41,6 +41,10 @@ using namespace std::chrono_literals; #include "newsettings.h" #include "taskmanager.h" +#define BOOT_PROGRESS(s) \ + bootLabel.redraw(s); \ + ESP_LOGI("BOOT", "%s", s); + namespace { espchrono::millis_clock::time_point lastStatsPush; std::optional lastStatsUpdate; @@ -96,7 +100,7 @@ extern "C" void app_main() recovery = true; } - bootLabel.redraw("settings"); + BOOT_PROGRESS("settings"); if (const auto result = configs.init("bobbycar"); result != ESP_OK) ESP_LOGE(TAG, "config_init_settings() failed with %s", esp_err_to_name(result)); @@ -119,7 +123,7 @@ extern "C" void app_main() { if (checkEnabledByName(task.name())) { - bootLabel.redraw(task.name()); + BOOT_PROGRESS(task.name()); task.setup(false); } } @@ -130,16 +134,18 @@ extern "C" void app_main() currentMode = &modes::defaultMode; #endif - bootLabel.redraw("switchScreen"); + BOOT_PROGRESS("switchScreen"); if (const auto result = checkIfInCalibration(); result) { switch(*result) { case SetupStep::INFORMATION: + BOOT_PROGRESS("Calibtration"); espgui::switchScreen(); break; case SetupStep::BASIC_BUTTONS: + BOOT_PROGRESS("Calibtration"); espgui::switchScreen(true); break; /*case SetupStep::CALIBRATE_POTIS: @@ -150,17 +156,21 @@ extern "C" void app_main() } else if (configs.lockscreen.keepLockedAfterReboot.value() && configs.lockscreen.locked.value()) { + BOOT_PROGRESS("Locked"); espgui::switchScreen(); espgui::pushScreen(); } else { + BOOT_PROGRESS("StatusDisplay") espgui::switchScreen(); } esp_chip_info(&chip_info); esp_pm_get_configuration(&pm_config); + ESP_LOGI(TAG, "Entering main loop..."); + while (true) { const auto now = espchrono::millis_clock::now();