averageTemperature property

Future<double> averageTemperature

The Tello's average temperature, presumably in celsius.

Implementation

Future<double> get averageTemperature async {
  String temperatureResponse = (await _command("temp?"));

  RegExp temperatureRegex = RegExp(r"((\d+)(~)(\d+)(\w+))");
  RegExpMatch matches = temperatureRegex.firstMatch(temperatureResponse)!;

  return (double.parse("${matches[2]}") + double.parse("${matches[4]}")) / 2;
}