// [PILOT] page 20 specifies that the terrain clearance is equal to
// 75% of the radio altitude, averaged over the previous 15 seconds.
+ // no updates when simulation is paused (dt=0.0), and add 5 samples/second only
+ if (globals->get_sim_time_sec() - last_update < 0.2)
+ return value;
+ last_update = globals->get_sim_time_sec();
+
samples_type::iterator iter;
// remove samples older than 15 seconds
double new_value = 0;
if (samples.size() > 0)
{
+ // time consuming loop => queue limited to 75 samples
+ // (= 15seconds * 5samples/second)
for (iter = samples.begin(); iter != samples.end(); iter++)
- new_value += (*iter).value;
+ new_value += (*iter).value;
new_value /= samples.size();
}
new_value *= 0.75;
{
samples.clear();
value = 0;
+ last_update = -1.0;
}
MK_VIII::IOHandler::IOHandler (MK_VIII *device)
SGSoundSample *sample = _sgr->find(refname.str());
if (! sample)
{
- string filename = "Sounds/mk-viii" + string(name) + ".wav";
+ string filename = "Sounds/mk-viii/" + string(name) + ".wav";
try
{
sample = new SGSoundSample(filename.c_str(), SGPath());
{
assert(altitude_callout_voice != NULL);
mk->voice_player.play(altitude_callout_voice);
+ altitude_callout_voice = NULL;
}
}
else if (select_voice_alerts(ALERT_MODE4_TOO_LOW_GEAR))
old_alerts = voice_alerts;
repeated_alerts = 0;
- altitude_callout_voice = NULL;
}
void
{
alerts &= ~_alerts;
repeated_alerts &= ~_alerts;
+ if (_alerts & ALERT_MODE6_ALTITUDE_CALLOUT)
+ altitude_callout_voice = NULL;
}
///////////////////////////////////////////////////////////////////////////////
initial_bias = 0.0;
while ((mk_data(radio_altitude).get() < min_agl - min_agl * initial_bias)&&
(initial_bias < 1.0))
- initial_bias += 0.2;
+ initial_bias += 0.2;
}
return initial_bias;
new_bias = 0.0;
while ((*reference < initial_value - initial_value * new_bias)&&
(new_bias < 1.0))
- new_bias += 0.2;
+ new_bias += 0.2;
}
if (new_bias > bias)