7#include "../LockState.h"
27 : lcd::MenuView(
display,
"HygieneOpeningMenu",
encoder,
"Hygiene Opening", numberOfColumns, numberOfRows) {}
47 if (menuItems.empty()) {
49 createMenuItem(
"Open Safe", [](MenuItem*) {
51 if (!timeRestictions.restrictHygieneOpeningTimes || timeRestictions.checkTime()) {
58 createMenuItem(
"Emlalock Unlock Key", [](MenuItem*) {
61 createMenuItem(
"Time Left: 00:00:00", [](MenuItem*) {});
63 lcd::MenuView::activate();
72 virtual void tick(
const bool& forceRedraw) {
74 lcd::MenuView::tick(forceRedraw);
76 auto direction =
encoder->getDirection();
77 auto click =
encoder->getNewClick();
80 if (click || (direction != RotaryEncoder::Direction::NOROTATION)) {
81 if (!getBacklightTimeoutManager().delayTimeout()) {
85 getBacklightTimeoutManager().tick(
display);
88 static time_t lastDisplayedTime = 0;
95 if (forceRedraw || (lastDisplayedTime != timeLeft)) {
96 lastDisplayedTime = timeLeft;
98 int sec = timeLeft % 60;
99 timeLeft = timeLeft / 60;
100 int min = timeLeft % 60;
101 timeLeft = timeLeft / 60;
104 sprintf(buf,
"Time Left: %02d:%02d:%02d", hour, min, sec);
106 menuItems.back().setText(buf);
static const time_t & getCleaningEndDate()
Get the End Date of the current cleaning opening (or 0)
Definition: LockState.h:416
const TimeRestrictions & getTimeRestrictions() const
get the timeout of display backlight in seconds
Definition: Configuration.h:354
static Configuration & getSingleton()
Get the Singleton object.
Definition: Configuration.h:162
static bool activateView(const ViewId &id)
activates the view described by the id
Definition: ViewStore.h:98
@ UnlockSafeView
Definition: ViewStore.h:38
@ TimeRestrictedView
Definition: ViewStore.h:36
@ EmlalockUnlockKeyMenu
Definition: ViewStore.h:28
views::ConfigurationServerView configurationServerView & display
Definition: main.cpp:57
RotaryEncoder encoder(ENCODER_PIN_CLK, ENCODER_PIN_DT, ENCODER_SWITCH)
Definition: ConfigurationServerView.h:10