本文整理汇总了C++中NMEAInfo::GetAltitudeBaroPreferred方法的典型用法代码示例。如果您正苦于以下问题:C++ NMEAInfo::GetAltitudeBaroPreferred方法的具体用法?C++ NMEAInfo::GetAltitudeBaroPreferred怎么用?C++ NMEAInfo::GetAltitudeBaroPreferred使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NMEAInfo
的用法示例。
在下文中一共展示了NMEAInfo::GetAltitudeBaroPreferred方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fixed
/**
* Update the measurements if new level reached
* @param basic NMEA_INFO for temperature and humidity
*/
void
CuSonde::updateMeasurements(const NMEAInfo &basic,
const DerivedInfo &calculated)
{
// if (not flying) nothing to update...
if (!calculated.flight.flying)
return;
// if (no temperature or humidity available) nothing to update...
if (!basic.temperature_available || !basic.humidity_available)
return;
// find appropriate level
unsigned short level = (unsigned short)((int)max(basic.GetAltitudeBaroPreferred(),
fixed(0.0))
/ HEIGHT_STEP);
// if (level out of range) cancel update
if (level >= NUM_LEVELS)
return;
// if (level skipped) cancel update
if (abs(level - last_level) > 1) {
last_level = level;
return;
}
// if (no level transition yet) wait for transition
if (abs(level - last_level) == 0)
return;
// calculate ground height
hGround = calculated.altitude_agl;
// if (going up)
if (level > last_level) {
// we round down (level) because of potential lag of temp sensor
cslevels[level].updateTemps(basic.humidity,
Units::ToUserUnit(basic.temperature, unGradCelcius));
fixed h_agl = fixed(level * HEIGHT_STEP) - hGround;
cslevels[level].updateThermalIndex(h_agl, maxGroundTemperature);
if (level > 0) {
findThermalHeight((unsigned short)(level - 1));
findCloudBase((unsigned short)(level - 1));
}
// if (going down)
} else {
// we round up (level+1) because of potential lag of temp sensor
cslevels[level + 1].updateTemps(basic.humidity,
Units::ToUserUnit(basic.temperature, unGradCelcius));
fixed h_agl = fixed((level + 1) * HEIGHT_STEP) - hGround;
cslevels[level + 1].updateThermalIndex(h_agl, maxGroundTemperature);
if (level < NUM_LEVELS - 1) {
findThermalHeight(level);
findCloudBase(level);
}
}
last_level = level;
}