make all possible functions const
This commit is contained in:
@@ -114,27 +114,19 @@ void MotorControl::emergencyStop() {
|
||||
setRealPower(0);
|
||||
}
|
||||
|
||||
int8_t MotorControl::getPower() {
|
||||
return this->power;
|
||||
}
|
||||
|
||||
int8_t MotorControl::getTargetPower() {
|
||||
return this->targetPower;
|
||||
}
|
||||
|
||||
bool MotorControl::isTargetPowerReached() {
|
||||
bool MotorControl::isTargetPowerReached() const {
|
||||
if (this->targetPower == this->power)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool MotorControl::isAccelerationPositive() {
|
||||
bool MotorControl::isAccelerationPositive() const {
|
||||
if (power < targetPower)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool MotorControl::isAccelerationNegative() {
|
||||
bool MotorControl::isAccelerationNegative() const {
|
||||
if (power > targetPower)
|
||||
return true;
|
||||
return false;
|
||||
|
||||
@@ -103,19 +103,19 @@ class MotorControl : public Component {
|
||||
*
|
||||
* @return int8_t percent of power (-100 to 100)
|
||||
*/
|
||||
int8_t getPower();
|
||||
int8_t getPower() const { return this->power; };
|
||||
|
||||
/**
|
||||
* @brief Get the target power
|
||||
*
|
||||
* @return int8_t percent of power (-100 to 100)
|
||||
*/
|
||||
int8_t getTargetPower();
|
||||
int8_t getTargetPower() const { return this->targetPower; };
|
||||
|
||||
uint16_t getDutycycle() const { return this->dutycycle; }
|
||||
bool isTargetPowerReached();
|
||||
bool isAccelerationPositive();
|
||||
bool isAccelerationNegative();
|
||||
bool isTargetPowerReached() const;
|
||||
bool isAccelerationPositive() const;
|
||||
bool isAccelerationNegative() const;
|
||||
|
||||
private:
|
||||
void run() override;
|
||||
|
||||
Reference in New Issue
Block a user