Reworked data types.

This commit is contained in:
2025-12-21 14:40:38 +01:00
parent acce874133
commit cb9eb8c3fe
9 changed files with 42 additions and 72 deletions

View File

@@ -80,7 +80,7 @@ BCCanDriver::dState BCCanDriverTinyCan::initDriver()
qDebug() << "XXX BCCanDriverTinyCan::Driver Init: putting BCDevice::ID::Console in slave mode ... ";
// BCDevice::ID::Console already in slave mode. good!
if( getValue( BCDevice::ID::Console, BC::ID::Cons_Status_Slave ) )
if( readRawValue( BCDevice::ID::Console, BC::ID::Cons_Status_Slave ) )
return BCCanDriver::sReady;
qDebug() << "BCCanDriverTinyCan::BCCanDriverTinyCan::XXX Driver Init: putting BCDevice::ID::Console in slave mode ... ";
@@ -88,11 +88,11 @@ BCCanDriver::dState BCCanDriverTinyCan::initDriver()
unsigned int retry = _timeOuts;
emit statusHint( "Driver Init: putting BCDevice::ID::Console in slave mode ... " );
int isSlave = 0;
bcdata_t isSlave = 0;
do
{
setValue( BCDevice::ID::Console, BC::ID::Cons_Status_Slave, 1 );
isSlave = getValue( BCDevice::ID::Console, BC::ID::Cons_Status_Slave );
writeRawValue( BCDevice::ID::Console, BC::ID::Cons_Status_Slave, 1 );
isSlave = *readRawValue( BCDevice::ID::Console, BC::ID::Cons_Status_Slave );
bc::delay_millis( 200 );
} while( retry-- && !isSlave );
@@ -109,8 +109,8 @@ BCCanDriver::dState BCCanDriverTinyCan::initDriver()
}
//unsigned int BCCanDriverTinyCan::getValue( unsigned char receipient, unsigned char reg )
uint BCCanDriverTinyCan::getValue(BCDevice::ID deviceID, BC::ID registerID ) const
std::optional<bcdata_t> BCCanDriverTinyCan::readRawValue( BCDevice::ID deviceID, BC::ID registerID ) const
{
struct TCanMsg msg;
@@ -169,16 +169,16 @@ retry:
if( !timeOuts )
throw std::runtime_error( "CAN --response errror" );
return (unsigned int) msg.MsgData[3];
//das ist mist!
return (bcdata_t) msg.MsgData[3];
}
// void BCCanDriverTinyCan::setValue( unsigned char receipient, unsigned char reg, unsigned char value )
void BCCanDriverTinyCan::setValue(BCDevice::ID deviceID, BC::ID registerID, int value ) const
void BCCanDriverTinyCan::writeRawValue( BCDevice::ID deviceID, BC::ID registerID, bcdata_t value ) const
{
qDebug() << "SaveItem( BCCanDriverTinyCan::CBCItem& item ): ";
qDebug() << " --- BCCanDriverTinyCan writeRawValue: " << value;
uint32_t device = static_cast<uint32_t>(deviceID);
uint8_t reg = static_cast<uint8_t> (registerID);
@@ -204,16 +204,3 @@ void BCCanDriverTinyCan::setValue(BCDevice::ID deviceID, BC::ID registerID, int
}
void BCCanDriverTinyCan::awaitReceiveBuf( int timeout )
{
}
void BCCanDriverTinyCan::awaitSendBuf(int timeout )
{
}