mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
Merge remote-tracking branch 'youby/master' into sim
This commit is contained in:
@@ -668,19 +668,21 @@ class TSecuritySystem
|
||||
|
||||
double velocity = 0.0;
|
||||
bool power = false;
|
||||
int cabactive = 0;
|
||||
|
||||
double AwareDelay = 30.0;
|
||||
double AwareMinSpeed = 0.0;
|
||||
double SoundSignalDelay = 5.0;
|
||||
double EmergencyBrakeDelay = 5.0;
|
||||
double MaxHoldTime = 1.5;
|
||||
bool CabDependent = false;
|
||||
|
||||
public:
|
||||
void set_enabled(bool e);
|
||||
void acknowledge_press();
|
||||
void acknowledge_release();
|
||||
void cabsignal_reset();
|
||||
void update(double dt, double Vel, bool pwr);
|
||||
void update(double dt, double Vel, bool pwr, int cab);
|
||||
void set_cabsignal();
|
||||
void set_cabsignal_lock(bool);
|
||||
bool is_blinking() const;
|
||||
|
||||
@@ -116,7 +116,7 @@ void TSecuritySystem::cabsignal_reset() {
|
||||
}
|
||||
}
|
||||
|
||||
void TSecuritySystem::update(double dt, double vel, bool pwr) {
|
||||
void TSecuritySystem::update(double dt, double vel, bool pwr, int cab) {
|
||||
if (!pwr)
|
||||
power = false;
|
||||
|
||||
@@ -130,14 +130,18 @@ void TSecuritySystem::update(double dt, double vel, bool pwr) {
|
||||
press_timer = 0.0;
|
||||
return;
|
||||
}
|
||||
|
||||
bool just_powered_on = !power && pwr;
|
||||
bool just_activated = CabDependent && (cabactive != cab);
|
||||
|
||||
if (!power && pwr && cabsignal_enabled) {
|
||||
if (!DebugModeFlag && cabsignal_enabled && (just_powered_on || just_activated)) {
|
||||
cabsignal_active = true;
|
||||
alert_timer = SoundSignalDelay;
|
||||
}
|
||||
|
||||
power = pwr;
|
||||
velocity = vel;
|
||||
cabactive = cab;
|
||||
|
||||
if (vigilance_enabled && velocity > AwareMinSpeed)
|
||||
vigilance_timer += dt;
|
||||
@@ -235,6 +239,7 @@ void TSecuritySystem::load(std::string const &line, double Vmax) {
|
||||
extract_value( MaxHoldTime, "MaxHoldTime", line, "" );
|
||||
extract_value( radiostop_enabled, "RadioStop", line, "" );
|
||||
extract_value( MagnetLocation, "MagnetLocation", line, "" );
|
||||
extract_value( CabDependent, "CabDependent", line, "" );
|
||||
}
|
||||
|
||||
double TableInterpolation(std::map<double, double> &Map, double Parameter)
|
||||
@@ -3080,7 +3085,8 @@ void TMoverParameters::SecuritySystemReset(void) // zbijanie czuwaka/SHP
|
||||
// *************************************************************************************************
|
||||
void TMoverParameters::SecuritySystemCheck(double dt)
|
||||
{
|
||||
SecuritySystem.update(dt, Vel, Power24vIsAvailable || Power110vIsAvailable);
|
||||
bool isPower = Power24vIsAvailable || Power110vIsAvailable;
|
||||
SecuritySystem.update(dt, Vel, isPower, CabActive);
|
||||
|
||||
if (!Battery || !Radio)
|
||||
{ // wyłączenie baterii deaktywuje sprzęt
|
||||
|
||||
Reference in New Issue
Block a user