#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::ColorMenuBackground); // TODO draw current and target height } void MoveScreen::onButton(Button button) { motorStateStop(); this->getScreenManager()->show(); } void MoveScreen::onTick() { if (State.MoveDirection != Direction::None) { this->getScreenManager()->show(); 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; } }