49 lines
1.1 KiB
C++
49 lines
1.1 KiB
C++
#include "./move.h"
|
|
#include "./home.h"
|
|
#include "fonts/FreeSansBold18pt7b.trimmed.h"
|
|
#include "include/config.h"
|
|
#include "lib/settings.h"
|
|
#include "lib/motorstate.h"
|
|
|
|
|
|
#define MOVE_FONT_BASELINE 25
|
|
#define MOVE_FONT_HEIGHT 42
|
|
|
|
#define MOVE_REFRESHRATE 250
|
|
|
|
|
|
void MoveScreen::onShow()
|
|
{
|
|
auto display = this->getDisplay();
|
|
|
|
display->setFont(&FreeSansBold18pt7bTrimmed);
|
|
display->fillScreen(Config::ColorHomeBackground);
|
|
|
|
// TODO draw current and target height
|
|
}
|
|
|
|
|
|
void MoveScreen::onButton(Button button)
|
|
{
|
|
motorStateStop();
|
|
this->getScreenManager()->show<HomeScreen>();
|
|
}
|
|
|
|
|
|
void MoveScreen::onTick()
|
|
{
|
|
if (State.MoveDirection != Direction::None)
|
|
{
|
|
this->getScreenManager()->show<HomeScreen>();
|
|
return;
|
|
}
|
|
|
|
// Don't update every tick, it takes a significant amount of time
|
|
// and monitoring the current height is more important.
|
|
// TODO should we also stop updating when we're approaching the target height or is that overkill?
|
|
if (State.CurrentTime - this->lastRefresh >= MOVE_REFRESHRATE)
|
|
{
|
|
|
|
this->lastRefresh = State.CurrentTime;
|
|
}
|
|
} |