diff --git a/fsfwconfig/OBSWConfig.h b/fsfwconfig/OBSWConfig.h index ea73eb1c..5db2e7d0 100644 --- a/fsfwconfig/OBSWConfig.h +++ b/fsfwconfig/OBSWConfig.h @@ -24,7 +24,7 @@ debugging. */ #define TEST_SUS_HANDLER 1 #define TEST_PLOC_HANDLER 0 -#define TE0720 1 +#define TE0720 0 #define TE0720_HEATER_TEST 0 #define P60DOCK_DEBUG 0 diff --git a/mission/devices/SusHandler.cpp b/mission/devices/SusHandler.cpp index 15062148..b351ff43 100644 --- a/mission/devices/SusHandler.cpp +++ b/mission/devices/SusHandler.cpp @@ -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): { diff --git a/mission/devices/SusHandler.h b/mission/devices/SusHandler.h index 2fb2a6a8..aabecac1 100644 --- a/mission/devices/SusHandler.h +++ b/mission/devices/SusHandler.h @@ -43,7 +43,8 @@ private: enum class CommunicationStep { PERFORM_CONVERSIONS, REQUEST_TEMP, - READ_TEMP + READ_TEMP, + WRITE_SETUP }; enum class InternalState {