diff --git a/components/espchrono b/components/espchrono index 4d2e930..1955671 160000 --- a/components/espchrono +++ b/components/espchrono @@ -1 +1 @@ -Subproject commit 4d2e9305dc8c434a7a5ddf5c534a3a896be04bee +Subproject commit 1955671291aaac9a1d10ba29113c5018a187e36e diff --git a/main/displays/menus/timesettingsmenu.cpp b/main/displays/menus/timesettingsmenu.cpp index cdeddc2..c71dfe2 100644 --- a/main/displays/menus/timesettingsmenu.cpp +++ b/main/displays/menus/timesettingsmenu.cpp @@ -1,5 +1,7 @@ #include "timesettingsmenu.h" +#include "sdkconfig.h" + // 3rdparty lib includes #include #include @@ -32,7 +34,11 @@ class CurrentLocalDateTimeText : public virtual espgui::TextInterface public: std::string text() const override { +#ifdef CONFIG_ESPCHRONO_SUPPORT_DEFAULT_TIMEZONE return fmt::format("local: {}", espchrono::toString(espchrono::toDateTime(espchrono::local_clock::now()))); +#else + return "TODO"; +#endif } }; diff --git a/main/ledstrip.h b/main/ledstrip.h index 925fcb7..5c79fd4 100644 --- a/main/ledstrip.h +++ b/main/ledstrip.h @@ -7,7 +7,6 @@ #include #ifdef FEATURE_LEDSTRIP -#define crgb_iterator __gnu_cxx::__normal_iterator> enum Bobbycar_Side { FRONT_RIGHT, diff --git a/main/time_bobbycar.cpp b/main/time_bobbycar.cpp index 6ca19ed..f95c6a4 100644 --- a/main/time_bobbycar.cpp +++ b/main/time_bobbycar.cpp @@ -10,6 +10,22 @@ // 3rdparty lib includes #include +// local includes +#include "globals.h" + +espchrono::time_zone get_default_timezone() noexcept +{ + using namespace espchrono; + return time_zone{minutes32{settings.timeSettings.timezoneOffset}, settings.timeSettings.daylightSavingMode}; +} + +#ifdef CONFIG_ESPCHRONO_SUPPORT_DEFAULT_TIMEZONE +espchrono::time_zone espchrono::get_default_timezone() noexcept +{ + return ::get_default_timezone(); +} +#endif + namespace { constexpr const char * const TAG = "BOBBYTIME"; } // namespace diff --git a/main/time_bobbycar.h b/main/time_bobbycar.h index 25e50ba..2d9d88c 100644 --- a/main/time_bobbycar.h +++ b/main/time_bobbycar.h @@ -1,15 +1,11 @@ #pragma once +#include "sdkconfig.h" + // 3rdparty lib includes #include -// local includes -#include "globals.h" - -auto espchrono::local_clock::timezone() noexcept -> time_zone -{ - return time_zone{minutes32{settings.timeSettings.timezoneOffset}, settings.timeSettings.daylightSavingMode}; -} +espchrono::time_zone get_default_timezone() noexcept; #ifdef FEATURE_NTP void initTime(); diff --git a/sdkconfig_comred b/sdkconfig_comred index 5476968..ef73e8e 100644 --- a/sdkconfig_comred +++ b/sdkconfig_comred @@ -180,6 +180,12 @@ CONFIG_LOG_LOCAL_LEVEL_ASYNC_HTTP_INFO=y CONFIG_LOG_LOCAL_LEVEL_ASYNC_HTTP=3 # end of Simple Async HTTP Request +# +# espchrono Configuration +# +# CONFIG_ESPCHRONO_SUPPORT_DEFAULT_TIMEZONE is not set +# end of espchrono Configuration + # # ESP Config lib settings # diff --git a/sdkconfig_feedc0de b/sdkconfig_feedc0de index fd4fa2c..f1e0a01 100644 --- a/sdkconfig_feedc0de +++ b/sdkconfig_feedc0de @@ -180,6 +180,12 @@ CONFIG_LOG_LOCAL_LEVEL_ASYNC_HTTP_INFO=y CONFIG_LOG_LOCAL_LEVEL_ASYNC_HTTP=3 # end of Simple Async HTTP Request +# +# espchrono Configuration +# +CONFIG_ESPCHRONO_SUPPORT_DEFAULT_TIMEZONE=y +# end of espchrono Configuration + # # ESP Config lib settings # diff --git a/sdkconfig_mick b/sdkconfig_mick index 8662ee9..e3cd162 100644 --- a/sdkconfig_mick +++ b/sdkconfig_mick @@ -180,6 +180,12 @@ CONFIG_LOG_LOCAL_LEVEL_ASYNC_HTTP_INFO=y CONFIG_LOG_LOCAL_LEVEL_ASYNC_HTTP=3 # end of Simple Async HTTP Request +# +# espchrono Configuration +# +CONFIG_ESPCHRONO_SUPPORT_DEFAULT_TIMEZONE=y +# end of espchrono Configuration + # # ESP Config lib settings # diff --git a/sdkconfig_peter b/sdkconfig_peter index 5476968..de6a036 100644 --- a/sdkconfig_peter +++ b/sdkconfig_peter @@ -180,6 +180,12 @@ CONFIG_LOG_LOCAL_LEVEL_ASYNC_HTTP_INFO=y CONFIG_LOG_LOCAL_LEVEL_ASYNC_HTTP=3 # end of Simple Async HTTP Request +# +# espchrono Configuration +# +CONFIG_ESPCHRONO_SUPPORT_DEFAULT_TIMEZONE=y +# end of espchrono Configuration + # # ESP Config lib settings #