mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-23 13:19:19 +02:00
build 200106. ep brake cab control, battery state cab indicator, additional cab control tooltips, minor bug fixes
This commit is contained in:
@@ -216,9 +216,12 @@ TGauge::Load_mapping( cParser &Input ) {
|
|||||||
if( key == "type:" ) {
|
if( key == "type:" ) {
|
||||||
auto const gaugetype { Input.getToken<std::string>( true, "\n\r\t ,;" ) };
|
auto const gaugetype { Input.getToken<std::string>( true, "\n\r\t ,;" ) };
|
||||||
m_type = (
|
m_type = (
|
||||||
|
gaugetype == "push" ? TGaugeType::push :
|
||||||
gaugetype == "impulse" ? TGaugeType::push :
|
gaugetype == "impulse" ? TGaugeType::push :
|
||||||
gaugetype == "return" ? TGaugeType::push :
|
gaugetype == "return" ? TGaugeType::push :
|
||||||
gaugetype == "delayed" ? TGaugeType::push_delayed :
|
gaugetype == "delayed" ? TGaugeType::push_delayed :
|
||||||
|
gaugetype == "pushtoggle" ? TGaugeType::pushtoggle :
|
||||||
|
gaugetype == "toggle" ? TGaugeType::toggle :
|
||||||
TGaugeType::toggle ); // default
|
TGaugeType::toggle ); // default
|
||||||
}
|
}
|
||||||
else if( key == "soundinc:" ) {
|
else if( key == "soundinc:" ) {
|
||||||
|
|||||||
5
Gauge.h
5
Gauge.h
@@ -21,9 +21,10 @@ enum class TGaugeAnimation {
|
|||||||
gt_Digital // licznik cyfrowy, np. kilometrów
|
gt_Digital // licznik cyfrowy, np. kilometrów
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class TGaugeType {
|
enum class TGaugeType : int {
|
||||||
toggle,
|
toggle = 1,
|
||||||
push,
|
push,
|
||||||
|
pushtoggle = ( toggle | push ),
|
||||||
push_delayed
|
push_delayed
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -3743,10 +3743,12 @@ void TMoverParameters::CompressorCheck(double dt) {
|
|||||||
CompressorPower == 0 ? Mains :
|
CompressorPower == 0 ? Mains :
|
||||||
CompressorPower == 3 ? Mains :
|
CompressorPower == 3 ? Mains :
|
||||||
( compressorowner != nullptr ) && ( compressorowner->ConverterFlag ) ) };
|
( compressorowner != nullptr ) && ( compressorowner->ConverterFlag ) ) };
|
||||||
auto const compressorallow {
|
// TBD: split CompressorAllow into separate enable/disable flags, inherit compressor from basic_device
|
||||||
|
auto const compressorenable {
|
||||||
( CompressorAllowLocal )
|
( CompressorAllowLocal )
|
||||||
&& ( ( CompressorStart == start_t::automatic )
|
&& ( ( CompressorStart == start_t::automatic )
|
||||||
|| ( ( compressorowner != nullptr ) && ( compressorowner->CompressorAllow ) ) ) };
|
|| ( ( compressorowner != nullptr ) && ( compressorowner->CompressorAllow ) ) ) };
|
||||||
|
auto const compressordisable { false == compressorenable };
|
||||||
|
|
||||||
auto const pressureistoolow { Compressor < MinCompressorF };
|
auto const pressureistoolow { Compressor < MinCompressorF };
|
||||||
auto const pressureistoohigh { Compressor > MaxCompressorF };
|
auto const pressureistoohigh { Compressor > MaxCompressorF };
|
||||||
@@ -3772,9 +3774,10 @@ void TMoverParameters::CompressorCheck(double dt) {
|
|||||||
auto const compressorflag { CompressorFlag };
|
auto const compressorflag { CompressorFlag };
|
||||||
CompressorFlag =
|
CompressorFlag =
|
||||||
( compressorpower )
|
( compressorpower )
|
||||||
|
&& ( false == compressordisable )
|
||||||
&& ( ( false == governorlock ) || ( CompressorPower == 3 ) )
|
&& ( ( false == governorlock ) || ( CompressorPower == 3 ) )
|
||||||
&& ( ( CompressorFlag )
|
&& ( ( CompressorFlag )
|
||||||
|| ( ( compressorallow ) && ( LastSwitchingTime > CtrlDelay ) ) );
|
|| ( ( compressorenable ) && ( LastSwitchingTime > CtrlDelay ) ) );
|
||||||
|
|
||||||
if( ( CompressorFlag ) && ( CompressorFlag != compressorflag ) ) {
|
if( ( CompressorFlag ) && ( CompressorFlag != compressorflag ) ) {
|
||||||
// jeśli została załączona to trzeba ograniczyć ponowne włączenie
|
// jeśli została załączona to trzeba ograniczyć ponowne włączenie
|
||||||
@@ -3943,7 +3946,7 @@ void TMoverParameters::UpdatePipePressure(double dt)
|
|||||||
|| ( true == s_CAtestebrake )
|
|| ( true == s_CAtestebrake )
|
||||||
|| ( ( true == securitysystempresent )
|
|| ( ( true == securitysystempresent )
|
||||||
&& ( false == lowvoltagepower ) ) ) {
|
&& ( false == lowvoltagepower ) ) ) {
|
||||||
dpMainValve = dpMainValve + PF( 0, PipePress, 0.15 ) * dt;
|
dpMainValve += PF( 0, PipePress, 0.15 ) * dt;
|
||||||
}
|
}
|
||||||
// 0.2*Spg
|
// 0.2*Spg
|
||||||
Pipe->Flow(-dpMainValve);
|
Pipe->Flow(-dpMainValve);
|
||||||
|
|||||||
56
Train.cpp
56
Train.cpp
@@ -1610,27 +1610,43 @@ void TTrain::OnCommand_autosandboxdeactivate(TTrain *Train, command_data const &
|
|||||||
|
|
||||||
void TTrain::OnCommand_epbrakecontroltoggle( TTrain *Train, command_data const &Command ) {
|
void TTrain::OnCommand_epbrakecontroltoggle( TTrain *Train, command_data const &Command ) {
|
||||||
|
|
||||||
|
if( Command.action == GLFW_REPEAT ) { return; }
|
||||||
|
|
||||||
|
auto const ispush{ ( static_cast<int>( Train->ggEPFuseButton.type() ) & static_cast<int>( TGaugeType::push ) ) != 0 };
|
||||||
|
auto const istoggle{ ( static_cast<int>( Train->ggEPFuseButton.type() ) & static_cast<int>( TGaugeType::toggle ) ) != 0 };
|
||||||
|
|
||||||
if( Command.action == GLFW_PRESS ) {
|
if( Command.action == GLFW_PRESS ) {
|
||||||
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
if( istoggle ) {
|
||||||
if( false == Train->mvOccupied->EpFuse ) {
|
// switch state
|
||||||
// turn on
|
if( false == Train->mvOccupied->EpFuse ) {
|
||||||
|
// turn on
|
||||||
|
if( Train->mvOccupied->EpFuseSwitch( true ) ) {
|
||||||
|
// audio feedback
|
||||||
|
Train->dsbPneumaticSwitch.play();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//turn off
|
||||||
|
Train->mvOccupied->EpFuseSwitch( false );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if( ispush ) {
|
||||||
|
// potentially turn on
|
||||||
if( Train->mvOccupied->EpFuseSwitch( true ) ) {
|
if( Train->mvOccupied->EpFuseSwitch( true ) ) {
|
||||||
// audio feedback
|
// audio feedback
|
||||||
Train->dsbPneumaticSwitch.play();
|
Train->dsbPneumaticSwitch.play();
|
||||||
// visual feedback
|
};
|
||||||
// NOTE: there's no button for ep brake control switch
|
|
||||||
// TBD, TODO: add ep brake control switch?
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
// visual feedback
|
||||||
//turn off
|
Train->ggEPFuseButton.UpdateValue( (
|
||||||
if( Train->mvOccupied->EpFuseSwitch( false ) ) {
|
ispush ? 1.0f : // push or pushtoggle
|
||||||
// audio feedback
|
Train->mvOccupied->EpFuse ? 1.0f : 0.0f ), // toggle
|
||||||
Train->dsbPneumaticSwitch.play();
|
Train->dsbSwitch );
|
||||||
// visual feedback
|
}
|
||||||
// NOTE: there's no button for ep brake control switch
|
else if( Command.action == GLFW_RELEASE ) {
|
||||||
// TBD, TODO: add ep brake control switch?
|
if( ispush ) {
|
||||||
}
|
// return the switch to neutral position
|
||||||
|
Train->ggEPFuseButton.UpdateValue( 0.0f, Train->dsbSwitch );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6668,6 +6684,7 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
ggUniveralBrakeButton1.Update();
|
ggUniveralBrakeButton1.Update();
|
||||||
ggUniveralBrakeButton2.Update();
|
ggUniveralBrakeButton2.Update();
|
||||||
ggUniveralBrakeButton3.Update();
|
ggUniveralBrakeButton3.Update();
|
||||||
|
ggEPFuseButton.Update();
|
||||||
ggAntiSlipButton.Update();
|
ggAntiSlipButton.Update();
|
||||||
ggSandButton.Update();
|
ggSandButton.Update();
|
||||||
ggAutoSandButton.Update();
|
ggAutoSandButton.Update();
|
||||||
@@ -7924,6 +7941,7 @@ void TTrain::clear_cab_controls()
|
|||||||
ggUniveralBrakeButton1.Clear();
|
ggUniveralBrakeButton1.Clear();
|
||||||
ggUniveralBrakeButton2.Clear();
|
ggUniveralBrakeButton2.Clear();
|
||||||
ggUniveralBrakeButton3.Clear();
|
ggUniveralBrakeButton3.Clear();
|
||||||
|
ggEPFuseButton.Clear();
|
||||||
ggSandButton.Clear();
|
ggSandButton.Clear();
|
||||||
ggAutoSandButton.Clear();
|
ggAutoSandButton.Clear();
|
||||||
ggAntiSlipButton.Clear();
|
ggAntiSlipButton.Clear();
|
||||||
@@ -7936,7 +7954,7 @@ void TTrain::clear_cab_controls()
|
|||||||
ggSpeedControlIncreaseButton.Clear();
|
ggSpeedControlIncreaseButton.Clear();
|
||||||
ggSpeedControlDecreaseButton.Clear();
|
ggSpeedControlDecreaseButton.Clear();
|
||||||
ggSpeedControlPowerIncreaseButton.Clear();
|
ggSpeedControlPowerIncreaseButton.Clear();
|
||||||
ggSpeedControlDecreaseButton.Clear();
|
ggSpeedControlPowerDecreaseButton.Clear();
|
||||||
for (auto &speedctrlbutton : ggSpeedCtrlButtons) {
|
for (auto &speedctrlbutton : ggSpeedCtrlButtons) {
|
||||||
speedctrlbutton.Clear();
|
speedctrlbutton.Clear();
|
||||||
}
|
}
|
||||||
@@ -8540,7 +8558,8 @@ bool TTrain::initialize_button(cParser &Parser, std::string const &Label, int co
|
|||||||
{ "i-doorpermit_left:", &mvOccupied->Doors.instances[ ( cab_to_end() == end::front ? side::left : side::right ) ].open_permit },
|
{ "i-doorpermit_left:", &mvOccupied->Doors.instances[ ( cab_to_end() == end::front ? side::left : side::right ) ].open_permit },
|
||||||
{ "i-doorpermit_right:", &mvOccupied->Doors.instances[ ( cab_to_end() == end::front ? side::right : side::left ) ].open_permit },
|
{ "i-doorpermit_right:", &mvOccupied->Doors.instances[ ( cab_to_end() == end::front ? side::right : side::left ) ].open_permit },
|
||||||
{ "i-doorstep:", &mvOccupied->Doors.step_enabled },
|
{ "i-doorstep:", &mvOccupied->Doors.step_enabled },
|
||||||
{ "i-mainpipelock:", &mvOccupied->LockPipe }
|
{ "i-mainpipelock:", &mvOccupied->LockPipe },
|
||||||
|
{ "i-battery:", &mvOccupied->Battery }
|
||||||
};
|
};
|
||||||
{
|
{
|
||||||
auto lookup = autolights.find( Label );
|
auto lookup = autolights.find( Label );
|
||||||
@@ -8616,6 +8635,7 @@ bool TTrain::initialize_gauge(cParser &Parser, std::string const &Label, int con
|
|||||||
{ "universalbrake1_bt:", ggUniveralBrakeButton1 },
|
{ "universalbrake1_bt:", ggUniveralBrakeButton1 },
|
||||||
{ "universalbrake2_bt:", ggUniveralBrakeButton2 },
|
{ "universalbrake2_bt:", ggUniveralBrakeButton2 },
|
||||||
{ "universalbrake3_bt:", ggUniveralBrakeButton3 },
|
{ "universalbrake3_bt:", ggUniveralBrakeButton3 },
|
||||||
|
{ "epbrake_bt:", ggEPFuseButton },
|
||||||
{ "sand_bt:", ggSandButton },
|
{ "sand_bt:", ggSandButton },
|
||||||
{ "autosandallow_sw:", ggAutoSandButton },
|
{ "autosandallow_sw:", ggAutoSandButton },
|
||||||
{ "antislip_bt:", ggAntiSlipButton },
|
{ "antislip_bt:", ggAntiSlipButton },
|
||||||
|
|||||||
1
Train.h
1
Train.h
@@ -449,6 +449,7 @@ public: // reszta może by?publiczna
|
|||||||
TGauge ggUniveralBrakeButton1;
|
TGauge ggUniveralBrakeButton1;
|
||||||
TGauge ggUniveralBrakeButton2;
|
TGauge ggUniveralBrakeButton2;
|
||||||
TGauge ggUniveralBrakeButton3;
|
TGauge ggUniveralBrakeButton3;
|
||||||
|
TGauge ggEPFuseButton;
|
||||||
TGauge ggSandButton; // guzik piasecznicy
|
TGauge ggSandButton; // guzik piasecznicy
|
||||||
TGauge ggAutoSandButton; // przełącznik piasecznicy
|
TGauge ggAutoSandButton; // przełącznik piasecznicy
|
||||||
TGauge ggAntiSlipButton;
|
TGauge ggAntiSlipButton;
|
||||||
|
|||||||
@@ -605,6 +605,9 @@ drivermouse_input::default_bindings() {
|
|||||||
{ "universalbrake3_bt:",{
|
{ "universalbrake3_bt:",{
|
||||||
user_command::universalbrakebutton3,
|
user_command::universalbrakebutton3,
|
||||||
user_command::none } },
|
user_command::none } },
|
||||||
|
{ "epbrake_bt:",{
|
||||||
|
user_command::epbrakecontroltoggle,
|
||||||
|
user_command::none } },
|
||||||
{ "sand_bt:", {
|
{ "sand_bt:", {
|
||||||
user_command::sandboxactivate,
|
user_command::sandboxactivate,
|
||||||
user_command::none } },
|
user_command::none } },
|
||||||
|
|||||||
@@ -111,6 +111,10 @@ init() {
|
|||||||
"line breaker",
|
"line breaker",
|
||||||
"alerter",
|
"alerter",
|
||||||
"independent brake releaser",
|
"independent brake releaser",
|
||||||
|
"spring brake",
|
||||||
|
"spring brake",
|
||||||
|
"spring brake",
|
||||||
|
"electro-pneumatic brake",
|
||||||
"sandbox",
|
"sandbox",
|
||||||
"wheelspin brake",
|
"wheelspin brake",
|
||||||
"horn",
|
"horn",
|
||||||
@@ -281,6 +285,10 @@ init() {
|
|||||||
"wylacznik szybki",
|
"wylacznik szybki",
|
||||||
"czuwak",
|
"czuwak",
|
||||||
"odluzniacz",
|
"odluzniacz",
|
||||||
|
"hamulec sprezynowy",
|
||||||
|
"hamulec sprezynowy",
|
||||||
|
"hamulec sprezynowy",
|
||||||
|
"hamulec elektropneumatyczny",
|
||||||
"piasecznica",
|
"piasecznica",
|
||||||
"hamulec przeciwposlizgowy",
|
"hamulec przeciwposlizgowy",
|
||||||
"syrena",
|
"syrena",
|
||||||
@@ -404,6 +412,10 @@ init() {
|
|||||||
"main_on_bt:",
|
"main_on_bt:",
|
||||||
"security_reset_bt:",
|
"security_reset_bt:",
|
||||||
"releaser_bt:",
|
"releaser_bt:",
|
||||||
|
"springbraketoggle_bt:",
|
||||||
|
"springbrakeon_bt:",
|
||||||
|
"springbrakeoff_bt:",
|
||||||
|
"epbrake_bt:",
|
||||||
"sand_bt:",
|
"sand_bt:",
|
||||||
"antislip_bt:",
|
"antislip_bt:",
|
||||||
"horn_bt:",
|
"horn_bt:",
|
||||||
|
|||||||
@@ -100,6 +100,10 @@ enum string {
|
|||||||
cab_main_on_bt,
|
cab_main_on_bt,
|
||||||
cab_security_reset_bt,
|
cab_security_reset_bt,
|
||||||
cab_releaser_bt,
|
cab_releaser_bt,
|
||||||
|
cab_springbrake_bt,
|
||||||
|
cab_springbrakeon_bt,
|
||||||
|
cab_springbrakeoff_bt,
|
||||||
|
cab_epbrake_bt,
|
||||||
cab_sand_bt,
|
cab_sand_bt,
|
||||||
cab_antislip_bt,
|
cab_antislip_bt,
|
||||||
cab_horn_bt,
|
cab_horn_bt,
|
||||||
|
|||||||
Reference in New Issue
Block a user