this works with the old SUS

This commit is contained in:
Jakob Meier 2021-05-09 12:09:39 +02:00
parent eeb8167cdc
commit 950eab2373
3 changed files with 15 additions and 8 deletions

View File

@ -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

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): {

View File

@ -43,7 +43,8 @@ private:
enum class CommunicationStep {
PERFORM_CONVERSIONS,
REQUEST_TEMP,
READ_TEMP
READ_TEMP,
WRITE_SETUP
};
enum class InternalState {