mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-23 17:59:19 +02:00
Merge remote-tracking branch 'TMJ/master'
This commit is contained in:
211
Driver.cpp
211
Driver.cpp
@@ -2502,10 +2502,14 @@ bool TController::CheckVehicles(TOrders user)
|
||||
{
|
||||
// HACK: to account for su-45/46 shortcomings diesel-powered engines only activate heating in cold conditions
|
||||
// TODO: take instead into account presence of converters in attached cars, once said presence is possible to specify
|
||||
auto const isheatingneeded{ (
|
||||
IsCargoTrain ? false :
|
||||
has_diesel_engine() ? ( Global.AirTemperature < 10 ) :
|
||||
true ) };
|
||||
auto const ispassengertrain { ( IsPassengerTrain ) && ( iVehicles - ControlledEnginesCount > 0 ) };
|
||||
auto const isheatingcouplingactive { pVehicles[ end::front ]->is_connected( pVehicles[ end::rear ], coupling::heating ) };
|
||||
auto const isheatingneeded {
|
||||
(is_emu() || is_dmu() ? true :
|
||||
// false == isheatingcouplingactive ? false :
|
||||
(OrderCurrentGet() & (Obey_train | Bank)) == 0 ? false :
|
||||
ispassengertrain ? (has_diesel_engine() ? (Global.AirTemperature < 10) : true) :
|
||||
false)};
|
||||
if( mvControlling->HeatingAllow != isheatingneeded ) {
|
||||
cue_action(
|
||||
isheatingneeded ?
|
||||
@@ -5317,41 +5321,43 @@ TCommandType TController::BackwardScan( double const Range )
|
||||
}
|
||||
// szukamy od pierwszej osi w wybranym kierunku
|
||||
double scandir = startdir * pVehicles[0]->RaDirectionGet();
|
||||
if (scandir != 0.0) {
|
||||
|
||||
if( scandir == 0.0 ) { return TCommandType::cm_Unknown; }
|
||||
|
||||
// skanowanie toru w poszukiwaniu eventów GetValues (PutValues nie są przydatne)
|
||||
// Ra: przy wstecznym skanowaniu prędkość nie ma znaczenia
|
||||
double scandist = Range; // zmodyfikuje na rzeczywiście przeskanowane
|
||||
basic_event *e = NULL; // event potencjalnie od semafora
|
||||
// opcjonalnie może być skanowanie od "wskaźnika" z przodu, np. W5, Tm=Ms1, koniec toru wg drugiej osi w kierunku ruchu
|
||||
TTrack *scantrack = BackwardTraceRoute(scandist, scandir, pVehicles[end::front], e);
|
||||
auto const dir = startdir * pVehicles[end::front]->VectorFront(); // wektor w kierunku jazdy/szukania
|
||||
if( !scantrack ) {
|
||||
basic_event *e = nullptr; // event potencjalnie od semafora
|
||||
// opcjonalnie może być skanowanie od "wskaźnika" z przodu, np. W5, Tm=Ms1, koniec toru wg
|
||||
// drugiej osi w kierunku ruchu
|
||||
auto const *scantrack{BackwardTraceRoute(scandist, scandir, pVehicles[end::front], e)};
|
||||
auto const dir{startdir *
|
||||
pVehicles[end::front]->VectorFront()}; // wektor w kierunku jazdy/szukania
|
||||
|
||||
// jeśli wstecz wykryto koniec toru to raczej nic się nie da w takiej sytuacji zrobić
|
||||
if (e == nullptr)
|
||||
{
|
||||
return TCommandType::cm_Unknown;
|
||||
}
|
||||
else {
|
||||
// a jeśli są dalej tory
|
||||
double vmechmax; // prędkość ustawiona semaforem
|
||||
if( e != nullptr ) {
|
||||
if (typeid(*e) != typeid(getvalues_event))
|
||||
{
|
||||
return TCommandType::cm_Unknown;
|
||||
}
|
||||
|
||||
// jeśli jest jakiś sygnał na widoku
|
||||
double scanvel; // prędkość ustawiona semaforem
|
||||
#if LOGBACKSCAN
|
||||
std::string edir {
|
||||
"Backward scan by "
|
||||
+ pVehicle->asName + " - "
|
||||
+ ( ( scandir > 0 ) ?
|
||||
"Event2 " :
|
||||
"Event1 " ) };
|
||||
#endif
|
||||
// najpierw sprawdzamy, czy semafor czy inny znak został przejechany
|
||||
auto pos = pVehicles[1]->RearPosition(); // pozycja tyłu
|
||||
if( typeid( *e ) == typeid( getvalues_event ) )
|
||||
{ // przesłać info o zbliżającym się semaforze
|
||||
#if LOGBACKSCAN
|
||||
std::string edir{"Backward scan by " + pVehicle->asName + " - " +
|
||||
((scandir > 0) ? "Event2 " : "Event1 ")};
|
||||
edir += "(" + (e->name()) + ")";
|
||||
#endif
|
||||
auto sl = e->input_location(); // położenie komórki pamięci
|
||||
auto sem = sl - pos; // wektor do komórki pamięci od końca składu
|
||||
if (dir.x * sem.x + dir.z * sem.z < 0) {
|
||||
{
|
||||
// najpierw sprawdzamy, czy semafor czy inny znak został przejechany
|
||||
auto const sl{e->input_location()}; // położenie komórki pamięci
|
||||
auto const pos{pVehicles[end::rear]->RearPosition()}; // pozycja tyłu
|
||||
auto const sem{sl - pos}; // wektor do komórki pamięci od końca składu
|
||||
if (dir.x * sem.x + dir.z * sem.z < 0)
|
||||
{
|
||||
// jeśli został minięty
|
||||
// iloczyn skalarny jest ujemny, gdy sygnał stoi z tyłu
|
||||
#if LOGBACKSCAN
|
||||
@@ -5359,119 +5365,120 @@ TCommandType TController::BackwardScan( double const Range )
|
||||
#endif
|
||||
return TCommandType::cm_Unknown; // nic
|
||||
}
|
||||
vmechmax = e->input_value(1); // prędkość przy tym semaforze
|
||||
scanvel = e->input_value(1); // prędkość przy tym semaforze
|
||||
// przeliczamy odległość od semafora - potrzebne by były współrzędne początku składu
|
||||
scandist = sem.Length() - 2; // 2m luzu przy manewrach wystarczy
|
||||
if( scandist < 0 ) {
|
||||
if (scandist < 0)
|
||||
{
|
||||
// ujemnych nie ma po co wysyłać
|
||||
scandist = 0;
|
||||
}
|
||||
bool move = false; // czy AI w trybie manewerowym ma dociągnąć pod S1
|
||||
if( e->input_command() == TCommandType::cm_SetVelocity ) {
|
||||
if( ( vmechmax == 0.0 ) ?
|
||||
( OrderCurrentGet() & ( Shunt | Loose_shunt | Connect ) ) :
|
||||
( OrderCurrentGet() & Connect ) ) { // przy podczepianiu ignorować wyjazd?
|
||||
}
|
||||
|
||||
auto move{false}; // czy AI w trybie manewerowym ma dociągnąć pod S1
|
||||
if (e->input_command() == TCommandType::cm_SetVelocity)
|
||||
{
|
||||
if ((scanvel == 0.0) ? (OrderCurrentGet() & (Shunt | Loose_shunt | Connect)) :
|
||||
(OrderCurrentGet() & Connect))
|
||||
{ // przy podczepianiu ignorować wyjazd?
|
||||
move = true; // AI w trybie manewerowym ma dociągnąć pod S1
|
||||
}
|
||||
else {
|
||||
if( ( scandist > fMinProximityDist )
|
||||
&& ( ( mvOccupied->Vel > EU07_AI_NOMOVEMENT )
|
||||
&& ( ( OrderCurrentGet() & ( Shunt | Loose_shunt ) ) == 0 ) ) ) {
|
||||
else
|
||||
{
|
||||
if ((scandist > fMinProximityDist) &&
|
||||
((mvOccupied->Vel > EU07_AI_NOMOVEMENT) &&
|
||||
((OrderCurrentGet() & (Shunt | Loose_shunt)) == 0)))
|
||||
{
|
||||
// jeśli semafor jest daleko, a pojazd jedzie, to informujemy o zmianie prędkości
|
||||
// jeśli jedzie manewrowo, musi dostać SetVelocity, żeby sie na pociągowy przełączył
|
||||
#if LOGBACKSCAN
|
||||
// WriteLog(edir+"SetProximityVelocity "+AnsiString(scandist) + AnsiString(vmechmax));
|
||||
// WriteLog(edir+"SetProximityVelocity "+AnsiString(scandist) +
|
||||
// AnsiString(scanvel));
|
||||
WriteLog(edir);
|
||||
#endif
|
||||
// SetProximityVelocity(scandist,vmechmax,&sl);
|
||||
return (
|
||||
vmechmax > 0 ?
|
||||
TCommandType::cm_SetVelocity :
|
||||
TCommandType::cm_Unknown );
|
||||
// SetProximityVelocity(scandist,scanvel,&sl);
|
||||
return (scanvel > 0 ? TCommandType::cm_SetVelocity : TCommandType::cm_Unknown);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
// ustawiamy prędkość tylko wtedy, gdy ma ruszyć, stanąć albo ma stać
|
||||
// if ((MoverParameters->Vel==0.0)||(vmechmax==0.0)) //jeśli stoi lub ma stanąć/stać
|
||||
// semafor na tym torze albo lokomtywa stoi, a ma ruszyć, albo ma stanąć, albo nie ruszać
|
||||
// stop trzeba powtarzać, bo inaczej zatrąbi i pojedzie sam
|
||||
// PutCommand("SetVelocity",vmechmax,e->Params[9].asMemCell->Value2(),&sl,stopSem);
|
||||
// if ((MoverParameters->Vel==0.0)||(scanvel==0.0)) //jeśli stoi lub ma stanąć/stać
|
||||
// semafor na tym torze albo lokomtywa stoi, a ma ruszyć, albo ma stanąć, albo nie
|
||||
// ruszać stop trzeba powtarzać, bo inaczej zatrąbi i pojedzie sam
|
||||
// PutCommand("SetVelocity",scanvel,e->Params[9].asMemCell->Value2(),&sl,stopSem);
|
||||
#if LOGBACKSCAN
|
||||
WriteLog(
|
||||
edir + " - [SetVelocity] ["
|
||||
+ to_string( vmechmax, 2 ) + "] ["
|
||||
+ to_string( e->input_value( 2 ), 2 ) + "]" );
|
||||
WriteLog(edir + " - [SetVelocity] [" + to_string(scanvel, 2) + "] [" +
|
||||
to_string(e->input_value(2), 2) + "]");
|
||||
#endif
|
||||
return (
|
||||
vmechmax > 0 ?
|
||||
TCommandType::cm_SetVelocity :
|
||||
TCommandType::cm_Unknown );
|
||||
return (scanvel > 0 ? TCommandType::cm_SetVelocity : TCommandType::cm_Unknown);
|
||||
}
|
||||
}
|
||||
}
|
||||
// reakcja AI w trybie manewrowym dodatkowo na sygnały manewrowe
|
||||
if (OrderCurrentGet() ? OrderCurrentGet() & (Shunt | Loose_shunt | Connect) :
|
||||
true) // w Wait_for_orders też widzi tarcze
|
||||
{ // reakcja AI w trybie manewrowym dodatkowo na sygnały manewrowe
|
||||
if (move ? true : e->input_command() == TCommandType::cm_ShuntVelocity)
|
||||
{
|
||||
if (move || e->input_command() == TCommandType::cm_ShuntVelocity)
|
||||
{ // jeśli powyżej było SetVelocity 0 0, to dociągamy pod S1
|
||||
/*
|
||||
if ((scandist > fMinProximityDist) &&
|
||||
(mvOccupied->Vel > EU07_AI_NOMOVEMENT) || (vmechmax == 0.0) )
|
||||
{ // jeśli tarcza jest daleko, to:
|
||||
((mvOccupied->Vel > EU07_AI_NOMOVEMENT) || (scanvel == 0.0)))
|
||||
{
|
||||
// jeśli tarcza jest daleko, to:
|
||||
//- jesli pojazd jedzie, to informujemy o zmianie prędkości
|
||||
//- jeśli stoi, to z własnej inicjatywy może podjechać pod zamkniętą
|
||||
// tarczę
|
||||
//- jeśli stoi, to z własnej inicjatywy może podjechać pod zamkniętą tarczę
|
||||
if (mvOccupied->Vel > EU07_AI_NOMOVEMENT) // tylko jeśli jedzie
|
||||
{ // Mechanik->PutCommand("SetProximityVelocity",scandist,vmechmax,sl);
|
||||
{ // Mechanik->PutCommand("SetProximityVelocity",scandist,scanvel,sl);
|
||||
#if LOGBACKSCAN
|
||||
// WriteLog(edir+"SetProximityVelocity "+AnsiString(scandist)+"
|
||||
// "+AnsiString(vmechmax));
|
||||
// "+AnsiString(scanvel));
|
||||
WriteLog(edir);
|
||||
#endif
|
||||
// SetProximityVelocity(scandist,vmechmax,&sl);
|
||||
return (iDrivigFlags & moveTrackEnd) ?
|
||||
TCommandType::cm_ChangeDirection :
|
||||
TCommandType::cm_Unknown; // jeśli jedzie na W5 albo koniec toru,
|
||||
// to można zmienić kierunek
|
||||
// SetProximityVelocity(scandist,scanvel,&sl);
|
||||
// jeśli jedzie na W5 albo koniec toru, to można zmienić kierunek
|
||||
return (iDrivigFlags & moveTrackEnd) ? TCommandType::cm_ChangeDirection :
|
||||
TCommandType::cm_Unknown;
|
||||
// TBD: request direction change also if VelNext in current direction is 0,
|
||||
// while signal behind requests movement?
|
||||
}
|
||||
}
|
||||
else {
|
||||
// ustawiamy prędkość tylko wtedy, gdy ma ruszyć, albo stanąć albo ma stać pod tarczą
|
||||
// stop trzeba powtarzać, bo inaczej zatrąbi i pojedzie sam
|
||||
// if ((MoverParameters->Vel==0.0)||(vmechmax==0.0)) //jeśli jedzie lub ma stanąć/stać
|
||||
else
|
||||
{
|
||||
// ustawiamy prędkość tylko wtedy, gdy ma ruszyć, albo stanąć albo ma stać pod
|
||||
// tarczą stop trzeba powtarzać, bo inaczej zatrąbi i pojedzie sam if
|
||||
// ((MoverParameters->Vel==0.0)||(scanvel==0.0)) //jeśli jedzie lub ma stanąć/stać
|
||||
{ // nie dostanie komendy jeśli jedzie i ma jechać
|
||||
// PutCommand("ShuntVelocity",vmechmax,e->Params[9].asMemCell->Value2(),&sl,stopSem);
|
||||
// PutCommand("ShuntVelocity",scanvel,e->Params[9].asMemCell->Value2(),&sl,stopSem);
|
||||
#if LOGBACKSCAN
|
||||
WriteLog(
|
||||
edir + " - [ShuntVelocity] ["
|
||||
+ to_string( vmechmax, 2 ) + "] ["
|
||||
+ to_string( e->input_value( 2 ), 2 ) + "]" );
|
||||
WriteLog(edir + " - [ShuntVelocity] [" + to_string(scanvel, 2) + "] [" +
|
||||
to_string(e->input_value(2), 2) + "]");
|
||||
#endif
|
||||
return (
|
||||
vmechmax > 0 ?
|
||||
TCommandType::cm_ShuntVelocity :
|
||||
return (scanvel > 0 ? TCommandType::cm_ShuntVelocity :
|
||||
TCommandType::cm_Unknown);
|
||||
}
|
||||
}
|
||||
if ((vmechmax != 0.0) && (scandist < 100.0)) {
|
||||
// jeśli Tm w odległości do 100m podaje zezwolenie na jazdę, to od razu ją ignorujemy, aby móc szukać kolejnej
|
||||
// eSignSkip=e; //wtedy uznajemy ignorowaną przy poszukiwaniu nowej
|
||||
// NOTE: dead code due to returns in branching above
|
||||
if ((scanvel != 0.0) && (scandist < 100.0))
|
||||
{
|
||||
// jeśli Tm w odległości do 100m podaje zezwolenie na jazdę, to od razu ją
|
||||
// ignorujemy, aby móc szukać kolejnej eSignSkip=e; //wtedy uznajemy ignorowaną przy
|
||||
// poszukiwaniu nowej
|
||||
#if LOGBACKSCAN
|
||||
WriteLog(edir + " - will be ignored due to Ms2");
|
||||
#endif
|
||||
return (
|
||||
vmechmax > 0 ?
|
||||
TCommandType::cm_ShuntVelocity :
|
||||
TCommandType::cm_Unknown );
|
||||
return (scanvel > 0 ? TCommandType::cm_ShuntVelocity : TCommandType::cm_Unknown);
|
||||
}
|
||||
*/
|
||||
return ((VelNext > 0) ?
|
||||
TCommandType::cm_Unknown : // no need to bother if we can continue in current direction
|
||||
(scanvel == 0) ?
|
||||
TCommandType::cm_Unknown : // no need to bother with a stop signal
|
||||
TCommandType::cm_ShuntVelocity); // otherwise report a relevant shunt signal behind
|
||||
} // if (move?...
|
||||
} // if (OrderCurrentGet()==Shunt)
|
||||
if (e->m_passive) // jeśli skanowany
|
||||
if (e->is_command()) // a podłączona komórka ma komendę
|
||||
return TCommandType::cm_Command; // to też się obrócić
|
||||
} // if (e->Type==tp_GetValues)
|
||||
} // if (e)
|
||||
} // if (scantrack)
|
||||
} // if (scandir!=0.0)
|
||||
return TCommandType::cm_Unknown; // nic
|
||||
|
||||
return (((e->m_passive) && (e->is_command())) ? TCommandType::cm_Command :
|
||||
TCommandType::cm_Unknown);
|
||||
};
|
||||
|
||||
std::string TController::NextStop() const
|
||||
@@ -7991,13 +7998,13 @@ TController::check_route_behind( double const Range ) {
|
||||
|| ( TestFlag( iDrivigFlags, moveConnect ) ) ) };
|
||||
if( couplinginprogress ) { return; }
|
||||
|
||||
auto const comm { BackwardScan( Range ) };
|
||||
if( comm != TCommandType::cm_Unknown ) {
|
||||
auto const commandbehind { BackwardScan( Range ) };
|
||||
if( commandbehind != TCommandType::cm_Unknown ) {
|
||||
// jeśli w drugą można jechać
|
||||
// należy sprawdzać odległość od znalezionego sygnalizatora,
|
||||
// aby w przypadku prędkości 0.1 wyciągnąć najpierw skład za sygnalizator
|
||||
// i dopiero wtedy zmienić kierunek jazdy, oczekując podania prędkości >0.5
|
||||
if( comm == TCommandType::cm_Command ) {
|
||||
if( commandbehind == TCommandType::cm_Command ) {
|
||||
// jeśli komenda Shunt to ją odbierz bez przemieszczania się (np. odczep wagony po dopchnięciu do końca toru)
|
||||
iDrivigFlags |= moveStopHere;
|
||||
}
|
||||
|
||||
2
Driver.h
2
Driver.h
@@ -408,7 +408,7 @@ private:
|
||||
double IdleTime{}; // keeps track of time spent at a stop
|
||||
double fStopTime = 0.0; // czas postoju przed dalszą jazdą (np. na przystanku)
|
||||
float ExchangeTime{ 0.0 }; // time needed to finish current load exchange
|
||||
double fShuntVelocity = 25.0; // prędkość manewrowania, zależy m.in. od składu
|
||||
double fShuntVelocity = 40.0; // prędkość manewrowania, zależy m.in. od składu
|
||||
int iDrivigFlags = // flagi bitowe ruchu
|
||||
moveStopPoint | // podjedź do W4 możliwie blisko
|
||||
moveStopHere | // nie podjeżdżaj do semafora, jeśli droga nie jest wolna
|
||||
|
||||
30
Globals.cpp
30
Globals.cpp
@@ -695,17 +695,24 @@ global_settings::ConfigParse(cParser &Parser) {
|
||||
{
|
||||
uart_conf.enable = true;
|
||||
Parser.getTokens(3, false);
|
||||
Parser >> uart_conf.port >> uart_conf.baud >> uart_conf.updatetime;
|
||||
Parser
|
||||
>> uart_conf.port
|
||||
>> uart_conf.baud
|
||||
>> uart_conf.updatetime;
|
||||
}
|
||||
else if (token == "uarttune")
|
||||
{
|
||||
Parser.getTokens(16);
|
||||
Parser >> uart_conf.mainbrakemin >> uart_conf.mainbrakemax >> uart_conf.localbrakemin >>
|
||||
uart_conf.localbrakemax >> uart_conf.tankmax >> uart_conf.tankuart >>
|
||||
uart_conf.pipemax >> uart_conf.pipeuart >> uart_conf.brakemax >>
|
||||
uart_conf.brakeuart >> uart_conf.hvmax >> uart_conf.hvuart >>
|
||||
uart_conf.currentmax >> uart_conf.currentuart >> uart_conf.lvmax >>
|
||||
uart_conf.lvuart;
|
||||
Parser
|
||||
>> uart_conf.mainbrakemin >> uart_conf.mainbrakemax
|
||||
>> uart_conf.localbrakemin >> uart_conf.localbrakemax
|
||||
>> uart_conf.tankmax >> uart_conf.tankuart
|
||||
>> uart_conf.pipemax >> uart_conf.pipeuart
|
||||
>> uart_conf.brakemax >> uart_conf.brakeuart
|
||||
>> uart_conf.pantographmax >> uart_conf.pantographuart
|
||||
>> uart_conf.hvmax >> uart_conf.hvuart
|
||||
>> uart_conf.currentmax >> uart_conf.currentuart
|
||||
>> uart_conf.lvmax >> uart_conf.lvuart;
|
||||
}
|
||||
else if (token == "uarttachoscale")
|
||||
{
|
||||
@@ -715,8 +722,11 @@ global_settings::ConfigParse(cParser &Parser) {
|
||||
else if (token == "uartfeature")
|
||||
{
|
||||
Parser.getTokens(4);
|
||||
Parser >> uart_conf.mainenable >> uart_conf.scndenable >> uart_conf.trainenable >>
|
||||
uart_conf.localenable;
|
||||
Parser
|
||||
>> uart_conf.mainenable
|
||||
>> uart_conf.scndenable
|
||||
>> uart_conf.trainenable
|
||||
>> uart_conf.localenable;
|
||||
}
|
||||
else if (token == "uartdebug")
|
||||
{
|
||||
@@ -1177,6 +1187,8 @@ global_settings::export_as_text( std::ostream &Output ) const {
|
||||
<< uart_conf.pipeuart << " "
|
||||
<< uart_conf.brakemax << " "
|
||||
<< uart_conf.brakeuart << " "
|
||||
<< uart_conf.pantographmax << " "
|
||||
<< uart_conf.pipemax << " "
|
||||
<< uart_conf.hvmax << " "
|
||||
<< uart_conf.hvuart << " "
|
||||
<< uart_conf.currentmax << " "
|
||||
|
||||
@@ -767,6 +767,7 @@ traction_table::InitTraction() {
|
||||
scene::node_data nodedata;
|
||||
nodedata.name = traction->asPowerSupplyName;
|
||||
powersource = new TTractionPowerSource( nodedata );
|
||||
powersource->IsAutogenerated = true;
|
||||
powersource->Init( traction->NominalVoltage, traction->MaxCurrent );
|
||||
simulation::Powergrid.insert( powersource );
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ public:
|
||||
// members
|
||||
TTractionPowerSource *psNode[ 2 ] = { nullptr, nullptr }; // zasilanie na końcach dla sekcji
|
||||
bool bSection = false; // czy jest sekcją
|
||||
bool IsAutogenerated { false }; // indicates autogenerated source for individual traction piece
|
||||
|
||||
private:
|
||||
// methods
|
||||
|
||||
@@ -799,6 +799,7 @@ TTrain::get_state() const {
|
||||
static_cast<float>( mvOccupied->Compressor ),
|
||||
static_cast<float>( mvOccupied->PipePress ),
|
||||
static_cast<float>( mvOccupied->BrakePress ),
|
||||
static_cast<float>( mvPantographUnit->PantPress ),
|
||||
fHVoltage,
|
||||
{ fHCurrent[ ( mvControlled->TrainType & dt_EZT ) ? 0 : 1 ], fHCurrent[ 2 ], fHCurrent[ 3 ] },
|
||||
ggLVoltage.GetValue(),
|
||||
|
||||
1
Train.h
1
Train.h
@@ -104,6 +104,7 @@ class TTrain {
|
||||
float reservoir_pressure;
|
||||
float pipe_pressure;
|
||||
float brake_pressure;
|
||||
float pantograph_pressure;
|
||||
float hv_voltage;
|
||||
std::array<float, 3> hv_current;
|
||||
float lv_voltage;
|
||||
|
||||
@@ -938,9 +938,9 @@ debug_panel::update_section_vehicle( std::vector<text_line> &Output ) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Output.emplace_back( textline, Global.UITextColor );
|
||||
}
|
||||
}
|
||||
|
||||
std::string
|
||||
debug_panel::update_vehicle_coupler( int const Side ) {
|
||||
@@ -1293,6 +1293,7 @@ debug_panel::update_section_powergrid( std::vector<text_line> &Output ) {
|
||||
|
||||
for( auto const *powerstation : simulation::Powergrid.sequence() ) {
|
||||
|
||||
if( true == powerstation->IsAutogenerated ) { continue; }
|
||||
if( true == powerstation->bSection ) { continue; }
|
||||
|
||||
auto const name { (
|
||||
|
||||
@@ -106,7 +106,25 @@ editor_mode::enter() {
|
||||
m_statebackup = { Global.pCamera, FreeFlyModeFlag, Global.ControlPicking };
|
||||
|
||||
Camera = Global.pCamera;
|
||||
// NOTE: camera placement is effectively a copy of drivermode DistantView( true )
|
||||
// TBD, TODO: refactor into a common vehicle method?
|
||||
if( false == FreeFlyModeFlag ) {
|
||||
|
||||
auto const *vehicle { Camera.m_owner };
|
||||
auto const cab {
|
||||
( vehicle->MoverParameters->CabOccupied == 0 ?
|
||||
1 :
|
||||
vehicle->MoverParameters->CabOccupied ) };
|
||||
auto const left { vehicle->VectorLeft() * cab };
|
||||
Camera.Pos =
|
||||
Math3D::vector3( Camera.Pos.x, vehicle->GetPosition().y, Camera.Pos.z )
|
||||
+ left * vehicle->GetWidth()
|
||||
+ Math3D::vector3( 1.25 * left.x, 1.6, 1.25 * left.z );
|
||||
Camera.m_owner = nullptr;
|
||||
Camera.LookAt = vehicle->GetPosition();
|
||||
Camera.RaLook(); // jednorazowe przestawienie kamery
|
||||
FreeFlyModeFlag = true;
|
||||
}
|
||||
Global.ControlPicking = true;
|
||||
EditorModeFlag = true;
|
||||
|
||||
|
||||
7
uart.cpp
7
uart.cpp
@@ -336,6 +336,7 @@ void uart_input::poll()
|
||||
uint16_t tank_press = (uint16_t)std::min(conf.tankuart, trainstate.reservoir_pressure * 0.1f / conf.tankmax * conf.tankuart);
|
||||
uint16_t pipe_press = (uint16_t)std::min(conf.pipeuart, trainstate.pipe_pressure * 0.1f / conf.pipemax * conf.pipeuart);
|
||||
uint16_t brake_press = (uint16_t)std::min(conf.brakeuart, trainstate.brake_pressure * 0.1f / conf.brakemax * conf.brakeuart);
|
||||
uint16_t pantograph_press = (uint16_t)std::min(conf.pantographuart, trainstate.pantograph_pressure * 0.1f / conf.pantographmax * conf.pantographuart );
|
||||
uint16_t hv_voltage = (uint16_t)std::min(conf.hvuart, trainstate.hv_voltage / conf.hvmax * conf.hvuart);
|
||||
uint16_t current1 = (uint16_t)std::min(conf.currentuart, trainstate.hv_current[0] / conf.currentmax * conf.currentuart);
|
||||
uint16_t current2 = (uint16_t)std::min(conf.currentuart, trainstate.hv_current[1] / conf.currentmax * conf.currentuart);
|
||||
@@ -409,8 +410,10 @@ void uart_input::poll()
|
||||
SPLIT_INT16(lv_voltage),
|
||||
//byte 33
|
||||
(uint8_t)trainstate.radio_channel,
|
||||
//byte 34-48
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
//byte 34-35
|
||||
SPLIT_INT16(pantograph_press),
|
||||
//byte 36-48
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
if (conf.debug)
|
||||
|
||||
Reference in New Issue
Block a user