diff --git a/Driver.cpp b/Driver.cpp index a4f8b8af..5258e1c7 100644 --- a/Driver.cpp +++ b/Driver.cpp @@ -6376,6 +6376,19 @@ TController::control_horns( double const Timedelta ) { void 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() ) { // jak zadziałało CA/SHP diff --git a/McZapkie/MOVER.h b/McZapkie/MOVER.h index 7ac0bf53..2702aee1 100644 --- a/McZapkie/MOVER.h +++ b/McZapkie/MOVER.h @@ -693,6 +693,7 @@ public: bool is_braking() const; bool is_engine_blocked() const; bool radiostop_available() const; + bool has_separate_acknowledge() const; void load(std::string const &line, double Vmax); double MagnetLocation = 0.0; diff --git a/McZapkie/Mover.cpp b/McZapkie/Mover.cpp index f864df5d..c5dcd116 100644 --- a/McZapkie/Mover.cpp +++ b/McZapkie/Mover.cpp @@ -132,10 +132,11 @@ void TSecuritySystem::update(double dt, double vel, bool pwr, int cab) { press_timer = 0.0; return; } - + bool just_powered_on = !power && pwr; bool just_activated = CabDependent && (cabactive != cab); + /* enabling battery */ if (!DebugModeFlag && cabsignal_enabled && (just_powered_on || just_activated)) { cabsignal_active = true; alert_timer = SoundSignalDelay; @@ -162,6 +163,10 @@ void TSecuritySystem::set_cabsignal() { cabsignal_active = true; } +bool TSecuritySystem::has_separate_acknowledge() const { + return separate_acknowledge; +} + bool TSecuritySystem::is_blinking() const { if (!power) return false; diff --git a/Train.cpp b/Train.cpp index f88006c5..d25d9197 100644 --- a/Train.cpp +++ b/Train.cpp @@ -712,7 +712,7 @@ dictionary_source *TTrain::GetTrainState( dictionary_source const &Extraparamete dict->insert( "brake_delay_flag", mvOccupied->BrakeDelayFlag ); dict->insert( "brake_op_mode_flag", mvOccupied->BrakeOpModeFlag ); // 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( "distance_counter", m_distancecounter ); 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 ) { // TODO: visual feedback 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 ) @@ -7906,6 +7911,7 @@ bool TTrain::Update( double const Deltatime ) ggMainOnButton.Update(); ggMainButton.Update(); ggSecurityResetButton.Update(); + ggSHPResetButton.Update(); ggReleaserButton.Update(); ggSpringBrakeOnButton.Update(); ggSpringBrakeOffButton.Update(); @@ -9258,6 +9264,7 @@ void TTrain::clear_cab_controls() ggMainOffButton.Clear(); ggMainOnButton.Clear(); ggSecurityResetButton.Clear(); + ggSHPResetButton.Clear(); ggReleaserButton.Clear(); ggSpringBrakeOnButton.Clear(); ggSpringBrakeOffButton.Clear(); @@ -10019,6 +10026,7 @@ bool TTrain::initialize_gauge(cParser &Parser, std::string const &Label, int con { "main_off_bt:", ggMainOffButton }, { "main_on_bt:", ggMainOnButton }, { "security_reset_bt:", ggSecurityResetButton }, + { "shp_reset_bt:", ggSHPResetButton }, { "releaser_bt:", ggReleaserButton }, { "springbrakeon_bt:", ggSpringBrakeOnButton }, { "springbrakeoff_bt:", ggSpringBrakeOffButton }, diff --git a/Train.h b/Train.h index 9adc2773..0ad1fe5e 100644 --- a/Train.h +++ b/Train.h @@ -546,6 +546,7 @@ public: // reszta może by?publiczna TGauge ggMainOnButton; TGauge ggMainButton; // EZT TGauge ggSecurityResetButton; + TGauge ggSHPResetButton; TGauge ggReleaserButton; TGauge ggSpringBrakeOnButton; TGauge ggSpringBrakeOffButton; diff --git a/driverhints.cpp b/driverhints.cpp index 166af15e..45bc6498 100644 --- a/driverhints.cpp +++ b/driverhints.cpp @@ -1202,7 +1202,18 @@ TController::cue_action( driver_hint const Action, float const Actionparameter ) hint( Action, [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; } case driver_hint::couplingadapterattach: { diff --git a/driverhints_def.h b/driverhints_def.h index 81f8fb4e..f59ed734 100644 --- a/driverhints_def.h +++ b/driverhints_def.h @@ -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(consistheatingoff, STRN("Switch off consist heating")) 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(couplingadapterremove, STRN("Remove coupling adapter")) 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(bufferscompress, STRN("Apply tractive force to compress buffers")) DRIVER_HINT_DEF(cabactivation, STRN("Activate cabin")) -DRIVER_HINT_DEF(cabdeactivation, STRN("Deactivate cabin")) \ No newline at end of file +DRIVER_HINT_DEF(cabdeactivation, STRN("Deactivate cabin")) diff --git a/drivermouseinput.cpp b/drivermouseinput.cpp index f5463406..de75d607 100644 --- a/drivermouseinput.cpp +++ b/drivermouseinput.cpp @@ -611,6 +611,9 @@ drivermouse_input::default_bindings() { { "security_reset_bt:", { user_command::alerteracknowledge, user_command::none } }, + { "shp_reset_bt:", { + user_command::cabsignalacknowledge, + user_command::none } }, { "releaser_bt:", { user_command::independentbrakebailoff, user_command::none } }, diff --git a/translation.cpp b/translation.cpp index d61e0010..ac31091c 100644 --- a/translation.cpp +++ b/translation.cpp @@ -220,6 +220,7 @@ std::string locale::label_cab_control(std::string const &Label) { "main_off_bt:", STRN("line breaker") }, { "main_on_bt:", STRN("line breaker") }, { "security_reset_bt:", STRN("alerter") }, + { "shp_reset_bt:", STRN("shp") }, { "releaser_bt:", STRN("independent brake releaser") }, { "sand_bt:", STRN("sandbox") }, { "antislip_bt:", STRN("wheelspin brake") }, diff --git a/vr/openvr_imp.cpp b/vr/openvr_imp.cpp index 8be82158..75520415 100644 --- a/vr/openvr_imp.cpp +++ b/vr/openvr_imp.cpp @@ -495,6 +495,9 @@ std::unordered_map vr_openvr::m_buttonb { "security_reset_bt:", { user_command::alerteracknowledge, user_command::none } }, + { "shp_reset_bt:", { + user_command::cabsignalacknowledge, + user_command::none } }, { "releaser_bt:", { user_command::independentbrakebailoff, user_command::none } },