RadioCalibration.parse constructor

RadioCalibration.parse(
  1. ByteData data_
)

Implementation

factory RadioCalibration.parse(ByteData data_) {
  if (data_.lengthInBytes < RadioCalibration.mavlinkEncodedLength) {
    var len = RadioCalibration.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var aileron = MavlinkMessage.asUint16List(data_, 0, 3);
  var elevator = MavlinkMessage.asUint16List(data_, 6, 3);
  var rudder = MavlinkMessage.asUint16List(data_, 12, 3);
  var gyro = MavlinkMessage.asUint16List(data_, 18, 2);
  var pitch = MavlinkMessage.asUint16List(data_, 22, 5);
  var throttle = MavlinkMessage.asUint16List(data_, 32, 5);

  return RadioCalibration(
      aileron: aileron,
      elevator: elevator,
      rudder: rudder,
      gyro: gyro,
      pitch: pitch,
      throttle: throttle);
}