getFirmwareVersion method

String getFirmwareVersion()
inherited

Returns the firmware of the hat.

Implementation

String getFirmwareVersion() {
  autoWait();
  var error = I2Cexception.empty();
  for (var i = 0; i < retry; ++i) {
    try {
      writeI2Cblock(HatCmd(firmwareCmd).getCmdSeq());
      sleep(Duration(milliseconds: 100));
      var data = i2c.readBytesReg(hatArduinoI2Caddress, hatRegister, 4);
      print(data.length);
      _updateLastAction();
      return '${data[1] & 0xff}.${data[2] & 0xff}.${data[3] & 0xff}';
    } on I2Cexception catch (e) {
      error = e;
      sleep(Duration(milliseconds: delay));
    }
  }
  throw error;
}