Added sunrise text, fixed timezone
This commit is contained in:
@@ -194,6 +194,7 @@ struct LedstripBrightnessAccessor : public NewSettingsAccessor<uint8_t> { Config
|
|||||||
struct LedstripEnableBlinkAnimationAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.ledstrip.enableAnimBlink; } };
|
struct LedstripEnableBlinkAnimationAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.ledstrip.enableAnimBlink; } };
|
||||||
struct LedstripOtaAnimationAccessor : public NewSettingsAccessor<OtaAnimationModes> { ConfigWrapper<OtaAnimationModes> &getConfig() const override { return configs.ledstrip.otaMode; } };
|
struct LedstripOtaAnimationAccessor : public NewSettingsAccessor<OtaAnimationModes> { ConfigWrapper<OtaAnimationModes> &getConfig() const override { return configs.ledstrip.otaMode; } };
|
||||||
struct LedstripEnableVisualizeBlinkAnimationAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.ledstrip.enableVisualizeBlink; } };
|
struct LedstripEnableVisualizeBlinkAnimationAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.ledstrip.enableVisualizeBlink; } };
|
||||||
|
struct LedstripAutomaticLightAccessor : public NewSettingsAccessor<bool> { ConfigWrapper<bool> &getConfig() const override { return configs.ledstrip.automaticLight; } };
|
||||||
|
|
||||||
// Battery
|
// Battery
|
||||||
struct BatterySeriesCellsAccessor : public NewSettingsAccessor<uint8_t> { ConfigWrapper<uint8_t> &getConfig() const override { return configs.battery.cellsSeries; } };
|
struct BatterySeriesCellsAccessor : public NewSettingsAccessor<uint8_t> { ConfigWrapper<uint8_t> &getConfig() const override { return configs.battery.cellsSeries; } };
|
||||||
|
@@ -42,6 +42,7 @@ constexpr char TEXT_LEDSTRIP_STVO[] = "Enable StVO";
|
|||||||
constexpr char TEXT_STVO_FRONTOFFSET[] = "StVO Front Offset";
|
constexpr char TEXT_STVO_FRONTOFFSET[] = "StVO Front Offset";
|
||||||
constexpr char TEXT_STVO_FRONTLENGTH[] = "StVO Front Length";
|
constexpr char TEXT_STVO_FRONTLENGTH[] = "StVO Front Length";
|
||||||
constexpr char TEXT_STVO_ENABLEFRONTLIGHT[] = "StVO Front Enable";
|
constexpr char TEXT_STVO_ENABLEFRONTLIGHT[] = "StVO Front Enable";
|
||||||
|
constexpr char TEXT_AUTOMATIC_LIGHTS[] = "Automatic Lights";
|
||||||
constexpr char TEXT_ANIMATION_MULTIPLIER[] = "Animation Multiplier";
|
constexpr char TEXT_ANIMATION_MULTIPLIER[] = "Animation Multiplier";
|
||||||
constexpr char TEXT_LEDSTRIP_BRIGHTNESS[] = "Ledstrip Brightness";
|
constexpr char TEXT_LEDSTRIP_BRIGHTNESS[] = "Ledstrip Brightness";
|
||||||
constexpr char TEXT_LEDSTRIP_ALLCUSTOMOFF[] = "All custom off";
|
constexpr char TEXT_LEDSTRIP_ALLCUSTOMOFF[] = "All custom off";
|
||||||
@@ -150,6 +151,7 @@ LedstripMenu::LedstripMenu()
|
|||||||
|
|
||||||
if (!simplified) { constructMenuItem<makeComponent<MenuItem, espgui::StaticText<TEXT_LEDSTRIP_STVO>, BobbyCheckbox, EnableLedstripStVOAccessor>>(); }
|
if (!simplified) { constructMenuItem<makeComponent<MenuItem, espgui::StaticText<TEXT_LEDSTRIP_STVO>, BobbyCheckbox, EnableLedstripStVOAccessor>>(); }
|
||||||
constructMenuItem<makeComponent<MenuItem, espgui::StaticText<TEXT_STVO_ENABLEFRONTLIGHT>, BobbyCheckbox, EnableLedstripStVOFrontlight>>();
|
constructMenuItem<makeComponent<MenuItem, espgui::StaticText<TEXT_STVO_ENABLEFRONTLIGHT>, BobbyCheckbox, EnableLedstripStVOFrontlight>>();
|
||||||
|
constructMenuItem<makeComponent<MenuItem, espgui::StaticText<TEXT_AUTOMATIC_LIGHTS>, BobbyCheckbox, LedstripAutomaticLightAccessor>>();
|
||||||
|
|
||||||
constructMenuItem<makeComponent<MenuItem, espgui::StaticText<TEXT_LEDANIMATION>, BobbyCheckbox, EnableLedAnimationAccessor>>();
|
constructMenuItem<makeComponent<MenuItem, espgui::StaticText<TEXT_LEDANIMATION>, BobbyCheckbox, EnableLedAnimationAccessor>>();
|
||||||
constructMenuItem<SwitchScreenTypeSafeChangeMenuItem<LedstripAnimation, LedstripMenu, TEXT_SELECTANIMATION>>(&configs.ledstrip.animationType);
|
constructMenuItem<SwitchScreenTypeSafeChangeMenuItem<LedstripAnimation, LedstripMenu, TEXT_SELECTANIMATION>>(&configs.ledstrip.animationType);
|
||||||
|
@@ -13,6 +13,7 @@
|
|||||||
#include "actions/dummyaction.h"
|
#include "actions/dummyaction.h"
|
||||||
#include "icons/back.h"
|
#include "icons/back.h"
|
||||||
#include "espstrutils.h"
|
#include "espstrutils.h"
|
||||||
|
#include <sunset.h>
|
||||||
|
|
||||||
// local includes
|
// local includes
|
||||||
#include "displays/bobbychangevaluedisplay.h"
|
#include "displays/bobbychangevaluedisplay.h"
|
||||||
@@ -53,6 +54,26 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class SuntimeText : public virtual espgui::TextInterface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
std::string text() const override
|
||||||
|
{
|
||||||
|
SunSet sunSet;
|
||||||
|
sunSet.setPosition(47.076668, 15.421371, 2); // Vienna
|
||||||
|
sunSet.setTZOffset(2);
|
||||||
|
const auto today = toDateTime(espchrono::utc_clock::now());
|
||||||
|
sunSet.setCurrentDate(static_cast<int>(today.date.year()), static_cast<uint>(today.date.month()), static_cast<uint>(today.date.day()));
|
||||||
|
const auto sunrise = static_cast<int>(sunSet.calcSunrise());
|
||||||
|
const auto sunset = static_cast<int>(sunSet.calcSunset());
|
||||||
|
const int sunriseHour = sunrise / 60;
|
||||||
|
const int sunriseMinute = sunrise % 60;
|
||||||
|
const int sunsetHour = sunset / 60;
|
||||||
|
const int sunsetMinute = sunset % 60;
|
||||||
|
return fmt::format("sunrise: {}:{:02d} sunset: {}:{:02d}", sunriseHour, sunriseMinute, sunsetHour, sunsetMinute);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
using TimezoneOffsetChangeDisplay = espgui::makeComponent<
|
using TimezoneOffsetChangeDisplay = espgui::makeComponent<
|
||||||
BobbyChangeValueDisplay<int32_t>,
|
BobbyChangeValueDisplay<int32_t>,
|
||||||
espgui::StaticText<TEXT_OFFSET>,
|
espgui::StaticText<TEXT_OFFSET>,
|
||||||
@@ -108,6 +129,7 @@ TimeSettingsMenu::TimeSettingsMenu()
|
|||||||
using namespace espgui;
|
using namespace espgui;
|
||||||
constructMenuItem<makeComponent<MenuItem, CurrentUtcDateTimeText, StaticFont<2>, DummyAction>>();
|
constructMenuItem<makeComponent<MenuItem, CurrentUtcDateTimeText, StaticFont<2>, DummyAction>>();
|
||||||
constructMenuItem<makeComponent<MenuItem, CurrentLocalDateTimeText, StaticFont<2>, DummyAction>>();
|
constructMenuItem<makeComponent<MenuItem, CurrentLocalDateTimeText, StaticFont<2>, DummyAction>>();
|
||||||
|
constructMenuItem<makeComponent<MenuItem, SuntimeText, StaticFont<2>, DummyAction>>();
|
||||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_OFFSET>, SwitchScreenAction<TimezoneOffsetChangeDisplay>>>();
|
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_OFFSET>, SwitchScreenAction<TimezoneOffsetChangeDisplay>>>();
|
||||||
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_DAYLIGHTSAVINGMODE>, SwitchScreenAction<DaylightSavingModeChangeDisplay>>>();
|
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_DAYLIGHTSAVINGMODE>, SwitchScreenAction<DaylightSavingModeChangeDisplay>>>();
|
||||||
if (configs.feature.ntp.isEnabled.value)
|
if (configs.feature.ntp.isEnabled.value)
|
||||||
|
@@ -362,8 +362,8 @@ void showCustomColor()
|
|||||||
if (!configs.ledstrip.automaticLight.value)
|
if (!configs.ledstrip.automaticLight.value)
|
||||||
return false;
|
return false;
|
||||||
SunSet sunSet;
|
SunSet sunSet;
|
||||||
sunSet.setPosition(47.076668, 15.421371, 1); // Vienna
|
sunSet.setPosition(47.076668, 15.421371, 0); // Vienna
|
||||||
sunSet.setTZOffset(1);
|
sunSet.setTZOffset(0);
|
||||||
const auto today = toDateTime(espchrono::utc_clock::now());
|
const auto today = toDateTime(espchrono::utc_clock::now());
|
||||||
sunSet.setCurrentDate(static_cast<int>(today.date.year()), static_cast<uint>(today.date.month()), static_cast<uint>(today.date.day()));
|
sunSet.setCurrentDate(static_cast<int>(today.date.year()), static_cast<uint>(today.date.month()), static_cast<uint>(today.date.day()));
|
||||||
const auto sunrise = static_cast<int>(sunSet.calcSunrise()) / 60;
|
const auto sunrise = static_cast<int>(sunSet.calcSunrise()) / 60;
|
||||||
|
Reference in New Issue
Block a user