Added some features

This commit is contained in:
CommanderRedYT
2022-04-08 18:19:24 +02:00
parent c7ca2846c7
commit 4765b97a70
3 changed files with 29 additions and 2 deletions

Binary file not shown.

View File

@ -15,7 +15,7 @@
#include "bobbybuttons.h" #include "bobbybuttons.h"
namespace { namespace {
bool isValidPin(std::array<int8_t, 4> enteredPin) bool isValid1stPin(std::array<int8_t, 4> enteredPin)
{ {
return std::equal(std::cbegin(enteredPin), std::cend(enteredPin), return std::equal(std::cbegin(enteredPin), std::cend(enteredPin),
std::cbegin(configs.lockscreen.pin), std::cend(configs.lockscreen.pin), std::cbegin(configs.lockscreen.pin), std::cend(configs.lockscreen.pin),
@ -23,6 +23,15 @@ bool isValidPin(std::array<int8_t, 4> enteredPin)
return digit == configuredDigit.value; return digit == configuredDigit.value;
}); });
} }
bool isValid2ndPin(std::array<int8_t, 4> enteredPin)
{
return std::equal(std::cbegin(enteredPin), std::cend(enteredPin),
std::cbegin(configs.lockscreen.pin2), std::cend(configs.lockscreen.pin2),
[](const int8_t digit, const auto &configuredDigit){
return digit == configuredDigit.value;
});
}
} // namespace } // namespace
void Lockscreen::start() void Lockscreen::start()
@ -95,7 +104,7 @@ void Lockscreen::redraw()
if (!m_back_pressed && ++m_currentIndex>=4) if (!m_back_pressed && ++m_currentIndex>=4)
{ {
if (isValidPin(m_numbers)) if (isValid1stPin(m_numbers))
{ {
if (!gas || !brems || *gas > 200.f || *brems > 200.f) if (!gas || !brems || *gas > 200.f || *brems > 200.f)
espgui::switchScreen<PotisCalibrateDisplay>(true); espgui::switchScreen<PotisCalibrateDisplay>(true);
@ -103,6 +112,18 @@ void Lockscreen::redraw()
espgui::switchScreen<MainMenu>(); espgui::switchScreen<MainMenu>();
#ifdef LOCKSCREEN_PLUGIN #ifdef LOCKSCREEN_PLUGIN
#include LOCKSCREEN_PLUGIN #include LOCKSCREEN_PLUGIN
LOCKSCREEN_PLUGIN_FIXES_1
#endif
return;
}
else if(isValid2ndPin(m_numbers))
{
if (!gas || !brems || *gas > 200.f || *brems > 200.f)
espgui::switchScreen<PotisCalibrateDisplay>(true);
else
espgui::switchScreen<MainMenu>();
#ifdef LOCKSCREEN_PLUGIN_FIXES_2
LOCKSCREEN_PLUGIN_FIXES_2
#endif #endif
return; return;
} }

View File

@ -319,6 +319,12 @@ public:
ConfigWrapper<int8_t> {3, DoReset, MinMaxValue<int8_t, 0, 9>, "lockscreenPin2" }, ConfigWrapper<int8_t> {3, DoReset, MinMaxValue<int8_t, 0, 9>, "lockscreenPin2" },
ConfigWrapper<int8_t> {4, DoReset, MinMaxValue<int8_t, 0, 9>, "lockscreenPin3" }, ConfigWrapper<int8_t> {4, DoReset, MinMaxValue<int8_t, 0, 9>, "lockscreenPin3" },
}; };
std::array<ConfigWrapper<int8_t>, 4> pin2 {
ConfigWrapper<int8_t> {0, DoReset, MinMaxValue<int8_t, 0, 9>, "lockscrnPin1_0" },
ConfigWrapper<int8_t> {0, DoReset, MinMaxValue<int8_t, 0, 9>, "lockscrnPin1_1" },
ConfigWrapper<int8_t> {0, DoReset, MinMaxValue<int8_t, 0, 9>, "lockscrnPin1_2" },
ConfigWrapper<int8_t> {0, DoReset, MinMaxValue<int8_t, 0, 9>, "lockscrnPin1_3" },
};
} lockscreen; } lockscreen;
struct { struct {