mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 01:19:19 +02:00
Merge branch 'master' of https://github.com/tmj-fstate/maszyna
This commit is contained in:
73
Train.cpp
73
Train.cpp
@@ -1963,15 +1963,6 @@ void TTrain::OnCommand_reverserdecrease( TTrain *Train, command_data const &Comm
|
|||||||
|
|
||||||
void TTrain::OnCommand_reverserforwardhigh( TTrain *Train, command_data const &Command ) {
|
void TTrain::OnCommand_reverserforwardhigh( TTrain *Train, command_data const &Command ) {
|
||||||
|
|
||||||
if( Command.action == GLFW_PRESS ) {
|
|
||||||
|
|
||||||
OnCommand_reverserforward( Train, Command );
|
|
||||||
OnCommand_reverserincrease( Train, Command );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void TTrain::OnCommand_reverserforward( TTrain *Train, command_data const &Command ) {
|
|
||||||
|
|
||||||
if( Command.action == GLFW_PRESS ) {
|
if( Command.action == GLFW_PRESS ) {
|
||||||
|
|
||||||
// HACK: master controller position isn't set in occupied vehicle in E(D)MUs
|
// HACK: master controller position isn't set in occupied vehicle in E(D)MUs
|
||||||
@@ -1994,9 +1985,44 @@ void TTrain::OnCommand_reverserforward( TTrain *Train, command_data const &Comma
|
|||||||
Train->DynamicObject->Mechanik->DirectionChange();
|
Train->DynamicObject->Mechanik->DirectionChange();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
OnCommand_reverserincrease( Train, Command );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TTrain::OnCommand_reverserforward( TTrain *Train, command_data const &Command ) {
|
||||||
|
|
||||||
|
if( Command.action == GLFW_PRESS ) {
|
||||||
|
|
||||||
|
// HACK: master controller position isn't set in occupied vehicle in E(D)MUs
|
||||||
|
// so we do a manual check in relevant vehicle here
|
||||||
|
if( false == Train->mvControlled->EIMDirectionChangeAllow() ) { return; }
|
||||||
|
|
||||||
|
// HACK: try to move the reverser one position back, in case it's set to "high forward"
|
||||||
|
//OnCommand_reverserdecrease( Train, Command );
|
||||||
|
// visual feedback
|
||||||
|
Train->ggDirForwardButton.UpdateValue(1.0, Train->dsbSwitch);
|
||||||
|
|
||||||
|
if( Train->mvOccupied->DirActive == 0 ) {
|
||||||
|
|
||||||
|
while( ( Train->mvOccupied->DirActive < 1 )
|
||||||
|
&& ( true == Train->mvOccupied->DirectionForward() ) ) {
|
||||||
|
// all work is done in the header
|
||||||
|
}
|
||||||
|
// aktualizacja skrajnych pojazdów w składzie
|
||||||
|
if( ( Train->mvOccupied->DirActive == 1 )
|
||||||
|
&& ( Train->DynamicObject->Mechanik ) ) {
|
||||||
|
|
||||||
|
Train->DynamicObject->Mechanik->DirectionChange();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (Command.action == GLFW_RELEASE) {
|
||||||
|
// release
|
||||||
|
// visual feedback
|
||||||
|
Train->ggDirForwardButton.UpdateValue(0.0, Train->dsbSwitch);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void TTrain::OnCommand_reverserneutral( TTrain *Train, command_data const &Command ) {
|
void TTrain::OnCommand_reverserneutral( TTrain *Train, command_data const &Command ) {
|
||||||
|
|
||||||
if( Command.action == GLFW_PRESS ) {
|
if( Command.action == GLFW_PRESS ) {
|
||||||
@@ -2004,7 +2030,8 @@ void TTrain::OnCommand_reverserneutral( TTrain *Train, command_data const &Comma
|
|||||||
// HACK: master controller position isn't set in occupied vehicle in E(D)MUs
|
// HACK: master controller position isn't set in occupied vehicle in E(D)MUs
|
||||||
// so we do a manual check in relevant vehicle here
|
// so we do a manual check in relevant vehicle here
|
||||||
if( false == Train->mvControlled->EIMDirectionChangeAllow() ) { return; }
|
if( false == Train->mvControlled->EIMDirectionChangeAllow() ) { return; }
|
||||||
|
// visual feedback
|
||||||
|
Train->ggDirNeutralButton.UpdateValue(1.0, Train->dsbSwitch);
|
||||||
while( ( Train->mvOccupied->DirActive < 0 )
|
while( ( Train->mvOccupied->DirActive < 0 )
|
||||||
&& ( true == Train->mvOccupied->DirectionForward() ) ) {
|
&& ( true == Train->mvOccupied->DirectionForward() ) ) {
|
||||||
// all work is done in the header
|
// all work is done in the header
|
||||||
@@ -2014,6 +2041,11 @@ void TTrain::OnCommand_reverserneutral( TTrain *Train, command_data const &Comma
|
|||||||
// all work is done in the header
|
// all work is done in the header
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (Command.action == GLFW_RELEASE) {
|
||||||
|
// release
|
||||||
|
// visual feedback
|
||||||
|
Train->ggDirNeutralButton.UpdateValue(0.0, Train->dsbSwitch);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TTrain::OnCommand_reverserbackward( TTrain *Train, command_data const &Command ) {
|
void TTrain::OnCommand_reverserbackward( TTrain *Train, command_data const &Command ) {
|
||||||
@@ -2023,8 +2055,8 @@ void TTrain::OnCommand_reverserbackward( TTrain *Train, command_data const &Comm
|
|||||||
// HACK: master controller position isn't set in occupied vehicle in E(D)MUs
|
// HACK: master controller position isn't set in occupied vehicle in E(D)MUs
|
||||||
// so we do a manual check in relevant vehicle here
|
// so we do a manual check in relevant vehicle here
|
||||||
if( false == Train->mvControlled->EIMDirectionChangeAllow() ) { return; }
|
if( false == Train->mvControlled->EIMDirectionChangeAllow() ) { return; }
|
||||||
|
Train->ggDirBackwardButton.UpdateValue(1.0, Train->dsbSwitch);
|
||||||
if( Train->mvOccupied->DirActive > -1 ) {
|
if( Train->mvOccupied->DirActive == 0 ) {
|
||||||
|
|
||||||
while( ( Train->mvOccupied->DirActive > -1 )
|
while( ( Train->mvOccupied->DirActive > -1 )
|
||||||
&& ( true == Train->mvOccupied->DirectionBackward() ) ) {
|
&& ( true == Train->mvOccupied->DirectionBackward() ) ) {
|
||||||
@@ -2038,6 +2070,11 @@ void TTrain::OnCommand_reverserbackward( TTrain *Train, command_data const &Comm
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (Command.action == GLFW_RELEASE) {
|
||||||
|
// release
|
||||||
|
// visual feedback
|
||||||
|
Train->ggDirBackwardButton.UpdateValue(0.0, Train->dsbSwitch);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TTrain::OnCommand_alerteracknowledge( TTrain *Train, command_data const &Command ) {
|
void TTrain::OnCommand_alerteracknowledge( TTrain *Train, command_data const &Command ) {
|
||||||
@@ -5974,6 +6011,9 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
}
|
}
|
||||||
// helper variables
|
// helper variables
|
||||||
m_doors = ( DynamicObject->Mechanik->IsAnyDoorOpen[ side::right ] || DynamicObject->Mechanik->IsAnyDoorOpen[ side::left ] );
|
m_doors = ( DynamicObject->Mechanik->IsAnyDoorOpen[ side::right ] || DynamicObject->Mechanik->IsAnyDoorOpen[ side::left ] );
|
||||||
|
m_dirforward = ( mvControlled->DirActive > 0 );
|
||||||
|
m_dirneutral = ( mvControlled->DirActive == 0 );
|
||||||
|
m_dirbackward = ( mvControlled->DirActive <0 );
|
||||||
|
|
||||||
// check for received user commands
|
// check for received user commands
|
||||||
// NOTE: this is a temporary arrangement, for the transition period from old command setup to the new one
|
// NOTE: this is a temporary arrangement, for the transition period from old command setup to the new one
|
||||||
@@ -6936,6 +6976,9 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
}
|
}
|
||||||
ggLocalBrake.Update();
|
ggLocalBrake.Update();
|
||||||
}
|
}
|
||||||
|
ggDirForwardButton.Update();
|
||||||
|
ggDirNeutralButton.Update();
|
||||||
|
ggDirBackwardButton.Update();
|
||||||
ggAlarmChain.Update();
|
ggAlarmChain.Update();
|
||||||
ggBrakeProfileCtrl.Update();
|
ggBrakeProfileCtrl.Update();
|
||||||
ggBrakeProfileG.Update();
|
ggBrakeProfileG.Update();
|
||||||
@@ -8304,6 +8347,9 @@ void TTrain::clear_cab_controls()
|
|||||||
ggScndCtrlButton.Clear();
|
ggScndCtrlButton.Clear();
|
||||||
ggDistanceCounterButton.Clear();
|
ggDistanceCounterButton.Clear();
|
||||||
ggDirKey.Clear();
|
ggDirKey.Clear();
|
||||||
|
ggDirForwardButton.Clear();
|
||||||
|
ggDirNeutralButton.Clear();
|
||||||
|
ggDirBackwardButton.Clear();
|
||||||
ggBrakeCtrl.Clear();
|
ggBrakeCtrl.Clear();
|
||||||
ggLocalBrake.Clear();
|
ggLocalBrake.Clear();
|
||||||
ggAlarmChain.Clear();
|
ggAlarmChain.Clear();
|
||||||
@@ -9155,6 +9201,9 @@ bool TTrain::initialize_gauge(cParser &Parser, std::string const &Label, int con
|
|||||||
{ "doorleftpermit_sw:", { ggDoorLeftPermitButton, &mvOccupied->Doors.instances[ ( cab_to_end() == end::front ? side::left : side::right ) ].open_permit } },
|
{ "doorleftpermit_sw:", { ggDoorLeftPermitButton, &mvOccupied->Doors.instances[ ( cab_to_end() == end::front ? side::left : side::right ) ].open_permit } },
|
||||||
{ "doorrightpermit_sw:", { ggDoorRightPermitButton, &mvOccupied->Doors.instances[ ( cab_to_end() == end::front ? side::right : side::left ) ].open_permit } },
|
{ "doorrightpermit_sw:", { ggDoorRightPermitButton, &mvOccupied->Doors.instances[ ( cab_to_end() == end::front ? side::right : side::left ) ].open_permit } },
|
||||||
{ "dooralloff_sw:", { ggDoorAllOffButton, &m_doors } },
|
{ "dooralloff_sw:", { ggDoorAllOffButton, &m_doors } },
|
||||||
|
{ "dirforward_bt:", { ggDirForwardButton, &m_dirforward } },
|
||||||
|
{ "dirneutral_bt:", { ggDirNeutralButton, &m_dirneutral } },
|
||||||
|
{ "dirbackward_bt:", { ggDirBackwardButton, &m_dirbackward } },
|
||||||
};
|
};
|
||||||
{
|
{
|
||||||
auto const lookup { stategauges.find( Label ) };
|
auto const lookup { stategauges.find( Label ) };
|
||||||
|
|||||||
6
Train.h
6
Train.h
@@ -465,6 +465,9 @@ public: // reszta może by?publiczna
|
|||||||
TGauge ggScndCtrl;
|
TGauge ggScndCtrl;
|
||||||
TGauge ggScndCtrlButton;
|
TGauge ggScndCtrlButton;
|
||||||
TGauge ggDirKey;
|
TGauge ggDirKey;
|
||||||
|
TGauge ggDirForwardButton;
|
||||||
|
TGauge ggDirNeutralButton;
|
||||||
|
TGauge ggDirBackwardButton;
|
||||||
TGauge ggBrakeCtrl;
|
TGauge ggBrakeCtrl;
|
||||||
TGauge ggLocalBrake;
|
TGauge ggLocalBrake;
|
||||||
TGauge ggAlarmChain;
|
TGauge ggAlarmChain;
|
||||||
@@ -789,6 +792,9 @@ private:
|
|||||||
double m_brakehandlecp{ 0.0 };
|
double m_brakehandlecp{ 0.0 };
|
||||||
int m_pantselection{ 0 };
|
int m_pantselection{ 0 };
|
||||||
bool m_doors{ false }; // helper, true if any door is open
|
bool m_doors{ false }; // helper, true if any door is open
|
||||||
|
bool m_dirforward{ false }; // helper, true if direction set to forward
|
||||||
|
bool m_dirneutral{ false }; // helper, true if direction set to neutral
|
||||||
|
bool m_dirbackward{ false }; // helper, true if direction set to backward
|
||||||
// ld substitute
|
// ld substitute
|
||||||
bool m_couplingdisconnect { false };
|
bool m_couplingdisconnect { false };
|
||||||
|
|
||||||
|
|||||||
@@ -530,6 +530,15 @@ drivermouse_input::default_bindings() {
|
|||||||
{ "dirkey:", {
|
{ "dirkey:", {
|
||||||
user_command::reverserincrease,
|
user_command::reverserincrease,
|
||||||
user_command::reverserdecrease } },
|
user_command::reverserdecrease } },
|
||||||
|
{ "dirforward_bt:", {
|
||||||
|
user_command::reverserforward,
|
||||||
|
user_command::none } },
|
||||||
|
{ "dirneutral_bt:", {
|
||||||
|
user_command::reverserneutral,
|
||||||
|
user_command::none } },
|
||||||
|
{ "dirbackward_bt:", {
|
||||||
|
user_command::reverserbackward,
|
||||||
|
user_command::none } },
|
||||||
{ "brakectrl:", {
|
{ "brakectrl:", {
|
||||||
user_command::trainbrakeset,
|
user_command::trainbrakeset,
|
||||||
user_command::none } },
|
user_command::none } },
|
||||||
|
|||||||
@@ -101,6 +101,9 @@ init() {
|
|||||||
"tempomat (speed)",
|
"tempomat (speed)",
|
||||||
"distance counter",
|
"distance counter",
|
||||||
"reverser",
|
"reverser",
|
||||||
|
"reverser forward",
|
||||||
|
"reverser neutral",
|
||||||
|
"reverser backward",
|
||||||
"train brake",
|
"train brake",
|
||||||
"independent brake",
|
"independent brake",
|
||||||
"manual brake",
|
"manual brake",
|
||||||
@@ -303,6 +306,9 @@ init() {
|
|||||||
"tempomat (predkosc)",
|
"tempomat (predkosc)",
|
||||||
"miernik odleglosci",
|
"miernik odleglosci",
|
||||||
"nastawnik kierunku",
|
"nastawnik kierunku",
|
||||||
|
"kierunek naprzod",
|
||||||
|
"kierunek neutralny",
|
||||||
|
"kierunek wstecz",
|
||||||
"hamulec zespolony",
|
"hamulec zespolony",
|
||||||
"hamulec pomocniczy",
|
"hamulec pomocniczy",
|
||||||
"hamulec reczny",
|
"hamulec reczny",
|
||||||
@@ -458,6 +464,9 @@ init() {
|
|||||||
"speedbutton9:",
|
"speedbutton9:",
|
||||||
"distancecounter_sw:",
|
"distancecounter_sw:",
|
||||||
"dirkey:",
|
"dirkey:",
|
||||||
|
"dirforward_bt:",
|
||||||
|
"dirneutral_bt:",
|
||||||
|
"dirbackward_bt:",
|
||||||
"brakectrl:",
|
"brakectrl:",
|
||||||
"localbrake:",
|
"localbrake:",
|
||||||
"manualbrake:",
|
"manualbrake:",
|
||||||
|
|||||||
Reference in New Issue
Block a user