this works with the old SUS

This commit is contained in:
2021-05-09 12:09:39 +02:00
parent 451729b103
commit 95f09469d1
3 changed files with 15 additions and 8 deletions

View File

@ -31,9 +31,14 @@ void SusHandler::doShutDown(){
ReturnValue_t SusHandler::buildNormalDeviceCommand(
DeviceCommandId_t * id) {
if (communicationStep == CommunicationStep::PERFORM_CONVERSIONS) {
*id = SUS::PERFORM_CONVERSIONS;
if (communicationStep == CommunicationStep::WRITE_SETUP) {
*id = SUS::WRITE_SETUP;
communicationStep = CommunicationStep::REQUEST_TEMP;
// communicationStep = CommunicationStep::PERFORM_CONVERSIONS;
}
else if (communicationStep == CommunicationStep::PERFORM_CONVERSIONS) {
*id = SUS::PERFORM_CONVERSIONS;
communicationStep = CommunicationStep::WRITE_SETUP;
// communicationStep = CommunicationStep::PERFORM_CONVERSIONS;
}
else if (communicationStep == CommunicationStep::REQUEST_TEMP) {
@ -63,6 +68,7 @@ ReturnValue_t SusHandler::buildCommandFromCommand(
size_t commandDataLen) {
switch(deviceCommand) {
case(SUS::WRITE_SETUP): {
gpioComIF->pullLow(chipSelectId);
cmdBuffer[0] = SUS::SETUP_DEFINITION;
rawPacket = cmdBuffer;
rawPacketLen = 1;
@ -76,11 +82,11 @@ ReturnValue_t SusHandler::buildCommandFromCommand(
* The sun sensor ADC is shutdown when CS is pulled high so each time requesting a
* measurement the setup has to be rewritten
*/
cmdBuffer[0] = SUS::RESET_FIFO;
cmdBuffer[1] = SUS::SETUP_DEFINITION;
// cmdBuffer[0] = SUS::RESET_FIFO;
// cmdBuffer[1] = SUS::SETUP_DEFINITION;
// wirte one dummy byte here
// cmdBuffer[2] = SUS::CONVERT_TEMPERATURE;
cmdBuffer[2] = SUS::CONVERT_DIFF_CHANNEL_1;
cmdBuffer[0] = SUS::CONVERT_DIFF_CHANNEL_1;
// cmdBuffer[0] = SUS::SETUP_DEFINITION;
// cmdBuffer[1] = SUS::UNIPOLAR_CONFIG;
@ -90,7 +96,7 @@ ReturnValue_t SusHandler::buildCommandFromCommand(
// cmdBuffer[30] = SUS::CONVERT_DIFF_CHANNEL_4_5;
rawPacket = cmdBuffer;
// rawPacketLen = SUS::SIZE_PERFORM_CONVERSIONS;
rawPacketLen = 5;
rawPacketLen = 3;
return RETURN_OK;
}
case(SUS::RQUEST_TEMP): {