diff --git a/McZapkie/hamulce.cpp b/McZapkie/hamulce.cpp
index da0a98116..9411dc425 100644
--- a/McZapkie/hamulce.cpp
+++ b/McZapkie/hamulce.cpp
@@ -977,7 +977,7 @@ double TESt::BVs(double const BCP) const
/// Brake cylinder (or impulse-chamber) pressure.
/// Time step [s].
/// Volume taken into the auxiliary reservoir, 0.96 of it drawn from the brake pipe.
-double TESt::FillBrakeRes(double const BCP, double const dt)
+double TESt::FillBrakeRes(double const BCP, double const dt) const
{
double const BVP{BrakeRes->P()};
double const VVP{ValveRes->P()};
diff --git a/McZapkie/hamulce.h b/McZapkie/hamulce.h
index b9a5ffd15..2fb433a85 100644
--- a/McZapkie/hamulce.h
+++ b/McZapkie/hamulce.h
@@ -628,7 +628,7 @@ class TESt : public TBrake
/// Brake cylinder (or impulse-chamber) pressure for .
/// Time step [s].
/// Volume taken into the auxiliary reservoir, 0.96 of it drawn from the brake pipe.
- double FillBrakeRes(double BCP, double dt); // napelnianie pomocniczego z rozdzielacza
+ double FillBrakeRes(double BCP, double dt) const; // napelnianie pomocniczego z rozdzielacza
/// Vents the valve, brake and control reservoirs to zero.
void ForceEmptiness() override; // wymuszenie bycia pustym
diff --git a/tests/unit/test_brake_handles.cpp b/tests/unit/test_brake_handles.cpp
index e6b435471..1490e43d8 100644
--- a/tests/unit/test_brake_handles.cpp
+++ b/tests/unit/test_brake_handles.cpp
@@ -36,6 +36,7 @@ void hold(vehicle &Vehicle, test::trace &Trace, std::string const &Event, double
// every position of the driver's handle, recorded in the trace
void every_position(vehicle &Vehicle, test::trace &Trace) {
Vehicle.hold_main_reservoir(std::max(Vehicle->MaxCompressor, 8.0));
+ REQUIRE(Vehicle->Handle != nullptr);
auto &handle{*Vehicle->Handle};
Vehicle.record(Trace);
@@ -97,6 +98,7 @@ TEST_CASE("brake handles: the local brake handle of every real vehicle") {
real.hold_main_reservoir(std::max(real->MaxCompressor, 8.0));
test::trace trace{"local brake/" + path, handle_channels(), 100};
real.record(trace);
+ REQUIRE(real->Handle != nullptr);
real->BrakeLevelSet(real->Handle->GetPos(bh_RP));
trace.mark("charge");
real.run(60.0);
@@ -127,6 +129,7 @@ TEST_CASE("brake handles: the overload and the high pressure buttons of the MHZ
real.hold_main_reservoir(std::max(real->MaxCompressor, 8.0));
test::trace trace{"brake handles/buttons/" + name, handle_channels(), 100};
real.record(trace);
+ REQUIRE(real->Handle != nullptr);
auto &handle{*real->Handle};
auto const at{[&trace, &real](std::string const &Event, double Position, double Seconds) {
trace.mark(Event);
@@ -167,6 +170,7 @@ void ready_knorr_ep(test::consist &Unit) {
Unit.add(definition::fiz("en57_v1/5bgb"));
auto &cab{Unit[0]};
REQUIRE(cab->BrakeHandle == TBrakeHandle::St113);
+ REQUIRE(cab->Handle != nullptr);
cab->BatterySwitch(true);
cab->CabActivisation();
cab.hold_brake_pipe(5.0);
@@ -190,6 +194,7 @@ TEST_CASE("brake handles: the positions of the Knorr St113 EP brake") {
test::consist unit;
ready_knorr_ep(unit);
auto &cab{unit[0]};
+ REQUIRE(cab->Handle != nullptr);
auto &handle{*cab->Handle};
auto const ep_at{[&unit, &cab, &handle](double Position) {
cab->BrakeLevelSet(Position);
diff --git a/vehicle/Driver.cpp b/vehicle/Driver.cpp
index 9f83b6d53..d174a377c 100644
--- a/vehicle/Driver.cpp
+++ b/vehicle/Driver.cpp
@@ -3126,6 +3126,14 @@ bool TController::IncBrake()
mvOccupied->SwitchEPBrake( 1 ); // to nie chce działać
OK = true;
}
+ else if( ( mvOccupied->Handle->GetPos( bh_EPR ) - mvOccupied->Handle->GetPos( bh_EPN ) < 0.1 )
+ && ( mvOccupied->EpForce <= 0.0 )
+ && ( mvOccupied->EPBrakeControlPowered() ) ) {
+ // the handle already in the EP brake position, but the EP brake dropped out with the control's
+ // supply (e.g. the EP fuse off in the running brake test): switch it on again
+ mvOccupied->SwitchEPBrake( 1 );
+ OK = ( mvOccupied->EpForce > 0.0 );
+ }
else
OK = false;
break;
diff --git a/vehicle/Train.cpp b/vehicle/Train.cpp
index e30635f4f..333d99a69 100644
--- a/vehicle/Train.cpp
+++ b/vehicle/Train.cpp
@@ -2235,7 +2235,9 @@ void TTrain::OnCommand_wheelspinbrakeactivate(TTrain *Train, command_data const
// visual feedback
Train->ggAntiSlipButton.UpdateValue(1.0, Train->dsbPneumaticSwitch);
- if (Train->mvOccupied->BrakeHandle == TBrakeHandle::St113 && Train->mvControlled->EpFuse == true)
+ // the EP fuse is the cab car's (Ctrl+Z switches mvOccupied's), checked by SwitchEPBrake with the rest of
+ // the control's supply
+ if (Train->mvOccupied->BrakeHandle == TBrakeHandle::St113)
{
Train->mvOccupied->SwitchEPBrake(1);
}