mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 02:29:17 +02:00
vigilance system fixes
This commit is contained in:
@@ -579,6 +579,7 @@ class TSecuritySystem
|
|||||||
double press_timer = 0.0;
|
double press_timer = 0.0;
|
||||||
|
|
||||||
double velocity = 0.0;
|
double velocity = 0.0;
|
||||||
|
bool power = false;
|
||||||
|
|
||||||
double AwareDelay = 30.0;
|
double AwareDelay = 30.0;
|
||||||
double AwareMinSpeed = 0.0;
|
double AwareMinSpeed = 0.0;
|
||||||
@@ -591,7 +592,7 @@ public:
|
|||||||
void acknowledge_press();
|
void acknowledge_press();
|
||||||
void acknowledge_release();
|
void acknowledge_release();
|
||||||
void cabsignal_reset();
|
void cabsignal_reset();
|
||||||
void update(double dt, double Vel);
|
void update(double dt, double Vel, bool pwr);
|
||||||
void set_cabsignal();
|
void set_cabsignal();
|
||||||
bool is_blinking() const;
|
bool is_blinking() const;
|
||||||
bool is_vigilance_blinking() const;
|
bool is_vigilance_blinking() const;
|
||||||
|
|||||||
@@ -82,10 +82,6 @@ int DirF(int CouplerN)
|
|||||||
void TSecuritySystem::set_enabled(bool e) {
|
void TSecuritySystem::set_enabled(bool e) {
|
||||||
if (vigilance_enabled || cabsignal_enabled)
|
if (vigilance_enabled || cabsignal_enabled)
|
||||||
enabled = e;
|
enabled = e;
|
||||||
if (enabled && cabsignal_enabled) {
|
|
||||||
cabsignal_active = true;
|
|
||||||
alert_timer = SoundSignalDelay;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TSecuritySystem::acknowledge_press() {
|
void TSecuritySystem::acknowledge_press() {
|
||||||
@@ -105,8 +101,9 @@ void TSecuritySystem::acknowledge_press() {
|
|||||||
void TSecuritySystem::acknowledge_release() {
|
void TSecuritySystem::acknowledge_release() {
|
||||||
pressed = false;
|
pressed = false;
|
||||||
|
|
||||||
|
if (press_timer > MaxHoldTime)
|
||||||
|
alert_timer = 0.0;
|
||||||
press_timer = 0.0;
|
press_timer = 0.0;
|
||||||
alert_timer = 0.0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TSecuritySystem::cabsignal_reset() {
|
void TSecuritySystem::cabsignal_reset() {
|
||||||
@@ -116,15 +113,22 @@ void TSecuritySystem::cabsignal_reset() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TSecuritySystem::update(double dt, double vel) {
|
void TSecuritySystem::update(double dt, double vel, bool pwr) {
|
||||||
if (!enabled) {
|
if (!enabled || !pwr) {
|
||||||
cabsignal_active = false;
|
cabsignal_active = false;
|
||||||
|
power = false;
|
||||||
vigilance_timer = 0.0;
|
vigilance_timer = 0.0;
|
||||||
alert_timer = 0.0;
|
alert_timer = 0.0;
|
||||||
press_timer = 0.0;
|
press_timer = 0.0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!power && pwr && cabsignal_enabled) {
|
||||||
|
cabsignal_active = true;
|
||||||
|
alert_timer = SoundSignalDelay;
|
||||||
|
}
|
||||||
|
|
||||||
|
power = pwr;
|
||||||
velocity = vel;
|
velocity = vel;
|
||||||
|
|
||||||
if (vigilance_enabled && velocity > AwareMinSpeed)
|
if (vigilance_enabled && velocity > AwareMinSpeed)
|
||||||
@@ -2142,6 +2146,8 @@ bool TMoverParameters::CabActivisation(void)
|
|||||||
{
|
{
|
||||||
CabNo = ActiveCab; // sterowanie jest z kabiny z obsadą
|
CabNo = ActiveCab; // sterowanie jest z kabiny z obsadą
|
||||||
DirAbsolute = ActiveDir * CabNo;
|
DirAbsolute = ActiveDir * CabNo;
|
||||||
|
SecuritySystem.set_enabled(true); // activate the alerter TODO: make it part of control based cab selection
|
||||||
|
|
||||||
SendCtrlToNext("CabActivisation", 1, CabNo);
|
SendCtrlToNext("CabActivisation", 1, CabNo);
|
||||||
}
|
}
|
||||||
return OK;
|
return OK;
|
||||||
@@ -2161,6 +2167,7 @@ bool TMoverParameters::CabDeactivisation(void)
|
|||||||
CabNo = 0;
|
CabNo = 0;
|
||||||
DirAbsolute = ActiveDir * CabNo;
|
DirAbsolute = ActiveDir * CabNo;
|
||||||
DepartureSignal = false; // nie buczeć z nieaktywnej kabiny
|
DepartureSignal = false; // nie buczeć z nieaktywnej kabiny
|
||||||
|
SecuritySystem.set_enabled(false);
|
||||||
|
|
||||||
SendCtrlToNext("CabActivisation", 0, ActiveCab); // CabNo==0!
|
SendCtrlToNext("CabActivisation", 0, ActiveCab); // CabNo==0!
|
||||||
}
|
}
|
||||||
@@ -2257,9 +2264,7 @@ void TMoverParameters::SecuritySystemReset(void) // zbijanie czuwaka/SHP
|
|||||||
// *************************************************************************************************
|
// *************************************************************************************************
|
||||||
void TMoverParameters::SecuritySystemCheck(double dt)
|
void TMoverParameters::SecuritySystemCheck(double dt)
|
||||||
{
|
{
|
||||||
if (Battery) {
|
SecuritySystem.update(dt, Vel, Battery || ConverterFlag);
|
||||||
SecuritySystem.update(dt, Vel);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!Battery || !Radio)
|
if (!Battery || !Radio)
|
||||||
{ // wyłączenie baterii deaktywuje sprzęt
|
{ // wyłączenie baterii deaktywuje sprzęt
|
||||||
@@ -2285,8 +2290,6 @@ bool TMoverParameters::BatterySwitch(bool State)
|
|||||||
SendCtrlToNext("BatterySwitch", 0, CabNo);
|
SendCtrlToNext("BatterySwitch", 0, CabNo);
|
||||||
BS = true;
|
BS = true;
|
||||||
|
|
||||||
SecuritySystem.set_enabled(Battery);
|
|
||||||
|
|
||||||
return BS;
|
return BS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -9741,8 +9744,7 @@ bool TMoverParameters::RunCommand( std::string Command, double CValue1, double C
|
|||||||
if ((CValue1 == 1))
|
if ((CValue1 == 1))
|
||||||
Battery = true;
|
Battery = true;
|
||||||
else if ((CValue1 == 0))
|
else if ((CValue1 == 0))
|
||||||
Battery = false;
|
Battery = false;
|
||||||
SecuritySystem.set_enabled(Battery);
|
|
||||||
OK = SendCtrlToNext( Command, CValue1, CValue2, Couplertype );
|
OK = SendCtrlToNext( Command, CValue1, CValue2, Couplertype );
|
||||||
}
|
}
|
||||||
// else if command='EpFuseSwitch' then {NBMX}
|
// else if command='EpFuseSwitch' then {NBMX}
|
||||||
|
|||||||
Reference in New Issue
Block a user