Add distance counter double click to activate

DCMB=[No] - Czy potrzebne jest podwojne nacisniecie
DCDPP=[1.0] - W jakim czasie drugie nacisnienie ma nastapic od pierwszego, aby aktywowac pomiar
This commit is contained in:
2025-02-16 21:10:32 +01:00
parent dd62a1529e
commit b10e6ccda3
4 changed files with 37 additions and 12 deletions

View File

@@ -1205,16 +1205,17 @@ class TMoverParameters
int LightsDefPos = 1;
bool LightsWrap = false;
int Lights[2][17]; // pozycje świateł, przód - tył, 1 .. 16
int ScndInMain{ 0 }; /*zaleznosc bocznika od nastawnika*/
bool MBrake = false; /*Czy jest hamulec reczny*/
double maxTachoSpeed = { 0.0 }; // maksymalna predkosc na tarczce predkosciomierza analogowego
double StopBrakeDecc = { 0.0 };
bool ReleaseParkingBySpringBrake { false };
bool ReleaseParkingBySpringBrakeWhenDoorIsOpen{ false };
bool SpringBrakeCutsOffDrive { true };
double SpringBrakeDriveEmergencyVel { -1 };
bool HideDirStatusWhenMoving { false }; // Czy gasic lampki kierunku powyzej predkosci zdefiniowanej przez HideDirStatusSpeed
int HideDirStatusSpeed{ 1 }; // Predkosc od ktorej lampki kierunku sa wylaczane
int ScndInMain{0}; /*zaleznosc bocznika od nastawnika*/
bool MBrake = false; /*Czy jest hamulec reczny*/
double StopBrakeDecc = 0.0;
bool ReleaseParkingBySpringBrake{false};
bool ReleaseParkingBySpringBrakeWhenDoorIsOpen{false};
bool SpringBrakeCutsOffDrive{true};
double SpringBrakeDriveEmergencyVel{-1};
bool HideDirStatusWhenMoving{false}; // Czy gasic lampki kierunku powyzej predkosci zdefiniowanej przez HideDirStatusSpeed
int HideDirStatusSpeed{1}; // Predkosc od ktorej lampki kierunku sa wylaczane
bool isDoubleClickForMeasureNeeded = {false}; // czy rozpoczecie pomiaru odleglosci odbywa sie po podwojnym wcisnienciu przycisku?
float DistanceCounterDoublePressPeriod = {1.f}; // czas w jakim nalezy podwojnie wcisnac przycisk, aby rozpoczac pomiar odleglosci
TSecuritySystem SecuritySystem;
int EmergencyBrakeWarningSignal{0}; // combined with basic WarningSignal when manual emergency brake is active
TUniversalCtrlTable UniCtrlList; /*lista pozycji uniwersalnego nastawnika*/

View File

@@ -10628,6 +10628,9 @@ void TMoverParameters::LoadFIZ_Cntrl( std::string const &line ) {
extract_value(HideDirStatusWhenMoving, "HideDirStatusWhenMoving", line, "");
extract_value(HideDirStatusSpeed, "HideDirStatusSpeed", line, "");
extract_value(isDoubleClickForMeasureNeeded, "DCMB", line, "");
extract_value(DistanceCounterDoublePressPeriod, "DCDPP", line, "");
std::map<std::string, start_t> starts {
{ "Disabled", start_t::disabled },

View File

@@ -1315,7 +1315,17 @@ void TTrain::OnCommand_distancecounteractivate( TTrain *Train, command_data cons
// visual feedback
Train->ggDistanceCounterButton.UpdateValue( 1.0, Train->dsbSwitch );
// activate or start anew
Train->m_distancecounter = 0.f;
if (Train->mvOccupied->isDoubleClickForMeasureNeeded) {
// handler tempomatu dla podwojnego kliku
if (Train->trainLenghtMeasureTimer >= 0.f) // jesli zdazylismy w czasie sekundy
Train->m_distancecounter = 0.f; // rozpoczynamy pomiar
else
Train->trainLenghtMeasureTimer = Train->mvOccupied->DistanceCounterDoublePressPeriod; // odpalamy zegarek od nowa
}
else {
// dla pojedynczego kliku
Train->m_distancecounter = 0.f;
}
}
else if( Command.action == GLFW_RELEASE ) {
// visual feedback
@@ -2869,7 +2879,7 @@ void TTrain::OnCommand_pantographvalvesoff( TTrain *Train, command_data const &C
}
else if( Command.action == GLFW_RELEASE ) {
// visual feedback
// NOTE: pantvalves_sw: is a specialized button, with no toggle behavior support
// NOTE: pantvalves_sw: is a speciali zed button, with no toggle behavior support
if (hasSeparateSwitches)
Train->ggPantValvesOff.UpdateValue(0.f, Train->dsbSwitch);
else
@@ -6922,6 +6932,16 @@ bool TTrain::Update( double const Deltatime )
mvOccupied->OperateDoors( static_cast<side>( idx ), true );
}
}
// train measurement timer
if (trainLenghtMeasureTimer >= 0.f) {
trainLenghtMeasureTimer -= Deltatime;
if (trainLenghtMeasureTimer < 0.f)
{
trainLenghtMeasureTimer = -1.f;
}
}
// helper variables
if( DynamicObject->Mechanik != nullptr ) {
m_doors = (

View File

@@ -882,6 +882,7 @@ private:
bool m_dirbackward{ false }; // helper, true if direction set to backward
bool m_doorpermits{ false }; // helper, true if any door permit is active
float m_doorpermittimers[2] = { -1.f, -1.f };
float trainLenghtMeasureTimer = { -1.f };
// ld substitute
bool m_couplingdisconnect { false };
bool m_couplingdisconnectback { false };