Beispiel #1
0
int main(int argc, char **argv)
{
  plan_tests(11);

  Validity v;
  v.Clear();
  ok1(!v.IsValid());
  v.Update(100);
  ok1(v.IsValid());
  v.Expire(101, 5);
  ok1(v.IsValid());
  v.Expire(105, 5);
  ok1(v.IsValid());
  v.Expire(106, 5);
  ok1(!v.IsValid());

  v.Update(100);
  ok1(v.Modified(Validity(99)));
  ok1(!v.Modified(Validity(100)));
  ok1(!v.Modified(Validity(101)));
  ok1(!v.Complement(Validity(1)));

  v.Clear();
  ok1(!v.Complement(invalid()));
  ok1(v.Complement(Validity(1)));

  return exit_status();
}
Beispiel #2
0
 /**
  * Set the true airspeed [m/s] and derive the indicated airspeed
  * from it, using the specified altitude [m].
  */
 void ProvideTrueAirspeedWithAltitude(fixed tas, fixed altitude) {
   true_airspeed = tas;
   indicated_airspeed = true_airspeed /
     AtmosphericPressure::AirDensityRatio(altitude);
   airspeed_available.Update(clock);
   airspeed_real = true;
 }
Beispiel #3
0
 /**
  * Set the true airspeed [m/s] and derive the indicated airspeed
  * from it, using the specified altitude [m].
  */
 void ProvideIndicatedAirspeedWithAltitude(fixed ias, fixed altitude) {
   indicated_airspeed = ias;
   true_airspeed = indicated_airspeed *
     AtmosphericPressure::AirDensityRatio(altitude);
   airspeed_available.Update(clock);
   airspeed_real = true;
 }
Beispiel #4
0
  void ProvideAutoMacCready(fixed clock, fixed mc) {
    if (auto_mac_cready_available &&
        fabs(auto_mac_cready - mc) < fixed(0.05))
      /* change is too small, ignore the new value to limit the rate */
      return;

    auto_mac_cready = mc;
    auto_mac_cready_available.Update(clock);
  }
Beispiel #5
0
  /**
   * Same as ProvidePressureAltitude(), but don't overwrite a "strong"
   * value.
   */
  void ProvideWeakPressureAltitude(double value) {
    if (pressure_altitude_available && !pressure_altitude_weak)
      /* don't overwrite "strong" value */
      return;

    pressure_altitude = value;
    pressure_altitude_weak = true;
    pressure_altitude_available.Update(clock);
  }
Beispiel #6
0
  /**
   * Same as ProvideBaroAltitudeTrue(), but don't overwrite a "strong"
   * value.
   */
  void ProvideWeakBaroAltitude(double value) {
    if (baro_altitude_available && !baro_altitude_weak)
      /* don't overwrite "strong" value */
      return;

    baro_altitude = value;
    baro_altitude_weak = true;
    baro_altitude_available.Update(clock);
  }
Beispiel #7
0
 /**
  * Provide barometric altitude from a static pressure sensor, but
  * only use it if the previous altitude was not present or the
  * same/lower priority.
  */
 void ProvideStaticPressure(AtmosphericPressure value) {
   static_pressure = value;
   static_pressure_available.Update(clock);
 }
Beispiel #8
0
 /**
  * Set the external wind value.
  */
 void ProvideExternalWind(const SpeedVector &value) {
   external_wind = value;
   external_wind_available.Update(clock);
 }
Beispiel #9
0
 /**
  * Set the barometric netto vario value [m/s].
  */
 void ProvideNettoVario(double value) {
   netto_vario = value;
   netto_vario_available.Update(clock);
 }
Beispiel #10
0
 /**
  * Set the barometric TE vario value [m/s].
  */
 void ProvideTotalEnergyVario(double value) {
   total_energy_vario = value;
   total_energy_vario_available.Update(clock);
 }
Beispiel #11
0
 /**
  * Set the gross, non-compensated, plain-old vertical speed vario value [m/s].
  */
 void ProvideNoncompVario(double value) {
   noncomp_vario = value;
   noncomp_vario_available.Update(clock);
 }
Beispiel #12
0
 /**
  * Set both true airspeed and indicated airspeed to two different
  * values [m/s].
  */
 void ProvideBothAirspeeds(double ias, double tas) {
   indicated_airspeed = ias;
   true_airspeed = tas;
   airspeed_available.Update(clock);
   airspeed_real = true;
 }
Beispiel #13
0
 /**
  * Used only as a config value that should be saved.
  *
  * Currently used for:
  *       battery voltage measurement (multiplier)
  *       offset between the pitot- and the static pressure sensor in hPa (zero).
  *       temperature sensor
  */
 void ProvideSensorCalibration(double value, double offset) {
   sensor_calibration_factor = value;
   sensor_calibration_offset = offset;
   sensor_calibration_available.Update(clock);
 }
Beispiel #14
0
 /**
  * Used to compute indicated airspeed
  * when static pressure is known.
  * Value already includes calibration data.
  */
 void ProvidePitotPressure(AtmosphericPressure value) {
   pitot_pressure = value;
   pitot_pressure_available.Update(clock);
 }
Beispiel #15
0
 /**
  * Provide dynamic pressure from a pitot tube.
  * Use only to compute indicated airspeed when static pressure is known.
  * When both pitot- and dynamic pressure are available use dynamic.
  */
 void ProvideDynamicPressure(AtmosphericPressure value) {
   dyn_pressure = value;
   dyn_pressure_available.Update(clock);
 }
Beispiel #16
0
 /**
  * Set the QNH for this flight
  */
 void SetQNH(const double _qnh) {
   qnh = AtmosphericPressure::HectoPascal(_qnh);
   qnh_available.Update(1);
 };
Beispiel #17
0
 /**
  * Provide pressure altitude above 1013 hPa, but only use it if
  * the previous altitude was not present or the same/lower priority.
  */
 void ProvidePressureAltitude(double value) {
   pressure_altitude = value;
   pressure_altitude_weak = false;
   pressure_altitude_available.Update(clock);
 }
Beispiel #18
0
 /**
  * Provide a "true" barometric altitude, but only use it if the
  * previous altitude was not present or the same/lower priority.
  */
 void ProvideBaroAltitudeTrue(double value) {
   baro_altitude = value;
   baro_altitude_weak = false;
   baro_altitude_available.Update(clock);
 }
Beispiel #19
0
 /**
  * Set both true airspeed and indicated airspeed to two different
  * values [m/s].
  */
 void ProvideBothAirspeeds(fixed ias, fixed tas) {
   indicated_airspeed = ias;
   true_airspeed = tas;
   airspeed_available.Update(clock);
   airspeed_real = true;
 }