/** * @file captureRoute.cpp * @author Alexander Klein (alex@kleiax.de) * @brief Contains the implementation of the class CaptureRoute * @version 0.1 * @date 2022-02-15 * * @copyright Copyright (c) 2022 * */ #include "driveModi/Modi/CaptureRoute/captureRoute.h" CaptureRoute::CaptureRoute(MoveControl* moveControl, Ps3Controller *gamepad, Navigation* navigation) : ManualControl(moveControl, gamepad) { this->navigation = navigation; this->routeInfo = RouteInfo{0, 0}; } void CaptureRoute::loop() { ManualControl::loop(); if (millis() - this->lastMillis < delay) { return; } this->runCaptureRoute(); this->lastMillis = millis(); } void CaptureRoute::runCaptureRoute() { if (this->gamepad->data.button.triangle) { if (this->navigation->addCurrentPosToRoute()) { this->routeInfo = navigation->getRouteInfo(); this->updateDisplay = true; } } } bool CaptureRoute::shouldUpdate() { if (this->updateDisplay) { this->updateDisplay = false; return true; } return false; }