예제 #1
0
        private void UpdateParam(ParamValuePacket p)
        {
            var name = GetParamName(p.Payload);

            float?floatVal;
            long? longVal;

            ConvertFromMavlinkUnionToParamValue(p.Payload.ParamValue, p.Payload.ParamType, out floatVal, out longVal);
            var mavParam = new MavParam(p.Payload.ParamIndex, name, p.Payload.ParamType, floatVal, longVal);

            _params.AddOrUpdate(name, mavParam, (s, param) => mavParam);
            _paramUpdated.OnNext(mavParam);
            _paramsCount.OnNext(p.Payload.ParamCount);
        }
        private void UpdateParam(ParamValuePacket p)
        {
            try
            {
                var name = GetParamName(p.Payload);

                float?floatVal;
                long? longVal;
                Converter.ConvertFromMavlinkUnionToParamValue(p.Payload.ParamValue, p.Payload.ParamType, out floatVal, out longVal);
                var mavParam = new MavParam(p.Payload.ParamIndex, name, p.Payload.ParamType, floatVal, longVal);
                _params.AddOrUpdate(name, mavParam, (s, param) => mavParam);
                _paramUpdated.OnNext(mavParam);
                _paramsCount.OnNext(p.Payload.ParamCount);
                _logger.Trace($"Recieve new param: {mavParam}");
            }
            catch (Exception e)
            {
                _logger.Warn(e, $"Recieve MavLink param '{p.Name}' with error:{e.Message}");
            }
        }