55 lines
995 B
C++
55 lines
995 B
C++
|
#include "./presets.h"
|
||
|
#include "./home.h"
|
||
|
#include "include/metrics.h"
|
||
|
#include "lib/settings.h"
|
||
|
|
||
|
|
||
|
|
||
|
void PresetsScreen::initHeights()
|
||
|
{
|
||
|
this->height[0] = Settings.Height.Preset[0];
|
||
|
this->height[1] = Settings.Height.Preset[1];
|
||
|
}
|
||
|
|
||
|
|
||
|
bool PresetsScreen::nextPage()
|
||
|
{
|
||
|
this->preset++;
|
||
|
if (this->preset < 2)
|
||
|
return true;
|
||
|
|
||
|
Settings.Height.Preset[0] = this->height[0];
|
||
|
Settings.Height.Preset[1] = this->height[1];
|
||
|
writeSettingsHeights();
|
||
|
|
||
|
this->screenManager->show<HomeScreen>();
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
void PresetsScreen::setHeight(uint16_t value)
|
||
|
{
|
||
|
if (value < Settings.Height.Minimum)
|
||
|
this->height[this->preset] = Settings.Height.Minimum;
|
||
|
else if (value > Settings.Height.Maximum)
|
||
|
this->height[this->preset] = Settings.Height.Maximum;
|
||
|
else
|
||
|
this->height[this->preset] = value;
|
||
|
}
|
||
|
|
||
|
|
||
|
const char* PresetsScreen::getTitle()
|
||
|
{
|
||
|
switch (this->preset)
|
||
|
{
|
||
|
case 0:
|
||
|
return "Preset 1";
|
||
|
|
||
|
case 1:
|
||
|
return "Preset 2";
|
||
|
|
||
|
default:
|
||
|
return nullptr;
|
||
|
}
|
||
|
}
|