diff --git a/McZapkie/MOVER.h b/McZapkie/MOVER.h index 57d948a1..53824bca 100644 --- a/McZapkie/MOVER.h +++ b/McZapkie/MOVER.h @@ -1289,7 +1289,7 @@ public: /*! pomocniczy nastawnik:*/ bool IncScndCtrl(int CtrlSpeed); bool DecScndCtrl(int CtrlSpeed); - + int GetVirtualScndPos(); bool AddPulseForce(int Multipler);/*dla drezyny*/ diff --git a/McZapkie/Mover.cpp b/McZapkie/Mover.cpp index 41604915..6ef5f41f 100644 --- a/McZapkie/Mover.cpp +++ b/McZapkie/Mover.cpp @@ -2064,6 +2064,16 @@ bool TMoverParameters::DecScndCtrl(int CtrlSpeed) return OK; } +int TMoverParameters::GetVirtualScndPos() +{ + if (TrainType == dt_ET42) + { + if (DynamicBrakeFlag && !ScndCtrlPos) + return -1; + } + return ScndCtrlPos; +} + // ************************************************************************************************* // Q: 20160710 // załączenie rozrządu diff --git a/Train.cpp b/Train.cpp index ec1b4ed4..c5c96a7b 100644 --- a/Train.cpp +++ b/Train.cpp @@ -898,14 +898,13 @@ void TTrain::OnCommand_secondcontrollerdecreasefast( TTrain *Train, command_data } void TTrain::OnCommand_secondcontrollerset( TTrain *Train, command_data const &Command ) { - auto const targetposition { std::min( Command.param1, Train->mvControlled->ScndCtrlPosNo ) }; - while( ( targetposition < Train->mvControlled->ScndCtrlPos ) + while( ( targetposition < Train->mvControlled->GetVirtualScndPos() ) && ( true == Train->mvControlled->DecScndCtrl( 1 ) ) ) { // all work is done in the header ; } - while( ( targetposition > Train->mvControlled->ScndCtrlPos ) + while( ( targetposition > Train->mvControlled->GetVirtualScndPos() ) && ( true == Train->mvControlled->IncScndCtrl( 1 ) ) ) { // all work is done in the header ; diff --git a/uart.cpp b/uart.cpp index 01a2b6cf..ab4b2b8c 100644 --- a/uart.cpp +++ b/uart.cpp @@ -197,7 +197,7 @@ void uart_input::poll() // second controller relay.post( user_command::secondcontrollerset, - buffer[ 7 ], + static_cast(buffer[ 7 ]), 0, GLFW_PRESS, // TODO: pass correct entity id once the missing systems are in place