init method
override
Initializes the connection to the device.
Implementation
@override
Future<bool> init() async {
// Open the port
logger.debug("Opening $port");
if (!await _serial.init()) {
logger.warning("Could not open firmware device on port $port");
return false;
}
// Execute the handshake
if (!(await _reset() || await _reset())) logger.warning("The Teensy on port $port failed to reset");
if (!await _sendHandshake()) {
logger.warning("Could not connect to Teensy", body: "Device on port $port failed the handshake");
return false;
}
logger.info("Connected to the ${device.name} Teensy on port $port");
_serial.startListening();
return true;
}