diff --git a/McZapkie/MOVER.h b/McZapkie/MOVER.h index f3c9057d..79b6c569 100644 --- a/McZapkie/MOVER.h +++ b/McZapkie/MOVER.h @@ -1484,9 +1484,10 @@ public: bool AddPulseForce(int Multipler);/*dla drezyny*/ - bool SandboxManual( bool const State, range_t const Notify = range_t::consist );/*wlacza/wylacza sypanie piasku*/ - bool SandboxAuto( bool const State, range_t const Notify = range_t::consist );/*wlacza/wylacza sypanie piasku*/ + bool SandboxManual( bool const State, range_t const Notify = range_t::consist );/*wlacza/wylacza reczne sypanie piasku*/ + bool SandboxAuto( bool const State, range_t const Notify = range_t::consist );/*wlacza/wylacza automatyczne sypanie piasku*/ bool Sandbox( bool const State, range_t const Notify = range_t::consist );/*wlacza/wylacza sypanie piasku*/ + bool SandboxAutoAllow(bool const State);/*wlacza/wylacza zezwolenie na automatyczne sypanie piasku*/ /*! zbijanie czuwaka/SHP*/ void SSReset(void); diff --git a/McZapkie/Mover.cpp b/McZapkie/Mover.cpp index 6ed13a37..d5ba5a7e 100644 --- a/McZapkie/Mover.cpp +++ b/McZapkie/Mover.cpp @@ -2328,6 +2328,24 @@ bool TMoverParameters::Sandbox( bool const State, range_t const Notify ) return result; } +// ************************************************************************************************* +// yB: 20190909 +// włączenie / wyłączenie automatycznej piasecznicy +// ************************************************************************************************* +bool TMoverParameters::SandboxAutoAllow(bool State) +{ + //SendCtrlToNext("SandboxAutoAllow", int(State), CabNo, ctrain_controll); + + if (SandDoseAutoAllow != State) + { + SandDoseAutoAllow = State; + return true; + } + else + return false; + +} + void TMoverParameters::SSReset(void) { // funkcja pomocnicza dla SecuritySystemReset - w Delphi Reset() SecuritySystem.SystemTimer = 0; diff --git a/Train.cpp b/Train.cpp index d2dd6cc9..59fb2277 100644 --- a/Train.cpp +++ b/Train.cpp @@ -1441,6 +1441,37 @@ void TTrain::OnCommand_sandboxactivate( TTrain *Train, command_data const &Comma } } +void TTrain::OnCommand_autosandboxtoggle(TTrain *Train, command_data const &Command) { + + if (Command.action == GLFW_PRESS) { + // only reacting to press, so the switch doesn't flip back and forth if key is held down + if (false == Train->mvOccupied->SandDoseAutoAllow) { + // turn on + OnCommand_autosandboxactivate(Train, Command); + } + else { + //turn off + OnCommand_autosandboxdeactivate(Train, Command); + } + } +}; + +void TTrain::OnCommand_autosandboxactivate(TTrain *Train, command_data const &Command) { + if (Command.action == GLFW_PRESS) { + // only reacting to press, so the switch doesn't flip back and forth if key is held down + Train->mvOccupied->SandboxAutoAllow(true); + Train->ggAutoSandAllow.UpdateValue(1.0, Train->dsbSwitch); + } +}; + +void TTrain::OnCommand_autosandboxdeactivate(TTrain *Train, command_data const &Command) { + if (Command.action == GLFW_PRESS) { + // only reacting to press, so the switch doesn't flip back and forth if key is held down + Train->mvOccupied->SandboxAutoAllow(false); + Train->ggAutoSandAllow.UpdateValue(0.0, Train->dsbSwitch); + } +}; + void TTrain::OnCommand_epbrakecontroltoggle( TTrain *Train, command_data const &Command ) { if( Command.action == GLFW_PRESS ) { @@ -8070,6 +8101,7 @@ bool TTrain::initialize_gauge(cParser &Parser, std::string const &Label, int con { "security_reset_bt:", ggSecurityResetButton }, { "releaser_bt:", ggReleaserButton }, { "sand_bt:", ggSandButton }, + { "autosandallow_sw:", ggAutoSandAllow }, { "antislip_bt:", ggAntiSlipButton }, { "horn_bt:", ggHornButton }, { "hornlow_bt:", ggHornLowButton }, diff --git a/Train.h b/Train.h index 4e1f187d..2e16d181 100644 --- a/Train.h +++ b/Train.h @@ -196,6 +196,9 @@ class TTrain static void OnCommand_alarmchaintoggle( TTrain *Train, command_data const &Command ); static void OnCommand_wheelspinbrakeactivate( TTrain *Train, command_data const &Command ); static void OnCommand_sandboxactivate( TTrain *Train, command_data const &Command ); + static void OnCommand_autosandboxtoggle(TTrain *Train, command_data const &Command); + static void OnCommand_autosandboxactivate(TTrain *Train, command_data const &Command); + static void OnCommand_autosandboxdeactivate(TTrain *Train, command_data const &Command); static void OnCommand_epbrakecontroltoggle( TTrain *Train, command_data const &Command ); static void OnCommand_trainbrakeoperationmodeincrease(TTrain *Train, command_data const &Command); static void OnCommand_trainbrakeoperationmodedecrease(TTrain *Train, command_data const &Command); @@ -408,6 +411,7 @@ public: // reszta może by?publiczna TGauge ggSecurityResetButton; TGauge ggReleaserButton; TGauge ggSandButton; // guzik piasecznicy + TGauge ggAutoSandAllow; // przełącznik piasecznicy TGauge ggAntiSlipButton; TGauge ggFuseButton; TGauge ggConverterFuseButton; // hunter-261211: przycisk odblokowania nadmiarowego przetwornic i ogrzewania