diff --git a/components/insa/include/ui/ScreenSaver.h b/components/insa/include/ui/ScreenSaver.h index ba0ee41..d406b57 100644 --- a/components/insa/include/ui/ScreenSaver.h +++ b/components/insa/include/ui/ScreenSaver.h @@ -2,7 +2,6 @@ #include "MenuOptions.h" #include "common/Widget.h" -#include #include class ScreenSaver final : public Widget diff --git a/components/insa/src/ui/SplashScreen.cpp b/components/insa/src/ui/SplashScreen.cpp index 4984744..dc275f0 100644 --- a/components/insa/src/ui/SplashScreen.cpp +++ b/components/insa/src/ui/SplashScreen.cpp @@ -16,11 +16,7 @@ SplashScreen::SplashScreen(menu_options_t *options) : Widget(options->u8g2), m_o void SplashScreen::update(const uint64_t dt) { counter += dt; -#ifndef ESP32 - if (counter > 3000) -#else - if (counter > 10) -#endif + if (counter >= 3000) { counter = 0; if (m_options && m_options->setScreen) diff --git a/components/ruth/persistence.c b/components/ruth/persistence.c index 47e11f0..7ee6a4b 100644 --- a/components/ruth/persistence.c +++ b/components/ruth/persistence.c @@ -1,5 +1,25 @@ #include "persistence.h" +#include "stddef.h" +void *persistence_init(const char *namespace_name) +{ + return NULL; +} + +void persistence_save(persistence_value_t value_type, const char *key, const void *value) +{ +} + +void *persistence_load(persistence_value_t value_type, const char *key, void *out) +{ + return NULL; +} + +void persistence_deinit() +{ +} + +/* #include "esp_err.h" #include "esp_log.h" #include "esp_mac.h" @@ -114,3 +134,4 @@ void persistence_deinit() nvs_close(persistence_handle); } +*/ \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index 318921f..5e4295a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -21,6 +21,8 @@ constexpr unsigned int WINDOW_HEIGHT = (U8G2_SCREEN_HEIGHT * U8G2_SCREEN_FACTOR std::shared_ptr device; std::vector> widgets; +static uint64_t lastFrameTime = 0; + SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) { if (SDL_Init(SDL_INIT_VIDEO) == false) @@ -154,9 +156,17 @@ SDL_AppResult SDL_AppIterate(void *appstate) SDL_SetRenderDrawColor(context->MainRenderer(), 0, 0, 0, 255); SDL_RenderClear(context->MainRenderer()); + const uint64_t currentTime = SDL_GetTicks(); + uint64_t dt = 0; + + if (lastFrameTime > 0) { + dt = currentTime - lastFrameTime; + } + lastFrameTime = currentTime; + for (const auto &widget : widgets) { - widget->Render(); + widget->Render(dt); } DebugOverlay::Render(context); diff --git a/src/ui/Device.cpp b/src/ui/Device.cpp index 24cee65..5480484 100644 --- a/src/ui/Device.cpp +++ b/src/ui/Device.cpp @@ -4,12 +4,15 @@ #include #include "MenuOptions.h" +#include "common/InactivityTracker.h" +#include "ui/ScreenSaver.h" #include "ui/SplashScreen.h" #include "ui/widgets/Button.h" #include "ui/widgets/D_Pad.h" u8g2_t u8g2; menu_options_t options; +std::unique_ptr m_inactivityTracker; static void set_pixel_rgba(const SDL_Surface *surface, const int x, const int y, const uint32_t pixel_color) { @@ -52,15 +55,11 @@ Device::Device(void *appstate) : UIWidget(appstate) m_children.push_back(std::make_shared