mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-23 07:29:19 +02:00
(separate shp reset) add handling of SeparateAcknowledge flag
This commit is contained in:
13
Driver.cpp
13
Driver.cpp
@@ -6376,6 +6376,19 @@ TController::control_horns( double const Timedelta ) {
|
|||||||
|
|
||||||
void
|
void
|
||||||
TController::control_security_system( double const Timedelta ) {
|
TController::control_security_system( double const Timedelta ) {
|
||||||
|
if( mvOccupied->SecuritySystem.is_cabsignal_blinking() && mvOccupied->SecuritySystem.has_separate_acknowledge()) {
|
||||||
|
// jak zadziałało SHP
|
||||||
|
if( ( false == is_emu() )
|
||||||
|
&& ( mvOccupied->DirActive == 0 ) ) {
|
||||||
|
cue_action( driver_hint::directionforward );
|
||||||
|
}
|
||||||
|
cue_action( driver_hint::shpsystemreset ); // to skasuj
|
||||||
|
if( BrakeCtrlPosition == 0 // TODO: verify whether it's 0 in all vehicle types
|
||||||
|
&& AccDesired > 0.0
|
||||||
|
&& mvOccupied->SecuritySystem.is_braking() ) {
|
||||||
|
cue_action( driver_hint::trainbrakerelease );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if( mvOccupied->SecuritySystem.is_blinking() ) {
|
if( mvOccupied->SecuritySystem.is_blinking() ) {
|
||||||
// jak zadziałało CA/SHP
|
// jak zadziałało CA/SHP
|
||||||
|
|||||||
@@ -693,6 +693,7 @@ public:
|
|||||||
bool is_braking() const;
|
bool is_braking() const;
|
||||||
bool is_engine_blocked() const;
|
bool is_engine_blocked() const;
|
||||||
bool radiostop_available() const;
|
bool radiostop_available() const;
|
||||||
|
bool has_separate_acknowledge() const;
|
||||||
void load(std::string const &line, double Vmax);
|
void load(std::string const &line, double Vmax);
|
||||||
|
|
||||||
double MagnetLocation = 0.0;
|
double MagnetLocation = 0.0;
|
||||||
|
|||||||
@@ -132,10 +132,11 @@ void TSecuritySystem::update(double dt, double vel, bool pwr, int cab) {
|
|||||||
press_timer = 0.0;
|
press_timer = 0.0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool just_powered_on = !power && pwr;
|
bool just_powered_on = !power && pwr;
|
||||||
bool just_activated = CabDependent && (cabactive != cab);
|
bool just_activated = CabDependent && (cabactive != cab);
|
||||||
|
|
||||||
|
/* enabling battery */
|
||||||
if (!DebugModeFlag && cabsignal_enabled && (just_powered_on || just_activated)) {
|
if (!DebugModeFlag && cabsignal_enabled && (just_powered_on || just_activated)) {
|
||||||
cabsignal_active = true;
|
cabsignal_active = true;
|
||||||
alert_timer = SoundSignalDelay;
|
alert_timer = SoundSignalDelay;
|
||||||
@@ -162,6 +163,10 @@ void TSecuritySystem::set_cabsignal() {
|
|||||||
cabsignal_active = true;
|
cabsignal_active = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TSecuritySystem::has_separate_acknowledge() const {
|
||||||
|
return separate_acknowledge;
|
||||||
|
}
|
||||||
|
|
||||||
bool TSecuritySystem::is_blinking() const {
|
bool TSecuritySystem::is_blinking() const {
|
||||||
if (!power)
|
if (!power)
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
14
Train.cpp
14
Train.cpp
@@ -712,7 +712,7 @@ dictionary_source *TTrain::GetTrainState( dictionary_source const &Extraparamete
|
|||||||
dict->insert( "brake_delay_flag", mvOccupied->BrakeDelayFlag );
|
dict->insert( "brake_delay_flag", mvOccupied->BrakeDelayFlag );
|
||||||
dict->insert( "brake_op_mode_flag", mvOccupied->BrakeOpModeFlag );
|
dict->insert( "brake_op_mode_flag", mvOccupied->BrakeOpModeFlag );
|
||||||
// other controls
|
// other controls
|
||||||
dict->insert( "ca", mvOccupied->SecuritySystem.is_blinking());
|
dict->insert( "ca", mvOccupied->SecuritySystem.is_vigilance_blinking());
|
||||||
dict->insert( "shp", mvOccupied->SecuritySystem.is_cabsignal_blinking());
|
dict->insert( "shp", mvOccupied->SecuritySystem.is_cabsignal_blinking());
|
||||||
dict->insert( "distance_counter", m_distancecounter );
|
dict->insert( "distance_counter", m_distancecounter );
|
||||||
dict->insert( "pantpress", std::abs( mvPantographUnit->PantPress ) );
|
dict->insert( "pantpress", std::abs( mvPantographUnit->PantPress ) );
|
||||||
@@ -2341,8 +2341,13 @@ void TTrain::OnCommand_alerteracknowledge( TTrain *Train, command_data const &Co
|
|||||||
void TTrain::OnCommand_cabsignalacknowledge( TTrain *Train, command_data const &Command ) {
|
void TTrain::OnCommand_cabsignalacknowledge( TTrain *Train, command_data const &Command ) {
|
||||||
// TODO: visual feedback
|
// TODO: visual feedback
|
||||||
if( Command.action == GLFW_PRESS ) {
|
if( Command.action == GLFW_PRESS ) {
|
||||||
Train->mvOccupied->SecuritySystem.cabsignal_reset();
|
if(Train->mvOccupied->SecuritySystem.has_separate_acknowledge()) {
|
||||||
}
|
Train->mvOccupied->SecuritySystem.cabsignal_reset();
|
||||||
|
Train->ggSHPResetButton.UpdateValue( 1.0, Train->dsbSwitch );
|
||||||
|
}
|
||||||
|
} else if( Command.action == GLFW_RELEASE ) {
|
||||||
|
Train->ggSHPResetButton.UpdateValue( 0.0 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TTrain::OnCommand_batterytoggle( TTrain *Train, command_data const &Command )
|
void TTrain::OnCommand_batterytoggle( TTrain *Train, command_data const &Command )
|
||||||
@@ -7906,6 +7911,7 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
ggMainOnButton.Update();
|
ggMainOnButton.Update();
|
||||||
ggMainButton.Update();
|
ggMainButton.Update();
|
||||||
ggSecurityResetButton.Update();
|
ggSecurityResetButton.Update();
|
||||||
|
ggSHPResetButton.Update();
|
||||||
ggReleaserButton.Update();
|
ggReleaserButton.Update();
|
||||||
ggSpringBrakeOnButton.Update();
|
ggSpringBrakeOnButton.Update();
|
||||||
ggSpringBrakeOffButton.Update();
|
ggSpringBrakeOffButton.Update();
|
||||||
@@ -9258,6 +9264,7 @@ void TTrain::clear_cab_controls()
|
|||||||
ggMainOffButton.Clear();
|
ggMainOffButton.Clear();
|
||||||
ggMainOnButton.Clear();
|
ggMainOnButton.Clear();
|
||||||
ggSecurityResetButton.Clear();
|
ggSecurityResetButton.Clear();
|
||||||
|
ggSHPResetButton.Clear();
|
||||||
ggReleaserButton.Clear();
|
ggReleaserButton.Clear();
|
||||||
ggSpringBrakeOnButton.Clear();
|
ggSpringBrakeOnButton.Clear();
|
||||||
ggSpringBrakeOffButton.Clear();
|
ggSpringBrakeOffButton.Clear();
|
||||||
@@ -10019,6 +10026,7 @@ bool TTrain::initialize_gauge(cParser &Parser, std::string const &Label, int con
|
|||||||
{ "main_off_bt:", ggMainOffButton },
|
{ "main_off_bt:", ggMainOffButton },
|
||||||
{ "main_on_bt:", ggMainOnButton },
|
{ "main_on_bt:", ggMainOnButton },
|
||||||
{ "security_reset_bt:", ggSecurityResetButton },
|
{ "security_reset_bt:", ggSecurityResetButton },
|
||||||
|
{ "shp_reset_bt:", ggSHPResetButton },
|
||||||
{ "releaser_bt:", ggReleaserButton },
|
{ "releaser_bt:", ggReleaserButton },
|
||||||
{ "springbrakeon_bt:", ggSpringBrakeOnButton },
|
{ "springbrakeon_bt:", ggSpringBrakeOnButton },
|
||||||
{ "springbrakeoff_bt:", ggSpringBrakeOffButton },
|
{ "springbrakeoff_bt:", ggSpringBrakeOffButton },
|
||||||
|
|||||||
1
Train.h
1
Train.h
@@ -546,6 +546,7 @@ public: // reszta może by?publiczna
|
|||||||
TGauge ggMainOnButton;
|
TGauge ggMainOnButton;
|
||||||
TGauge ggMainButton; // EZT
|
TGauge ggMainButton; // EZT
|
||||||
TGauge ggSecurityResetButton;
|
TGauge ggSecurityResetButton;
|
||||||
|
TGauge ggSHPResetButton;
|
||||||
TGauge ggReleaserButton;
|
TGauge ggReleaserButton;
|
||||||
TGauge ggSpringBrakeOnButton;
|
TGauge ggSpringBrakeOnButton;
|
||||||
TGauge ggSpringBrakeOffButton;
|
TGauge ggSpringBrakeOffButton;
|
||||||
|
|||||||
@@ -1202,7 +1202,18 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
|
|||||||
hint(
|
hint(
|
||||||
Action,
|
Action,
|
||||||
[this](float const Parameter) -> bool {
|
[this](float const Parameter) -> bool {
|
||||||
return !mvOccupied->SecuritySystem.is_blinking(); } );
|
return !mvOccupied->SecuritySystem.is_vigilance_blinking(); } );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case driver_hint::shpsystemreset: {
|
||||||
|
if( AIControllFlag ) {
|
||||||
|
if (mvOccupied->SecuritySystem.is_cabsignal_blinking())
|
||||||
|
mvOccupied->SecuritySystem.cabsignal_reset();
|
||||||
|
}
|
||||||
|
hint(
|
||||||
|
Action,
|
||||||
|
[this](float const Parameter) -> bool {
|
||||||
|
return !mvOccupied->SecuritySystem.is_cabsignal_blinking(); } );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case driver_hint::couplingadapterattach: {
|
case driver_hint::couplingadapterattach: {
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ DRIVER_HINT_DEF(consistlightsoff, STRN("Switch off consist lights"))
|
|||||||
DRIVER_HINT_DEF(consistheatingon, STRN("Switch on consist heating"))
|
DRIVER_HINT_DEF(consistheatingon, STRN("Switch on consist heating"))
|
||||||
DRIVER_HINT_DEF(consistheatingoff, STRN("Switch off consist heating"))
|
DRIVER_HINT_DEF(consistheatingoff, STRN("Switch off consist heating"))
|
||||||
DRIVER_HINT_DEF(securitysystemreset, STRN("Acknowledge alerter"))
|
DRIVER_HINT_DEF(securitysystemreset, STRN("Acknowledge alerter"))
|
||||||
|
DRIVER_HINT_DEF(shpsystemreset, STRN("Acknowledge SHP"))
|
||||||
DRIVER_HINT_DEF(couplingadapterattach, STRN("Attach coupling adapter"))
|
DRIVER_HINT_DEF(couplingadapterattach, STRN("Attach coupling adapter"))
|
||||||
DRIVER_HINT_DEF(couplingadapterremove, STRN("Remove coupling adapter"))
|
DRIVER_HINT_DEF(couplingadapterremove, STRN("Remove coupling adapter"))
|
||||||
DRIVER_HINT_DEF(secondcontrollersetzero, STRN("Switch off field shunting"))
|
DRIVER_HINT_DEF(secondcontrollersetzero, STRN("Switch off field shunting"))
|
||||||
@@ -101,4 +102,4 @@ DRIVER_HINT_DEF(releaseron, STRN("Actuate"))
|
|||||||
DRIVER_HINT_DEF(releaseroff, STRN("Stop actuating"))
|
DRIVER_HINT_DEF(releaseroff, STRN("Stop actuating"))
|
||||||
DRIVER_HINT_DEF(bufferscompress, STRN("Apply tractive force to compress buffers"))
|
DRIVER_HINT_DEF(bufferscompress, STRN("Apply tractive force to compress buffers"))
|
||||||
DRIVER_HINT_DEF(cabactivation, STRN("Activate cabin"))
|
DRIVER_HINT_DEF(cabactivation, STRN("Activate cabin"))
|
||||||
DRIVER_HINT_DEF(cabdeactivation, STRN("Deactivate cabin"))
|
DRIVER_HINT_DEF(cabdeactivation, STRN("Deactivate cabin"))
|
||||||
|
|||||||
@@ -611,6 +611,9 @@ drivermouse_input::default_bindings() {
|
|||||||
{ "security_reset_bt:", {
|
{ "security_reset_bt:", {
|
||||||
user_command::alerteracknowledge,
|
user_command::alerteracknowledge,
|
||||||
user_command::none } },
|
user_command::none } },
|
||||||
|
{ "shp_reset_bt:", {
|
||||||
|
user_command::cabsignalacknowledge,
|
||||||
|
user_command::none } },
|
||||||
{ "releaser_bt:", {
|
{ "releaser_bt:", {
|
||||||
user_command::independentbrakebailoff,
|
user_command::independentbrakebailoff,
|
||||||
user_command::none } },
|
user_command::none } },
|
||||||
|
|||||||
@@ -220,6 +220,7 @@ std::string locale::label_cab_control(std::string const &Label)
|
|||||||
{ "main_off_bt:", STRN("line breaker") },
|
{ "main_off_bt:", STRN("line breaker") },
|
||||||
{ "main_on_bt:", STRN("line breaker") },
|
{ "main_on_bt:", STRN("line breaker") },
|
||||||
{ "security_reset_bt:", STRN("alerter") },
|
{ "security_reset_bt:", STRN("alerter") },
|
||||||
|
{ "shp_reset_bt:", STRN("shp") },
|
||||||
{ "releaser_bt:", STRN("independent brake releaser") },
|
{ "releaser_bt:", STRN("independent brake releaser") },
|
||||||
{ "sand_bt:", STRN("sandbox") },
|
{ "sand_bt:", STRN("sandbox") },
|
||||||
{ "antislip_bt:", STRN("wheelspin brake") },
|
{ "antislip_bt:", STRN("wheelspin brake") },
|
||||||
|
|||||||
@@ -495,6 +495,9 @@ std::unordered_map<std::string, vr_openvr::button_bindings> vr_openvr::m_buttonb
|
|||||||
{ "security_reset_bt:", {
|
{ "security_reset_bt:", {
|
||||||
user_command::alerteracknowledge,
|
user_command::alerteracknowledge,
|
||||||
user_command::none } },
|
user_command::none } },
|
||||||
|
{ "shp_reset_bt:", {
|
||||||
|
user_command::cabsignalacknowledge,
|
||||||
|
user_command::none } },
|
||||||
{ "releaser_bt:", {
|
{ "releaser_bt:", {
|
||||||
user_command::independentbrakebailoff,
|
user_command::independentbrakebailoff,
|
||||||
user_command::none } },
|
user_command::none } },
|
||||||
|
|||||||
Reference in New Issue
Block a user