ATS logic added
This commit is contained in:
@@ -37,14 +37,13 @@ void SingleValueStrategy::setSetpoint(float setpoint) {
|
||||
* @return The setpoint with added random noise.
|
||||
*/
|
||||
float SingleValueStrategy::execute(float currentValue) {
|
||||
if(_noiseMagnitude <= 0){
|
||||
Serial.println("Single value strategy static.");
|
||||
if(_noiseMagnitude <= 0.0f){
|
||||
Serial.printf("Single value strategy static. %f \n", _setpoint);
|
||||
return _setpoint;
|
||||
}
|
||||
|
||||
int noiseInt = rand() % 201;
|
||||
noiseInt -= 100;
|
||||
float noise = (noiseInt / 100) * _noiseMagnitude;
|
||||
Serial.println("Single value strategy with noise.");
|
||||
float noise = (static_cast<float>(noiseInt) / 100) * _noiseMagnitude;
|
||||
Serial.printf("Single value strategy with noise. %f \n", noise);
|
||||
return _setpoint + noise;
|
||||
}
|
||||
Reference in New Issue
Block a user