EscStatus.parse constructor

EscStatus.parse(
  1. ByteData data_
)

Implementation

factory EscStatus.parse(ByteData data_) {
  if (data_.lengthInBytes < EscStatus.mavlinkEncodedLength) {
    var len = EscStatus.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var timeUsec = data_.getUint64(0, Endian.little);
  var rpm = MavlinkMessage.asInt32List(data_, 8, 4);
  var voltage = MavlinkMessage.asFloat32List(data_, 24, 4);
  var current = MavlinkMessage.asFloat32List(data_, 40, 4);
  var index = data_.getUint8(56);

  return EscStatus(
      timeUsec: timeUsec,
      rpm: rpm,
      voltage: voltage,
      current: current,
      index: index);
}