reply fix in rad sensor handler

This commit is contained in:
Jakob Meier 2021-07-01 17:27:51 +02:00
parent d5a07f9c63
commit 0e9c1831ed
2 changed files with 15 additions and 2 deletions

View File

@ -168,7 +168,10 @@ void ObjectFactory::produce(void* args){
SpiCookie* spiCookieRadSensor = new SpiCookie(addresses::RAD_SENSOR, gpioIds::CS_RAD_SENSOR,
std::string("/dev/spidev2.0"), RAD_SENSOR::READ_SIZE, spi::DEFAULT_MAX_1227_MODE,
spi::DEFAULT_MAX_1227_SPEED);
new RadiationSensorHandler(objects::RAD_SENSOR, objects::SPI_COM_IF, spiCookieRadSensor);
RadiationSensorHandler* radsensor = new RadiationSensorHandler(objects::RAD_SENSOR,
objects::SPI_COM_IF, spiCookieRadSensor);
radsensor->setStartUpImmediately();
GpioCookie* gpioCookieSus = new GpioCookie();
GpioCallback* susgpio = new GpioCallback(std::string("Chip select SUS 1"), gpio::OUT, 1,

View File

@ -77,7 +77,7 @@ ReturnValue_t RadiationSensorHandler::buildCommandFromCommand(
case(RAD_SENSOR::START_CONVERSION): {
/* First the fifo will be reset here */
cmdBuffer[0] = RAD_SENSOR::RESET_DEFINITION;
cmdBuffer[1] = RAD_SENSOR::CONVERSION_DEFINITION;
cmdBuffer[0] = RAD_SENSOR::CONVERSION_DEFINITION;
rawPacket = cmdBuffer;
rawPacketLen = 2;
return RETURN_OK;
@ -109,7 +109,17 @@ void RadiationSensorHandler::fillCommandAndReplyMap() {
ReturnValue_t RadiationSensorHandler::scanForReply(const uint8_t *start,
size_t remainingSize, DeviceCommandId_t *foundId, size_t *foundLen) {
*foundId = this->getPendingCommand();
switch (*foundId) {
case RAD_SENSOR::START_CONVERSION:
case RAD_SENSOR::WRITE_SETUP:
return IGNORE_REPLY_DATA;
default:
break;
}
*foundLen = remainingSize;
return HasReturnvaluesIF::RETURN_OK;
}