47 lines
1.2 KiB
C++
47 lines
1.2 KiB
C++
/**
|
|
* @file driveManager.cpp
|
|
* @author Alexander Klein (alex@kleiax.de)
|
|
* @brief Implementation of the class DriveManager
|
|
* @version 0.1
|
|
* @date 2021-12-14
|
|
*
|
|
* @copyright Copyright (c) 2021
|
|
*
|
|
*/
|
|
|
|
#include "driveModi/driveManager.h"
|
|
|
|
DriveManager::DriveManager(MoveControl *moveControl, const SensorData* sensorData, const ControlPadInput *input) {
|
|
this->driveModiParams.input = input;
|
|
this->driveModiParams.moveControl = moveControl;
|
|
this->driveModiParams.sensorData = sensorData;
|
|
|
|
this->init();
|
|
}
|
|
|
|
DriveManager::DriveManager(DriveModiParams params){
|
|
this->driveModiParams = params;
|
|
|
|
this->init();
|
|
}
|
|
|
|
void DriveManager::changeModus(DriveModi* modus) {
|
|
if (this->currentModusPtr) {
|
|
this->removeChildComponent(this->currentModusPtr);
|
|
delete this->currentModusPtr;
|
|
this->currentModusPtr = nullptr;
|
|
}
|
|
|
|
this->currentModusPtr = modus;
|
|
|
|
if (this->currentModusPtr) {
|
|
this->currentModusPtr->activate(this->driveModiParams);
|
|
this->addChildComponent(this->currentModusPtr);
|
|
}
|
|
}
|
|
|
|
void DriveManager::init() {
|
|
this->addChildComponent(this->driveModiParams.moveControl);
|
|
this->activateOnlyChilds();
|
|
}
|