mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-19 21:34:58 +01:00
feat: Elf emergency brake position in the master controller (eu07/maszyna#413)
The Elf's master controller (EIMCtrlType 2) gets an optional emergency brake position below its position 0, turned on by the new .fiz key EIMCtrlMainEmergency=Yes in Cntrl (default No, no change without it). With it the old positions move up by one (MCPN 5, neutral at 4): the emergency position brakes fully at once and vents the brake pipe, like the alarm chain or the Impuls's EIMCtrlEmergency. The loader raises a too small MCPN to 5 and logs it. The Elf code with hard-coded positions (CheckEIMIC, the MED full braking, the AI) takes the shift into account. SVN data to change afterwards (dynamic/pkp/elf_v1, needs this exe): - every .fiz with EIMCtrlType=2: EIMCtrlMainEmergency=Yes, MCPN=5, DirChangeMaxPos=4 where present; - the cab .mmd mainctrl entries: offset one notch lower (-0.06 -> -0.09), sounds shifted one index up, new sound0 with 26284_elf_nastawnik_nagle_*.wav. Issue: (eu07/maszyna#413)
This commit is contained in:
@@ -3144,9 +3144,11 @@ bool TController::IncBrakeEIM()
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
OK = mvOccupied->MainCtrlPos > 1;
|
||||
// the braking position, above the emergency brake one where the controller has it
|
||||
auto const brakepos{1 + mvOccupied->EIMCtrlEmergencyPositions()};
|
||||
OK = mvOccupied->MainCtrlPos > brakepos;
|
||||
if( OK )
|
||||
mvOccupied->MainCtrlPos = 1;
|
||||
mvOccupied->MainCtrlPos = brakepos;
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
@@ -3300,9 +3302,10 @@ bool TController::DecBrakeEIM()
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
OK = mvOccupied->MainCtrlPos < 3;
|
||||
auto const neutralpos{mvOccupied->MainCtrlNoPowerPos()};
|
||||
OK = mvOccupied->MainCtrlPos < neutralpos;
|
||||
if( OK )
|
||||
mvOccupied->MainCtrlPos = 3;
|
||||
mvOccupied->MainCtrlPos = neutralpos;
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
@@ -3663,12 +3666,14 @@ bool TController::IncSpeedEIM() {
|
||||
}
|
||||
*/
|
||||
break;
|
||||
case 2:
|
||||
OK = mvControlling->MainCtrlPos < 4;
|
||||
case 2: {
|
||||
auto const powerpos{4 + mvControlling->EIMCtrlEmergencyPositions()};
|
||||
OK = mvControlling->MainCtrlPos < powerpos;
|
||||
if( OK ) {
|
||||
mvControlling->MainCtrlPos = 4;
|
||||
mvControlling->MainCtrlPos = powerpos;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
@@ -3696,9 +3701,10 @@ bool TController::DecSpeedEIM( int const Amount )
|
||||
mvControlling->SpeedCtrlPowerDec();
|
||||
}
|
||||
else {
|
||||
OK = mvControlling->MainCtrlPos > 2;
|
||||
auto const holdpos{2 + mvControlling->EIMCtrlEmergencyPositions()};
|
||||
OK = mvControlling->MainCtrlPos > holdpos;
|
||||
if( OK ) {
|
||||
mvControlling->MainCtrlPos = 2;
|
||||
mvControlling->MainCtrlPos = holdpos;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -4170,8 +4176,9 @@ void TController::CheckTimeControllers()
|
||||
}
|
||||
else if (mvOccupied->EIMCtrlType == 2) //elf
|
||||
{
|
||||
if (mvOccupied->eimic > 0) mvOccupied->MainCtrlPos = 3;
|
||||
if (mvOccupied->eimic < 0) mvOccupied->MainCtrlPos = 2;
|
||||
auto const emergencypositions{mvOccupied->EIMCtrlEmergencyPositions()};
|
||||
if (mvOccupied->eimic > 0) mvOccupied->MainCtrlPos = 3 + emergencypositions;
|
||||
if (mvOccupied->eimic < 0) mvOccupied->MainCtrlPos = 2 + emergencypositions;
|
||||
}
|
||||
}
|
||||
//4. Check Speed Control System
|
||||
|
||||
@@ -3238,7 +3238,8 @@ bool TDynamicObject::Update(double dt, double dt1)
|
||||
|
||||
auto eimic = std::min(MoverParameters->eimic, MoverParameters->eimicSpeedCtrl);
|
||||
MoverParameters->eimic_real = eimic;
|
||||
if (MoverParameters->EIMCtrlType == 2 && MoverParameters->MainCtrlPos == 0)
|
||||
// Elf: full braking at once in the lowest position, and in the emergency brake position below it
|
||||
if (MoverParameters->EIMCtrlType == 2 && MoverParameters->MainCtrlPos <= MoverParameters->EIMCtrlEmergencyPositions())
|
||||
eimic = -1.0;
|
||||
MoverParameters->SendCtrlToNext("EIMIC", std::max(0., eimic), MoverParameters->CabActive);
|
||||
auto LBR = std::max(-eimic, 0.);
|
||||
|
||||
Reference in New Issue
Block a user