75 lines
1.3 KiB
C++
75 lines
1.3 KiB
C++
#include "Screen/SetTimeScreen.h"
|
|
#include "Screen/IntensityScreen.h"
|
|
#include "ExposureTimer.h"
|
|
#include "Buzzer.h"
|
|
#include "Config.h"
|
|
|
|
|
|
void SetTimeScreen::printValue()
|
|
{
|
|
LiquidCrystal* display = getDisplay();
|
|
display->setCursor(0, 1);
|
|
|
|
String time = FormatTime(ExposureTime);
|
|
uint8_t offset = (LCDWidth - time.length()) / 2;
|
|
|
|
for (uint8_t space = 0; space < offset; space++)
|
|
display->print(' ');
|
|
|
|
display->print(time);
|
|
offset += time.length();
|
|
|
|
if (getEditMode())
|
|
{
|
|
display->write(LCDCharUpDown);
|
|
offset++;
|
|
}
|
|
|
|
for (uint8_t space = offset; space < LCDWidth; space++)
|
|
display->print(' ');
|
|
}
|
|
|
|
|
|
void SetTimeScreen::gotoNext()
|
|
{
|
|
buzzSelect();
|
|
getScreenManager()->show<IntensityScreen>();
|
|
}
|
|
|
|
|
|
void SetTimeScreen::onHide()
|
|
{
|
|
}
|
|
|
|
|
|
void SetTimeScreen::onButton()
|
|
{
|
|
buzzSelect();
|
|
setEditMode(!getEditMode());
|
|
printValue();
|
|
}
|
|
|
|
|
|
void SetTimeScreen::onEncoder(long lastPosition, long newPosition)
|
|
{
|
|
if (getEditMode())
|
|
{
|
|
buzzSelect();
|
|
|
|
if (newPosition > lastPosition)
|
|
ExposureTime += ExposureTime >= LargeStepTreshold ? LargeStep : SmallStep;
|
|
else if (ExposureTime > 0)
|
|
ExposureTime -= ExposureTime > LargeStepTreshold ? LargeStep : SmallStep;
|
|
|
|
printValue();
|
|
}
|
|
else
|
|
BaseMenuScreen::onEncoder(lastPosition, newPosition);
|
|
}
|
|
|
|
|
|
void SetTimeScreen::onTick()
|
|
{
|
|
}
|
|
|