mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-19 19:14:59 +01:00
fix: SM42 shunt mode switched on at the first move of the switch (eu07/maszyna#497)
CurrentSwitch() asked MaxCurrentSwitch() first. Since 2e86b3a5 (2021) that one
takes any change of the motor overload relay threshold, on every engine type, and
reports it, so the first move of the switch only flipped the threshold (meaningless
on a diesel) and the shunt mode of the SM42/SP42 (and the 2Ls150 gear of the SM03)
took a second one, both on and off; the cab switch, which shows the shunt mode,
didn't move at the first click. The diesels with a shunt mode now set it alone.
This commit is contained in:
@@ -809,6 +809,19 @@ bool TMoverParameters::ChangeCab(int direction)
|
||||
// rozruch wysoki (true) albo niski (false)
|
||||
bool TMoverParameters::CurrentSwitch(bool const State)
|
||||
{
|
||||
// TBD, TODO: split off shunt mode toggle into a separate command? It doesn't make much sense to have these two together like that
|
||||
// the diesels with a shunt mode have no motor overload relay threshold to switch, the switch sets their shunt mode alone.
|
||||
// MaxCurrentSwitch() takes any change of the setting, so asked first it took the first move of the switch (eu07/maszyna#497)
|
||||
if (true == ShuntModeAllow && (EngineType == TEngineType::DieselEngine || EngineType == TEngineType::DieselElectric))
|
||||
{
|
||||
// dla 2Ls150 przed ustawieniem kierunku, for SM42/SP42 at the controller's zero position
|
||||
if (EngineType == TEngineType::DieselEngine ? DirActive != 0 : false == IsMainCtrlNoPowerPos())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
ShuntMode = State;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (MaxCurrentSwitch(State))
|
||||
{
|
||||
@@ -818,20 +831,6 @@ bool TMoverParameters::CurrentSwitch(bool const State)
|
||||
}
|
||||
return true;
|
||||
}
|
||||
// TBD, TODO: split off shunt mode toggle into a separate command? It doesn't make much sense to have these two together like that
|
||||
// dla 2Ls150
|
||||
if (EngineType == TEngineType::DieselEngine && true == ShuntModeAllow && DirActive == 0)
|
||||
{
|
||||
// przed ustawieniem kierunku
|
||||
ShuntMode = State;
|
||||
return true;
|
||||
}
|
||||
// for SM42/SP42
|
||||
if (EngineType == TEngineType::DieselElectric && true == ShuntModeAllow && IsMainCtrlNoPowerPos())
|
||||
{
|
||||
ShuntMode = State;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user