Compute the altitude incrementally from slope for Manual Slope Mode (#3847)

This commit is contained in:
Michel Dagenais
2021-03-18 22:22:09 -04:00
committed by GitHub
parent 0fe28abe5a
commit 2be7a2c86e

View File

@@ -1788,6 +1788,13 @@ void TrainSidebar::guiUpdate() // refreshes the telemetry
rtData.setAltitude(displayAltitude);
}
}
else if (!(status & RT_MODE_ERGO)) {
// For manual slope mode, estimate vertical change based upon time passed and slope.
// Note this isn't exactly right but is very close - we should use the previous slope for the time passed.
double altitudeDeltaMeters = slope * (10 * distanceTick); // ((slope / 100) * distanceTick) * 1000
displayAltitude += altitudeDeltaMeters;
rtData.setAltitude(displayAltitude);
}
// time
total_msecs = session_elapsed_msec + session_time.elapsed();