code optimization
- lifecycle functions for widgets - persistence functions Signed-off-by: Peter Siegmund <developer@mars3142.org>
This commit is contained in:
@@ -4,6 +4,22 @@ Widget::Widget(u8g2_t *u8g2) : u8g2(u8g2)
|
||||
{
|
||||
}
|
||||
|
||||
void Widget::enter()
|
||||
{
|
||||
}
|
||||
|
||||
void Widget::pause()
|
||||
{
|
||||
}
|
||||
|
||||
void Widget::resume()
|
||||
{
|
||||
}
|
||||
|
||||
void Widget::exit()
|
||||
{
|
||||
}
|
||||
|
||||
void Widget::update(uint64_t dt)
|
||||
{
|
||||
}
|
||||
|
@@ -45,7 +45,7 @@ void LightMenu::onButtonPressed(const MenuItem &menuItem, const ButtonType butto
|
||||
if (m_options && m_options->persistence && m_options->persistence->save)
|
||||
{
|
||||
const auto value = getItem(item.getId()).getValue();
|
||||
m_options->persistence->save("light_activated", value.c_str());
|
||||
m_options->persistence->save(VALUE_TYPE_STRING, "light_activated", value.c_str());
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -57,8 +57,8 @@ void LightMenu::onButtonPressed(const MenuItem &menuItem, const ButtonType butto
|
||||
{
|
||||
if (m_options && m_options->persistence && m_options->persistence->save)
|
||||
{
|
||||
const auto value = std::to_string(getItem(item.getId()).getIndex());
|
||||
m_options->persistence->save("light_mode", value.c_str());
|
||||
const auto value = getItem(item.getId()).getIndex();
|
||||
m_options->persistence->save(VALUE_TYPE_INT32, "light_mode", &value);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@@ -37,6 +37,6 @@ void LightSettingsMenu::onButtonPressed(const MenuItem &menuItem, const ButtonTy
|
||||
{
|
||||
const auto key = "section_" + std::to_string(menuItem.getId());
|
||||
const auto value = getItem(menuItem.getId()).getValue();
|
||||
m_options->persistence->save(key.c_str(), value.c_str());
|
||||
m_options->persistence->save(VALUE_TYPE_STRING, key.c_str(), value.c_str());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user