mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 12:49:18 +02:00
Configurable CabSignal activation with cabin activation
This commit is contained in:
@@ -668,19 +668,21 @@ class TSecuritySystem
|
|||||||
|
|
||||||
double velocity = 0.0;
|
double velocity = 0.0;
|
||||||
bool power = false;
|
bool power = false;
|
||||||
|
int cabactive = 0;
|
||||||
|
|
||||||
double AwareDelay = 30.0;
|
double AwareDelay = 30.0;
|
||||||
double AwareMinSpeed = 0.0;
|
double AwareMinSpeed = 0.0;
|
||||||
double SoundSignalDelay = 5.0;
|
double SoundSignalDelay = 5.0;
|
||||||
double EmergencyBrakeDelay = 5.0;
|
double EmergencyBrakeDelay = 5.0;
|
||||||
double MaxHoldTime = 1.5;
|
double MaxHoldTime = 1.5;
|
||||||
|
bool CabDependent = false;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void set_enabled(bool e);
|
void set_enabled(bool e);
|
||||||
void acknowledge_press();
|
void acknowledge_press();
|
||||||
void acknowledge_release();
|
void acknowledge_release();
|
||||||
void cabsignal_reset();
|
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();
|
||||||
void set_cabsignal_lock(bool);
|
void set_cabsignal_lock(bool);
|
||||||
bool is_blinking() const;
|
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)
|
if (!pwr)
|
||||||
power = false;
|
power = false;
|
||||||
|
|
||||||
@@ -128,16 +128,22 @@ void TSecuritySystem::update(double dt, double vel, bool pwr) {
|
|||||||
vigilance_timer = 0.0;
|
vigilance_timer = 0.0;
|
||||||
alert_timer = 0.0;
|
alert_timer = 0.0;
|
||||||
press_timer = 0.0;
|
press_timer = 0.0;
|
||||||
|
if (!DebugModeFlag)
|
||||||
|
cabactive = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!power && pwr && cabsignal_enabled) {
|
bool is_powered = !power && pwr;
|
||||||
|
bool is_cabactived = CabDependent && (cabactive != cab);
|
||||||
|
|
||||||
|
if (cabsignal_enabled && (is_powered || is_cabactived)) {
|
||||||
cabsignal_active = true;
|
cabsignal_active = true;
|
||||||
alert_timer = SoundSignalDelay;
|
alert_timer = SoundSignalDelay;
|
||||||
}
|
}
|
||||||
|
|
||||||
power = pwr;
|
power = pwr;
|
||||||
velocity = vel;
|
velocity = vel;
|
||||||
|
cabactive = cab;
|
||||||
|
|
||||||
if (vigilance_enabled && velocity > AwareMinSpeed)
|
if (vigilance_enabled && velocity > AwareMinSpeed)
|
||||||
vigilance_timer += dt;
|
vigilance_timer += dt;
|
||||||
@@ -235,6 +241,7 @@ void TSecuritySystem::load(std::string const &line, double Vmax) {
|
|||||||
extract_value( MaxHoldTime, "MaxHoldTime", line, "" );
|
extract_value( MaxHoldTime, "MaxHoldTime", line, "" );
|
||||||
extract_value( radiostop_enabled, "RadioStop", line, "" );
|
extract_value( radiostop_enabled, "RadioStop", line, "" );
|
||||||
extract_value( MagnetLocation, "MagnetLocation", line, "" );
|
extract_value( MagnetLocation, "MagnetLocation", line, "" );
|
||||||
|
extract_value( CabDependent, "CabDependent", line, "" );
|
||||||
}
|
}
|
||||||
|
|
||||||
double TableInterpolation(std::map<double, double> &Map, double Parameter)
|
double TableInterpolation(std::map<double, double> &Map, double Parameter)
|
||||||
@@ -3080,7 +3087,8 @@ void TMoverParameters::SecuritySystemReset(void) // zbijanie czuwaka/SHP
|
|||||||
// *************************************************************************************************
|
// *************************************************************************************************
|
||||||
void TMoverParameters::SecuritySystemCheck(double dt)
|
void TMoverParameters::SecuritySystemCheck(double dt)
|
||||||
{
|
{
|
||||||
SecuritySystem.update(dt, Vel, Power24vIsAvailable || Power110vIsAvailable);
|
bool isPower = Power24vIsAvailable || Power110vIsAvailable;
|
||||||
|
SecuritySystem.update(dt, Vel, isPower, CabActive);
|
||||||
|
|
||||||
if (!Battery || !Radio)
|
if (!Battery || !Radio)
|
||||||
{ // wyłączenie baterii deaktywuje sprzęt
|
{ // wyłączenie baterii deaktywuje sprzęt
|
||||||
|
|||||||
Reference in New Issue
Block a user