Rework driver code, again.

This commit is contained in:
2026-01-01 13:28:17 +01:00
parent 6b039e4b7f
commit 6e860d8d05
10 changed files with 91 additions and 71 deletions

View File

@@ -47,12 +47,11 @@ void BCTransmitter::onToggleConnectionState( bool connect )
{
if( connect )
{
if( _canDriver->getState() != BCDriver::DriverState::Ready )
if( _canDriver->getState() != BCDriver::DriverState::DeviceReady )
_canDriver->onStartDriver();
// __fix!
uint32_t hwVersion = _canDriver->readRawByte( (uint32_t)BCDevice::ID::Console, (uint8_t)BC::ID::Cons_Rev_Hw);
BCDriver::TransmitResult hwVersion = _canDriver->readRawByte( (uint32_t)BCDevice::ID::Console, (uint8_t)BC::ID::Cons_Rev_Hw);
if(!hwVersion)
{
qDebug() << "Console not responding";
@@ -63,7 +62,7 @@ void BCTransmitter::onToggleConnectionState( bool connect )
}
qDebug() << " ---HAIL to the kings: " << hwVersion;
qDebug() << " ---HAIL to the kings: " << hwVersion.value();
}
}
@@ -141,9 +140,9 @@ void BCTransmitter::processValueOp( BCValue::OpID opID )
}
}
uint32_t BCTransmitter::readRawByte( uint32_t deviceID, uint8_t registerID ) const
uint8_t BCTransmitter::readByte( uint32_t deviceID, uint8_t registerID ) const
{
uint32_t result{};
BCDriver::TransmitResult result;
try
{
result = _canDriver->readRawByte( deviceID, registerID );
@@ -152,11 +151,11 @@ uint32_t BCTransmitter::readRawByte( uint32_t deviceID, uint8_t registerID ) c
{
qDebug() << " -- OUCH: read exception: " << exception.what();
}
return result;
return result.value();
}
void BCTransmitter::writeRawByte( uint32_t deviceID, uint8_t registerID , uint8_t value ) const
void BCTransmitter::writeByte( uint32_t deviceID, uint8_t registerID , uint8_t value ) const
{
try
{