mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-21 19:05:00 +01:00
fix: the SM42's CA off in the shunt mode only with AwareOffInShuntMode, an alarm on kept
Review of #275. The shunt mode suspends the vigilance device (CA) only on the vehicles whose .fiz sets the new Security key AwareOffInShuntMode=Yes (default No), instead of on every diesel-electric with ShuntMode=1 (SP42, SU42 and the 401Z generator car had it too). Suspended, the CA counts no time towards a new alarm, but an alarm already on stays, goes on to the emergency braking and needs the usual acknowledgement, instead of going out with the shunt mode.
This commit is contained in:
@@ -1131,7 +1131,7 @@ class TSecuritySystem
|
||||
bool is_sifa = false; // Sifa-like pedal device, with inverted input for convenient keyboard usage
|
||||
bool separate_acknowledge = false; // cabsignal reset button is separate from vigilance
|
||||
bool cabsignal_lock = false;
|
||||
bool vigilance_suspended = false; // the vigilance device switched off by the vehicle, as by the SM42's shunt mode
|
||||
bool vigilance_suspended = false; // the vigilance device switched off by the shunt mode of the vehicle, see AwareOffInShuntMode
|
||||
|
||||
double vigilance_timer = 0.0;
|
||||
double alert_timer = 0.0;
|
||||
@@ -1147,6 +1147,7 @@ class TSecuritySystem
|
||||
double EmergencyBrakeDelay = 5.0;
|
||||
double MaxHoldTime = 1.5;
|
||||
bool CabDependent = false;
|
||||
bool AwareOffInShuntMode = false; // the shunt mode of the vehicle switches the vigilance device off, as on the SM42
|
||||
|
||||
public:
|
||||
void set_enabled(bool e);
|
||||
@@ -1156,7 +1157,7 @@ class TSecuritySystem
|
||||
void update(double dt, double Vel, bool pwr, int cab);
|
||||
void set_cabsignal();
|
||||
void set_cabsignal_lock(bool);
|
||||
void set_vigilance_suspended(bool Suspended);
|
||||
void set_shunt_mode(bool State);
|
||||
bool is_blinking() const;
|
||||
bool is_vigilance_blinking() const;
|
||||
bool is_cabsignal_blinking() const;
|
||||
|
||||
@@ -154,11 +154,12 @@ void TSecuritySystem::update(double dt, double vel, bool pwr, int cab)
|
||||
|
||||
if (vigilance_suspended)
|
||||
{
|
||||
// the vigilance device is switched off: neither the alerter nor the button held too long, its alarm gone with it
|
||||
vigilance_timer = 0.0;
|
||||
press_timer = 0.0;
|
||||
if (!cabsignal_active)
|
||||
alert_timer = 0.0;
|
||||
// the vigilance device is switched off: no time counts towards a new alarm, of the alerter or of the button held
|
||||
// too long. an alarm already on, with the emergency braking it leads to, stays until it's acknowledged as usual
|
||||
if (vigilance_timer <= AwareDelay)
|
||||
vigilance_timer = 0.0;
|
||||
if (press_timer <= MaxHoldTime)
|
||||
press_timer = 0.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -242,9 +243,9 @@ void TSecuritySystem::set_cabsignal_lock(bool v)
|
||||
cabsignal_lock = v;
|
||||
}
|
||||
|
||||
void TSecuritySystem::set_vigilance_suspended(bool const Suspended)
|
||||
void TSecuritySystem::set_shunt_mode(bool const State)
|
||||
{
|
||||
vigilance_suspended = Suspended;
|
||||
vigilance_suspended = State && AwareOffInShuntMode;
|
||||
}
|
||||
|
||||
bool TSecuritySystem::is_engine_blocked() const
|
||||
@@ -276,6 +277,7 @@ void TSecuritySystem::load(std::string const &line, double Vmax)
|
||||
extract_value(radiostop_enabled, "RadioStop", line, "");
|
||||
extract_value(MagnetLocation, "MagnetLocation", line, "");
|
||||
extract_value(CabDependent, "CabDependent", line, "");
|
||||
extract_value(AwareOffInShuntMode, "AwareOffInShuntMode", line, "");
|
||||
}
|
||||
|
||||
double TableInterpolation(std::map<double, double> &Map, double Parameter)
|
||||
@@ -3158,8 +3160,8 @@ void TMoverParameters::SecuritySystemReset(void) // zbijanie czuwaka/SHP
|
||||
void TMoverParameters::SecuritySystemCheck(double dt)
|
||||
{
|
||||
bool isPower = Power24vIsAvailable || Power110vIsAvailable;
|
||||
// the shunt mode of the SM42/SP42 switches their vigilance device (CA) off (eu07/maszyna#457)
|
||||
SecuritySystem.set_vigilance_suspended(EngineType == TEngineType::DieselElectric && ShuntMode);
|
||||
// the shunt mode of the SM42 switches its vigilance device (CA) off, on the vehicles with AwareOffInShuntMode=Yes (eu07/maszyna#457)
|
||||
SecuritySystem.set_shunt_mode(ShuntMode);
|
||||
SecuritySystem.update(dt, Vel, isPower, CabActive);
|
||||
|
||||
if (!Battery || !Radio)
|
||||
|
||||
Reference in New Issue
Block a user