mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 20:59:19 +02:00
separate cabsignal acknowledge
This commit is contained in:
@@ -572,6 +572,7 @@ class TSecuritySystem
|
||||
bool pressed = false;
|
||||
bool enabled = false;
|
||||
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
|
||||
|
||||
double vigilance_timer = 0.0;
|
||||
double alert_timer = 0.0;
|
||||
@@ -589,6 +590,7 @@ public:
|
||||
void set_enabled(bool e);
|
||||
void acknowledge_press();
|
||||
void acknowledge_release();
|
||||
void cabsignal_reset();
|
||||
void update(double dt, double Vel);
|
||||
void set_cabsignal();
|
||||
bool is_blinking() const;
|
||||
|
||||
@@ -82,7 +82,7 @@ int DirF(int CouplerN)
|
||||
void TSecuritySystem::set_enabled(bool e) {
|
||||
if (vigilance_enabled || cabsignal_enabled)
|
||||
enabled = e;
|
||||
if (enabled && cabsignal_enabled && !is_sifa) {
|
||||
if (enabled && cabsignal_enabled) {
|
||||
cabsignal_active = true;
|
||||
alert_timer = SoundSignalDelay;
|
||||
}
|
||||
@@ -91,14 +91,15 @@ void TSecuritySystem::set_enabled(bool e) {
|
||||
void TSecuritySystem::acknowledge_press() {
|
||||
pressed = true;
|
||||
|
||||
if (cabsignal_active) {
|
||||
if (!separate_acknowledge && cabsignal_active) {
|
||||
cabsignal_active = false;
|
||||
alert_timer = 0.0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (vigilance_timer > AwareDelay)
|
||||
alert_timer = 0.0;
|
||||
vigilance_timer = 0.0;
|
||||
alert_timer = 0.0;
|
||||
}
|
||||
|
||||
void TSecuritySystem::acknowledge_release() {
|
||||
@@ -108,6 +109,13 @@ void TSecuritySystem::acknowledge_release() {
|
||||
alert_timer = 0.0;
|
||||
}
|
||||
|
||||
void TSecuritySystem::cabsignal_reset() {
|
||||
if (cabsignal_active) {
|
||||
cabsignal_active = false;
|
||||
alert_timer = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
void TSecuritySystem::update(double dt, double vel) {
|
||||
if (!enabled) {
|
||||
cabsignal_active = false;
|
||||
@@ -176,6 +184,8 @@ void TSecuritySystem::load(std::string const &line, double Vmax) {
|
||||
cabsignal_enabled = true;
|
||||
if( awaresystem.find( "Sifa" ) != std::string::npos )
|
||||
is_sifa = true;
|
||||
if( awaresystem.find( "SeparateAcknowledge" ) != std::string::npos )
|
||||
separate_acknowledge = true;
|
||||
|
||||
extract_value( AwareDelay, "AwareDelay", line, "" );
|
||||
AwareMinSpeed = 0.1 * Vmax; //domyślnie 10% Vmax
|
||||
|
||||
Reference in New Issue
Block a user