Backup.
This commit is contained in:
@@ -127,14 +127,14 @@ BCDriver::DriverState BCDriverTinyCan::connectDriver()
|
||||
|
||||
unsigned int retry = cTimeOuts;
|
||||
emit driverStateChanged( _driverState, "Driver Init: putting Console in slave mode ... " );
|
||||
TransmitResult isSlave = 0;
|
||||
TransmitResult isSlave = 0;
|
||||
do
|
||||
{
|
||||
writeRawByte( console, slaveFlag, 1 );
|
||||
isSlave = readRawByte( console, slaveFlag );
|
||||
bc::delay_millis( 200 );
|
||||
{
|
||||
writeRawByte( console, slaveFlag, 1 );
|
||||
isSlave = readRawByte( console, slaveFlag );
|
||||
bc::delay_millis( 200 );
|
||||
|
||||
} while( retry-- && !(*isSlave) );
|
||||
} while( retry-- && !(*isSlave) );
|
||||
|
||||
bc::delay_millis( 500 ); // give the Console some time to settle
|
||||
//if( !isSlave )
|
||||
@@ -156,9 +156,6 @@ BCDriver::DriverState BCDriverTinyCan::connectDriver()
|
||||
{
|
||||
::CanDownDriver();
|
||||
::UnloadDriver();
|
||||
|
||||
// re-throw
|
||||
throw BCException( except.what() );
|
||||
}
|
||||
*/
|
||||
|
||||
@@ -168,14 +165,11 @@ BCDriver::TransmitResult BCDriverTinyCan::readRawByte( uint32_t deviceID, uint8_
|
||||
{
|
||||
|
||||
//TransmitResult
|
||||
qDebug() << " --- DriverState: " << _driverState;
|
||||
qDebug() << " --- BCDriverTinyCan::readRawByte DriverState: " << getDriverState();
|
||||
|
||||
if( getDriverState() != DriverState::DeviceReady)
|
||||
return std::unexpected(QString("readRawValue error: driver not loaded." ) );
|
||||
|
||||
/*
|
||||
Nicht hier!
|
||||
if( getState() != DriverState::DeviceReady)
|
||||
//throw BCException( "readRawValue error: driver not loaded." );
|
||||
return std::nullopt;
|
||||
*/
|
||||
::TCanMsg msg;
|
||||
|
||||
// msg verpacken
|
||||
@@ -197,7 +191,7 @@ BCDriver::TransmitResult BCDriverTinyCan::readRawByte( uint32_t deviceID, uint8_
|
||||
bc::delay_millis( cTIMEOUT_MS );
|
||||
|
||||
if( timeOuts == -1 )
|
||||
return std::unexpected(QString("readRawValue error: could not send value" ));
|
||||
return std::unexpected(QString("readRawValue error: could not send value" ));
|
||||
|
||||
retry:
|
||||
|
||||
@@ -238,11 +232,9 @@ retry:
|
||||
BCDriver::TransmitResult BCDriverTinyCan::writeRawByte( uint32_t deviceID, uint8_t registerID ,uint8_t value ) const
|
||||
{
|
||||
|
||||
/*
|
||||
Nicht hier!
|
||||
if( getState() != DriverState::DeviceReady)
|
||||
throw BCException( "writeRawValue error: driver not loaded." );
|
||||
*/
|
||||
if( getDriverState() != DriverState::DeviceReady)
|
||||
return std::unexpected(QString("writeRawValue error: driver not loaded." ) );
|
||||
|
||||
qDebug() << " --- BCDriverTinyCan writeRawValue: " << value;
|
||||
|
||||
::TCanMsg msg;
|
||||
|
||||
Reference in New Issue
Block a user