mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-24 08:39:18 +02:00
Merge with TMJ
This commit is contained in:
@@ -78,6 +78,7 @@ enum class TCommandType
|
|||||||
cm_OutsideStation,
|
cm_OutsideStation,
|
||||||
// cm_Shunt, // unused?
|
// cm_Shunt, // unused?
|
||||||
cm_EmergencyBrake,
|
cm_EmergencyBrake,
|
||||||
|
cm_SecuritySystemMagnet,
|
||||||
cm_Command // komenda pobierana z komórki
|
cm_Command // komenda pobierana z komórki
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
54
Driver.cpp
54
Driver.cpp
@@ -271,6 +271,9 @@ void TSpeedPos::CommandCheck()
|
|||||||
case TCommandType::cm_EmergencyBrake:
|
case TCommandType::cm_EmergencyBrake:
|
||||||
fVelNext = -1;
|
fVelNext = -1;
|
||||||
break;
|
break;
|
||||||
|
case TCommandType::cm_SecuritySystemMagnet:
|
||||||
|
fVelNext = -1;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
// inna komenda w evencie skanowanym powoduje zatrzymanie i wysłanie tej komendy
|
// inna komenda w evencie skanowanym powoduje zatrzymanie i wysłanie tej komendy
|
||||||
// nie manewrowa, nie przystanek, nie zatrzymać na SBL
|
// nie manewrowa, nie przystanek, nie zatrzymać na SBL
|
||||||
@@ -880,6 +883,7 @@ TCommandType TController::TableUpdate(double &fVelDes, double &fDist, double &fN
|
|||||||
eSignNext = nullptr;
|
eSignNext = nullptr;
|
||||||
IsAtPassengerStop = false;
|
IsAtPassengerStop = false;
|
||||||
IsScheduledPassengerStopVisible = false;
|
IsScheduledPassengerStopVisible = false;
|
||||||
|
mvOccupied->SecuritySystem.SHPLock = false;
|
||||||
// te flagi są ustawiane tutaj, w razie potrzeby
|
// te flagi są ustawiane tutaj, w razie potrzeby
|
||||||
iDrivigFlags &= ~(moveTrackEnd | moveSwitchFound | moveSemaphorFound | /*moveSpeedLimitFound*/ moveStopPointFound );
|
iDrivigFlags &= ~(moveTrackEnd | moveSwitchFound | moveSemaphorFound | /*moveSpeedLimitFound*/ moveStopPointFound );
|
||||||
|
|
||||||
@@ -1404,9 +1408,37 @@ TController::TableUpdateEvent( double &Velocity, TCommandType &Command, TSpeedPo
|
|||||||
SemNextStopIndex = -1; // jeśli minęliśmy semafor od ograniczenia to go kasujemy ze zmiennej sprawdzającej dla skanowania w przód
|
SemNextStopIndex = -1; // jeśli minęliśmy semafor od ograniczenia to go kasujemy ze zmiennej sprawdzającej dla skanowania w przód
|
||||||
}
|
}
|
||||||
switch( Point.evEvent->input_command() ) {
|
switch( Point.evEvent->input_command() ) {
|
||||||
|
// TBD, TODO: expand emergency_brake handling to a more generic security system signal
|
||||||
case TCommandType::cm_EmergencyBrake: {
|
case TCommandType::cm_EmergencyBrake: {
|
||||||
pVehicle->RadioStop();
|
pVehicle->RadioStop();
|
||||||
Point.Clear(); // signal received, deactivate
|
Point.Clear(); // signal received, deactivate
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
case TCommandType::cm_SecuritySystemMagnet: {
|
||||||
|
// NOTE: magnet induction calculation presumes the driver is located in the front vehicle
|
||||||
|
// TBD, TODO: take into account actual position of controlled/occupied vehicle in the consist, whichever comes first
|
||||||
|
auto const magnetlocation { pVehicles[ end::front ]->MoverParameters->SecuritySystem.MagnetLocation };
|
||||||
|
auto const magnetrange { 1.0 };
|
||||||
|
auto const ismagnetpassed { Point.fDist < -( magnetlocation + magnetrange ) };
|
||||||
|
if( Point.fDist < -( magnetlocation ) ) {
|
||||||
|
// NOTE: normally we'd activate the magnet once the leading vehicle passes it
|
||||||
|
// but on a fresh scan after direction change it would be detected as long as it's under consist, and meet the (simple) activation condition
|
||||||
|
// thus we're doing a more precise check in such situation (we presume direction change takes place only if the vehicle is standing still)
|
||||||
|
if( ( mvOccupied->Vel > EU07_AI_NOMOVEMENT )
|
||||||
|
|| ( false == ismagnetpassed ) ) {
|
||||||
|
mvOccupied->SecuritySystem.SHPLock |= ( !AIControllFlag ); // don't make life difficult for the ai, but a human driver is a fair game
|
||||||
|
PutCommand(
|
||||||
|
Point.evEvent->input_text(),
|
||||||
|
Point.evEvent->input_value( 1 ),
|
||||||
|
Point.evEvent->input_value( 2 ),
|
||||||
|
nullptr );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( ismagnetpassed ) {
|
||||||
|
Point.Clear();
|
||||||
|
mvOccupied->SecuritySystem.SHPLock = false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
break;
|
break;
|
||||||
@@ -1415,6 +1447,19 @@ TController::TableUpdateEvent( double &Velocity, TCommandType &Command, TSpeedPo
|
|||||||
}
|
}
|
||||||
// check signals ahead
|
// check signals ahead
|
||||||
if( Point.fDist > 0.0 ) {
|
if( Point.fDist > 0.0 ) {
|
||||||
|
// bail out early for signals which activate when passed
|
||||||
|
// TBD: make it an event method?
|
||||||
|
switch( Point.evEvent->input_command() ) {
|
||||||
|
case TCommandType::cm_EmergencyBrake: {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
case TCommandType::cm_SecuritySystemMagnet: {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if( Point.IsProperSemaphor( OrderCurrentGet() ) ) {
|
if( Point.IsProperSemaphor( OrderCurrentGet() ) ) {
|
||||||
// special rule for cars: ignore stop signals at distance too short to come to a stop
|
// special rule for cars: ignore stop signals at distance too short to come to a stop
|
||||||
@@ -2793,7 +2838,8 @@ bool TController::PrepareEngine()
|
|||||||
&& ( true == IsAnyConverterEnabled )
|
&& ( true == IsAnyConverterEnabled )
|
||||||
&& ( true == IsAnyCompressorEnabled )
|
&& ( true == IsAnyCompressorEnabled )
|
||||||
&& ( ( mvControlling->ScndPipePress > 4.5 ) || ( mvControlling->VeselVolume == 0.0 ) )
|
&& ( ( mvControlling->ScndPipePress > 4.5 ) || ( mvControlling->VeselVolume == 0.0 ) )
|
||||||
&& ( ( mvOccupied->fBrakeCtrlPos == mvOccupied->Handle->GetPos( bh_RP ) || ( mvOccupied->BrakeHandle == TBrakeHandle::NoHandle ) ) );
|
&& ( ( static_cast<int>( mvOccupied->fBrakeCtrlPos ) == static_cast<int>( mvOccupied->Handle->GetPos( bh_RP ) ) )
|
||||||
|
|| ( mvOccupied->BrakeHandle == TBrakeHandle::NoHandle ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( true == isready ) {
|
if( true == isready ) {
|
||||||
@@ -7511,8 +7557,10 @@ TController::adjust_desired_speed_for_current_speed() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// HACK: limit acceleration for cargo trains, to reduce probability of breaking couplers on sudden jolts
|
// HACK: limit acceleration for cargo trains, to reduce probability of breaking couplers on sudden jolts
|
||||||
auto MaxAcc{ 0.5 * (mvOccupied->Couplers[mvOccupied->DirAbsolute >= 0 ? 1 : 0].FmaxC) / fMass };
|
auto MaxAcc{ 0.5 * mvOccupied->Couplers[(mvOccupied->DirAbsolute >= 0 ? end::rear : end::front)].FmaxC / fMass };
|
||||||
MaxAcc *= clamp(vel * 0.2, 0.2, 1.0);
|
if( iVehicles - ControlledEnginesCount > 0 ) {
|
||||||
|
MaxAcc *= clamp( vel * 0.025, 0.2, 1.0 );
|
||||||
|
}
|
||||||
AccDesired = std::min(AccDesired, clamp(MaxAcc, HeavyCargoTrainAcceleration, AccPreferred));
|
AccDesired = std::min(AccDesired, clamp(MaxAcc, HeavyCargoTrainAcceleration, AccPreferred));
|
||||||
// TBD: expand this behaviour to all trains with car(s) exceeding certain weight?
|
// TBD: expand this behaviour to all trains with car(s) exceeding certain weight?
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -740,6 +740,10 @@ putvalues_event::deserialize_( cParser &Input, scene::scratch_data &Scratchpad )
|
|||||||
m_input.command_type = TCommandType::cm_OutsideStation;
|
m_input.command_type = TCommandType::cm_OutsideStation;
|
||||||
m_passive = true; // ma być skanowny, aby AI nie przekraczało W5
|
m_passive = true; // ma być skanowny, aby AI nie przekraczało W5
|
||||||
}
|
}
|
||||||
|
else if( token == "CabSignal" ) {
|
||||||
|
m_input.command_type = TCommandType::cm_SecuritySystemMagnet;
|
||||||
|
m_passive = true;
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
m_input.command_type = TCommandType::cm_Unknown;
|
m_input.command_type = TCommandType::cm_Unknown;
|
||||||
}
|
}
|
||||||
|
|||||||
10
Globals.cpp
10
Globals.cpp
@@ -86,8 +86,7 @@ global_settings::ConfigParse(cParser &Parser) {
|
|||||||
{
|
{
|
||||||
Parser.getTokens(1);
|
Parser.getTokens(1);
|
||||||
Parser >> BaseDrawRange;
|
Parser >> BaseDrawRange;
|
||||||
BaseDrawRange = clamp(BaseDrawRange, 500.f,
|
BaseDrawRange = clamp(BaseDrawRange, 500.f, 5000.f); // arbitrary limits to keep users from hurting themselves
|
||||||
5000.f); // arbitrary limits to keep users from hurting themselves
|
|
||||||
}
|
}
|
||||||
else if (token == "fullscreen")
|
else if (token == "fullscreen")
|
||||||
{
|
{
|
||||||
@@ -1009,6 +1008,12 @@ global_settings::ConfigParse_gfx( cParser &Parser, std::string_view const Token
|
|||||||
Parser.getTokens(1);
|
Parser.getTokens(1);
|
||||||
Parser >> gfx_shadergamma;
|
Parser >> gfx_shadergamma;
|
||||||
}
|
}
|
||||||
|
else if (Token == "gfx.drawrange.factor.max")
|
||||||
|
{
|
||||||
|
Parser.getTokens(1);
|
||||||
|
Parser >> gfx_distance_factor_max;
|
||||||
|
gfx_distance_factor_max = clamp(gfx_distance_factor_max, 1.f, 3.f);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tokenparsed = false;
|
tokenparsed = false;
|
||||||
@@ -1230,6 +1235,7 @@ global_settings::export_as_text( std::ostream &Output ) const {
|
|||||||
export_as_text( Output, "gfx.skippipeline", gfx_skippipeline );
|
export_as_text( Output, "gfx.skippipeline", gfx_skippipeline );
|
||||||
export_as_text( Output, "gfx.extraeffects", gfx_extraeffects );
|
export_as_text( Output, "gfx.extraeffects", gfx_extraeffects );
|
||||||
export_as_text( Output, "gfx.shadergamma", gfx_shadergamma );
|
export_as_text( Output, "gfx.shadergamma", gfx_shadergamma );
|
||||||
|
export_as_text( Output, "gfx.drawrange.factor.max", gfx_distance_factor_max );
|
||||||
export_as_text( Output, "python.enabled", python_enabled );
|
export_as_text( Output, "python.enabled", python_enabled );
|
||||||
export_as_text( Output, "python.threadedupload", python_threadedupload );
|
export_as_text( Output, "python.threadedupload", python_threadedupload );
|
||||||
export_as_text( Output, "python.uploadmain", python_uploadmain );
|
export_as_text( Output, "python.uploadmain", python_uploadmain );
|
||||||
|
|||||||
@@ -148,8 +148,8 @@ struct global_settings {
|
|||||||
bool ResourceMove{ false }; // gfx resources are moved between cpu and gpu side instead of sending a copy
|
bool ResourceMove{ false }; // gfx resources are moved between cpu and gpu side instead of sending a copy
|
||||||
bool compress_tex{ true }; // all textures are compressed on gpu side
|
bool compress_tex{ true }; // all textures are compressed on gpu side
|
||||||
std::string asSky{ "1" };
|
std::string asSky{ "1" };
|
||||||
double fFpsAverage{ 20.0 }; // oczekiwana wartosć FPS
|
float fFpsAverage{ 0.f }; // oczekiwana wartosć FPS
|
||||||
double fFpsDeviation{ 5.0 }; // odchylenie standardowe FPS
|
float fFpsDeviation{ 5.f }; // odchylenie standardowe FPS
|
||||||
double fFpsMin{ 30.0 }; // dolna granica FPS, przy której promień scenerii będzie zmniejszany
|
double fFpsMin{ 30.0 }; // dolna granica FPS, przy której promień scenerii będzie zmniejszany
|
||||||
double fFpsMax{ 65.0 }; // górna granica FPS, przy której promień scenerii będzie zwiększany
|
double fFpsMax{ 65.0 }; // górna granica FPS, przy której promień scenerii będzie zwiększany
|
||||||
// audio
|
// audio
|
||||||
@@ -228,6 +228,7 @@ struct global_settings {
|
|||||||
bool gfx_extraeffects = true;
|
bool gfx_extraeffects = true;
|
||||||
bool gfx_shadergamma = false;
|
bool gfx_shadergamma = false;
|
||||||
bool gfx_usegles = false;
|
bool gfx_usegles = false;
|
||||||
|
float gfx_distance_factor_max { 3.f };
|
||||||
|
|
||||||
std::string exec_on_exit;
|
std::string exec_on_exit;
|
||||||
|
|
||||||
|
|||||||
@@ -664,6 +664,8 @@ struct TSecuritySystem
|
|||||||
int NextVelocityAllowed; /*predkosc pokazywana przez sygnalizacje kabinowa*/
|
int NextVelocityAllowed; /*predkosc pokazywana przez sygnalizacje kabinowa*/
|
||||||
bool RadioStop; // czy jest RadioStop
|
bool RadioStop; // czy jest RadioStop
|
||||||
bool PoweredUp { false }; // helper, for detection of power state change
|
bool PoweredUp { false }; // helper, for detection of power state change
|
||||||
|
bool SHPLock{ false }; // prevents tps reset when true
|
||||||
|
double MagnetLocation { 0.0 }; // placement of tps magnet, as offset from vehicle front
|
||||||
|
|
||||||
inline bool is_beeping() const {
|
inline bool is_beeping() const {
|
||||||
return TestFlag( Status, s_SHPalarm );
|
return TestFlag( Status, s_SHPalarm );
|
||||||
|
|||||||
@@ -2664,6 +2664,7 @@ bool TMoverParameters::CabDeactivisation( bool const Enforce )
|
|||||||
DirAbsolute = DirActive * CabActive;
|
DirAbsolute = DirActive * CabActive;
|
||||||
DepartureSignal = false; // nie buczeć z nieaktywnej kabiny
|
DepartureSignal = false; // nie buczeć z nieaktywnej kabiny
|
||||||
SecuritySystem.Status = s_off; // deactivate alerter TODO: make it part of control based cab selection
|
SecuritySystem.Status = s_off; // deactivate alerter TODO: make it part of control based cab selection
|
||||||
|
SecuritySystem.SHPLock = false;
|
||||||
|
|
||||||
SendCtrlToNext("CabActivisation", 0, CabOccupied); // CabActive==0!
|
SendCtrlToNext("CabActivisation", 0, CabOccupied); // CabActive==0!
|
||||||
}
|
}
|
||||||
@@ -2827,19 +2828,19 @@ void TMoverParameters::SSReset(void)
|
|||||||
SetFlag(SecuritySystem.Status, -s_aware);
|
SetFlag(SecuritySystem.Status, -s_aware);
|
||||||
SetFlag(SecuritySystem.Status, -s_CAalarm);
|
SetFlag(SecuritySystem.Status, -s_CAalarm);
|
||||||
SetFlag(SecuritySystem.Status, -s_CAebrake);
|
SetFlag(SecuritySystem.Status, -s_CAebrake);
|
||||||
// EmergencyBrakeFlag = false; //YB-HN
|
|
||||||
SecuritySystem.VelocityAllowed = -1;
|
SecuritySystem.VelocityAllowed = -1;
|
||||||
}
|
}
|
||||||
else if (TestFlag(SecuritySystem.Status, s_active))
|
else if (TestFlag(SecuritySystem.Status, s_active))
|
||||||
{
|
{
|
||||||
|
if( false == SecuritySystem.SHPLock ) {
|
||||||
SecuritySystem.SystemBrakeSHPTimer = 0;
|
SecuritySystem.SystemBrakeSHPTimer = 0;
|
||||||
SecuritySystem.SystemSoundSHPTimer = 0;
|
SecuritySystem.SystemSoundSHPTimer = 0;
|
||||||
SetFlag(SecuritySystem.Status, -s_active);
|
SetFlag( SecuritySystem.Status, -s_active );
|
||||||
SetFlag(SecuritySystem.Status, -s_SHPalarm);
|
SetFlag( SecuritySystem.Status, -s_SHPalarm );
|
||||||
SetFlag(SecuritySystem.Status, -s_SHPebrake);
|
SetFlag( SecuritySystem.Status, -s_SHPebrake );
|
||||||
// EmergencyBrakeFlag = false; //YB-HN
|
|
||||||
SecuritySystem.VelocityAllowed = -1;
|
SecuritySystem.VelocityAllowed = -1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// *****************************************************************************
|
// *****************************************************************************
|
||||||
@@ -10542,7 +10543,7 @@ void TMoverParameters::LoadFIZ_Security( std::string const &line ) {
|
|||||||
extract_value( SecuritySystem.SoundSignalDelay, "SoundSignalDelay", line, "" );
|
extract_value( SecuritySystem.SoundSignalDelay, "SoundSignalDelay", line, "" );
|
||||||
extract_value( SecuritySystem.EmergencyBrakeDelay, "EmergencyBrakeDelay", line, "" );
|
extract_value( SecuritySystem.EmergencyBrakeDelay, "EmergencyBrakeDelay", line, "" );
|
||||||
extract_value( SecuritySystem.RadioStop, "RadioStop", line, "" );
|
extract_value( SecuritySystem.RadioStop, "RadioStop", line, "" );
|
||||||
|
extract_value( SecuritySystem.MagnetLocation, "MagnetLocation", line, "" );
|
||||||
extract_value( EmergencyBrakeWarningSignal, "EmergencyBrakeWarningSignal", line, "" );
|
extract_value( EmergencyBrakeWarningSignal, "EmergencyBrakeWarningSignal", line, "" );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -11487,9 +11488,6 @@ bool TMoverParameters::CheckLocomotiveParameters(bool ReadyFlag, int Dir)
|
|||||||
BrakeDelay[b] = BrakeDelay[b] * (2.5 + Random(0.0, 0.2)) / 3.0;
|
BrakeDelay[b] = BrakeDelay[b] * (2.5 + Random(0.0, 0.2)) / 3.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TrainType == dt_ET22)
|
|
||||||
CompressorPower = 0;
|
|
||||||
|
|
||||||
Hamulec->Init(PipePress, HighPipePress, LowPipePress, BrakePress, BrakeDelayFlag);
|
Hamulec->Init(PipePress, HighPipePress, LowPipePress, BrakePress, BrakeDelayFlag);
|
||||||
/*
|
/*
|
||||||
ScndPipePress = Compressor;
|
ScndPipePress = Compressor;
|
||||||
@@ -11506,6 +11504,13 @@ bool TMoverParameters::CheckLocomotiveParameters(bool ReadyFlag, int Dir)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// security system
|
||||||
|
// by default place the magnet in the vehicle centre
|
||||||
|
if( SecuritySystem.MagnetLocation == 0 ) {
|
||||||
|
SecuritySystem.MagnetLocation = Dim.L / 2 - 0.5;
|
||||||
|
}
|
||||||
|
SecuritySystem.MagnetLocation = clamp( SecuritySystem.MagnetLocation, 0.0, Dim.L );
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -12037,7 +12042,7 @@ bool TMoverParameters::RunCommand( std::string Command, double CValue1, double C
|
|||||||
{
|
{
|
||||||
SecuritySystem.VelocityAllowed = static_cast<int>(floor(CValue1));
|
SecuritySystem.VelocityAllowed = static_cast<int>(floor(CValue1));
|
||||||
SecuritySystem.NextVelocityAllowed = static_cast<int>(floor(CValue2));
|
SecuritySystem.NextVelocityAllowed = static_cast<int>(floor(CValue2));
|
||||||
SecuritySystem.SystemSoundSHPTimer = 0; // hunter-091012
|
// SecuritySystem.SystemSoundSHPTimer = 0; // hunter-091012
|
||||||
SetFlag(SecuritySystem.Status, s_active);
|
SetFlag(SecuritySystem.Status, s_active);
|
||||||
}
|
}
|
||||||
// else OK:=false;
|
// else OK:=false;
|
||||||
|
|||||||
@@ -86,6 +86,10 @@ TCommandType TMemCell::CommandCheck()
|
|||||||
eCommand = TCommandType::cm_EmergencyBrake;
|
eCommand = TCommandType::cm_EmergencyBrake;
|
||||||
bCommand = false;
|
bCommand = false;
|
||||||
}
|
}
|
||||||
|
else if( szText == "CabSignal" ) {
|
||||||
|
eCommand = TCommandType::cm_SecuritySystemMagnet;
|
||||||
|
bCommand = false;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
eCommand = TCommandType::cm_Unknown; // ciąg nierozpoznany (nie jest komendą)
|
eCommand = TCommandType::cm_Unknown; // ciąg nierozpoznany (nie jest komendą)
|
||||||
|
|||||||
9
gl/ubo.h
9
gl/ubo.h
@@ -44,10 +44,10 @@ namespace gl
|
|||||||
glm::mat4 inv_view;
|
glm::mat4 inv_view;
|
||||||
glm::mat4 lightview[MAX_CASCADES];
|
glm::mat4 lightview[MAX_CASCADES];
|
||||||
glm::vec4 cascade_end;
|
glm::vec4 cascade_end;
|
||||||
float time;
|
float time; UBS_PAD( 12 );
|
||||||
};
|
};
|
||||||
|
|
||||||
static_assert(sizeof(scene_ubs) == 340, "bad size of ubs");
|
static_assert(sizeof(scene_ubs) == 352, "bad size of ubs");
|
||||||
|
|
||||||
const size_t MAX_PARAMS = 3;
|
const size_t MAX_PARAMS = 3;
|
||||||
|
|
||||||
@@ -62,8 +62,7 @@ namespace gl
|
|||||||
float emission;
|
float emission;
|
||||||
float fog_density;
|
float fog_density;
|
||||||
float alpha_mult;
|
float alpha_mult;
|
||||||
float shadow_tone;
|
float shadow_tone; UBS_PAD(12);
|
||||||
UBS_PAD(4);
|
|
||||||
|
|
||||||
void set_modelview(const glm::mat4 &mv)
|
void set_modelview(const glm::mat4 &mv)
|
||||||
{
|
{
|
||||||
@@ -72,7 +71,7 @@ namespace gl
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static_assert(sizeof(model_ubs) == 200 + 16 * MAX_PARAMS, "bad size of ubs");
|
static_assert(sizeof(model_ubs) == 208 + 16 * MAX_PARAMS, "bad size of ubs");
|
||||||
|
|
||||||
struct light_element_ubs
|
struct light_element_ubs
|
||||||
{
|
{
|
||||||
|
|||||||
3
moon.cpp
3
moon.cpp
@@ -31,11 +31,12 @@ cMoon::init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cMoon::update() {
|
cMoon::update( bool const Includephase ) {
|
||||||
|
|
||||||
m_observer.temp = Global.AirTemperature;
|
m_observer.temp = Global.AirTemperature;
|
||||||
|
|
||||||
move();
|
move();
|
||||||
|
if( Includephase ) { phase(); }
|
||||||
glm::vec3 position( 0.f, 0.f, -1.f );
|
glm::vec3 position( 0.f, 0.f, -1.f );
|
||||||
position = glm::rotateX( position, glm::radians( static_cast<float>( m_body.elevref ) ) );
|
position = glm::rotateX( position, glm::radians( static_cast<float>( m_body.elevref ) ) );
|
||||||
position = glm::rotateY( position, glm::radians( static_cast<float>( -m_body.hrang ) ) );
|
position = glm::rotateY( position, glm::radians( static_cast<float>( -m_body.hrang ) ) );
|
||||||
|
|||||||
2
moon.h
2
moon.h
@@ -12,7 +12,7 @@ public:
|
|||||||
|
|
||||||
// methods:
|
// methods:
|
||||||
void init();
|
void init();
|
||||||
void update();
|
void update( bool const Includephase = false );
|
||||||
void render();
|
void render();
|
||||||
// returns vector pointing at the sun
|
// returns vector pointing at the sun
|
||||||
glm::vec3 getDirection();
|
glm::vec3 getDirection();
|
||||||
|
|||||||
@@ -702,7 +702,7 @@ void opengl33_renderer::Render_pass(viewport_config &vp, rendermode const Mode)
|
|||||||
|
|
||||||
scene_ubs.projection = OpenGLMatrices.data(GL_PROJECTION);
|
scene_ubs.projection = OpenGLMatrices.data(GL_PROJECTION);
|
||||||
scene_ubo->update(scene_ubs);
|
scene_ubo->update(scene_ubs);
|
||||||
Render(&simulation::Environment);
|
Render(&simulation::Environment, false);
|
||||||
|
|
||||||
if( Global.gfx_shadowmap_enabled )
|
if( Global.gfx_shadowmap_enabled )
|
||||||
setup_shadow_bind_map();
|
setup_shadow_bind_map();
|
||||||
@@ -916,7 +916,7 @@ void opengl33_renderer::Render_pass(viewport_config &vp, rendermode const Mode)
|
|||||||
setup_shadow_unbind_map();
|
setup_shadow_unbind_map();
|
||||||
scene_ubs.projection = OpenGLMatrices.data(GL_PROJECTION);
|
scene_ubs.projection = OpenGLMatrices.data(GL_PROJECTION);
|
||||||
scene_ubo->update(scene_ubs);
|
scene_ubo->update(scene_ubs);
|
||||||
Render(&simulation::Environment);
|
Render(&simulation::Environment, Global.gfx_skippipeline); // HACK: sun/moon drawing messes up rendering with skippipeline on TODO: investigate and fix
|
||||||
// opaque parts...
|
// opaque parts...
|
||||||
setup_drawing(false);
|
setup_drawing(false);
|
||||||
setup_shadow_bind_map();
|
setup_shadow_bind_map();
|
||||||
@@ -1521,7 +1521,7 @@ void opengl33_renderer::setup_sunlight_intensity( float const Factor ) {
|
|||||||
light_ubo->update( light_ubs );
|
light_ubo->update( light_ubs );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool opengl33_renderer::Render(world_environment *Environment)
|
bool opengl33_renderer::Render(world_environment *Environment, bool const Skipcelestialbodies )
|
||||||
{
|
{
|
||||||
m_shadowcolor = colors::white; // prevent shadow from affecting sky
|
m_shadowcolor = colors::white; // prevent shadow from affecting sky
|
||||||
setup_shadow_color( m_shadowcolor );
|
setup_shadow_color( m_shadowcolor );
|
||||||
@@ -1534,6 +1534,7 @@ bool opengl33_renderer::Render(world_environment *Environment)
|
|||||||
|
|
||||||
Bind_Material(null_handle);
|
Bind_Material(null_handle);
|
||||||
::glDisable(GL_DEPTH_TEST);
|
::glDisable(GL_DEPTH_TEST);
|
||||||
|
::glDepthMask(GL_FALSE);
|
||||||
::glPushMatrix();
|
::glPushMatrix();
|
||||||
|
|
||||||
// skydome
|
// skydome
|
||||||
@@ -1554,7 +1555,7 @@ bool opengl33_renderer::Render(world_environment *Environment)
|
|||||||
::glBlendFunc( GL_SRC_ALPHA, GL_ONE );
|
::glBlendFunc( GL_SRC_ALPHA, GL_ONE );
|
||||||
|
|
||||||
// stars
|
// stars
|
||||||
if (Environment->m_stars.m_stars != nullptr)
|
if (Environment->m_stars.m_stars != nullptr && !Skipcelestialbodies )
|
||||||
{
|
{
|
||||||
// setup
|
// setup
|
||||||
::glPushMatrix();
|
::glPushMatrix();
|
||||||
@@ -1581,6 +1582,7 @@ bool opengl33_renderer::Render(world_environment *Environment)
|
|||||||
glm::vec3 suncolor = interpolate(glm::vec3(255.0f / 255.0f, 242.0f / 255.0f, 231.0f / 255.0f), glm::vec3(235.0f / 255.0f, 140.0f / 255.0f, 36.0f / 255.0f), duskfactor);
|
glm::vec3 suncolor = interpolate(glm::vec3(255.0f / 255.0f, 242.0f / 255.0f, 231.0f / 255.0f), glm::vec3(235.0f / 255.0f, 140.0f / 255.0f, 36.0f / 255.0f), duskfactor);
|
||||||
|
|
||||||
// sun
|
// sun
|
||||||
|
// if( !Skipcelestialbodies )
|
||||||
{
|
{
|
||||||
Bind_Texture(0, m_suntexture);
|
Bind_Texture(0, m_suntexture);
|
||||||
glm::vec4 color(suncolor.x, suncolor.y, suncolor.z, clamp(1.5f - Global.Overcast, 0.f, 1.f) * fogfactor);
|
glm::vec4 color(suncolor.x, suncolor.y, suncolor.z, clamp(1.5f - Global.Overcast, 0.f, 1.f) * fogfactor);
|
||||||
@@ -1597,6 +1599,7 @@ bool opengl33_renderer::Render(world_environment *Environment)
|
|||||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||||
}
|
}
|
||||||
// moon
|
// moon
|
||||||
|
if( !Skipcelestialbodies )
|
||||||
{
|
{
|
||||||
Bind_Texture(0, m_moontexture);
|
Bind_Texture(0, m_moontexture);
|
||||||
glm::vec3 mooncolor(255.0f / 255.0f, 242.0f / 255.0f, 231.0f / 255.0f);
|
glm::vec3 mooncolor(255.0f / 255.0f, 242.0f / 255.0f, 231.0f / 255.0f);
|
||||||
@@ -1668,7 +1671,8 @@ bool opengl33_renderer::Render(world_environment *Environment)
|
|||||||
clamp( Environment->m_moon.getAngle(), 0.f, 90.f ) / 90.f );
|
clamp( Environment->m_moon.getAngle(), 0.f, 90.f ) / 90.f );
|
||||||
|
|
||||||
model_ubs.param[0] = color;
|
model_ubs.param[0] = color;
|
||||||
model_ubs.param[1] = glm::vec4(glm::vec3(modelview * glm::vec4(moonvector, 1.0f)), /*0.00451f*/ size);
|
// model_ubs.param[1] = glm::vec4(glm::vec3(modelview * glm::vec4(moonvector, 1.0f)), 0.00451f);
|
||||||
|
model_ubs.param[1] = glm::vec4(glm::vec3(modelview * glm::vec4(moonvector, 1.0f)), size);
|
||||||
model_ubs.param[2] = glm::vec4(moonu, moonv, 0.333f, 0.0f);
|
model_ubs.param[2] = glm::vec4(moonu, moonv, 0.333f, 0.0f);
|
||||||
model_ubo->update(model_ubs);
|
model_ubo->update(model_ubs);
|
||||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||||
@@ -1711,6 +1715,7 @@ bool opengl33_renderer::Render(world_environment *Environment)
|
|||||||
gl::program::unbind();
|
gl::program::unbind();
|
||||||
gl::vao::unbind();
|
gl::vao::unbind();
|
||||||
::glPopMatrix();
|
::glPopMatrix();
|
||||||
|
::glDepthMask(GL_TRUE);
|
||||||
::glEnable(GL_DEPTH_TEST);
|
::glEnable(GL_DEPTH_TEST);
|
||||||
|
|
||||||
m_sunlight.apply_angle();
|
m_sunlight.apply_angle();
|
||||||
@@ -4135,13 +4140,32 @@ void opengl33_renderer::Update(double const Deltatime)
|
|||||||
|
|
||||||
// adjust draw ranges etc, based on recent performance
|
// adjust draw ranges etc, based on recent performance
|
||||||
// TODO: it doesn't make much sense with vsync
|
// TODO: it doesn't make much sense with vsync
|
||||||
if( Global.targetfps == 0.0f ) {
|
if( Global.targetfps != 0.f ) {
|
||||||
|
auto const fps_diff = m_framerate - Global.targetfps;
|
||||||
|
if( fps_diff < -0.5f ) {
|
||||||
|
Global.fDistanceFactor = std::min( std::max( 1.0f, Global.fDistanceFactor - 0.05f ), Global.gfx_distance_factor_max );
|
||||||
|
}
|
||||||
|
else if( fps_diff > 0.5f ) {
|
||||||
|
Global.fDistanceFactor = std::min( std::min( 3.0f, Global.fDistanceFactor + 0.05f ), Global.gfx_distance_factor_max );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// legacy framerate parameters
|
||||||
|
else if( Global.fFpsAverage != 0.f ) {
|
||||||
|
auto const fps_diff = m_framerate - Global.fFpsAverage;
|
||||||
|
if( fps_diff < -Global.fFpsDeviation ) {
|
||||||
|
Global.fDistanceFactor = std::min( std::max( 1.0f, Global.fDistanceFactor - 0.05f ), Global.gfx_distance_factor_max );
|
||||||
|
}
|
||||||
|
else if( fps_diff > Global.fFpsDeviation ) {
|
||||||
|
Global.fDistanceFactor = std::min( std::min( 3.0f, Global.fDistanceFactor + 0.05f ), Global.gfx_distance_factor_max );
|
||||||
|
}
|
||||||
|
}
|
||||||
// automatic adjustment
|
// automatic adjustment
|
||||||
|
else {
|
||||||
auto const framerate = interpolate( 1000.f / Timer::subsystem.gfx_color.average(), m_framerate, 0.75f );
|
auto const framerate = interpolate( 1000.f / Timer::subsystem.gfx_color.average(), m_framerate, 0.75f );
|
||||||
float targetfactor;
|
float targetfactor;
|
||||||
if( framerate > 120.0 ) { targetfactor = 3.00f; }
|
if( framerate > 120.f ) { targetfactor = std::min( Global.gfx_distance_factor_max, 3.00f ); }
|
||||||
else if( framerate > 90.0 ) { targetfactor = 1.50f; }
|
else if( framerate > 90.f ) { targetfactor = std::min( Global.gfx_distance_factor_max, 1.50f ); }
|
||||||
else if( framerate > 60.0 ) { targetfactor = 1.25f; }
|
else if( framerate > 60.f ) { targetfactor = std::min( Global.gfx_distance_factor_max, 1.25f ); }
|
||||||
else { targetfactor = 1.00f; }
|
else { targetfactor = 1.00f; }
|
||||||
if( targetfactor > Global.fDistanceFactor ) {
|
if( targetfactor > Global.fDistanceFactor ) {
|
||||||
Global.fDistanceFactor = std::min( targetfactor, Global.fDistanceFactor + 0.05f );
|
Global.fDistanceFactor = std::min( targetfactor, Global.fDistanceFactor + 0.05f );
|
||||||
@@ -4150,15 +4174,6 @@ void opengl33_renderer::Update(double const Deltatime)
|
|||||||
Global.fDistanceFactor = std::max( targetfactor, Global.fDistanceFactor - 0.05f );
|
Global.fDistanceFactor = std::max( targetfactor, Global.fDistanceFactor - 0.05f );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
auto const fps_diff = Global.targetfps - m_framerate;
|
|
||||||
if( fps_diff > 0.5f ) {
|
|
||||||
Global.fDistanceFactor = std::max( 1.0f, Global.fDistanceFactor - 0.05f );
|
|
||||||
}
|
|
||||||
else if( fps_diff < 1.0f ) {
|
|
||||||
Global.fDistanceFactor = std::min( 3.0f, Global.fDistanceFactor + 0.05f );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( Global.UpdateMaterials ) {
|
if( Global.UpdateMaterials ) {
|
||||||
// update resources if there was environmental change
|
// update resources if there was environmental change
|
||||||
|
|||||||
@@ -234,7 +234,7 @@ class opengl33_renderer : public gfx_renderer {
|
|||||||
void Render_pass(viewport_config &vp, rendermode const Mode);
|
void Render_pass(viewport_config &vp, rendermode const Mode);
|
||||||
// creates dynamic environment cubemap
|
// creates dynamic environment cubemap
|
||||||
bool Render_reflections(viewport_config &vp);
|
bool Render_reflections(viewport_config &vp);
|
||||||
bool Render(world_environment *Environment);
|
bool Render(world_environment *Environment, bool const Skipcelestialbodies );
|
||||||
void Render(scene::basic_region *Region);
|
void Render(scene::basic_region *Region);
|
||||||
void Render(section_sequence::iterator First, section_sequence::iterator Last);
|
void Render(section_sequence::iterator First, section_sequence::iterator Last);
|
||||||
void Render(cell_sequence::iterator First, cell_sequence::iterator Last);
|
void Render(cell_sequence::iterator First, cell_sequence::iterator Last);
|
||||||
|
|||||||
@@ -4186,13 +4186,33 @@ opengl_renderer::Update( double const Deltatime ) {
|
|||||||
m_framerate = 1000.f / ( Timer::subsystem.gfx_total.average() );
|
m_framerate = 1000.f / ( Timer::subsystem.gfx_total.average() );
|
||||||
|
|
||||||
// adjust draw ranges etc, based on recent performance
|
// adjust draw ranges etc, based on recent performance
|
||||||
if( Global.targetfps == 0.0f ) {
|
// TODO: it doesn't make much sense with vsync
|
||||||
|
if( Global.targetfps != 0.f ) {
|
||||||
|
auto const fps_diff = m_framerate - Global.targetfps;
|
||||||
|
if( fps_diff < -0.5f ) {
|
||||||
|
Global.fDistanceFactor = std::min( std::max( 1.0f, Global.fDistanceFactor - 0.05f ), Global.gfx_distance_factor_max );
|
||||||
|
}
|
||||||
|
else if( fps_diff > 0.5f ) {
|
||||||
|
Global.fDistanceFactor = std::min( std::min( 3.0f, Global.fDistanceFactor + 0.05f ), Global.gfx_distance_factor_max );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// legacy framerate parameters
|
||||||
|
else if( Global.fFpsAverage != 0.f ) {
|
||||||
|
auto const fps_diff = m_framerate - Global.fFpsAverage;
|
||||||
|
if( fps_diff < -Global.fFpsDeviation ) {
|
||||||
|
Global.fDistanceFactor = std::min( std::max( 1.0f, Global.fDistanceFactor - 0.05f ), Global.gfx_distance_factor_max );
|
||||||
|
}
|
||||||
|
else if( fps_diff > Global.fFpsDeviation ) {
|
||||||
|
Global.fDistanceFactor = std::min( std::min( 3.0f, Global.fDistanceFactor + 0.05f ), Global.gfx_distance_factor_max );
|
||||||
|
}
|
||||||
|
}
|
||||||
// automatic adjustment
|
// automatic adjustment
|
||||||
|
else {
|
||||||
auto const framerate = interpolate( 1000.f / Timer::subsystem.gfx_color.average(), m_framerate, 0.75f );
|
auto const framerate = interpolate( 1000.f / Timer::subsystem.gfx_color.average(), m_framerate, 0.75f );
|
||||||
float targetfactor;
|
float targetfactor;
|
||||||
if( framerate > 120.0 ) { targetfactor = 3.00f; }
|
if( framerate > 120.f ) { targetfactor = std::min( Global.gfx_distance_factor_max, 3.00f ); }
|
||||||
else if( framerate > 90.0 ) { targetfactor = 1.50f; }
|
else if( framerate > 90.f ) { targetfactor = std::min( Global.gfx_distance_factor_max, 1.50f ); }
|
||||||
else if( framerate > 60.0 ) { targetfactor = 1.25f; }
|
else if( framerate > 60.f ) { targetfactor = std::min( Global.gfx_distance_factor_max, 1.25f ); }
|
||||||
else { targetfactor = 1.00f; }
|
else { targetfactor = 1.00f; }
|
||||||
if( targetfactor > Global.fDistanceFactor ) {
|
if( targetfactor > Global.fDistanceFactor ) {
|
||||||
Global.fDistanceFactor = std::min( targetfactor, Global.fDistanceFactor + 0.05f );
|
Global.fDistanceFactor = std::min( targetfactor, Global.fDistanceFactor + 0.05f );
|
||||||
@@ -4201,15 +4221,6 @@ opengl_renderer::Update( double const Deltatime ) {
|
|||||||
Global.fDistanceFactor = std::max( targetfactor, Global.fDistanceFactor - 0.05f );
|
Global.fDistanceFactor = std::max( targetfactor, Global.fDistanceFactor - 0.05f );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
auto const fps_diff = Global.targetfps - m_framerate;
|
|
||||||
if( fps_diff > 0.5f ) {
|
|
||||||
Global.fDistanceFactor = std::max( 1.0f, Global.fDistanceFactor - 0.05f );
|
|
||||||
}
|
|
||||||
else if( fps_diff < 1.0f ) {
|
|
||||||
Global.fDistanceFactor = std::min( 3.0f, Global.fDistanceFactor + 0.05f );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( Global.UpdateMaterials ) {
|
if( Global.UpdateMaterials ) {
|
||||||
// update resources if there was environmental change
|
// update resources if there was environmental change
|
||||||
|
|||||||
@@ -314,6 +314,8 @@ void state_manager::process_commands() {
|
|||||||
// HACK: force re-calculation of precipitation
|
// HACK: force re-calculation of precipitation
|
||||||
Global.Overcast = clamp( Global.Overcast - 0.0001f, 0.0f, 2.0f );
|
Global.Overcast = clamp( Global.Overcast - 0.0001f, 0.0f, 2.0f );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
simulation::Environment.update_moon();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (commanddata.command == user_command::setweather) {
|
if (commanddata.command == user_command::setweather) {
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ world_environment::update() {
|
|||||||
Global.DayLight.position = m_moon.getDirection();
|
Global.DayLight.position = m_moon.getDirection();
|
||||||
Global.DayLight.direction = -1.0f * m_moon.getDirection();
|
Global.DayLight.direction = -1.0f * m_moon.getDirection();
|
||||||
keylightintensity = moonlightlevel;
|
keylightintensity = moonlightlevel;
|
||||||
m_lightintensity = 0.35f;
|
m_lightintensity = moonlightlevel;
|
||||||
// if the moon is up, it overrides the twilight
|
// if the moon is up, it overrides the twilight
|
||||||
twilightfactor = 0.0f;
|
twilightfactor = 0.0f;
|
||||||
keylightcolor = glm::vec3( 255.0f / 255.0f, 242.0f / 255.0f, 202.0f / 255.0f );
|
keylightcolor = glm::vec3( 255.0f / 255.0f, 242.0f / 255.0f, 202.0f / 255.0f );
|
||||||
@@ -165,9 +165,10 @@ world_environment::update() {
|
|||||||
// tonal impact of skydome color is inversely proportional to how high the sun is above the horizon
|
// tonal impact of skydome color is inversely proportional to how high the sun is above the horizon
|
||||||
// (this is pure conjecture, aimed more to 'look right' than be accurate)
|
// (this is pure conjecture, aimed more to 'look right' than be accurate)
|
||||||
float const ambienttone = clamp( 1.0f - ( Global.SunAngle / 90.0f ), 0.0f, 1.0f );
|
float const ambienttone = clamp( 1.0f - ( Global.SunAngle / 90.0f ), 0.0f, 1.0f );
|
||||||
Global.DayLight.ambient[ 0 ] = interpolate( skydomehsv.z, skydomecolour.r, ambienttone );
|
float const ambientintensitynightfactor = 1.f - 0.75f * clamp( -m_sun.getAngle(), 0.0f, 18.0f ) / 18.0f;
|
||||||
Global.DayLight.ambient[ 1 ] = interpolate( skydomehsv.z, skydomecolour.g, ambienttone );
|
Global.DayLight.ambient[ 0 ] = interpolate( skydomehsv.z, skydomecolour.r, ambienttone ) * ambientintensitynightfactor;
|
||||||
Global.DayLight.ambient[ 2 ] = interpolate( skydomehsv.z, skydomecolour.b, ambienttone );
|
Global.DayLight.ambient[ 1 ] = interpolate( skydomehsv.z, skydomecolour.g, ambienttone ) * ambientintensitynightfactor;
|
||||||
|
Global.DayLight.ambient[ 2 ] = interpolate( skydomehsv.z, skydomecolour.b, ambienttone ) * ambientintensitynightfactor;
|
||||||
|
|
||||||
Global.fLuminance = intensity;
|
Global.fLuminance = intensity;
|
||||||
|
|
||||||
@@ -210,6 +211,12 @@ world_environment::update_precipitation() {
|
|||||||
m_precipitation.update();
|
m_precipitation.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
world_environment::update_moon() {
|
||||||
|
|
||||||
|
m_moon.update( true );
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
world_environment::update_wind() {
|
world_environment::update_wind() {
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ public:
|
|||||||
void init();
|
void init();
|
||||||
void update();
|
void update();
|
||||||
void update_precipitation();
|
void update_precipitation();
|
||||||
|
void update_moon();
|
||||||
void time( int const Hour = -1, int const Minute = -1, int const Second = -1 );
|
void time( int const Hour = -1, int const Minute = -1, int const Second = -1 );
|
||||||
// switches between static and dynamic daylight calculation
|
// switches between static and dynamic daylight calculation
|
||||||
void on_daylight_change();
|
void on_daylight_change();
|
||||||
|
|||||||
2
uart.cpp
2
uart.cpp
@@ -199,7 +199,7 @@ void uart_input::poll()
|
|||||||
if (!sync) {
|
if (!sync) {
|
||||||
int sync_cnt = 0;
|
int sync_cnt = 0;
|
||||||
int sync_fail = 0;
|
int sync_fail = 0;
|
||||||
char sc = 0;
|
unsigned char sc = 0;
|
||||||
while ((ret = sp_blocking_read(port, &sc, 1, 10)) >= 0) {
|
while ((ret = sp_blocking_read(port, &sc, 1, 10)) >= 0) {
|
||||||
if (conf.debug)
|
if (conf.debug)
|
||||||
WriteLog("uart: read byte: " + std::to_string((int)sc));
|
WriteLog("uart: read byte: " + std::to_string((int)sc));
|
||||||
|
|||||||
Reference in New Issue
Block a user