Reset twoWire on error rather than crash

This commit is contained in:
Chris Esposito 2018-11-06 12:06:28 +11:00
parent 1d9f2398bb
commit 2158a6f58b
1 changed files with 9 additions and 1 deletions

View File

@ -131,7 +131,15 @@ void isoDriver::timerTick(void){
{ {
if (twoWireStateInvalid) if (twoWireStateInvalid)
twoWire->reset(); twoWire->reset();
twoWire->run(); try
{
twoWire->run();
}
catch(...)
{
qDebug() << "Resetting I2C";
twoWire->reset();
}
invalidateTwoWireState = false; invalidateTwoWireState = false;
twoWireStateInvalid = false; twoWireStateInvalid = false;
} }