Umstellung auf Floatgenerell bei Speed

Umstellung auf Float bei Beschleunigung
Entfernen von minspeed
Entfernen nicht notwendiger Konstruktoren in Lokomotive
This commit is contained in:
2023-05-19 16:41:59 +02:00
parent a5f5b18a27
commit fe94db4e88
5 changed files with 51 additions and 66 deletions

View File

@@ -2,24 +2,12 @@
#include<fahrt.h>
#include<locomotive.h>
Fahrt::Fahrt(Locomotive locomotive, MotorDirection Direction, Gleis gleis, Gleisabschnitt gleisabschnitt): _locomotive(locomotive), _gleis(gleis), _gleisabschnitt(gleisabschnitt)
{
_direction = Direction;
_speed = locomotive.getDefaultSpeed();
_bremsweg=0;
}
Fahrt::Fahrt(Locomotive locomotive, byte speed, MotorDirection Direction, Gleis gleis, Gleisabschnitt gleisabschnitt): _locomotive(locomotive), _gleis(gleis), _gleisabschnitt(gleisabschnitt)
{
_direction = Direction;
_speed = speed;
_bremsweg=0;
}
Fahrt::Fahrt(Locomotive locomotive, byte speed, MotorDirection Direction, Gleis gleis, Gleisabschnitt gleisabschnitt, float bremsweg): _locomotive(locomotive), _gleis(gleis), _gleisabschnitt(gleisabschnitt)
Fahrt::Fahrt(Locomotive locomotive, byte speed, MotorDirection Direction, Gleis gleis, float startbeschleunigung, Gleisabschnitt gleisabschnitt, float bremsweg): _locomotive(locomotive), _gleis(gleis), _gleisabschnitt(gleisabschnitt)
{
_direction = Direction;
_speed = speed;
_startbeschleunigung = startbeschleunigung;
_bremsweg=bremsweg;
}
@@ -50,10 +38,7 @@ void Fahrt::Loop()
delay(20);
if (_gleisabschnitt.IstBesetzt() && !_abschnittErkannt)
{
if (_bremsweg==0)
_locomotive.Break();
else
_locomotive.Accelerate(0, _bremsweg);
_locomotive.Accelerate(0, _bremsweg);
_abschnittErkannt=true;
}
}