static bool PZAN3(NMEAInputLine &line, NMEAInfo &info) { // old: $PZAN3,+,026,V,321,035,A,321,035,V*cc // new: $PZAN3,+,026,A,321,035,V[,A]*cc line.Skip(3); int direction, speed; if (!line.ReadChecked(direction) || !line.ReadChecked(speed)) return false; char okay = line.ReadFirstChar(); if (okay == 'V') { okay = line.ReadFirstChar(); if (okay == 'V') return true; if (okay != 'A') { line.Skip(); okay = line.ReadFirstChar(); } } if (okay == 'A') { SpeedVector wind(Angle::Degrees(direction), Units::ToSysUnit(fixed(speed), Unit::KILOMETER_PER_HOUR)); info.ProvideExternalWind(wind); } return true; }
static bool PZAN3(NMEAInputLine &line, NMEAInfo &info) { // old: $PZAN3,+,026,V,321,035,A,321,035,V*cc // new: $PZAN3,+,026,A,321,035,V[,A]*cc line.skip(3); int direction, speed; if (!line.read_checked(direction) || !line.read_checked(speed)) return false; char okay = line.read_first_char(); if (okay == 'V') { okay = line.read_first_char(); if (okay == 'V') return true; if (okay != 'A') { line.skip(); okay = line.read_first_char(); } } if (okay == 'A') { SpeedVector wind(Angle::Degrees(fixed(direction)), Units::ToSysUnit(fixed(speed), unKiloMeterPerHour)); info.ProvideExternalWind(wind); } return true; }
static bool LXWP0(NMEAInputLine &line, NMEAInfo &info) { /* $LXWP0,Y,222.3,1665.5,1.71,,,,,,239,174,10.1 0 loger_stored (Y/N) 1 IAS (kph) ----> Condor uses TAS! 2 baroaltitude (m) 3-8 vario (m/s) (last 6 measurements in last second) 9 heading of plane 10 windcourse (deg) 11 windspeed (kph) */ line.Skip(); fixed airspeed; bool tas_available = line.ReadChecked(airspeed); if (tas_available && (airspeed < fixed(-50) || airspeed > fixed(250))) /* implausible */ return false; fixed value; if (line.ReadChecked(value)) /* a dump on a LX7007 has confirmed that the LX sends uncorrected altitude above 1013.25hPa here */ info.ProvidePressureAltitude(value); if (tas_available) /* * Call ProvideTrueAirspeed() after ProvidePressureAltitude() to use * the provided altitude (if available) */ info.ProvideTrueAirspeed(Units::ToSysUnit(airspeed, Unit::KILOMETER_PER_HOUR)); if (line.ReadChecked(value)) info.ProvideTotalEnergyVario(value); line.Skip(6); SpeedVector wind; if (ReadSpeedVector(line, wind)) info.ProvideExternalWind(wind); return true; }
/** * Parse a "$PDGFTL1" sentence. * * Example: "$PDGFTL1,2025,2000,250,-14,45,134,28,65,382,153*3D" */ static bool PDGFTL1(NMEAInputLine &line, NMEAInfo &info) { double value; // Baro Altitude QNE(1013.25) 2025 meter 2025 mt if (line.ReadChecked(value)) info.ProvidePressureAltitude(value); // Baro Altitude QNH 2000 meter 2000 mt if (line.ReadChecked(value)) info.ProvideBaroAltitudeTrue(value); // Vario 250 cm/sec +2,50 m/s if (line.ReadChecked(value)) info.ProvideTotalEnergyVario(value / 100); // Netto Vario -14 dm/sec -1,40 m/s if (line.ReadChecked(value)) info.ProvideNettoVario(value / 10); // Indicated Air Speed 45 km/h 45 km/h if (line.ReadChecked(value)) info.ProvideIndicatedAirspeed(Units::ToSysUnit(value, Unit::KILOMETER_PER_HOUR)); // Ground Efficiency 134 ratio 13,4 : 1 line.Skip(); // Wind Speed 28 km/h 28 km/h // Wind Direction 65 degree 65 degree SpeedVector wind; if (ReadSpeedVector(line, wind)) info.ProvideExternalWind(wind); // Main Lithium Battery Voltage 382 0.01 volts 3,82 volts if (line.ReadChecked(value)) { info.voltage = value / 100; info.voltage_available.Update(info.clock); } // Backup AA Battery Voltage 153 0.01 volts 1,53 volts return true; }
static bool cLXWP0(NMEAInputLine &line, NMEAInfo &info) { /* $LXWP0,Y,222.3,1665.5,1.71,,,,,,239,174,10.1 0 logger_stored (Y/N) 1 IAS (kph) ----> Condor uses TAS! 2 baroaltitude (m) 3 vario (m/s) 4-8 unknown 9 heading of plane 10 windcourse (deg) 11 windspeed (kph) */ fixed value; line.Skip(); fixed airspeed; bool tas_available = line.ReadChecked(airspeed); fixed alt = line.Read(fixed_zero); if (tas_available) info.ProvideTrueAirspeedWithAltitude(Units::ToSysUnit(airspeed, Unit::KILOMETER_PER_HOUR), alt); // ToDo check if QNH correction is needed! info.ProvideBaroAltitudeTrue(alt); if (line.ReadChecked(value)) info.ProvideTotalEnergyVario(value); line.Skip(6); SpeedVector wind; if (ReadSpeedVector(line, wind)) info.ProvideExternalWind(wind); return true; }
/** * Parse a "$C" sentence. * * Example: "$C,+2025,-7,+18,+25,+29,122,314,314,0,-356,+25,45,T*3D" */ static bool LeonardoParseC(NMEAInputLine &line, NMEAInfo &info) { double value; // 0 = altitude [m] if (line.ReadChecked(value)) info.ProvideBaroAltitudeTrue(value); // 1 = vario [cm/s] if (line.ReadChecked(value)) info.ProvideTotalEnergyVario(value / 100); // 2 = airspeed [km/h] /* XXX is that TAS or IAS? */ if (line.ReadChecked(value)) info.ProvideTrueAirspeed(Units::ToSysUnit(value, Unit::KILOMETER_PER_HOUR)); if (line.Rest().empty()) /* short "$C" sentence ends after airspeed */ return true; // 3 = netto vario [dm/s] if (line.ReadChecked(value)) info.ProvideNettoVario(value / 10); // 4 = temperature [deg C] double oat; info.temperature_available = line.ReadChecked(oat); if (info.temperature_available) info.temperature = CelsiusToKelvin(oat); line.Skip(5); // 10 = wind speed [km/h] // 11 = wind direction [degrees] SpeedVector wind; if (ReadSpeedVector(line, wind)) info.ProvideExternalWind(wind); return true; }
/* !w,<1>,<2>,<3>,<4>,<5>,<6>,<7>,<8>,<9>,<10>,<11>,<12>,<13>*hh<CR><LF> <1> Vector wind direction in degrees <2> Vector wind speed in 10ths of meters per second <3> Vector wind age in seconds <4> Component wind in 10ths of Meters per second + 500 (500 = 0, 495 = 0.5 m/s tailwind) <5> True altitude in Meters + 1000 <6> Instrument QNH setting <7> True airspeed in 100ths of Meters per second <8> Variometer reading in 10ths of knots + 200 <9> Averager reading in 10ths of knots + 200 <10> Relative variometer reading in 10ths of knots + 200 <11> Instrument MacCready setting in 10ths of knots <12> Instrument Ballast setting in percent of capacity <13> Instrument Bug setting *hh Checksum, XOR of all bytes */ static bool cai_w(NMEAInputLine &line, NMEAInfo &info) { SpeedVector wind; if (ReadSpeedVector(line, wind)) info.ProvideExternalWind(wind.Reciprocal()); line.skip(2); fixed value; if (line.read_checked(value)) info.ProvideBaroAltitudeTrue(value - fixed(1000)); if (line.read_checked(value)) info.settings.ProvideQNH(value, info.clock); if (line.read_checked(value)) info.ProvideTrueAirspeed(value / 100); if (line.read_checked(value)) info.ProvideTotalEnergyVario(Units::ToSysUnit((value - fixed(200)) / 10, unKnots)); line.skip(2); int i; if (line.read_checked(i)) info.settings.ProvideMacCready(Units::ToSysUnit(fixed(i) / 10, unKnots), info.clock); if (line.read_checked(i)) info.settings.ProvideBallastFraction(fixed(i) / 100, info.clock); if (line.read_checked(i)) info.settings.ProvideBugs(fixed(i) / 100, info.clock); return true; }
static bool ParsePITV5(NMEAInputLine &line, NMEAInfo &info) { fixed value; fixed norm, bearing; // wind speed [m/s] bool norm_valid = line.ReadChecked(norm); // wind dir [degrees] bool bearing_valid = line.ReadChecked(bearing); if (norm_valid && bearing_valid) { SpeedVector wind(Angle::Degrees(bearing), norm); info.ProvideExternalWind(wind); } if (line.ReadChecked(value)) { // sqrt density ratio } if (line.ReadChecked(value)) { // turbulence } // climb/cruise switch switch (line.Read(-1)) { case 1: info.switch_state.flight_mode = SwitchState::FlightMode::CRUISE; break; case 0: info.switch_state.flight_mode = SwitchState::FlightMode::CIRCLING; break; } // mc value [m/s] if (line.ReadChecked(value)) { info.settings.ProvideMacCready(value, info.clock); } return true; }
/** * Parse a "$PILC,PDA1" sentence. * * Example: "$PILC,PDA1,1489,-3.21,274,15,58*7D" */ static bool ParsePDA1(NMEAInputLine &line, NMEAInfo &info) { fixed value; // altitude [m] int altitude; if (line.ReadChecked(altitude)) info.ProvideBaroAltitudeTrue(fixed(altitude)); // total energy vario [m/s] if (line.ReadChecked(value)) info.ProvideTotalEnergyVario(value); // wind direction [degrees, kph] SpeedVector wind; if (ReadSpeedVector(line, wind)) info.ProvideExternalWind(wind); // confidence [0..100] // not used return true; }