Cleanups.
This commit is contained in:
@@ -49,7 +49,7 @@ BCDriver::DriverState BCDriverTinyCan::loadDriver()
|
||||
|
||||
//qDebug() << "CanBusControl " << cbc::Version << '\n' << "based on BigXionFlasher (c) 2011-2013 by Thomas Koenig <info@bigxionflasher.org> - www.bigxionflasher.org";
|
||||
|
||||
struct ::TDeviceStatus status;
|
||||
struct ::TDeviceStatus canDevicestatus;
|
||||
|
||||
if( ::LoadDriver( NULL ) < 0 )
|
||||
throw BCException( "Driver Error: 'LoadDriver'" );
|
||||
@@ -64,14 +64,14 @@ BCDriver::DriverState BCDriverTinyCan::loadDriver()
|
||||
|
||||
::CanSetSpeed( 0, CAN_125K_BIT );
|
||||
::CanSetMode( 0, OP_CAN_START, CAN_CMD_ALL_CLEAR );
|
||||
::CanGetDeviceStatus( 0, &status );
|
||||
::CanGetDeviceStatus( 0, &canDevicestatus );
|
||||
|
||||
setState(BCDriver::DriverState::Initialized);
|
||||
|
||||
if( status.DrvStatus < DRV_STATUS_CAN_OPEN )
|
||||
if( canDevicestatus.DrvStatus < DRV_STATUS_CAN_OPEN )
|
||||
throw BCException( "Driver Error: could not open device." );
|
||||
|
||||
if( status.CanStatus == CAN_STATUS_BUS_OFF )
|
||||
if( canDevicestatus.CanStatus == CAN_STATUS_BUS_OFF )
|
||||
{
|
||||
::CanSetMode( 0, OP_CAN_RESET, CAN_CMD_NONE );
|
||||
throw BCException( "Driver Error: CAN Status 'BusOff'" );
|
||||
|
||||
Reference in New Issue
Block a user