Add the ability to set the minimum allowed age for metar reports.
This commit is contained in:
parent
2a8f368072
commit
ba13669d32
2 changed files with 4 additions and 1 deletions
|
@ -324,6 +324,7 @@ FGMetarEnvironmentCtrl::FGMetarEnvironmentCtrl ()
|
|||
proxy_host( fgGetNode("/sim/presets/proxy/host", true) ),
|
||||
proxy_port( fgGetNode("/sim/presets/proxy/port", true) ),
|
||||
proxy_auth( fgGetNode("/sim/presets/proxy/authentication", true) ),
|
||||
metar_max_age( fgGetNode("/environment/params/metar-max-age-min", true) ),
|
||||
_error_count( 0 ),
|
||||
_error_dt( 0.0 )
|
||||
{
|
||||
|
@ -543,7 +544,8 @@ FGMetarEnvironmentCtrl::fetch_data( const string &icao )
|
|||
string port = proxy_port->getStringValue();
|
||||
result.m = new FGMetar( icao, host, port, auth);
|
||||
|
||||
if (result.m->getAge_min() > 4 * 60) {
|
||||
long max_age = metar_max_age->getLongValue();
|
||||
if (max_age && result.m->getAge_min() > max_age) {
|
||||
SG_LOG( SG_GENERAL, SG_WARN, "METAR data too old");
|
||||
delete result.m;
|
||||
result.m = NULL;
|
||||
|
|
|
@ -177,6 +177,7 @@ private:
|
|||
SGPropertyNode *proxy_host;
|
||||
SGPropertyNode *proxy_port;
|
||||
SGPropertyNode *proxy_auth;
|
||||
SGPropertyNode *metar_max_age;
|
||||
|
||||
FGMetarResult fetch_data( const string &icao );
|
||||
virtual void update_metar_properties( FGMetar *m );
|
||||
|
|
Loading…
Reference in a new issue