16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-18 01:59:19 +02:00

Fix problem with min value bigger than max value in std::clamps

This commit is contained in:
docentYT
2026-05-03 22:18:40 +02:00
parent 13c7317f6e
commit d464628a8e
2 changed files with 17 additions and 34 deletions

View File

@@ -7887,7 +7887,8 @@ TController::adjust_desired_speed_for_braking_test() {
break;
}
case 3: {
AccDesired = std::clamp( -AbsAccS, fAccThreshold * 1.01, fAccThreshold * 1.21 );
auto [minV, maxV] = std::minmax(fAccThreshold * 1.01f, fAccThreshold * 1.21f);
AccDesired = std::clamp(-AbsAccS, minV, maxV);
VelDesired = DBT_VelocityBrake;
if( vel <= DBT_VelocityRelease ) {
DynamicBrakeTest = 4;