another try to read out the adc

This commit is contained in:
Jakob Meier 2021-05-03 12:05:19 +02:00
parent 8d2993f88d
commit a126812a23

View File

@ -31,7 +31,28 @@ void RadiationSensorHandler::doShutDown(){
ReturnValue_t RadiationSensorHandler::buildNormalDeviceCommand( ReturnValue_t RadiationSensorHandler::buildNormalDeviceCommand(
DeviceCommandId_t * id) { DeviceCommandId_t * id) {
switch (communicationStep) {
case CommunicationStep::FIRST_CONVERSION: {
*id = RAD_SENSOR::FIRST_CONVERSION;
communicationStep = CommunicationStep::READ_CONVERSIONS;
break;
}
case CommunicationStep::PERFORM_CONVERSION: {
*id = RAD_SENSOR::PERFORM_CONVERSION; *id = RAD_SENSOR::PERFORM_CONVERSION;
communicationStep = CommunicationStep::READ_CONVERSIONS;
break;
}
case CommunicationStep::READ_CONVERSIONS: {
*id = RAD_SENSOR::READ_CONVERSIONS;
communicationStep = CommunicationStep::PERFRORM_CONVERSION;
break;
}
default: {
sif::debug << "RadiationSensorHandler::buildNormalDeviceCommand: Unknwon communication "
<< "step" << std::endl;
return HasReturnvaluesIF::RETURN_OK;
}
}
return buildCommandFromCommand(*id, nullptr, 0); return buildCommandFromCommand(*id, nullptr, 0);
} }
@ -57,6 +78,13 @@ ReturnValue_t RadiationSensorHandler::buildCommandFromCommand(
internalState = InternalState::CONFIGURED; internalState = InternalState::CONFIGURED;
return RETURN_OK; return RETURN_OK;
} }
case(RAD_SENSOR::FIRST_CONVERSION): {
/* Dummy bytes are written to remove old values from fifo */
cmdBuffer[0] = RAD_SENSOR::FIRST_CONVERSION_DEFINITION;
rawPacket = cmdBuffer;
rawPacketLen = RAD_SENSOR::READ_SIZE;
return RETURN_OK;
}
case(RAD_SENSOR::PERFORM_CONVERSION): { case(RAD_SENSOR::PERFORM_CONVERSION): {
/* Dummy bytes are written to remove old values from fifo */ /* Dummy bytes are written to remove old values from fifo */
cmdBuffer[0] = RAD_SENSOR::CONVERSION_DEFINITION; cmdBuffer[0] = RAD_SENSOR::CONVERSION_DEFINITION;