Skip to content

Commit 5553e93

Browse files
committed
Cruise control refactoring and algorithm adjusting
1 parent f5484af commit 5553e93

File tree

6 files changed

+623
-929
lines changed

6 files changed

+623
-929
lines changed

Source/Orts.Simulation/Common/Scripting/TrainControlSystem.cs

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -356,28 +356,18 @@ internal void AttachToHost(ScriptedTrainControlSystem host)
356356
/// Set dynamic brake controller to position in range [0-1].
357357
/// </summary>
358358
public Action<float> SetDynamicBrakeController;
359-
public float? ATOSetSpeedMpS
359+
public float? SetSpeedMpS
360360
{
361361
get
362362
{
363-
return Locomotive.CruiseControl?.ATOSetSpeedMpS;
363+
if (Locomotive?.CruiseControl.SpeedRegMode == CruiseControl.SpeedRegulatorMode.Auto) return Locomotive.CruiseControl.SetSpeedMpS;
364+
return null;
364365
}
365366
set
366367
{
367368
if (Locomotive.CruiseControl != null) Locomotive.CruiseControl.ATOSetSpeedMpS = value;
368369
}
369370
}
370-
public float? ATOSetAccelerationMpSS
371-
{
372-
get
373-
{
374-
return Locomotive.CruiseControl?.ATOSetAccelerationMpSS;
375-
}
376-
set
377-
{
378-
if (Locomotive.CruiseControl != null) Locomotive.CruiseControl.ATOSetAccelerationMpSS = value;
379-
}
380-
}
381371
/// <summary>
382372
/// Cut power by pull all pantographs down.
383373
/// </summary>

Source/Orts.Simulation/Simulation/Confirmer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ public Confirmer(Simulator simulator, double defaultDurationS)
257257
, new string [] { GetString("Battery"), GetString("off"), null, GetString("on") }
258258
, new string [] { GetString("Master key"), GetString("off"), null, GetString("on") }
259259
// Cruise control
260-
, new string [] { GetString("Max acceleration"), null, null, null }
260+
, new string [] { GetString("Max acceleration"), null, null, null, GetString("decrease"), GetString("increase") }
261261
, new string [] { GetString("Restricted speed zone"), GetString("off"), null, GetString("on") }
262262
// Train Devices
263263
, new string [] { GetString("Doors Left"), GetString("close"), null, GetString("open") }

0 commit comments

Comments
 (0)