mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 10:29:19 +02:00
build 190504. pantograph compressor start method, door control mode support, impulse type battery switch support, disconnect ai logic tweak
This commit is contained in:
21
Driver.cpp
21
Driver.cpp
@@ -4176,6 +4176,7 @@ TController::UpdateSituation(double dt) {
|
|||||||
// HACK: activate route scanning if an idling vehicle is activated by a human user
|
// HACK: activate route scanning if an idling vehicle is activated by a human user
|
||||||
if( ( OrderCurrentGet() == Wait_for_orders )
|
if( ( OrderCurrentGet() == Wait_for_orders )
|
||||||
&& ( false == AIControllFlag )
|
&& ( false == AIControllFlag )
|
||||||
|
&& ( false == iEngineActive )
|
||||||
&& ( true == mvControlling->Battery ) ) {
|
&& ( true == mvControlling->Battery ) ) {
|
||||||
OrderNext( Prepare_engine );
|
OrderNext( Prepare_engine );
|
||||||
}
|
}
|
||||||
@@ -5004,9 +5005,14 @@ TController::UpdateSituation(double dt) {
|
|||||||
// jeśli dociskanie w celu odczepienia
|
// jeśli dociskanie w celu odczepienia
|
||||||
// 3. faza odczepiania.
|
// 3. faza odczepiania.
|
||||||
SetVelocity(2, 0); // jazda w ustawionym kierunku z prędkością 2
|
SetVelocity(2, 0); // jazda w ustawionym kierunku z prędkością 2
|
||||||
if( ( mvControlling->MainCtrlPowerPos() > 0 )
|
if( iVehicleCount >= 0 ) {
|
||||||
|| ( mvOccupied->BrakeSystem == TBrakeSystem::ElectroPneumatic ) ) {
|
// zmieni się po odczepieniu
|
||||||
// jeśli jazda
|
WriteLog( mvOccupied->Name + " dociskanie..." );
|
||||||
|
while( mvOccupied->DecLocalBrakeLevel( 1 ) ) { // dociśnij sklad
|
||||||
|
;
|
||||||
|
}
|
||||||
|
IncSpeed();
|
||||||
|
}
|
||||||
WriteLog(mvOccupied->Name + " odczepianie w kierunku " + std::to_string(mvOccupied->DirAbsolute));
|
WriteLog(mvOccupied->Name + " odczepianie w kierunku " + std::to_string(mvOccupied->DirAbsolute));
|
||||||
TDynamicObject *p = pVehicle; // pojazd do odczepienia, w (pVehicle) siedzi AI
|
TDynamicObject *p = pVehicle; // pojazd do odczepienia, w (pVehicle) siedzi AI
|
||||||
int d; // numer sprzęgu, który sprawdzamy albo odczepiamy
|
int d; // numer sprzęgu, który sprawdzamy albo odczepiamy
|
||||||
@@ -5044,15 +5050,6 @@ TController::UpdateSituation(double dt) {
|
|||||||
iVehicleCount = -2;
|
iVehicleCount = -2;
|
||||||
} // a jak nie, to dociskać dalej
|
} // a jak nie, to dociskać dalej
|
||||||
}
|
}
|
||||||
if (iVehicleCount >= 0) // zmieni się po odczepieniu
|
|
||||||
if (!mvOccupied->DecLocalBrakeLevel(1))
|
|
||||||
{ // dociśnij sklad
|
|
||||||
WriteLog( mvOccupied->Name + " dociskanie..." );
|
|
||||||
// mvOccupied->BrakeReleaser(); //wyluzuj lokomotywę
|
|
||||||
// Ready=true; //zamiast sprawdzenia odhamowania całego składu
|
|
||||||
IncSpeed(); // dla (Ready)==false nie ruszy
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((mvOccupied->Vel < 0.01) && !(iDrivigFlags & movePress))
|
if ((mvOccupied->Vel < 0.01) && !(iDrivigFlags & movePress))
|
||||||
{ // 2. faza odczepiania: zmień kierunek na przeciwny i dociśnij
|
{ // 2. faza odczepiania: zmień kierunek na przeciwny i dociśnij
|
||||||
// za radą yB ustawiamy pozycję 3 kranu (ruszanie kranem w innych miejscach
|
// za radą yB ustawiamy pozycję 3 kranu (ruszanie kranem w innych miejscach
|
||||||
|
|||||||
@@ -766,6 +766,7 @@ private:
|
|||||||
// ld inputs
|
// ld inputs
|
||||||
bool lock_enabled { true };
|
bool lock_enabled { true };
|
||||||
bool step_enabled { true };
|
bool step_enabled { true };
|
||||||
|
bool remote_only { false }; // door ignores local control signals
|
||||||
// internal data
|
// internal data
|
||||||
int permit_preset { -1 }; // curent position of preset selection switch
|
int permit_preset { -1 }; // curent position of preset selection switch
|
||||||
// vehicle parts
|
// vehicle parts
|
||||||
@@ -1162,6 +1163,7 @@ public:
|
|||||||
bool CompressorAllowLocal{ true }; // local device state override (most units don't have this fitted so it's set to true not to intefere)
|
bool CompressorAllowLocal{ true }; // local device state override (most units don't have this fitted so it's set to true not to intefere)
|
||||||
bool CompressorGovernorLock{ false }; // indicates whether compressor pressure switch was activated due to reaching cut-out pressure
|
bool CompressorGovernorLock{ false }; // indicates whether compressor pressure switch was activated due to reaching cut-out pressure
|
||||||
start_t CompressorStart{ start_t::manual }; // whether the compressor is started manually, or another way
|
start_t CompressorStart{ start_t::manual }; // whether the compressor is started manually, or another way
|
||||||
|
start_t PantographCompressorStart{ start_t::manual };
|
||||||
// TODO converter parameters, for when we start cleaning up mover parameters
|
// TODO converter parameters, for when we start cleaning up mover parameters
|
||||||
start_t ConverterStart{ start_t::manual }; // whether converter is started manually, or by other means
|
start_t ConverterStart{ start_t::manual }; // whether converter is started manually, or by other means
|
||||||
float ConverterStartDelay{ 0.0f }; // delay (in seconds) before the converter is started, once its activation conditions are met
|
float ConverterStartDelay{ 0.0f }; // delay (in seconds) before the converter is started, once its activation conditions are met
|
||||||
@@ -1344,8 +1346,6 @@ public:
|
|||||||
bool PantRearUp = false;
|
bool PantRearUp = false;
|
||||||
bool PantFrontSP = true; //dzwiek patykow 'Winger 010304
|
bool PantFrontSP = true; //dzwiek patykow 'Winger 010304
|
||||||
bool PantRearSP = true;
|
bool PantRearSP = true;
|
||||||
int PantFrontStart = 0; //stan patykow 'Winger 160204
|
|
||||||
int PantRearStart = 0;
|
|
||||||
double PantFrontVolt = 0.0; //pantograf pod napieciem? 'Winger 160404
|
double PantFrontVolt = 0.0; //pantograf pod napieciem? 'Winger 160404
|
||||||
double PantRearVolt = 0.0;
|
double PantRearVolt = 0.0;
|
||||||
// TODO: move these switch types where they belong, cabin definition
|
// TODO: move these switch types where they belong, cabin definition
|
||||||
@@ -1553,6 +1553,7 @@ public:
|
|||||||
bool PermitDoors( side const Door, bool const State = true, range_t const Notify = range_t::consist );
|
bool PermitDoors( side const Door, bool const State = true, range_t const Notify = range_t::consist );
|
||||||
bool ChangeDoorPermitPreset( int const Change, range_t const Notify = range_t::consist );
|
bool ChangeDoorPermitPreset( int const Change, range_t const Notify = range_t::consist );
|
||||||
bool PermitDoorStep( bool const State, range_t const Notify = range_t::consist );
|
bool PermitDoorStep( bool const State, range_t const Notify = range_t::consist );
|
||||||
|
bool ChangeDoorControlMode( bool const State, range_t const Notify = range_t::consist );
|
||||||
bool OperateDoors( side const Door, bool const State, range_t const Notify = range_t::consist );
|
bool OperateDoors( side const Door, bool const State, range_t const Notify = range_t::consist );
|
||||||
bool LockDoors( bool const State, range_t const Notify = range_t::consist );
|
bool LockDoors( bool const State, range_t const Notify = range_t::consist );
|
||||||
bool signal_departure( bool const State, range_t const Notify = range_t::consist ); // toggles departure warning
|
bool signal_departure( bool const State, range_t const Notify = range_t::consist ); // toggles departure warning
|
||||||
|
|||||||
@@ -653,12 +653,19 @@ void TMoverParameters::UpdatePantVolume(double dt)
|
|||||||
{ // KURS90 - sprężarka pantografów; Ra 2014-07: teraz jest to zbiornik rozrządu, chociaż to jeszcze nie tak
|
{ // KURS90 - sprężarka pantografów; Ra 2014-07: teraz jest to zbiornik rozrządu, chociaż to jeszcze nie tak
|
||||||
|
|
||||||
// check the pantograph compressor while at it
|
// check the pantograph compressor while at it
|
||||||
if( PantCompFlag ) {
|
if( ( PantPress < 4.2 )
|
||||||
if( ( false == Battery )
|
&& ( ( PantographCompressorStart == start_t::automatic )
|
||||||
|
|| ( PantographCompressorStart == start_t::manualwithautofallback ) )
|
||||||
|
&& ( ( true == PantRearUp )
|
||||||
|
|| ( true == PantFrontUp ) ) ) {
|
||||||
|
// automatic start if the pressure is too low
|
||||||
|
PantCompFlag = true;
|
||||||
|
}
|
||||||
|
if( ( true == PantCompFlag )
|
||||||
|
&& ( false == Battery )
|
||||||
&& ( false == ConverterFlag ) ) {
|
&& ( false == ConverterFlag ) ) {
|
||||||
PantCompFlag = false;
|
PantCompFlag = false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (EnginePowerSource.SourceType == TPowerSource::CurrentCollector) // tylko jeśli pantografujący
|
if (EnginePowerSource.SourceType == TPowerSource::CurrentCollector) // tylko jeśli pantografujący
|
||||||
{
|
{
|
||||||
@@ -5916,7 +5923,6 @@ bool TMoverParameters::PantFront( bool const State, range_t const Notify )
|
|||||||
if( PantFrontUp != State ) {
|
if( PantFrontUp != State ) {
|
||||||
PantFrontUp = State;
|
PantFrontUp = State;
|
||||||
if( State == true ) {
|
if( State == true ) {
|
||||||
PantFrontStart = 0;
|
|
||||||
if( Notify != range_t::local ) {
|
if( Notify != range_t::local ) {
|
||||||
// wysłanie wyłączenia do pozostałych?
|
// wysłanie wyłączenia do pozostałych?
|
||||||
SendCtrlToNext(
|
SendCtrlToNext(
|
||||||
@@ -5927,7 +5933,6 @@ bool TMoverParameters::PantFront( bool const State, range_t const Notify )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
PantFrontStart = 1;
|
|
||||||
if( Notify != range_t::local ) {
|
if( Notify != range_t::local ) {
|
||||||
// wysłanie wyłączenia do pozostałych?
|
// wysłanie wyłączenia do pozostałych?
|
||||||
SendCtrlToNext(
|
SendCtrlToNext(
|
||||||
@@ -5969,7 +5974,6 @@ bool TMoverParameters::PantRear( bool const State, range_t const Notify )
|
|||||||
if( PantRearUp != State ) {
|
if( PantRearUp != State ) {
|
||||||
PantRearUp = State;
|
PantRearUp = State;
|
||||||
if( State == true ) {
|
if( State == true ) {
|
||||||
PantRearStart = 0;
|
|
||||||
if( Notify != range_t::local ) {
|
if( Notify != range_t::local ) {
|
||||||
// wysłanie wyłączenia do pozostałych?
|
// wysłanie wyłączenia do pozostałych?
|
||||||
SendCtrlToNext(
|
SendCtrlToNext(
|
||||||
@@ -5980,7 +5984,6 @@ bool TMoverParameters::PantRear( bool const State, range_t const Notify )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
PantRearStart = 1;
|
|
||||||
if( Notify != range_t::local ) {
|
if( Notify != range_t::local ) {
|
||||||
// wysłanie wyłączenia do pozostałych?
|
// wysłanie wyłączenia do pozostałych?
|
||||||
SendCtrlToNext(
|
SendCtrlToNext(
|
||||||
@@ -6913,12 +6916,7 @@ bool TMoverParameters::PermitDoors( side const Door, bool const State, range_t c
|
|||||||
|
|
||||||
bool const initialstate { Doors.instances[Door].open_permit };
|
bool const initialstate { Doors.instances[Door].open_permit };
|
||||||
|
|
||||||
if( ( false == Doors.permit_presets.empty() ) // HACK: for cases where preset switch is used before battery
|
|
||||||
|| ( ( true == Battery )
|
|
||||||
&& ( false == Doors.is_locked ) ) ) {
|
|
||||||
|
|
||||||
Doors.instances[ Door ].open_permit = State;
|
Doors.instances[ Door ].open_permit = State;
|
||||||
}
|
|
||||||
|
|
||||||
if( Notify != range_t::local ) {
|
if( Notify != range_t::local ) {
|
||||||
|
|
||||||
@@ -6937,6 +6935,34 @@ bool TMoverParameters::PermitDoors( side const Door, bool const State, range_t c
|
|||||||
return ( Doors.instances[ Door ].open_permit != initialstate );
|
return ( Doors.instances[ Door ].open_permit != initialstate );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TMoverParameters::ChangeDoorControlMode( bool const State, range_t const Notify ) {
|
||||||
|
|
||||||
|
auto const initialstate { Doors.remote_only };
|
||||||
|
|
||||||
|
Doors.remote_only = State;
|
||||||
|
if( Notify != range_t::local ) {
|
||||||
|
// wysłanie wyłączenia do pozostałych?
|
||||||
|
SendCtrlToNext(
|
||||||
|
"DoorMode",
|
||||||
|
( State == true ?
|
||||||
|
1 :
|
||||||
|
0 ),
|
||||||
|
CabNo,
|
||||||
|
( Notify == range_t::unit ?
|
||||||
|
coupling::control | coupling::permanent :
|
||||||
|
coupling::control ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( true == State ) {
|
||||||
|
// when door are put in remote control mode they're automatically open
|
||||||
|
// TBD, TODO: make it dependant on config switch?
|
||||||
|
OperateDoors( side::left, true );
|
||||||
|
OperateDoors( side::right, true );
|
||||||
|
}
|
||||||
|
|
||||||
|
return ( Doors.step_enabled != initialstate );
|
||||||
|
}
|
||||||
|
|
||||||
bool TMoverParameters::OperateDoors( side const Door, bool const State, range_t const Notify ) {
|
bool TMoverParameters::OperateDoors( side const Door, bool const State, range_t const Notify ) {
|
||||||
|
|
||||||
auto &door { Doors.instances[ Door ] };
|
auto &door { Doors.instances[ Door ] };
|
||||||
@@ -7044,15 +7070,17 @@ TMoverParameters::update_doors( double const Deltatime ) {
|
|||||||
|
|
||||||
// NBMX Obsluga drzwi, MC: zuniwersalnione
|
// NBMX Obsluga drzwi, MC: zuniwersalnione
|
||||||
auto const localopencontrol {
|
auto const localopencontrol {
|
||||||
( Doors.open_control == control_t::passenger )
|
( false == Doors.remote_only )
|
||||||
|| ( Doors.open_control == control_t::mixed ) };
|
&& ( ( Doors.open_control == control_t::passenger )
|
||||||
|
|| ( Doors.open_control == control_t::mixed ) ) };
|
||||||
auto const remoteopencontrol {
|
auto const remoteopencontrol {
|
||||||
( Doors.open_control == control_t::driver )
|
( Doors.open_control == control_t::driver )
|
||||||
|| ( Doors.open_control == control_t::conductor )
|
|| ( Doors.open_control == control_t::conductor )
|
||||||
|| ( Doors.open_control == control_t::mixed ) };
|
|| ( Doors.open_control == control_t::mixed ) };
|
||||||
auto const localclosecontrol {
|
auto const localclosecontrol {
|
||||||
( Doors.close_control == control_t::passenger )
|
( false == Doors.remote_only )
|
||||||
|| ( Doors.close_control == control_t::mixed ) };
|
&& ( ( Doors.close_control == control_t::passenger )
|
||||||
|
|| ( Doors.close_control == control_t::mixed ) ) };
|
||||||
auto const remoteclosecontrol {
|
auto const remoteclosecontrol {
|
||||||
( Doors.close_control == control_t::driver )
|
( Doors.close_control == control_t::driver )
|
||||||
|| ( Doors.close_control == control_t::conductor )
|
|| ( Doors.close_control == control_t::conductor )
|
||||||
@@ -7080,7 +7108,7 @@ TMoverParameters::update_doors( double const Deltatime ) {
|
|||||||
&& ( door.step_position <= 0.f );
|
&& ( door.step_position <= 0.f );
|
||||||
|
|
||||||
door.local_open = door.local_open && ( false == door.is_open ) && ( ( false == Doors.permit_needed ) || door.open_permit );
|
door.local_open = door.local_open && ( false == door.is_open ) && ( ( false == Doors.permit_needed ) || door.open_permit );
|
||||||
door.remote_open = door.remote_open && ( false == door.is_open ) && ( ( false == Doors.permit_needed ) || door.open_permit );
|
door.remote_open = ( door.remote_open || Doors.remote_only ) && ( false == door.is_open ) && ( ( false == Doors.permit_needed ) || door.open_permit );
|
||||||
door.local_close = door.local_close && ( false == door.is_closed );
|
door.local_close = door.local_close && ( false == door.is_closed );
|
||||||
door.remote_close = door.remote_close && ( false == door.is_closed );
|
door.remote_close = door.remote_close && ( false == door.is_closed );
|
||||||
|
|
||||||
@@ -8732,6 +8760,14 @@ void TMoverParameters::LoadFIZ_Cntrl( std::string const &line ) {
|
|||||||
lookup->second :
|
lookup->second :
|
||||||
start_t::manual;
|
start_t::manual;
|
||||||
}
|
}
|
||||||
|
// pantograph compressor
|
||||||
|
{
|
||||||
|
auto lookup = starts.find( extract_value( "PantCompressorStart", line ) );
|
||||||
|
PantographCompressorStart =
|
||||||
|
lookup != starts.end() ?
|
||||||
|
lookup->second :
|
||||||
|
start_t::manual;
|
||||||
|
}
|
||||||
// fuel pump
|
// fuel pump
|
||||||
{
|
{
|
||||||
auto lookup = starts.find( extract_value( "FuelStart", line ) );
|
auto lookup = starts.find( extract_value( "FuelStart", line ) );
|
||||||
@@ -10046,6 +10082,13 @@ bool TMoverParameters::RunCommand( std::string Command, double CValue1, double C
|
|||||||
false );
|
false );
|
||||||
OK = SendCtrlToNext( Command, CValue1, CValue2, Couplertype );
|
OK = SendCtrlToNext( Command, CValue1, CValue2, Couplertype );
|
||||||
}
|
}
|
||||||
|
else if( Command == "DoorMode" ) {
|
||||||
|
Doors.remote_only = (
|
||||||
|
CValue1 == 1 ?
|
||||||
|
true :
|
||||||
|
false );
|
||||||
|
OK = SendCtrlToNext( Command, CValue1, CValue2, Couplertype );
|
||||||
|
}
|
||||||
else if( Command == "DepartureSignal" ) {
|
else if( Command == "DepartureSignal" ) {
|
||||||
DepartureSignal = (
|
DepartureSignal = (
|
||||||
CValue1 == 1 ?
|
CValue1 == 1 ?
|
||||||
@@ -10062,12 +10105,10 @@ bool TMoverParameters::RunCommand( std::string Command, double CValue1, double C
|
|||||||
if ((CValue1 == 1))
|
if ((CValue1 == 1))
|
||||||
{
|
{
|
||||||
PantFrontUp = true;
|
PantFrontUp = true;
|
||||||
PantFrontStart = 0;
|
|
||||||
}
|
}
|
||||||
else if ((CValue1 == 0))
|
else if ((CValue1 == 0))
|
||||||
{
|
{
|
||||||
PantFrontUp = false;
|
PantFrontUp = false;
|
||||||
PantFrontStart = 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -10077,24 +10118,20 @@ bool TMoverParameters::RunCommand( std::string Command, double CValue1, double C
|
|||||||
(TestFlag(Couplers[0].CouplingFlag, ctrain_controll) && (CValue2 == -1)))
|
(TestFlag(Couplers[0].CouplingFlag, ctrain_controll) && (CValue2 == -1)))
|
||||||
{
|
{
|
||||||
PantFrontUp = true;
|
PantFrontUp = true;
|
||||||
PantFrontStart = 0;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PantRearUp = true;
|
PantRearUp = true;
|
||||||
PantRearStart = 0;
|
|
||||||
}
|
}
|
||||||
else if ((CValue1 == 0))
|
else if ((CValue1 == 0))
|
||||||
if ((TestFlag(Couplers[1].CouplingFlag, ctrain_controll) && (CValue2 == 1)) ||
|
if ((TestFlag(Couplers[1].CouplingFlag, ctrain_controll) && (CValue2 == 1)) ||
|
||||||
(TestFlag(Couplers[0].CouplingFlag, ctrain_controll) && (CValue2 == -1)))
|
(TestFlag(Couplers[0].CouplingFlag, ctrain_controll) && (CValue2 == -1)))
|
||||||
{
|
{
|
||||||
PantFrontUp = false;
|
PantFrontUp = false;
|
||||||
PantFrontStart = 1;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PantRearUp = false;
|
PantRearUp = false;
|
||||||
PantRearStart = 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
OK = SendCtrlToNext( Command, CValue1, CValue2, Couplertype );
|
OK = SendCtrlToNext( Command, CValue1, CValue2, Couplertype );
|
||||||
@@ -10107,12 +10144,10 @@ bool TMoverParameters::RunCommand( std::string Command, double CValue1, double C
|
|||||||
if ((CValue1 == 1))
|
if ((CValue1 == 1))
|
||||||
{
|
{
|
||||||
PantRearUp = true;
|
PantRearUp = true;
|
||||||
PantRearStart = 0;
|
|
||||||
}
|
}
|
||||||
else if ((CValue1 == 0))
|
else if ((CValue1 == 0))
|
||||||
{
|
{
|
||||||
PantRearUp = false;
|
PantRearUp = false;
|
||||||
PantRearStart = 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -10123,24 +10158,20 @@ bool TMoverParameters::RunCommand( std::string Command, double CValue1, double C
|
|||||||
(TestFlag(Couplers[0].CouplingFlag, ctrain_controll) && (CValue2 == -1)))
|
(TestFlag(Couplers[0].CouplingFlag, ctrain_controll) && (CValue2 == -1)))
|
||||||
{
|
{
|
||||||
PantRearUp = true;
|
PantRearUp = true;
|
||||||
PantRearStart = 0;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PantFrontUp = true;
|
PantFrontUp = true;
|
||||||
PantFrontStart = 0;
|
|
||||||
}
|
}
|
||||||
else if ((CValue1 == 0))
|
else if ((CValue1 == 0))
|
||||||
if ((TestFlag(Couplers[1].CouplingFlag, ctrain_controll) && (CValue2 == 1)) ||
|
if ((TestFlag(Couplers[1].CouplingFlag, ctrain_controll) && (CValue2 == 1)) ||
|
||||||
(TestFlag(Couplers[0].CouplingFlag, ctrain_controll) && (CValue2 == -1)))
|
(TestFlag(Couplers[0].CouplingFlag, ctrain_controll) && (CValue2 == -1)))
|
||||||
{
|
{
|
||||||
PantRearUp = false;
|
PantRearUp = false;
|
||||||
PantRearStart = 1;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PantFrontUp = false;
|
PantFrontUp = false;
|
||||||
PantFrontStart = 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
OK = SendCtrlToNext( Command, CValue1, CValue2, Couplertype );
|
OK = SendCtrlToNext( Command, CValue1, CValue2, Couplertype );
|
||||||
|
|||||||
58
Train.cpp
58
Train.cpp
@@ -327,6 +327,7 @@ TTrain::commandhandler_map const TTrain::m_commandhandlers = {
|
|||||||
{ user_command::dooropenall, &TTrain::OnCommand_dooropenall },
|
{ user_command::dooropenall, &TTrain::OnCommand_dooropenall },
|
||||||
{ user_command::doorcloseall, &TTrain::OnCommand_doorcloseall },
|
{ user_command::doorcloseall, &TTrain::OnCommand_doorcloseall },
|
||||||
{ user_command::doorsteptoggle, &TTrain::OnCommand_doorsteptoggle },
|
{ user_command::doorsteptoggle, &TTrain::OnCommand_doorsteptoggle },
|
||||||
|
{ user_command::doormodetoggle, &TTrain::OnCommand_doormodetoggle },
|
||||||
{ user_command::carcouplingincrease, &TTrain::OnCommand_carcouplingincrease },
|
{ user_command::carcouplingincrease, &TTrain::OnCommand_carcouplingincrease },
|
||||||
{ user_command::carcouplingdisconnect, &TTrain::OnCommand_carcouplingdisconnect },
|
{ user_command::carcouplingdisconnect, &TTrain::OnCommand_carcouplingdisconnect },
|
||||||
{ user_command::departureannounce, &TTrain::OnCommand_departureannounce },
|
{ user_command::departureannounce, &TTrain::OnCommand_departureannounce },
|
||||||
@@ -778,7 +779,7 @@ void TTrain::OnCommand_mastercontrollerincrease( TTrain *Train, command_data con
|
|||||||
if( Command.action != GLFW_RELEASE ) {
|
if( Command.action != GLFW_RELEASE ) {
|
||||||
// on press or hold
|
// on press or hold
|
||||||
if( ( Train->ggJointCtrl.SubModel != nullptr )
|
if( ( Train->ggJointCtrl.SubModel != nullptr )
|
||||||
&& ( Train->mvControlled->LocalBrakePosA > 0.0 ) ) {
|
&& ( Train->mvOccupied->LocalBrakePosA > 0.0 ) ) {
|
||||||
OnCommand_independentbrakedecrease( Train, Command );
|
OnCommand_independentbrakedecrease( Train, Command );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -798,7 +799,7 @@ void TTrain::OnCommand_mastercontrollerincreasefast( TTrain *Train, command_data
|
|||||||
if( Command.action != GLFW_RELEASE ) {
|
if( Command.action != GLFW_RELEASE ) {
|
||||||
// on press or hold
|
// on press or hold
|
||||||
if( ( Train->ggJointCtrl.SubModel != nullptr )
|
if( ( Train->ggJointCtrl.SubModel != nullptr )
|
||||||
&& ( Train->mvControlled->LocalBrakePosA > 0.0 ) ) {
|
&& ( Train->mvOccupied->LocalBrakePosA > 0.0 ) ) {
|
||||||
OnCommand_independentbrakedecreasefast( Train, Command );
|
OnCommand_independentbrakedecreasefast( Train, Command );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -1722,10 +1723,11 @@ void TTrain::OnCommand_alerteracknowledge( TTrain *Train, command_data const &Co
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: replace battery with a two-state device, update switch code accordingly
|
||||||
void TTrain::OnCommand_batterytoggle( TTrain *Train, command_data const &Command ) {
|
void TTrain::OnCommand_batterytoggle( TTrain *Train, command_data const &Command ) {
|
||||||
|
|
||||||
if( Command.action == GLFW_PRESS ) {
|
if( Command.action != GLFW_REPEAT ) {
|
||||||
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
// keep the switch from flipping back and forth if key is held down
|
||||||
if( false == Train->mvOccupied->Battery ) {
|
if( false == Train->mvOccupied->Battery ) {
|
||||||
// turn on
|
// turn on
|
||||||
OnCommand_batteryenable( Train, Command );
|
OnCommand_batteryenable( Train, Command );
|
||||||
@@ -1739,16 +1741,13 @@ void TTrain::OnCommand_batterytoggle( TTrain *Train, command_data const &Command
|
|||||||
|
|
||||||
void TTrain::OnCommand_batteryenable( TTrain *Train, command_data const &Command ) {
|
void TTrain::OnCommand_batteryenable( TTrain *Train, command_data const &Command ) {
|
||||||
|
|
||||||
|
if( Command.action == GLFW_PRESS ) {
|
||||||
|
// visual feedback
|
||||||
|
Train->ggBatteryButton.UpdateValue( 1.0, Train->dsbSwitch );
|
||||||
|
|
||||||
if( true == Train->mvOccupied->Battery ) { return; } // already on
|
if( true == Train->mvOccupied->Battery ) { return; } // already on
|
||||||
|
|
||||||
if( Command.action == GLFW_PRESS ) {
|
|
||||||
// ignore repeats
|
|
||||||
// wyłącznik jest też w SN61, ewentualnie załączać prąd na stałe z poziomu FIZ
|
|
||||||
if( Train->mvOccupied->BatterySwitch( true ) ) {
|
if( Train->mvOccupied->BatterySwitch( true ) ) {
|
||||||
// bateria potrzebna np. do zapalenia świateł
|
|
||||||
if( Train->ggBatteryButton.SubModel ) {
|
|
||||||
Train->ggBatteryButton.UpdateValue( 1.0, Train->dsbSwitch );
|
|
||||||
}
|
|
||||||
// side-effects
|
// side-effects
|
||||||
if( Train->mvOccupied->LightsPosNo > 0 ) {
|
if( Train->mvOccupied->LightsPosNo > 0 ) {
|
||||||
Train->SetLights();
|
Train->SetLights();
|
||||||
@@ -1760,19 +1759,23 @@ void TTrain::OnCommand_batteryenable( TTrain *Train, command_data const &Command
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if( Command.action == GLFW_RELEASE ) {
|
||||||
|
if( Train->ggBatteryButton.type() == TGaugeType::push ) {
|
||||||
|
// return the switch to neutral position
|
||||||
|
Train->ggBatteryButton.UpdateValue( 0.5f );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TTrain::OnCommand_batterydisable( TTrain *Train, command_data const &Command ) {
|
void TTrain::OnCommand_batterydisable( TTrain *Train, command_data const &Command ) {
|
||||||
|
// TBD, TODO: ewentualnie zablokować z FIZ, np. w samochodach się nie odłącza akumulatora
|
||||||
|
if( Command.action == GLFW_PRESS ) {
|
||||||
|
// visual feedback
|
||||||
|
Train->ggBatteryButton.UpdateValue( 0.0, Train->dsbSwitch );
|
||||||
|
|
||||||
if( false == Train->mvOccupied->Battery ) { return; } // already off
|
if( false == Train->mvOccupied->Battery ) { return; } // already off
|
||||||
|
|
||||||
if( Command.action == GLFW_PRESS ) {
|
|
||||||
// ignore repeats
|
|
||||||
if( Train->mvOccupied->BatterySwitch( false ) ) {
|
if( Train->mvOccupied->BatterySwitch( false ) ) {
|
||||||
// ewentualnie zablokować z FIZ, np. w samochodach się nie odłącza akumulatora
|
|
||||||
if( Train->ggBatteryButton.SubModel ) {
|
|
||||||
Train->ggBatteryButton.UpdateValue( 0.0, Train->dsbSwitch );
|
|
||||||
}
|
|
||||||
// side-effects
|
// side-effects
|
||||||
if( false == Train->mvControlled->ConverterFlag ) {
|
if( false == Train->mvControlled->ConverterFlag ) {
|
||||||
// if there's no (low voltage) power source left, drop pantographs
|
// if there's no (low voltage) power source left, drop pantographs
|
||||||
@@ -1781,6 +1784,12 @@ void TTrain::OnCommand_batterydisable( TTrain *Train, command_data const &Comman
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if( Command.action == GLFW_RELEASE ) {
|
||||||
|
if( Train->ggBatteryButton.type() == TGaugeType::push ) {
|
||||||
|
// return the switch to neutral position
|
||||||
|
Train->ggBatteryButton.UpdateValue( 0.5f );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TTrain::OnCommand_pantographtogglefront( TTrain *Train, command_data const &Command ) {
|
void TTrain::OnCommand_pantographtogglefront( TTrain *Train, command_data const &Command ) {
|
||||||
@@ -4725,6 +4734,13 @@ void TTrain::OnCommand_doorsteptoggle( TTrain *Train, command_data const &Comman
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TTrain::OnCommand_doormodetoggle( TTrain *Train, command_data const &Command ) {
|
||||||
|
|
||||||
|
if( Command.action == GLFW_PRESS ) {
|
||||||
|
Train->mvOccupied->ChangeDoorControlMode( false == Train->mvOccupied->Doors.remote_only );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void TTrain::OnCommand_carcouplingincrease( TTrain *Train, command_data const &Command ) {
|
void TTrain::OnCommand_carcouplingincrease( TTrain *Train, command_data const &Command ) {
|
||||||
|
|
||||||
if( ( true == FreeFlyModeFlag )
|
if( ( true == FreeFlyModeFlag )
|
||||||
@@ -7456,9 +7472,10 @@ void TTrain::clear_cab_controls()
|
|||||||
void TTrain::set_cab_controls( int const Cab ) {
|
void TTrain::set_cab_controls( int const Cab ) {
|
||||||
// switches
|
// switches
|
||||||
// battery
|
// battery
|
||||||
if( true == mvOccupied->Battery ) {
|
ggBatteryButton.PutValue(
|
||||||
ggBatteryButton.PutValue( 1.f );
|
( ggBatteryButton.type() == TGaugeType::push ? 0.5f :
|
||||||
}
|
mvOccupied->Battery ? 1.f :
|
||||||
|
0.f ) );
|
||||||
// motor connectors
|
// motor connectors
|
||||||
ggStLinOffButton.PutValue(
|
ggStLinOffButton.PutValue(
|
||||||
( mvControlled->StLinSwitchOff ?
|
( mvControlled->StLinSwitchOff ?
|
||||||
@@ -8026,6 +8043,7 @@ bool TTrain::initialize_gauge(cParser &Parser, std::string const &Label, int con
|
|||||||
}
|
}
|
||||||
// TODO: move viable dedicated gauges to the automatic array
|
// TODO: move viable dedicated gauges to the automatic array
|
||||||
std::unordered_map<std::string, bool *> const autoboolgauges = {
|
std::unordered_map<std::string, bool *> const autoboolgauges = {
|
||||||
|
{ "doormode_sw:", &mvOccupied->Doors.remote_only },
|
||||||
{ "doorstep_sw:", &mvOccupied->Doors.step_enabled },
|
{ "doorstep_sw:", &mvOccupied->Doors.step_enabled },
|
||||||
{ "coolingfans_sw:", &mvControlled->RVentForceOn }
|
{ "coolingfans_sw:", &mvControlled->RVentForceOn }
|
||||||
};
|
};
|
||||||
|
|||||||
1
Train.h
1
Train.h
@@ -329,6 +329,7 @@ class TTrain
|
|||||||
static void OnCommand_dooropenall( TTrain *Train, command_data const &Command );
|
static void OnCommand_dooropenall( TTrain *Train, command_data const &Command );
|
||||||
static void OnCommand_doorcloseall( TTrain *Train, command_data const &Command );
|
static void OnCommand_doorcloseall( TTrain *Train, command_data const &Command );
|
||||||
static void OnCommand_doorsteptoggle( TTrain *Train, command_data const &Command );
|
static void OnCommand_doorsteptoggle( TTrain *Train, command_data const &Command );
|
||||||
|
static void OnCommand_doormodetoggle( TTrain *Train, command_data const &Command );
|
||||||
static void OnCommand_carcouplingincrease( TTrain *Train, command_data const &Command );
|
static void OnCommand_carcouplingincrease( TTrain *Train, command_data const &Command );
|
||||||
static void OnCommand_carcouplingdisconnect( TTrain *Train, command_data const &Command );
|
static void OnCommand_carcouplingdisconnect( TTrain *Train, command_data const &Command );
|
||||||
static void OnCommand_departureannounce( TTrain *Train, command_data const &Command );
|
static void OnCommand_departureannounce( TTrain *Train, command_data const &Command );
|
||||||
|
|||||||
@@ -154,6 +154,7 @@ commanddescription_sequence Commands_descriptions = {
|
|||||||
{ "doorcloseright", command_target::vehicle },
|
{ "doorcloseright", command_target::vehicle },
|
||||||
{ "doorcloseall", command_target::vehicle },
|
{ "doorcloseall", command_target::vehicle },
|
||||||
{ "doorsteptoggle", command_target::vehicle },
|
{ "doorsteptoggle", command_target::vehicle },
|
||||||
|
{ "doormodetoggle", command_target::vehicle },
|
||||||
{ "departureannounce", command_target::vehicle },
|
{ "departureannounce", command_target::vehicle },
|
||||||
{ "doorlocktoggle", command_target::vehicle },
|
{ "doorlocktoggle", command_target::vehicle },
|
||||||
{ "pantographcompressorvalvetoggle", command_target::vehicle },
|
{ "pantographcompressorvalvetoggle", command_target::vehicle },
|
||||||
|
|||||||
@@ -147,6 +147,7 @@ enum class user_command {
|
|||||||
doorcloseright,
|
doorcloseright,
|
||||||
doorcloseall,
|
doorcloseall,
|
||||||
doorsteptoggle,
|
doorsteptoggle,
|
||||||
|
doormodetoggle,
|
||||||
departureannounce,
|
departureannounce,
|
||||||
doorlocktoggle,
|
doorlocktoggle,
|
||||||
pantographcompressorvalvetoggle,
|
pantographcompressorvalvetoggle,
|
||||||
|
|||||||
@@ -156,6 +156,7 @@ driverkeyboard_input::default_bindings() {
|
|||||||
// doorcloseright,
|
// doorcloseright,
|
||||||
{ user_command::doorcloseall, GLFW_KEY_SLASH | keymodifier::control },
|
{ user_command::doorcloseall, GLFW_KEY_SLASH | keymodifier::control },
|
||||||
// doorsteptoggle,
|
// doorsteptoggle,
|
||||||
|
{ user_command::doormodetoggle, GLFW_KEY_SLASH | keymodifier::shift | keymodifier::control },
|
||||||
{ user_command::departureannounce, GLFW_KEY_SLASH },
|
{ user_command::departureannounce, GLFW_KEY_SLASH },
|
||||||
{ user_command::doorlocktoggle, GLFW_KEY_S | keymodifier::control },
|
{ user_command::doorlocktoggle, GLFW_KEY_S | keymodifier::control },
|
||||||
{ user_command::pantographcompressorvalvetoggle, GLFW_KEY_V | keymodifier::control },
|
{ user_command::pantographcompressorvalvetoggle, GLFW_KEY_V | keymodifier::control },
|
||||||
|
|||||||
@@ -633,6 +633,9 @@ drivermouse_input::default_bindings() {
|
|||||||
{ "doorstep_sw:", {
|
{ "doorstep_sw:", {
|
||||||
user_command::doorsteptoggle,
|
user_command::doorsteptoggle,
|
||||||
user_command::none } },
|
user_command::none } },
|
||||||
|
{ "doormode_sw:", {
|
||||||
|
user_command::doormodetoggle,
|
||||||
|
user_command::none } },
|
||||||
{ "departure_signal_bt:", {
|
{ "departure_signal_bt:", {
|
||||||
user_command::departureannounce,
|
user_command::departureannounce,
|
||||||
user_command::none } },
|
user_command::none } },
|
||||||
|
|||||||
@@ -131,6 +131,7 @@ init() {
|
|||||||
"all doors (open)",
|
"all doors (open)",
|
||||||
"all doors (close)",
|
"all doors (close)",
|
||||||
"doorstep",
|
"doorstep",
|
||||||
|
"door control mode",
|
||||||
"departure signal",
|
"departure signal",
|
||||||
"upper headlight",
|
"upper headlight",
|
||||||
"left headlight",
|
"left headlight",
|
||||||
@@ -296,6 +297,7 @@ init() {
|
|||||||
"drzwi (otworz)",
|
"drzwi (otworz)",
|
||||||
"drzwi (zamknij)",
|
"drzwi (zamknij)",
|
||||||
"stopien drzwi",
|
"stopien drzwi",
|
||||||
|
"tryb sterowania drzwiami",
|
||||||
"sygnal odjazdu",
|
"sygnal odjazdu",
|
||||||
"reflektor gorny",
|
"reflektor gorny",
|
||||||
"reflektor lewy",
|
"reflektor lewy",
|
||||||
@@ -414,6 +416,7 @@ init() {
|
|||||||
"doorallon_sw:",
|
"doorallon_sw:",
|
||||||
"dooralloff_sw:",
|
"dooralloff_sw:",
|
||||||
"doorstep_sw:",
|
"doorstep_sw:",
|
||||||
|
"doormode_sw:",
|
||||||
"departure_signal_bt:",
|
"departure_signal_bt:",
|
||||||
"upperlight_sw:",
|
"upperlight_sw:",
|
||||||
"leftlight_sw:",
|
"leftlight_sw:",
|
||||||
|
|||||||
@@ -120,6 +120,7 @@ enum string {
|
|||||||
cab_doorallon_sw,
|
cab_doorallon_sw,
|
||||||
cab_dooralloff_sw,
|
cab_dooralloff_sw,
|
||||||
cab_doorstep_sw,
|
cab_doorstep_sw,
|
||||||
|
cab_doormode_sw,
|
||||||
cab_departure_signal_bt,
|
cab_departure_signal_bt,
|
||||||
cab_upperlight_sw,
|
cab_upperlight_sw,
|
||||||
cab_leftlight_sw,
|
cab_leftlight_sw,
|
||||||
|
|||||||
Reference in New Issue
Block a user