diff --git a/mission/devices/SusHandler.cpp b/mission/devices/SusHandler.cpp index b351ff43..25c01c87 100644 --- a/mission/devices/SusHandler.cpp +++ b/mission/devices/SusHandler.cpp @@ -86,8 +86,19 @@ ReturnValue_t SusHandler::buildCommandFromCommand( // cmdBuffer[1] = SUS::SETUP_DEFINITION; // wirte one dummy byte here // cmdBuffer[2] = SUS::CONVERT_TEMPERATURE; - cmdBuffer[0] = SUS::CONVERT_DIFF_CHANNEL_1; - + cmdBuffer[0] = SUS::CONVERT_DIFF_CHANNEL_0; + cmdBuffer[1] = SUS::DUMMY_BYTE; + cmdBuffer[2] = SUS::CONVERT_DIFF_CHANNEL_1; + cmdBuffer[3] = SUS::DUMMY_BYTE; + cmdBuffer[4] = SUS::CONVERT_DIFF_CHANNEL_2; + cmdBuffer[5] = SUS::DUMMY_BYTE; + cmdBuffer[6] = SUS::CONVERT_DIFF_CHANNEL_3; + cmdBuffer[7] = SUS::DUMMY_BYTE; + cmdBuffer[9] = SUS::CONVERT_DIFF_CHANNEL_4; + cmdBuffer[10] = SUS::DUMMY_BYTE; + cmdBuffer[11] = SUS::CONVERT_DIFF_CHANNEL_5; + cmdBuffer[12] = SUS::DUMMY_BYTE; + cmdBuffer[13] = SUS::DUMMY_BYTE; // cmdBuffer[0] = SUS::SETUP_DEFINITION; // cmdBuffer[1] = SUS::UNIPOLAR_CONFIG; // cmdBuffer[2] = SUS::CONVERT_TEMPERATURE; @@ -96,7 +107,7 @@ ReturnValue_t SusHandler::buildCommandFromCommand( // cmdBuffer[30] = SUS::CONVERT_DIFF_CHANNEL_4_5; rawPacket = cmdBuffer; // rawPacketLen = SUS::SIZE_PERFORM_CONVERSIONS; - rawPacketLen = 3; + rawPacketLen = 14; return RETURN_OK; } case(SUS::RQUEST_TEMP): { @@ -142,7 +153,7 @@ ReturnValue_t SusHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) { switch (id) { case SUS::PERFORM_CONVERSIONS: { -// gpioComIF->pullHigh(chipSelectId); + gpioComIF->pullHigh(chipSelectId); PoolReadGuard readSet(&dataset); dataset.temperatureCelcius = (*(packet + 25) << 8 | *(packet + 26)) * 0.125; dataset.diffScanChannel0_1 = (*(packet + 29) << 8 | *(packet + 30)); diff --git a/mission/devices/SusHandler.h b/mission/devices/SusHandler.h index aabecac1..fdc4b28a 100644 --- a/mission/devices/SusHandler.h +++ b/mission/devices/SusHandler.h @@ -60,7 +60,7 @@ private: uint8_t cmdBuffer[SUS::MAX_CMD_SIZE]; InternalState internalState = InternalState::SETUP; - CommunicationStep communicationStep = CommunicationStep::PERFORM_CONVERSIONS; + CommunicationStep communicationStep = CommunicationStep::WRITE_SETUP; }; #endif /* MISSION_DEVICES_SUSHANDLER_H_ */ diff --git a/mission/devices/devicedefinitions/SusDefinitions.h b/mission/devices/devicedefinitions/SusDefinitions.h index 438d761d..0985ce99 100644 --- a/mission/devices/devicedefinitions/SusDefinitions.h +++ b/mission/devices/devicedefinitions/SusDefinitions.h @@ -19,7 +19,7 @@ namespace SUS { * power on. * * @note Bit1 (DIFFSEL1) - Bit0 (DIFFSEL0): 0b00, No byte is following the setup byte - * Bit3 (REFSEL1) - Bit2 (REFSEL0): 0b00, internal reference, needs wake-up delay + * Bit3 (REFSEL1) - Bit2 (REFSEL0): 0b10, internal reference, no wake-up delay * Bit5 (CLKSEL1) - Bit4 (CLKSEL0): 0b11, MAX1227 clocked through SPI SCLK * Bit7 - Bit6: 0b01, tells MAX1227 that this is the setup register * @@ -41,6 +41,7 @@ namespace SUS { static const uint8_t CONVERT_DIFF_CHANNEL_2 = 0b10010110; static const uint8_t CONVERT_DIFF_CHANNEL_3 = 0b10011110; static const uint8_t CONVERT_DIFF_CHANNEL_4 = 0b10100110; + static const uint8_t CONVERT_DIFF_CHANNEL_5 = 0b10101110; static const uint8_t RESET_FIFO = 0b00011000;