mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-24 00:49:18 +02:00
separate cabsignal acknowledge
This commit is contained in:
@@ -572,6 +572,7 @@ class TSecuritySystem
|
|||||||
bool pressed = false;
|
bool pressed = false;
|
||||||
bool enabled = false;
|
bool enabled = false;
|
||||||
bool is_sifa = false; // Sifa-like pedal device, with inverted input for convenient keyboard usage
|
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 vigilance_timer = 0.0;
|
||||||
double alert_timer = 0.0;
|
double alert_timer = 0.0;
|
||||||
@@ -589,6 +590,7 @@ 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 update(double dt, double Vel);
|
void update(double dt, double Vel);
|
||||||
void set_cabsignal();
|
void set_cabsignal();
|
||||||
bool is_blinking() const;
|
bool is_blinking() const;
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ 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 && !is_sifa) {
|
if (enabled && cabsignal_enabled) {
|
||||||
cabsignal_active = true;
|
cabsignal_active = true;
|
||||||
alert_timer = SoundSignalDelay;
|
alert_timer = SoundSignalDelay;
|
||||||
}
|
}
|
||||||
@@ -91,14 +91,15 @@ void TSecuritySystem::set_enabled(bool e) {
|
|||||||
void TSecuritySystem::acknowledge_press() {
|
void TSecuritySystem::acknowledge_press() {
|
||||||
pressed = true;
|
pressed = true;
|
||||||
|
|
||||||
if (cabsignal_active) {
|
if (!separate_acknowledge && cabsignal_active) {
|
||||||
cabsignal_active = false;
|
cabsignal_active = false;
|
||||||
alert_timer = 0.0;
|
alert_timer = 0.0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (vigilance_timer > AwareDelay)
|
||||||
|
alert_timer = 0.0;
|
||||||
vigilance_timer = 0.0;
|
vigilance_timer = 0.0;
|
||||||
alert_timer = 0.0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TSecuritySystem::acknowledge_release() {
|
void TSecuritySystem::acknowledge_release() {
|
||||||
@@ -108,6 +109,13 @@ void TSecuritySystem::acknowledge_release() {
|
|||||||
alert_timer = 0.0;
|
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) {
|
void TSecuritySystem::update(double dt, double vel) {
|
||||||
if (!enabled) {
|
if (!enabled) {
|
||||||
cabsignal_active = false;
|
cabsignal_active = false;
|
||||||
@@ -176,6 +184,8 @@ void TSecuritySystem::load(std::string const &line, double Vmax) {
|
|||||||
cabsignal_enabled = true;
|
cabsignal_enabled = true;
|
||||||
if( awaresystem.find( "Sifa" ) != std::string::npos )
|
if( awaresystem.find( "Sifa" ) != std::string::npos )
|
||||||
is_sifa = true;
|
is_sifa = true;
|
||||||
|
if( awaresystem.find( "SeparateAcknowledge" ) != std::string::npos )
|
||||||
|
separate_acknowledge = true;
|
||||||
|
|
||||||
extract_value( AwareDelay, "AwareDelay", line, "" );
|
extract_value( AwareDelay, "AwareDelay", line, "" );
|
||||||
AwareMinSpeed = 0.1 * Vmax; //domyślnie 10% Vmax
|
AwareMinSpeed = 0.1 * Vmax; //domyślnie 10% Vmax
|
||||||
|
|||||||
@@ -215,6 +215,7 @@ TTrain::commandhandler_map const TTrain::m_commandhandlers = {
|
|||||||
{ user_command::reverserneutral, &TTrain::OnCommand_reverserneutral },
|
{ user_command::reverserneutral, &TTrain::OnCommand_reverserneutral },
|
||||||
{ user_command::reverserbackward, &TTrain::OnCommand_reverserbackward },
|
{ user_command::reverserbackward, &TTrain::OnCommand_reverserbackward },
|
||||||
{ user_command::alerteracknowledge, &TTrain::OnCommand_alerteracknowledge },
|
{ user_command::alerteracknowledge, &TTrain::OnCommand_alerteracknowledge },
|
||||||
|
{ user_command::cabsignalacknowledge, &TTrain::OnCommand_cabsignalacknowledge },
|
||||||
{ user_command::batterytoggle, &TTrain::OnCommand_batterytoggle },
|
{ user_command::batterytoggle, &TTrain::OnCommand_batterytoggle },
|
||||||
{ user_command::batteryenable, &TTrain::OnCommand_batteryenable },
|
{ user_command::batteryenable, &TTrain::OnCommand_batteryenable },
|
||||||
{ user_command::batterydisable, &TTrain::OnCommand_batterydisable },
|
{ user_command::batterydisable, &TTrain::OnCommand_batterydisable },
|
||||||
@@ -1730,6 +1731,13 @@ void TTrain::OnCommand_alerteracknowledge( TTrain *Train, command_data const &Co
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TTrain::OnCommand_cabsignalacknowledge( TTrain *Train, command_data const &Command ) {
|
||||||
|
// TODO: visual feedback
|
||||||
|
if( Command.action == GLFW_PRESS ) {
|
||||||
|
Train->mvOccupied->SecuritySystem.cabsignal_reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void TTrain::OnCommand_batterytoggle( TTrain *Train, command_data const &Command )
|
void TTrain::OnCommand_batterytoggle( TTrain *Train, command_data const &Command )
|
||||||
{
|
{
|
||||||
if( Command.action == GLFW_PRESS ) {
|
if( Command.action == GLFW_PRESS ) {
|
||||||
|
|||||||
1
Train.h
1
Train.h
@@ -219,6 +219,7 @@ class TTrain
|
|||||||
static void OnCommand_reverserneutral( TTrain *Train, command_data const &Command );
|
static void OnCommand_reverserneutral( TTrain *Train, command_data const &Command );
|
||||||
static void OnCommand_reverserbackward( TTrain *Train, command_data const &Command );
|
static void OnCommand_reverserbackward( TTrain *Train, command_data const &Command );
|
||||||
static void OnCommand_alerteracknowledge( TTrain *Train, command_data const &Command );
|
static void OnCommand_alerteracknowledge( TTrain *Train, command_data const &Command );
|
||||||
|
static void OnCommand_cabsignalacknowledge( TTrain *Train, command_data const &Command );
|
||||||
static void OnCommand_batterytoggle( TTrain *Train, command_data const &Command );
|
static void OnCommand_batterytoggle( TTrain *Train, command_data const &Command );
|
||||||
static void OnCommand_batteryenable( TTrain *Train, command_data const &Command );
|
static void OnCommand_batteryenable( TTrain *Train, command_data const &Command );
|
||||||
static void OnCommand_batterydisable( TTrain *Train, command_data const &Command );
|
static void OnCommand_batterydisable( TTrain *Train, command_data const &Command );
|
||||||
|
|||||||
@@ -116,6 +116,7 @@ commanddescription_sequence Commands_descriptions = {
|
|||||||
{ "brakeloadcompensationdecrease", command_target::vehicle, command_mode::oneoff },
|
{ "brakeloadcompensationdecrease", command_target::vehicle, command_mode::oneoff },
|
||||||
{ "mubrakingindicatortoggle", command_target::vehicle, command_mode::oneoff },
|
{ "mubrakingindicatortoggle", command_target::vehicle, command_mode::oneoff },
|
||||||
{ "alerteracknowledge", command_target::vehicle, command_mode::oneoff },
|
{ "alerteracknowledge", command_target::vehicle, command_mode::oneoff },
|
||||||
|
{ "cabsignalacknowledge", command_target::vehicle, command_mode::oneoff },
|
||||||
{ "hornlowactivate", command_target::vehicle, command_mode::oneoff },
|
{ "hornlowactivate", command_target::vehicle, command_mode::oneoff },
|
||||||
{ "hornhighactivate", command_target::vehicle, command_mode::oneoff },
|
{ "hornhighactivate", command_target::vehicle, command_mode::oneoff },
|
||||||
{ "whistleactivate", command_target::vehicle, command_mode::oneoff },
|
{ "whistleactivate", command_target::vehicle, command_mode::oneoff },
|
||||||
|
|||||||
@@ -110,6 +110,7 @@ enum class user_command {
|
|||||||
brakeloadcompensationdecrease,
|
brakeloadcompensationdecrease,
|
||||||
mubrakingindicatortoggle,
|
mubrakingindicatortoggle,
|
||||||
alerteracknowledge,
|
alerteracknowledge,
|
||||||
|
cabsignalacknowledge,
|
||||||
hornlowactivate,
|
hornlowactivate,
|
||||||
hornhighactivate,
|
hornhighactivate,
|
||||||
whistleactivate,
|
whistleactivate,
|
||||||
|
|||||||
Reference in New Issue
Block a user