From bbdc67c9b298a62413d9178cb64d2f38fd3a1908 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kr=C3=B3lik=20Uszasty?= Date: Thu, 9 May 2019 19:39:23 +0200 Subject: [PATCH] Fixed speedcontrol for EN57A --- McZapkie/Mover.cpp | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/McZapkie/Mover.cpp b/McZapkie/Mover.cpp index 93f048f6..fb83ef35 100644 --- a/McZapkie/Mover.cpp +++ b/McZapkie/Mover.cpp @@ -1691,7 +1691,9 @@ bool TMoverParameters::IncMainCtrl(int CtrlSpeed) else { ++MainCtrlPos; OK = true; - } + if ((EIMCtrlType == 0) && (SpeedCtrlAutoTurnOffFlag == 1) && (MainCtrlActualPos != MainCtrlPos)) + DecScndCtrl(2); + } break; } @@ -1853,6 +1855,8 @@ bool TMoverParameters::DecMainCtrl(int CtrlSpeed) { MainCtrlPos--; OK = true; + if ((EIMCtrlType == 0) && (SpeedCtrlAutoTurnOffFlag == 1) && (MainCtrlActualPos != MainCtrlPos)) + DecScndCtrl(2); } else if (CtrlSpeed > 1) OK = (DecMainCtrl(1) && DecMainCtrl(2)); // CtrlSpeed-1); @@ -1994,7 +1998,7 @@ bool TMoverParameters::IncScndCtrl(int CtrlSpeed) if (LastRelayTime > CtrlDelay) LastRelayTime = 0; - if ((OK) && (EngineType == TEngineType::ElectricInductionMotor) && (ScndCtrlPosNo == 1)) + if ((OK) && (EngineType == TEngineType::ElectricInductionMotor) && (ScndCtrlPosNo == 1) && (MainCtrlPos>0)) { // NOTE: round() already adds 0.5, are the ones added here as well correct? if ((Vmax < 250)) @@ -6130,15 +6134,6 @@ void TMoverParameters::CheckSpeedCtrl() eimicSpeedCtrl = clamp(0.5 * (ScndCtrlActualPos * 2 - Vel), -1.0, 1.0); else eimicSpeedCtrl = 1; - if ((EIMCtrlType == 0) && (SpeedCtrlAutoTurnOffFlag == 1) && (MainCtrlActualPos != MainCtrlPos)) - { - DecScndCtrl(1); - if (CabNo == 0) - { - SendCtrlToNext("ScndCtrl", ScndCtrlPos, 1); - SendCtrlToNext("ScndCtrl", ScndCtrlPos, -1); - } - } } // *************************************************************************************************